@ng-matero/extensions 12.5.2 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (560) hide show
  1. package/README.md +2 -16
  2. package/_all-color.scss +1 -1
  3. package/_all-theme.scss +2 -0
  4. package/_index.scss +3 -1
  5. package/_theming.scss +3 -1
  6. package/alert/_alert-theme.scss +2 -2
  7. package/alert/alert.component.d.ts +3 -0
  8. package/alert/alert.module.d.ts +6 -0
  9. package/alert/mtxAlert.d.ts +1 -0
  10. package/alert/package.json +5 -6
  11. package/button/button-loading.directive.d.ts +3 -0
  12. package/button/button.module.d.ts +8 -0
  13. package/button/mtxButton.d.ts +1 -0
  14. package/button/package.json +5 -6
  15. package/checkbox-group/checkbox-group.component.d.ts +5 -4
  16. package/checkbox-group/checkbox-group.module.d.ts +9 -0
  17. package/checkbox-group/mtxCheckboxGroup.d.ts +1 -0
  18. package/checkbox-group/package.json +5 -6
  19. package/colorpicker/_colorpicker-theme.import.scss +2 -0
  20. package/colorpicker/_colorpicker-theme.scss +43 -0
  21. package/colorpicker/colorpicker-animations.d.ts +8 -0
  22. package/colorpicker/colorpicker-content.scss +4 -0
  23. package/colorpicker/colorpicker-input.d.ts +92 -0
  24. package/colorpicker/colorpicker-module.d.ts +15 -0
  25. package/colorpicker/colorpicker-toggle.d.ts +38 -0
  26. package/colorpicker/colorpicker-toggle.scss +23 -0
  27. package/colorpicker/colorpicker.d.ts +131 -0
  28. package/{extensions.d.ts → colorpicker/mtxColorpicker.d.ts} +1 -0
  29. package/colorpicker/package.json +10 -0
  30. package/colorpicker/public-api.d.ts +5 -0
  31. package/column-resize/column-resize-directives/column-resize-flex.d.ts +3 -0
  32. package/column-resize/column-resize-directives/column-resize.d.ts +3 -0
  33. package/column-resize/column-resize-module.d.ts +6 -7
  34. package/column-resize/column-resize-notifier.d.ts +5 -7
  35. package/column-resize/column-resize.d.ts +3 -0
  36. package/column-resize/column-size-store.d.ts +3 -7
  37. package/column-resize/event-dispatcher.d.ts +3 -0
  38. package/column-resize/mtxColumnResize.d.ts +1 -0
  39. package/column-resize/overlay-handle.d.ts +3 -0
  40. package/column-resize/package.json +5 -6
  41. package/column-resize/resizable.d.ts +3 -0
  42. package/column-resize/resize-strategy.d.ts +7 -0
  43. package/core/datetime/datetime.module.d.ts +8 -0
  44. package/core/datetime/native-datetime-adapter.d.ts +3 -0
  45. package/core/density/private/_compatibility.scss +74 -0
  46. package/core/mtxCore.d.ts +1 -0
  47. package/core/package.json +5 -6
  48. package/{pipes/public-api.d.ts → core/pipes/index.d.ts} +0 -0
  49. package/core/pipes/pipes.module.d.ts +8 -0
  50. package/{pipes → core/pipes}/to-observable.pipe.d.ts +3 -0
  51. package/core/public-api.d.ts +1 -0
  52. package/core/style/_elevation.scss +197 -0
  53. package/core/style/_private.scss +41 -0
  54. package/core/style/_variables.scss +44 -0
  55. package/core/style/_vendor-prefixes.scss +60 -0
  56. package/core/theming/_palette.scss +746 -0
  57. package/core/theming/_theming.scss +430 -0
  58. package/core/typography/_typography-utils.scss +101 -0
  59. package/core/typography/_typography.scss +273 -0
  60. package/datetimepicker/_datetimepicker-theme.scss +17 -5
  61. package/datetimepicker/calendar-body.d.ts +3 -0
  62. package/datetimepicker/calendar-body.scss +5 -4
  63. package/datetimepicker/calendar.d.ts +6 -11
  64. package/datetimepicker/clock.d.ts +13 -9
  65. package/datetimepicker/datetimepicker-animations.d.ts +7 -5
  66. package/datetimepicker/datetimepicker-input.d.ts +7 -2
  67. package/datetimepicker/datetimepicker-module.d.ts +20 -0
  68. package/datetimepicker/datetimepicker-toggle.d.ts +20 -2
  69. package/datetimepicker/datetimepicker-toggle.scss +23 -0
  70. package/datetimepicker/datetimepicker-types.d.ts +1 -0
  71. package/datetimepicker/datetimepicker.d.ts +73 -25
  72. package/datetimepicker/month-view.d.ts +7 -4
  73. package/datetimepicker/mtxDatetimepicker.d.ts +1 -2
  74. package/datetimepicker/multi-year-view.d.ts +7 -4
  75. package/datetimepicker/package.json +5 -6
  76. package/datetimepicker/public-api.d.ts +4 -1
  77. package/datetimepicker/year-view.d.ts +7 -4
  78. package/dialog/{dialog.config.d.ts → dialog-config.d.ts} +0 -0
  79. package/dialog/dialog.component.d.ts +4 -1
  80. package/dialog/dialog.d.ts +4 -1
  81. package/dialog/dialog.module.d.ts +10 -0
  82. package/dialog/mtxDialog.d.ts +1 -0
  83. package/dialog/package.json +5 -6
  84. package/dialog/public-api.d.ts +2 -2
  85. package/esm2020/alert/alert.component.mjs +52 -0
  86. package/esm2020/alert/alert.module.mjs +18 -0
  87. package/{esm2015/alert/mtxAlert.js → esm2020/alert/mtxAlert.mjs} +0 -0
  88. package/{esm2015/alert/public-api.js → esm2020/alert/public-api.mjs} +0 -0
  89. package/esm2020/button/button-loading.directive.mjs +79 -0
  90. package/esm2020/button/button.module.mjs +20 -0
  91. package/{esm2015/button/mtxButton.js → esm2020/button/mtxButton.mjs} +0 -0
  92. package/{esm2015/button/public-api.js → esm2020/button/public-api.mjs} +0 -0
  93. package/esm2020/checkbox-group/checkbox-group.component.mjs +234 -0
  94. package/{esm2015/checkbox-group/checkbox-group.interface.js → esm2020/checkbox-group/checkbox-group.interface.mjs} +0 -0
  95. package/esm2020/checkbox-group/checkbox-group.module.mjs +21 -0
  96. package/{esm2015/checkbox-group/mtxCheckboxGroup.js → esm2020/checkbox-group/mtxCheckboxGroup.mjs} +0 -0
  97. package/{esm2015/checkbox-group/public-api.js → esm2020/checkbox-group/public-api.mjs} +0 -0
  98. package/esm2020/colorpicker/colorpicker-animations.mjs +16 -0
  99. package/esm2020/colorpicker/colorpicker-input.mjs +228 -0
  100. package/esm2020/colorpicker/colorpicker-module.mjs +65 -0
  101. package/esm2020/colorpicker/colorpicker-toggle.mjs +90 -0
  102. package/esm2020/colorpicker/colorpicker.mjs +363 -0
  103. package/esm2020/colorpicker/mtxColorpicker.mjs +5 -0
  104. package/esm2020/colorpicker/public-api.mjs +6 -0
  105. package/esm2020/column-resize/column-resize-directives/column-resize-flex.mjs +45 -0
  106. package/esm2020/column-resize/column-resize-directives/column-resize.mjs +45 -0
  107. package/{esm2015/column-resize/column-resize-directives/constants.js → esm2020/column-resize/column-resize-directives/constants.mjs} +0 -0
  108. package/esm2020/column-resize/column-resize-module.mjs +28 -0
  109. package/esm2020/column-resize/column-resize-notifier.mjs +47 -0
  110. package/esm2020/column-resize/column-resize.mjs +82 -0
  111. package/esm2020/column-resize/column-size-store.mjs +20 -0
  112. package/esm2020/column-resize/event-dispatcher.mjs +67 -0
  113. package/{esm2015/column-resize/mtxColumnResize.js → esm2020/column-resize/mtxColumnResize.mjs} +0 -0
  114. package/esm2020/column-resize/overlay-handle.mjs +146 -0
  115. package/{esm2015/column-resize/polyfill.js → esm2020/column-resize/polyfill.mjs} +0 -0
  116. package/{esm2015/column-resize/public-api.js → esm2020/column-resize/public-api.mjs} +0 -0
  117. package/esm2020/column-resize/resizable.mjs +199 -0
  118. package/{esm2015/column-resize/resize-ref.js → esm2020/column-resize/resize-ref.mjs} +0 -0
  119. package/esm2020/column-resize/resize-strategy.mjs +232 -0
  120. package/{esm2015/column-resize/selectors.js → esm2020/column-resize/selectors.mjs} +0 -0
  121. package/{esm2015/core/datetime/datetime-adapter.js → esm2020/core/datetime/datetime-adapter.mjs} +0 -0
  122. package/{esm2015/core/datetime/datetime-formats.js → esm2020/core/datetime/datetime-formats.mjs} +0 -0
  123. package/esm2020/core/datetime/datetime.module.mjs +42 -0
  124. package/{esm2015/core/datetime/index.js → esm2020/core/datetime/index.mjs} +0 -0
  125. package/esm2020/core/datetime/native-datetime-adapter.mjs +138 -0
  126. package/{esm2015/core/datetime/native-datetime-formats.js → esm2020/core/datetime/native-datetime-formats.mjs} +0 -0
  127. package/{esm2015/core/mtxCore.js → esm2020/core/mtxCore.mjs} +0 -0
  128. package/esm2020/core/pipes/index.mjs +3 -0
  129. package/esm2020/core/pipes/pipes.module.mjs +18 -0
  130. package/esm2020/core/pipes/to-observable.pipe.mjs +15 -0
  131. package/{esm2015/core/public-api.js → esm2020/core/public-api.mjs} +2 -1
  132. package/esm2020/datetimepicker/calendar-body.mjs +78 -0
  133. package/esm2020/datetimepicker/calendar.mjs +618 -0
  134. package/esm2020/datetimepicker/clock.mjs +277 -0
  135. package/esm2020/datetimepicker/datetimepicker-animations.mjs +44 -0
  136. package/{esm2015/datetimepicker/datetimepicker-errors.js → esm2020/datetimepicker/datetimepicker-errors.mjs} +0 -0
  137. package/{esm2015/datetimepicker/datetimepicker-filtertype.js → esm2020/datetimepicker/datetimepicker-filtertype.mjs} +0 -0
  138. package/esm2020/datetimepicker/datetimepicker-input.mjs +344 -0
  139. package/esm2020/datetimepicker/datetimepicker-module.mjs +75 -0
  140. package/esm2020/datetimepicker/datetimepicker-toggle.mjs +94 -0
  141. package/esm2020/datetimepicker/datetimepicker-types.mjs +2 -0
  142. package/esm2020/datetimepicker/datetimepicker.mjs +492 -0
  143. package/esm2020/datetimepicker/month-view.mjs +148 -0
  144. package/esm2020/datetimepicker/mtxDatetimepicker.mjs +5 -0
  145. package/esm2020/datetimepicker/multi-year-view.mjs +214 -0
  146. package/esm2020/datetimepicker/public-api.mjs +14 -0
  147. package/esm2020/datetimepicker/year-view.mjs +138 -0
  148. package/{esm2015/dialog/dialog.config.js → esm2020/dialog/dialog-config.mjs} +1 -1
  149. package/esm2020/dialog/dialog.component.mjs +33 -0
  150. package/esm2020/dialog/dialog.mjs +74 -0
  151. package/esm2020/dialog/dialog.module.mjs +24 -0
  152. package/{esm2015/dialog/mtxDialog.js → esm2020/dialog/mtxDialog.mjs} +0 -0
  153. package/esm2020/dialog/public-api.mjs +5 -0
  154. package/esm2020/form-group/form-group.component.mjs +37 -0
  155. package/esm2020/form-group/form-group.module.mjs +18 -0
  156. package/{esm2015/form-group/mtxFormGroup.js → esm2020/form-group/mtxFormGroup.mjs} +0 -0
  157. package/{esm2015/form-group/public-api.js → esm2020/form-group/public-api.mjs} +0 -0
  158. package/esm2020/grid/cell.component.mjs +108 -0
  159. package/esm2020/grid/column-menu.component.mjs +95 -0
  160. package/esm2020/grid/column-resize/column-resize-directives/column-resize-flex.mjs +37 -0
  161. package/esm2020/grid/column-resize/column-resize-directives/column-resize.mjs +37 -0
  162. package/{esm2015/grid/column-resize/column-resize-directives/common.js → esm2020/grid/column-resize/column-resize-directives/common.mjs} +0 -0
  163. package/esm2020/grid/column-resize/column-resize-module.mjs +42 -0
  164. package/esm2020/grid/column-resize/overlay-handle.mjs +60 -0
  165. package/{esm2015/grid/column-resize/resizable-directives/common.js → esm2020/grid/column-resize/resizable-directives/common.mjs} +0 -0
  166. package/esm2020/grid/column-resize/resizable-directives/resizable.mjs +62 -0
  167. package/esm2020/grid/column-resize/resize-strategy.mjs +42 -0
  168. package/esm2020/grid/expansion-toggle.directive.mjs +64 -0
  169. package/esm2020/grid/grid.component.mjs +556 -0
  170. package/{esm2015/grid/grid.interface.js → esm2020/grid/grid.interface.mjs} +0 -0
  171. package/esm2020/grid/grid.module.mjs +117 -0
  172. package/esm2020/grid/grid.service.mjs +44 -0
  173. package/{esm2015/grid/mtxGrid.js → esm2020/grid/mtxGrid.mjs} +0 -0
  174. package/esm2020/grid/public-api.mjs +16 -0
  175. package/esm2020/loader/loader.component.mjs +63 -0
  176. package/esm2020/loader/loader.module.mjs +20 -0
  177. package/{esm2015/loader/mtxLoader.js → esm2020/loader/mtxLoader.mjs} +0 -0
  178. package/{esm2015/loader/public-api.js → esm2020/loader/public-api.mjs} +0 -0
  179. package/esm2020/ng-matero-extensions.mjs +5 -0
  180. package/{esm2015/popover/mtxPopover.js → esm2020/popover/mtxPopover.mjs} +0 -0
  181. package/{esm2015/popover/popover-animations.js → esm2020/popover/popover-animations.mjs} +0 -0
  182. package/{esm2015/popover/popover-errors.js → esm2020/popover/popover-errors.mjs} +0 -0
  183. package/{esm2015/popover/popover-interfaces.js → esm2020/popover/popover-interfaces.mjs} +0 -0
  184. package/esm2020/popover/popover-module.mjs +22 -0
  185. package/esm2020/popover/popover-target.mjs +17 -0
  186. package/esm2020/popover/popover-trigger.mjs +441 -0
  187. package/{esm2015/popover/popover-types.js → esm2020/popover/popover-types.mjs} +0 -0
  188. package/esm2020/popover/popover.mjs +334 -0
  189. package/{esm2015/popover/public-api.js → esm2020/popover/public-api.mjs} +0 -0
  190. package/{esm2015/progress/mtxProgress.js → esm2020/progress/mtxProgress.mjs} +0 -0
  191. package/esm2020/progress/progress.component.mjs +55 -0
  192. package/esm2020/progress/progress.module.mjs +18 -0
  193. package/{esm2015/progress/public-api.js → esm2020/progress/public-api.mjs} +0 -0
  194. package/esm2020/public-api.mjs +5 -0
  195. package/{esm2015/select/mtxSelect.js → esm2020/select/mtxSelect.mjs} +0 -0
  196. package/{esm2015/select/option.component.js → esm2020/select/option.component.mjs} +18 -26
  197. package/{esm2015/select/public-api.js → esm2020/select/public-api.mjs} +0 -0
  198. package/esm2020/select/select.component.mjs +458 -0
  199. package/esm2020/select/select.module.mjs +74 -0
  200. package/esm2020/select/templates.directive.mjs +124 -0
  201. package/{esm2015/slider/mtxSlider.js → esm2020/slider/mtxSlider.mjs} +0 -0
  202. package/{esm2015/slider/public-api.js → esm2020/slider/public-api.mjs} +0 -0
  203. package/esm2020/slider/slider-module.mjs +19 -0
  204. package/esm2020/slider/slider.mjs +1115 -0
  205. package/{esm2015/split/interface.js → esm2020/split/interface.mjs} +1 -1
  206. package/{esm2015/split/mtxSplit.js → esm2020/split/mtxSplit.mjs} +0 -0
  207. package/{esm2015/split/public-api.js → esm2020/split/public-api.mjs} +0 -0
  208. package/esm2020/split/split-pane.directive.mjs +149 -0
  209. package/esm2020/split/split.component.mjs +619 -0
  210. package/esm2020/split/split.module.mjs +19 -0
  211. package/esm2020/split/utils.mjs +222 -0
  212. package/{esm2015/text3d/mtxText3d.js → esm2020/text3d/mtxText3d.mjs} +0 -0
  213. package/{esm2015/text3d/public-api.js → esm2020/text3d/public-api.mjs} +0 -0
  214. package/esm2020/text3d/text3d.component.mjs +45 -0
  215. package/esm2020/text3d/text3d.module.mjs +18 -0
  216. package/{esm2015/tooltip/mtxTooltip.js → esm2020/tooltip/mtxTooltip.mjs} +0 -0
  217. package/{esm2015/tooltip/public-api.js → esm2020/tooltip/public-api.mjs} +0 -0
  218. package/{esm2015/tooltip/tooltip-animations.js → esm2020/tooltip/tooltip-animations.mjs} +0 -0
  219. package/esm2020/tooltip/tooltip-module.mjs +23 -0
  220. package/esm2020/tooltip/tooltip.mjs +674 -0
  221. package/fesm2015/mtxAlert.mjs +74 -0
  222. package/fesm2015/mtxAlert.mjs.map +1 -0
  223. package/fesm2015/mtxButton.mjs +102 -0
  224. package/fesm2015/mtxButton.mjs.map +1 -0
  225. package/fesm2015/mtxCheckboxGroup.mjs +257 -0
  226. package/fesm2015/mtxCheckboxGroup.mjs.map +1 -0
  227. package/fesm2015/mtxColorpicker.mjs +754 -0
  228. package/fesm2015/mtxColorpicker.mjs.map +1 -0
  229. package/fesm2015/{mtxColumnResize.js → mtxColumnResize.mjs} +108 -145
  230. package/fesm2015/mtxColumnResize.mjs.map +1 -0
  231. package/fesm2015/mtxCore.mjs +362 -0
  232. package/fesm2015/mtxCore.mjs.map +1 -0
  233. package/fesm2015/mtxDatetimepicker.mjs +2474 -0
  234. package/fesm2015/mtxDatetimepicker.mjs.map +1 -0
  235. package/fesm2015/mtxDialog.mjs +128 -0
  236. package/fesm2015/mtxDialog.mjs.map +1 -0
  237. package/fesm2015/mtxFormGroup.mjs +59 -0
  238. package/fesm2015/mtxFormGroup.mjs.map +1 -0
  239. package/fesm2015/mtxGrid.mjs +1271 -0
  240. package/fesm2015/mtxGrid.mjs.map +1 -0
  241. package/fesm2015/mtxLoader.mjs +87 -0
  242. package/fesm2015/mtxLoader.mjs.map +1 -0
  243. package/fesm2015/mtxPopover.mjs +865 -0
  244. package/fesm2015/mtxPopover.mjs.map +1 -0
  245. package/fesm2015/mtxProgress.mjs +77 -0
  246. package/fesm2015/mtxProgress.mjs.map +1 -0
  247. package/fesm2015/mtxSelect.mjs +712 -0
  248. package/fesm2015/mtxSelect.mjs.map +1 -0
  249. package/fesm2015/mtxSlider.mjs +1139 -0
  250. package/fesm2015/mtxSlider.mjs.map +1 -0
  251. package/fesm2015/{mtxSplit.js → mtxSplit.mjs} +87 -98
  252. package/fesm2015/mtxSplit.mjs.map +1 -0
  253. package/fesm2015/mtxText3d.mjs +67 -0
  254. package/fesm2015/mtxText3d.mjs.map +1 -0
  255. package/fesm2015/{mtxTooltip.js → mtxTooltip.mjs} +90 -88
  256. package/fesm2015/mtxTooltip.mjs.map +1 -0
  257. package/fesm2015/ng-matero-extensions.mjs +9 -0
  258. package/fesm2015/ng-matero-extensions.mjs.map +1 -0
  259. package/fesm2020/mtxAlert.mjs +74 -0
  260. package/fesm2020/mtxAlert.mjs.map +1 -0
  261. package/fesm2020/mtxButton.mjs +102 -0
  262. package/fesm2020/mtxButton.mjs.map +1 -0
  263. package/fesm2020/mtxCheckboxGroup.mjs +257 -0
  264. package/fesm2020/mtxCheckboxGroup.mjs.map +1 -0
  265. package/fesm2020/mtxColorpicker.mjs +750 -0
  266. package/fesm2020/mtxColorpicker.mjs.map +1 -0
  267. package/fesm2020/mtxColumnResize.mjs +953 -0
  268. package/fesm2020/mtxColumnResize.mjs.map +1 -0
  269. package/{fesm2015/mtxCore.js → fesm2020/mtxCore.mjs} +75 -42
  270. package/fesm2020/mtxCore.mjs.map +1 -0
  271. package/fesm2020/mtxDatetimepicker.mjs +2462 -0
  272. package/fesm2020/mtxDatetimepicker.mjs.map +1 -0
  273. package/fesm2020/mtxDialog.mjs +129 -0
  274. package/fesm2020/mtxDialog.mjs.map +1 -0
  275. package/fesm2020/mtxFormGroup.mjs +59 -0
  276. package/fesm2020/mtxFormGroup.mjs.map +1 -0
  277. package/fesm2020/mtxGrid.mjs +1259 -0
  278. package/fesm2020/mtxGrid.mjs.map +1 -0
  279. package/fesm2020/mtxLoader.mjs +87 -0
  280. package/fesm2020/mtxLoader.mjs.map +1 -0
  281. package/{fesm2015/mtxPopover.js → fesm2020/mtxPopover.mjs} +120 -111
  282. package/fesm2020/mtxPopover.mjs.map +1 -0
  283. package/fesm2020/mtxProgress.mjs +77 -0
  284. package/fesm2020/mtxProgress.mjs.map +1 -0
  285. package/fesm2020/mtxSelect.mjs +709 -0
  286. package/fesm2020/mtxSelect.mjs.map +1 -0
  287. package/{fesm2015/mtxSlider.js → fesm2020/mtxSlider.mjs} +97 -94
  288. package/fesm2020/mtxSlider.mjs.map +1 -0
  289. package/fesm2020/mtxSplit.mjs +1007 -0
  290. package/fesm2020/mtxSplit.mjs.map +1 -0
  291. package/fesm2020/mtxText3d.mjs +67 -0
  292. package/fesm2020/mtxText3d.mjs.map +1 -0
  293. package/fesm2020/mtxTooltip.mjs +718 -0
  294. package/fesm2020/mtxTooltip.mjs.map +1 -0
  295. package/fesm2020/ng-matero-extensions.mjs +9 -0
  296. package/fesm2020/ng-matero-extensions.mjs.map +1 -0
  297. package/form-group/_form-group-theme.scss +1 -1
  298. package/form-group/form-group.component.d.ts +5 -4
  299. package/form-group/form-group.module.d.ts +6 -0
  300. package/form-group/mtxFormGroup.d.ts +1 -0
  301. package/form-group/package.json +5 -6
  302. package/grid/_grid-theme.scss +1 -1
  303. package/grid/cell.component.d.ts +3 -0
  304. package/grid/column-menu.component.d.ts +3 -0
  305. package/grid/column-menu.component.scss +1 -1
  306. package/grid/column-resize/_column-resize.scss +3 -3
  307. package/grid/column-resize/column-resize-directives/column-resize-flex.d.ts +3 -0
  308. package/grid/column-resize/column-resize-directives/column-resize.d.ts +3 -0
  309. package/grid/column-resize/column-resize-module.d.ts +12 -7
  310. package/grid/column-resize/overlay-handle.d.ts +3 -0
  311. package/grid/column-resize/resizable-directives/resizable.d.ts +3 -0
  312. package/grid/column-resize/resize-strategy.d.ts +3 -0
  313. package/grid/expansion-toggle.directive.d.ts +3 -0
  314. package/grid/grid.component.d.ts +20 -1
  315. package/grid/grid.module.d.ts +26 -0
  316. package/grid/grid.service.d.ts +3 -0
  317. package/grid/mtxGrid.d.ts +1 -0
  318. package/grid/package.json +5 -6
  319. package/grid/public-api.d.ts +0 -1
  320. package/loader/_loader-theme.scss +1 -1
  321. package/loader/loader.component.d.ts +7 -1
  322. package/loader/loader.module.d.ts +8 -0
  323. package/loader/mtxLoader.d.ts +1 -0
  324. package/loader/package.json +5 -6
  325. package/{color-picker/mtxColorPicker.d.ts → ng-matero-extensions.d.ts} +1 -0
  326. package/package.json +171 -15
  327. package/popover/_popover-theme.scss +1 -1
  328. package/popover/mtxPopover.d.ts +1 -0
  329. package/popover/package.json +5 -6
  330. package/popover/popover-module.d.ts +10 -0
  331. package/popover/popover-target.d.ts +3 -0
  332. package/popover/popover-trigger.d.ts +3 -0
  333. package/popover/popover.d.ts +6 -3
  334. package/progress/_progress-theme.scss +2 -2
  335. package/progress/mtxProgress.d.ts +1 -0
  336. package/progress/package.json +5 -6
  337. package/progress/progress.component.d.ts +3 -0
  338. package/progress/progress.module.d.ts +6 -0
  339. package/public-api.d.ts +2 -19
  340. package/select/_select-theme.scss +1 -1
  341. package/select/mtxSelect.d.ts +1 -0
  342. package/select/option.component.d.ts +3 -0
  343. package/select/package.json +5 -6
  344. package/select/select.component.d.ts +4 -1
  345. package/select/select.component.scss +1 -1
  346. package/select/select.module.d.ts +10 -0
  347. package/select/templates.directive.d.ts +23 -0
  348. package/slider/_slider-theme.scss +5 -5
  349. package/slider/mtxSlider.d.ts +1 -0
  350. package/slider/package.json +5 -6
  351. package/slider/slider-module.d.ts +7 -0
  352. package/slider/slider.d.ts +4 -1
  353. package/slider/slider.scss +8 -7
  354. package/split/_split-theme.scss +10 -3
  355. package/split/interface.d.ts +1 -2
  356. package/split/mtxSplit.d.ts +1 -0
  357. package/split/package.json +5 -6
  358. package/split/split-pane.directive.d.ts +3 -0
  359. package/split/split.component.d.ts +12 -1
  360. package/split/split.module.d.ts +7 -0
  361. package/text3d/_text3d-theme.scss +2 -2
  362. package/text3d/mtxText3d.d.ts +1 -0
  363. package/text3d/package.json +5 -6
  364. package/text3d/text3d.component.d.ts +3 -1
  365. package/text3d/text3d.module.d.ts +6 -0
  366. package/tooltip/_tooltip-theme.scss +3 -3
  367. package/tooltip/mtxTooltip.d.ts +1 -0
  368. package/tooltip/package.json +5 -6
  369. package/tooltip/tooltip-module.d.ts +10 -0
  370. package/tooltip/tooltip.d.ts +5 -0
  371. package/tooltip/tooltip.scss +1 -1
  372. package/alert/mtxAlert.metadata.json +0 -1
  373. package/bundles/extensions.umd.js +0 -198
  374. package/bundles/extensions.umd.js.map +0 -1
  375. package/bundles/mtxAlert.umd.js +0 -101
  376. package/bundles/mtxAlert.umd.js.map +0 -1
  377. package/bundles/mtxButton.umd.js +0 -119
  378. package/bundles/mtxButton.umd.js.map +0 -1
  379. package/bundles/mtxCheckboxGroup.umd.js +0 -285
  380. package/bundles/mtxCheckboxGroup.umd.js.map +0 -1
  381. package/bundles/mtxColorPicker.umd.js +0 -337
  382. package/bundles/mtxColorPicker.umd.js.map +0 -1
  383. package/bundles/mtxColumnResize.umd.js +0 -1339
  384. package/bundles/mtxColumnResize.umd.js.map +0 -1
  385. package/bundles/mtxCore.umd.js +0 -670
  386. package/bundles/mtxCore.umd.js.map +0 -1
  387. package/bundles/mtxDatetimepicker.umd.js +0 -2590
  388. package/bundles/mtxDatetimepicker.umd.js.map +0 -1
  389. package/bundles/mtxDialog.umd.js +0 -160
  390. package/bundles/mtxDialog.umd.js.map +0 -1
  391. package/bundles/mtxFormGroup.umd.js +0 -80
  392. package/bundles/mtxFormGroup.umd.js.map +0 -1
  393. package/bundles/mtxGrid.umd.js +0 -1583
  394. package/bundles/mtxGrid.umd.js.map +0 -1
  395. package/bundles/mtxLoader.umd.js +0 -104
  396. package/bundles/mtxLoader.umd.js.map +0 -1
  397. package/bundles/mtxPipes.umd.js +0 -44
  398. package/bundles/mtxPipes.umd.js.map +0 -1
  399. package/bundles/mtxPopover.umd.js +0 -1260
  400. package/bundles/mtxPopover.umd.js.map +0 -1
  401. package/bundles/mtxProgress.umd.js +0 -92
  402. package/bundles/mtxProgress.umd.js.map +0 -1
  403. package/bundles/mtxSelect.umd.js +0 -1097
  404. package/bundles/mtxSelect.umd.js.map +0 -1
  405. package/bundles/mtxSlider.umd.js +0 -1551
  406. package/bundles/mtxSlider.umd.js.map +0 -1
  407. package/bundles/mtxSplit.umd.js +0 -1430
  408. package/bundles/mtxSplit.umd.js.map +0 -1
  409. package/bundles/mtxText3d.umd.js +0 -92
  410. package/bundles/mtxText3d.umd.js.map +0 -1
  411. package/bundles/mtxTooltip.umd.js +0 -1078
  412. package/bundles/mtxTooltip.umd.js.map +0 -1
  413. package/button/mtxButton.metadata.json +0 -1
  414. package/checkbox-group/mtxCheckboxGroup.metadata.json +0 -1
  415. package/color-picker/color-picker.component.d.ts +0 -120
  416. package/color-picker/color-picker.module.d.ts +0 -2
  417. package/color-picker/mtxColorPicker.metadata.json +0 -1
  418. package/color-picker/package.json +0 -11
  419. package/color-picker/public-api.d.ts +0 -2
  420. package/column-resize/mtxColumnResize.metadata.json +0 -1
  421. package/core/mtxCore.metadata.json +0 -1
  422. package/datetimepicker/datetimepicker.module.d.ts +0 -2
  423. package/datetimepicker/mtxDatetimepicker.metadata.json +0 -1
  424. package/dialog/mtxDialog.metadata.json +0 -1
  425. package/esm2015/alert/alert.component.js +0 -63
  426. package/esm2015/alert/alert.module.js +0 -14
  427. package/esm2015/button/button-loading.directive.js +0 -89
  428. package/esm2015/button/button.module.js +0 -16
  429. package/esm2015/checkbox-group/checkbox-group.component.js +0 -236
  430. package/esm2015/checkbox-group/checkbox-group.module.js +0 -17
  431. package/esm2015/color-picker/color-picker.component.js +0 -268
  432. package/esm2015/color-picker/color-picker.module.js +0 -26
  433. package/esm2015/color-picker/mtxColorPicker.js +0 -5
  434. package/esm2015/color-picker/public-api.js +0 -3
  435. package/esm2015/column-resize/column-resize-directives/column-resize-flex.js +0 -54
  436. package/esm2015/column-resize/column-resize-directives/column-resize.js +0 -54
  437. package/esm2015/column-resize/column-resize-module.js +0 -24
  438. package/esm2015/column-resize/column-resize-notifier.js +0 -54
  439. package/esm2015/column-resize/column-resize.js +0 -80
  440. package/esm2015/column-resize/column-size-store.js +0 -18
  441. package/esm2015/column-resize/event-dispatcher.js +0 -75
  442. package/esm2015/column-resize/overlay-handle.js +0 -144
  443. package/esm2015/column-resize/resizable.js +0 -197
  444. package/esm2015/column-resize/resize-strategy.js +0 -245
  445. package/esm2015/core/datetime/datetime.module.js +0 -32
  446. package/esm2015/core/datetime/native-datetime-adapter.js +0 -144
  447. package/esm2015/datetimepicker/calendar-body.js +0 -75
  448. package/esm2015/datetimepicker/calendar.js +0 -629
  449. package/esm2015/datetimepicker/clock.js +0 -283
  450. package/esm2015/datetimepicker/datetimepicker-animations.js +0 -30
  451. package/esm2015/datetimepicker/datetimepicker-input.js +0 -333
  452. package/esm2015/datetimepicker/datetimepicker-toggle.js +0 -81
  453. package/esm2015/datetimepicker/datetimepicker.js +0 -411
  454. package/esm2015/datetimepicker/datetimepicker.module.js +0 -49
  455. package/esm2015/datetimepicker/month-view.js +0 -149
  456. package/esm2015/datetimepicker/mtxDatetimepicker.js +0 -7
  457. package/esm2015/datetimepicker/multi-year-view.js +0 -214
  458. package/esm2015/datetimepicker/public-api.js +0 -11
  459. package/esm2015/datetimepicker/year-view.js +0 -140
  460. package/esm2015/dialog/dialog.component.js +0 -40
  461. package/esm2015/dialog/dialog.js +0 -81
  462. package/esm2015/dialog/dialog.module.js +0 -21
  463. package/esm2015/dialog/public-api.js +0 -5
  464. package/esm2015/extensions-experimental.module.js +0 -13
  465. package/esm2015/extensions.js +0 -5
  466. package/esm2015/extensions.module.js +0 -40
  467. package/esm2015/form-group/form-group.component.js +0 -47
  468. package/esm2015/form-group/form-group.module.js +0 -14
  469. package/esm2015/grid/cell-selection.directive.js +0 -62
  470. package/esm2015/grid/cell.component.js +0 -115
  471. package/esm2015/grid/column-menu.component.js +0 -72
  472. package/esm2015/grid/column-resize/column-resize-directives/column-resize-flex.js +0 -47
  473. package/esm2015/grid/column-resize/column-resize-directives/column-resize.js +0 -47
  474. package/esm2015/grid/column-resize/column-resize-module.js +0 -36
  475. package/esm2015/grid/column-resize/overlay-handle.js +0 -68
  476. package/esm2015/grid/column-resize/resizable-directives/resizable.js +0 -75
  477. package/esm2015/grid/column-resize/resize-strategy.js +0 -45
  478. package/esm2015/grid/expansion-toggle.directive.js +0 -62
  479. package/esm2015/grid/grid.component.js +0 -418
  480. package/esm2015/grid/grid.module.js +0 -69
  481. package/esm2015/grid/grid.service.js +0 -50
  482. package/esm2015/grid/public-api.js +0 -17
  483. package/esm2015/loader/loader.component.js +0 -66
  484. package/esm2015/loader/loader.module.js +0 -16
  485. package/esm2015/pipes/mtxPipes.js +0 -5
  486. package/esm2015/pipes/pipes.module.js +0 -14
  487. package/esm2015/pipes/public-api.js +0 -3
  488. package/esm2015/pipes/to-observable.pipe.js +0 -12
  489. package/esm2015/popover/popover-module.js +0 -18
  490. package/esm2015/popover/popover-target.js +0 -24
  491. package/esm2015/popover/popover-trigger.js +0 -434
  492. package/esm2015/popover/popover.js +0 -326
  493. package/esm2015/progress/progress.component.js +0 -54
  494. package/esm2015/progress/progress.module.js +0 -14
  495. package/esm2015/public-api.js +0 -23
  496. package/esm2015/select/select.component.js +0 -380
  497. package/esm2015/select/select.module.js +0 -46
  498. package/esm2015/select/templates.directive.js +0 -211
  499. package/esm2015/slider/slider-module.js +0 -15
  500. package/esm2015/slider/slider.js +0 -1115
  501. package/esm2015/split/split-pane.directive.js +0 -156
  502. package/esm2015/split/split.component.js +0 -620
  503. package/esm2015/split/split.module.js +0 -15
  504. package/esm2015/split/utils.js +0 -227
  505. package/esm2015/text3d/text3d.component.js +0 -53
  506. package/esm2015/text3d/text3d.module.js +0 -14
  507. package/esm2015/tooltip/tooltip-module.js +0 -20
  508. package/esm2015/tooltip/tooltip.js +0 -678
  509. package/extensions-experimental.module.d.ts +0 -2
  510. package/extensions.metadata.json +0 -1
  511. package/extensions.module.d.ts +0 -2
  512. package/fesm2015/extensions.js +0 -80
  513. package/fesm2015/extensions.js.map +0 -1
  514. package/fesm2015/mtxAlert.js +0 -82
  515. package/fesm2015/mtxAlert.js.map +0 -1
  516. package/fesm2015/mtxButton.js +0 -108
  517. package/fesm2015/mtxButton.js.map +0 -1
  518. package/fesm2015/mtxCheckboxGroup.js +0 -256
  519. package/fesm2015/mtxCheckboxGroup.js.map +0 -1
  520. package/fesm2015/mtxColorPicker.js +0 -295
  521. package/fesm2015/mtxColorPicker.js.map +0 -1
  522. package/fesm2015/mtxColumnResize.js.map +0 -1
  523. package/fesm2015/mtxCore.js.map +0 -1
  524. package/fesm2015/mtxDatetimepicker.js +0 -2355
  525. package/fesm2015/mtxDatetimepicker.js.map +0 -1
  526. package/fesm2015/mtxDialog.js +0 -141
  527. package/fesm2015/mtxDialog.js.map +0 -1
  528. package/fesm2015/mtxFormGroup.js +0 -66
  529. package/fesm2015/mtxFormGroup.js.map +0 -1
  530. package/fesm2015/mtxGrid.js +0 -1186
  531. package/fesm2015/mtxGrid.js.map +0 -1
  532. package/fesm2015/mtxLoader.js +0 -87
  533. package/fesm2015/mtxLoader.js.map +0 -1
  534. package/fesm2015/mtxPipes.js +0 -31
  535. package/fesm2015/mtxPipes.js.map +0 -1
  536. package/fesm2015/mtxPopover.js.map +0 -1
  537. package/fesm2015/mtxProgress.js +0 -73
  538. package/fesm2015/mtxProgress.js.map +0 -1
  539. package/fesm2015/mtxSelect.js +0 -700
  540. package/fesm2015/mtxSelect.js.map +0 -1
  541. package/fesm2015/mtxSlider.js.map +0 -1
  542. package/fesm2015/mtxSplit.js.map +0 -1
  543. package/fesm2015/mtxText3d.js +0 -72
  544. package/fesm2015/mtxText3d.js.map +0 -1
  545. package/fesm2015/mtxTooltip.js.map +0 -1
  546. package/form-group/mtxFormGroup.metadata.json +0 -1
  547. package/grid/cell-selection.directive.d.ts +0 -17
  548. package/grid/mtxGrid.metadata.json +0 -1
  549. package/loader/mtxLoader.metadata.json +0 -1
  550. package/pipes/mtxPipes.d.ts +0 -4
  551. package/pipes/mtxPipes.metadata.json +0 -1
  552. package/pipes/package.json +0 -11
  553. package/pipes/pipes.module.d.ts +0 -2
  554. package/popover/mtxPopover.metadata.json +0 -1
  555. package/progress/mtxProgress.metadata.json +0 -1
  556. package/select/mtxSelect.metadata.json +0 -1
  557. package/slider/mtxSlider.metadata.json +0 -1
  558. package/split/mtxSplit.metadata.json +0 -1
  559. package/text3d/mtxText3d.metadata.json +0 -1
  560. package/tooltip/mtxTooltip.metadata.json +0 -1
@@ -0,0 +1,2462 @@
1
+ import * as i2 from '@angular/cdk/a11y';
2
+ import { A11yModule } from '@angular/cdk/a11y';
3
+ import * as i4 from '@angular/cdk/overlay';
4
+ import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
5
+ import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
6
+ import * as i3 from '@angular/common';
7
+ import { CommonModule } from '@angular/common';
8
+ import * as i0 from '@angular/core';
9
+ import { EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, Optional, Inject, InjectionToken, ViewChild, forwardRef, Directive, ContentChild, NgModule } from '@angular/core';
10
+ import * as i3$1 from '@angular/material/button';
11
+ import { MatButtonModule } from '@angular/material/button';
12
+ import { ENTER, PAGE_DOWN, PAGE_UP, END, HOME, DOWN_ARROW, UP_ARROW, RIGHT_ARROW, LEFT_ARROW, ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
13
+ import { coerceBooleanProperty, coerceStringArray } from '@angular/cdk/coercion';
14
+ import { first, take, filter } from 'rxjs/operators';
15
+ import * as i1 from '@ng-matero/extensions/core';
16
+ import { MTX_DATETIME_FORMATS } from '@ng-matero/extensions/core';
17
+ import { trigger, transition, animate, keyframes, style, state } from '@angular/animations';
18
+ import * as i1$1 from '@angular/material/datepicker';
19
+ import { _getFocusedElementPierceShadowDom } from '@angular/cdk/platform';
20
+ import { mixinColor } from '@angular/material/core';
21
+ import { Subject, Subscription, merge, of } from 'rxjs';
22
+ import * as i6 from '@angular/cdk/bidi';
23
+ import { NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators } from '@angular/forms';
24
+ import { MAT_INPUT_VALUE_ACCESSOR } from '@angular/material/input';
25
+ import * as i2$1 from '@angular/material/form-field';
26
+
27
+ /**
28
+ * Animations used by the Material datepicker.
29
+ * @docs-private
30
+ */
31
+ const mtxDatetimepickerAnimations = {
32
+ /** Transforms the height of the datepicker's calendar. */
33
+ transformPanel: trigger('transformPanel', [
34
+ transition('void => enter-dropdown', animate('120ms cubic-bezier(0, 0, 0.2, 1)', keyframes([
35
+ style({ opacity: 0, transform: 'scale(1, 0.8)' }),
36
+ style({ opacity: 1, transform: 'scale(1, 1)' }),
37
+ ]))),
38
+ transition('void => enter-dialog', animate('150ms cubic-bezier(0, 0, 0.2, 1)', keyframes([
39
+ style({ opacity: 0, transform: 'scale(0.7)' }),
40
+ style({ transform: 'none', opacity: 1 }),
41
+ ]))),
42
+ transition('* => void', animate('100ms linear', style({ opacity: 0 }))),
43
+ ]),
44
+ /** Fades in the content of the calendar. */
45
+ fadeInCalendar: trigger('fadeInCalendar', [
46
+ state('void', style({ opacity: 0 })),
47
+ state('enter', style({ opacity: 1 })),
48
+ // TODO(crisbeto): this animation should be removed since it isn't quite on spec, but we
49
+ // need to keep it until #12440 gets in, otherwise the exit animation will look glitchy.
50
+ transition('void => *', animate('120ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)')),
51
+ ]),
52
+ slideCalendar: trigger('slideCalendar', [
53
+ transition('* => left', [
54
+ animate(180, keyframes([
55
+ style({ transform: 'translateX(100%)', offset: 0.5 }),
56
+ style({ transform: 'translateX(-100%)', offset: 0.51 }),
57
+ style({ transform: 'translateX(0)', offset: 1 }),
58
+ ])),
59
+ ]),
60
+ transition('* => right', [
61
+ animate(180, keyframes([
62
+ style({ transform: 'translateX(-100%)', offset: 0.5 }),
63
+ style({ transform: 'translateX(100%)', offset: 0.51 }),
64
+ style({ transform: 'translateX(0)', offset: 1 }),
65
+ ])),
66
+ ]),
67
+ ]),
68
+ };
69
+
70
+ /** @docs-private */
71
+ function createMissingDateImplError(provider) {
72
+ return Error(`MtxDatetimepicker: No provider found for ${provider}. You must import one of the following ` +
73
+ `modules at your application root: MtxNativeDatetimeModule, MtxMomentDatetimeModule, or provide a ` +
74
+ `custom implementation.`);
75
+ }
76
+
77
+ var MtxDatetimepickerFilterType;
78
+ (function (MtxDatetimepickerFilterType) {
79
+ MtxDatetimepickerFilterType[MtxDatetimepickerFilterType["DATE"] = 0] = "DATE";
80
+ MtxDatetimepickerFilterType[MtxDatetimepickerFilterType["HOUR"] = 1] = "HOUR";
81
+ MtxDatetimepickerFilterType[MtxDatetimepickerFilterType["MINUTE"] = 2] = "MINUTE";
82
+ })(MtxDatetimepickerFilterType || (MtxDatetimepickerFilterType = {}));
83
+
84
+ /**
85
+ * An internal class that represents the data corresponding to a single calendar cell.
86
+ * @docs-private
87
+ */
88
+ class MtxCalendarCell {
89
+ constructor(value, displayValue, ariaLabel, enabled) {
90
+ this.value = value;
91
+ this.displayValue = displayValue;
92
+ this.ariaLabel = ariaLabel;
93
+ this.enabled = enabled;
94
+ }
95
+ }
96
+ /**
97
+ * An internal component used to display calendar data in a table.
98
+ * @docs-private
99
+ */
100
+ class MtxCalendarBody {
101
+ constructor() {
102
+ /** The number of columns in the table. */
103
+ this.numCols = 7;
104
+ /** Whether to allow selection of disabled cells. */
105
+ this.allowDisabledSelection = false;
106
+ /** The cell number of the active cell in the table. */
107
+ this.activeCell = 0;
108
+ /** Emits when a new value is selected. */
109
+ this.selectedValueChange = new EventEmitter();
110
+ }
111
+ /** The number of blank cells to put at the beginning for the first row. */
112
+ get _firstRowOffset() {
113
+ return this.rows && this.rows.length && this.rows[0].length
114
+ ? this.numCols - this.rows[0].length
115
+ : 0;
116
+ }
117
+ _cellClicked(cell) {
118
+ if (!this.allowDisabledSelection && !cell.enabled) {
119
+ return;
120
+ }
121
+ this.selectedValueChange.emit(cell.value);
122
+ }
123
+ _isActiveCell(rowIndex, colIndex) {
124
+ let cellNumber = rowIndex * this.numCols + colIndex;
125
+ // Account for the fact that the first row may not have as many cells.
126
+ if (rowIndex) {
127
+ cellNumber -= this._firstRowOffset;
128
+ }
129
+ return cellNumber === this.activeCell;
130
+ }
131
+ }
132
+ /** @nocollapse */ /** @nocollapse */ MtxCalendarBody.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxCalendarBody, deps: [], target: i0.ɵɵFactoryTarget.Component });
133
+ /** @nocollapse */ /** @nocollapse */ MtxCalendarBody.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: MtxCalendarBody, selector: "[mtx-calendar-body]", inputs: { label: "label", rows: "rows", todayValue: "todayValue", selectedValue: "selectedValue", labelMinRequiredCells: "labelMinRequiredCells", numCols: "numCols", allowDisabledSelection: "allowDisabledSelection", activeCell: "activeCell" }, outputs: { selectedValueChange: "selectedValueChange" }, host: { classAttribute: "mtx-calendar-body" }, exportAs: ["mtxCalendarBody"], ngImport: i0, template: "<!--\n If there's not enough space in the first row, create a separate label row. We mark this row as\n aria-hidden because we don't want it to be read out as one of the weeks in the month.\n-->\n<tr *ngIf=\"_firstRowOffset < labelMinRequiredCells\" aria-hidden=\"true\">\n <td [attr.colspan]=\"numCols\" class=\"mtx-calendar-body-label\">{{ label }}</td>\n</tr>\n\n<!-- Create the first row separately so we can include a special spacer cell. -->\n<tr *ngFor=\"let row of rows; let rowIndex = index\" role=\"row\">\n <!--\n We mark this cell as aria-hidden so it doesn't get read out as one of the days in the week.\n -->\n <td *ngIf=\"rowIndex === 0 && _firstRowOffset\"\n [attr.colspan]=\"_firstRowOffset\"\n aria-hidden=\"true\"\n class=\"mtx-calendar-body-label\">\n {{ _firstRowOffset >= labelMinRequiredCells ? label : '' }}\n </td>\n <td *ngFor=\"let item of row; let colIndex = index\"\n role=\"gridcell\"\n class=\"mtx-calendar-body-cell\"\n [tabindex]=\"_isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [attr.data-mat-row]=\"rowIndex\"\n [attr.data-mat-col]=\"colIndex\"\n [attr.aria-label]=\"item.ariaLabel\"\n [attr.aria-disabled]=\"!item.enabled || null\"\n [class.mtx-calendar-body-active]=\"_isActiveCell(rowIndex, colIndex)\"\n [class.mtx-calendar-body-disabled]=\"!item.enabled\"\n (click)=\"_cellClicked(item)\">\n <div [attr.aria-selected]=\"selectedValue === item.value\"\n [class.mtx-calendar-body-selected]=\"selectedValue === item.value\"\n [class.mtx-calendar-body-today]=\"todayValue === item.value\"\n class=\"mtx-calendar-body-cell-content\">\n {{ item.displayValue }}\n </div>\n </td>\n</tr>\n", styles: [".mtx-calendar-body{min-width:224px}.mtx-calendar-body-label{height:0;line-height:0;text-align:left;padding:7.1428571429% 4.7142857143%}[dir=rtl] .mtx-calendar-body-label{text-align:right}.mtx-calendar-body-cell{position:relative;width:14.2857142857%;height:0;line-height:0;padding:7.1428571429% 0;text-align:center;outline:none;cursor:pointer}.mtx-calendar-body-disabled{cursor:default;pointer-events:none}.mtx-calendar-body-cell-content{position:absolute;top:5%;left:5%;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;border:1px solid transparent;border-radius:999px}\n"], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
134
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxCalendarBody, decorators: [{
135
+ type: Component,
136
+ args: [{ selector: '[mtx-calendar-body]', host: {
137
+ class: 'mtx-calendar-body',
138
+ }, exportAs: 'mtxCalendarBody', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!--\n If there's not enough space in the first row, create a separate label row. We mark this row as\n aria-hidden because we don't want it to be read out as one of the weeks in the month.\n-->\n<tr *ngIf=\"_firstRowOffset < labelMinRequiredCells\" aria-hidden=\"true\">\n <td [attr.colspan]=\"numCols\" class=\"mtx-calendar-body-label\">{{ label }}</td>\n</tr>\n\n<!-- Create the first row separately so we can include a special spacer cell. -->\n<tr *ngFor=\"let row of rows; let rowIndex = index\" role=\"row\">\n <!--\n We mark this cell as aria-hidden so it doesn't get read out as one of the days in the week.\n -->\n <td *ngIf=\"rowIndex === 0 && _firstRowOffset\"\n [attr.colspan]=\"_firstRowOffset\"\n aria-hidden=\"true\"\n class=\"mtx-calendar-body-label\">\n {{ _firstRowOffset >= labelMinRequiredCells ? label : '' }}\n </td>\n <td *ngFor=\"let item of row; let colIndex = index\"\n role=\"gridcell\"\n class=\"mtx-calendar-body-cell\"\n [tabindex]=\"_isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [attr.data-mat-row]=\"rowIndex\"\n [attr.data-mat-col]=\"colIndex\"\n [attr.aria-label]=\"item.ariaLabel\"\n [attr.aria-disabled]=\"!item.enabled || null\"\n [class.mtx-calendar-body-active]=\"_isActiveCell(rowIndex, colIndex)\"\n [class.mtx-calendar-body-disabled]=\"!item.enabled\"\n (click)=\"_cellClicked(item)\">\n <div [attr.aria-selected]=\"selectedValue === item.value\"\n [class.mtx-calendar-body-selected]=\"selectedValue === item.value\"\n [class.mtx-calendar-body-today]=\"todayValue === item.value\"\n class=\"mtx-calendar-body-cell-content\">\n {{ item.displayValue }}\n </div>\n </td>\n</tr>\n", styles: [".mtx-calendar-body{min-width:224px}.mtx-calendar-body-label{height:0;line-height:0;text-align:left;padding:7.1428571429% 4.7142857143%}[dir=rtl] .mtx-calendar-body-label{text-align:right}.mtx-calendar-body-cell{position:relative;width:14.2857142857%;height:0;line-height:0;padding:7.1428571429% 0;text-align:center;outline:none;cursor:pointer}.mtx-calendar-body-disabled{cursor:default;pointer-events:none}.mtx-calendar-body-cell-content{position:absolute;top:5%;left:5%;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;border:1px solid transparent;border-radius:999px}\n"] }]
139
+ }], propDecorators: { label: [{
140
+ type: Input
141
+ }], rows: [{
142
+ type: Input
143
+ }], todayValue: [{
144
+ type: Input
145
+ }], selectedValue: [{
146
+ type: Input
147
+ }], labelMinRequiredCells: [{
148
+ type: Input
149
+ }], numCols: [{
150
+ type: Input
151
+ }], allowDisabledSelection: [{
152
+ type: Input
153
+ }], activeCell: [{
154
+ type: Input
155
+ }], selectedValueChange: [{
156
+ type: Output
157
+ }] } });
158
+
159
+ const yearsPerPage = 24;
160
+ const yearsPerRow = 4;
161
+ /**
162
+ * An internal component used to display multiple years in the datetimepicker.
163
+ * @docs-private
164
+ */
165
+ class MtxMultiYearView {
166
+ constructor(_adapter, _dateFormats) {
167
+ this._adapter = _adapter;
168
+ this._dateFormats = _dateFormats;
169
+ this.type = 'date';
170
+ /** Emits when a new month is selected. */
171
+ this.selectedChange = new EventEmitter();
172
+ /** Emits when any date is selected. */
173
+ this._userSelection = new EventEmitter();
174
+ if (!this._adapter) {
175
+ throw createMissingDateImplError('DatetimeAdapter');
176
+ }
177
+ if (!this._dateFormats) {
178
+ throw createMissingDateImplError('MTX_DATETIME_FORMATS');
179
+ }
180
+ this._activeDate = this._adapter.today();
181
+ }
182
+ /** The date to display in this multi year view */
183
+ get activeDate() {
184
+ return this._activeDate;
185
+ }
186
+ set activeDate(value) {
187
+ const oldActiveDate = this._activeDate;
188
+ this._activeDate = value || this._adapter.today();
189
+ if (oldActiveDate &&
190
+ this._activeDate &&
191
+ !isSameMultiYearView(this._adapter, oldActiveDate, this._activeDate, this.minDate, this.maxDate)) {
192
+ this._init();
193
+ }
194
+ }
195
+ /** The currently selected date. */
196
+ get selected() {
197
+ return this._selected;
198
+ }
199
+ set selected(value) {
200
+ this._selected = value;
201
+ this._selectedYear = this._selected && this._adapter.getYear(this._selected);
202
+ }
203
+ /** The minimum selectable date. */
204
+ get minDate() {
205
+ return this._minDate;
206
+ }
207
+ set minDate(value) {
208
+ this._minDate = this._getValidDateOrNull(this._adapter.deserialize(value));
209
+ }
210
+ /** The maximum selectable date. */
211
+ get maxDate() {
212
+ return this._maxDate;
213
+ }
214
+ set maxDate(value) {
215
+ this._maxDate = this._getValidDateOrNull(this._adapter.deserialize(value));
216
+ }
217
+ ngAfterContentInit() {
218
+ this._init();
219
+ }
220
+ /** Handles when a new year is selected. */
221
+ _yearSelected(year) {
222
+ const month = this._adapter.getMonth(this.activeDate);
223
+ const normalizedDate = this._adapter.createDatetime(year, month, 1, 0, 0);
224
+ this.selectedChange.emit(this._adapter.createDatetime(year, month, Math.min(this._adapter.getDate(this.activeDate), this._adapter.getNumDaysInMonth(normalizedDate)), this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate)));
225
+ if (this.type === 'year') {
226
+ this._userSelection.emit();
227
+ }
228
+ }
229
+ _getActiveCell() {
230
+ return getActiveOffset(this._adapter, this.activeDate, this.minDate, this.maxDate);
231
+ }
232
+ _calendarStateDone() {
233
+ this._calendarState = '';
234
+ }
235
+ /** Initializes this year view. */
236
+ _init() {
237
+ this._todayYear = this._adapter.getYear(this._adapter.today());
238
+ this._yearLabel = this._adapter.getYearName(this.activeDate);
239
+ const activeYear = this._adapter.getYear(this.activeDate);
240
+ const minYearOfPage = activeYear - getActiveOffset(this._adapter, this.activeDate, this.minDate, this.maxDate);
241
+ this._years = [];
242
+ for (let i = 0, row = []; i < yearsPerPage; i++) {
243
+ row.push(minYearOfPage + i);
244
+ if (row.length === yearsPerRow) {
245
+ this._years.push(row.map(year => this._createCellForYear(year)));
246
+ row = [];
247
+ }
248
+ }
249
+ }
250
+ /** Creates an MtxCalendarCell for the given year. */
251
+ _createCellForYear(year) {
252
+ const yearName = this._adapter.getYearName(this._adapter.createDate(year, 0, 1));
253
+ return new MtxCalendarCell(year, yearName, yearName, this._shouldEnableYear(year));
254
+ }
255
+ /** Whether the given year is enabled. */
256
+ _shouldEnableYear(year) {
257
+ // disable if the year is greater than maxDate lower than minDate
258
+ if (year === undefined ||
259
+ year === null ||
260
+ (this.maxDate && year > this._adapter.getYear(this.maxDate)) ||
261
+ (this.minDate && year < this._adapter.getYear(this.minDate))) {
262
+ return false;
263
+ }
264
+ // enable if it reaches here and there's no filter defined
265
+ if (!this.dateFilter) {
266
+ return true;
267
+ }
268
+ const firstOfYear = this._adapter.createDate(year, 0, 1);
269
+ // If any date in the year is enabled count the year as enabled.
270
+ for (let date = firstOfYear; this._adapter.getYear(date) === year; date = this._adapter.addCalendarDays(date, 1)) {
271
+ if (this.dateFilter(date)) {
272
+ return true;
273
+ }
274
+ }
275
+ return false;
276
+ }
277
+ /**
278
+ * Gets the year in this years range that the given Date falls on.
279
+ * Returns null if the given Date is not in this range.
280
+ */
281
+ _getYearInCurrentRange(date) {
282
+ const year = this._adapter.getYear(date);
283
+ return this._isInRange(year) ? year : null;
284
+ }
285
+ /**
286
+ * Validate if the current year is in the current range
287
+ * Returns true if is in range else returns false
288
+ */
289
+ _isInRange(year) {
290
+ return true;
291
+ }
292
+ /**
293
+ * @param obj The object to check.
294
+ * @returns The given object if it is both a date instance and valid, otherwise null.
295
+ */
296
+ _getValidDateOrNull(obj) {
297
+ return this._adapter.isDateInstance(obj) && this._adapter.isValid(obj) ? obj : null;
298
+ }
299
+ }
300
+ /** @nocollapse */ /** @nocollapse */ MtxMultiYearView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxMultiYearView, deps: [{ token: i1.DatetimeAdapter, optional: true }, { token: MTX_DATETIME_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
301
+ /** @nocollapse */ /** @nocollapse */ MtxMultiYearView.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: MtxMultiYearView, selector: "mtx-multi-year-view", inputs: { type: "type", dateFilter: "dateFilter", activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate" }, outputs: { selectedChange: "selectedChange", _userSelection: "_userSelection" }, exportAs: ["mtxMultiYearView"], ngImport: i0, template: "<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\"></thead>\n <tbody mtx-calendar-body\n (@slideCalendar.done)=\"_calendarStateDone()\"\n [@slideCalendar]=\"_calendarState\"\n [todayValue]=\"_todayYear\"\n [rows]=\"_years\"\n [numCols]=\"4\"\n [activeCell]=\"_getActiveCell()\"\n [allowDisabledSelection]=\"true\"\n [selectedValue]=\"_selectedYear!\"\n (selectedValueChange)=\"_yearSelected($event)\"></tbody>\n</table>\n", components: [{ type: MtxCalendarBody, selector: "[mtx-calendar-body]", inputs: ["label", "rows", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "allowDisabledSelection", "activeCell"], outputs: ["selectedValueChange"], exportAs: ["mtxCalendarBody"] }], animations: [mtxDatetimepickerAnimations.slideCalendar], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
302
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxMultiYearView, decorators: [{
303
+ type: Component,
304
+ args: [{ selector: 'mtx-multi-year-view', exportAs: 'mtxMultiYearView', animations: [mtxDatetimepickerAnimations.slideCalendar], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\"></thead>\n <tbody mtx-calendar-body\n (@slideCalendar.done)=\"_calendarStateDone()\"\n [@slideCalendar]=\"_calendarState\"\n [todayValue]=\"_todayYear\"\n [rows]=\"_years\"\n [numCols]=\"4\"\n [activeCell]=\"_getActiveCell()\"\n [allowDisabledSelection]=\"true\"\n [selectedValue]=\"_selectedYear!\"\n (selectedValueChange)=\"_yearSelected($event)\"></tbody>\n</table>\n" }]
305
+ }], ctorParameters: function () { return [{ type: i1.DatetimeAdapter, decorators: [{
306
+ type: Optional
307
+ }] }, { type: undefined, decorators: [{
308
+ type: Optional
309
+ }, {
310
+ type: Inject,
311
+ args: [MTX_DATETIME_FORMATS]
312
+ }] }]; }, propDecorators: { type: [{
313
+ type: Input
314
+ }], dateFilter: [{
315
+ type: Input
316
+ }], selectedChange: [{
317
+ type: Output
318
+ }], _userSelection: [{
319
+ type: Output
320
+ }], activeDate: [{
321
+ type: Input
322
+ }], selected: [{
323
+ type: Input
324
+ }], minDate: [{
325
+ type: Input
326
+ }], maxDate: [{
327
+ type: Input
328
+ }] } });
329
+ function isSameMultiYearView(dateAdapter, date1, date2, minDate, maxDate) {
330
+ const year1 = dateAdapter.getYear(date1);
331
+ const year2 = dateAdapter.getYear(date2);
332
+ const startingYear = getStartingYear(dateAdapter, minDate, maxDate);
333
+ return (Math.floor((year1 - startingYear) / yearsPerPage) ===
334
+ Math.floor((year2 - startingYear) / yearsPerPage));
335
+ }
336
+ /**
337
+ * When the multi-year view is first opened, the active year will be in view.
338
+ * So we compute how many years are between the active year and the *slot* where our
339
+ * "startingYear" will render when paged into view.
340
+ */
341
+ function getActiveOffset(dateAdapter, activeDate, minDate, maxDate) {
342
+ const activeYear = dateAdapter.getYear(activeDate);
343
+ return euclideanModulo(activeYear - getStartingYear(dateAdapter, minDate, maxDate), yearsPerPage);
344
+ }
345
+ /**
346
+ * We pick a "starting" year such that either the maximum year would be at the end
347
+ * or the minimum year would be at the beginning of a page.
348
+ */
349
+ function getStartingYear(dateAdapter, minDate, maxDate) {
350
+ let startingYear = 0;
351
+ if (maxDate) {
352
+ const maxYear = dateAdapter.getYear(maxDate);
353
+ startingYear = maxYear - yearsPerPage + 1;
354
+ }
355
+ else if (minDate) {
356
+ startingYear = dateAdapter.getYear(minDate);
357
+ }
358
+ return startingYear;
359
+ }
360
+ /** Gets remainder that is non-negative, even if first number is negative */
361
+ function euclideanModulo(a, b) {
362
+ return ((a % b) + b) % b;
363
+ }
364
+
365
+ const DAYS_PER_WEEK = 7;
366
+ /**
367
+ * An internal component used to display a single month in the datetimepicker.
368
+ * @docs-private
369
+ */
370
+ class MtxMonthView {
371
+ constructor(_adapter, _dateFormats) {
372
+ this._adapter = _adapter;
373
+ this._dateFormats = _dateFormats;
374
+ this.type = 'date';
375
+ /** Emits when a new date is selected. */
376
+ this.selectedChange = new EventEmitter();
377
+ /** Emits when any date is selected. */
378
+ this._userSelection = new EventEmitter();
379
+ if (!this._adapter) {
380
+ throw createMissingDateImplError('DatetimeAdapter');
381
+ }
382
+ if (!this._dateFormats) {
383
+ throw createMissingDateImplError('MTX_DATETIME_FORMATS');
384
+ }
385
+ const firstDayOfWeek = this._adapter.getFirstDayOfWeek();
386
+ const narrowWeekdays = this._adapter.getDayOfWeekNames('narrow');
387
+ const longWeekdays = this._adapter.getDayOfWeekNames('long');
388
+ // Rotate the labels for days of the week based on the configured first day of the week.
389
+ const weekdays = longWeekdays.map((long, i) => {
390
+ return { long, narrow: narrowWeekdays[i] };
391
+ });
392
+ this._weekdays = weekdays.slice(firstDayOfWeek).concat(weekdays.slice(0, firstDayOfWeek));
393
+ this._activeDate = this._adapter.today();
394
+ }
395
+ /**
396
+ * The date to display in this month view (everything other than the month and year is ignored).
397
+ */
398
+ get activeDate() {
399
+ return this._activeDate;
400
+ }
401
+ set activeDate(value) {
402
+ const oldActiveDate = this._activeDate;
403
+ this._activeDate = value || this._adapter.today();
404
+ if (oldActiveDate &&
405
+ this._activeDate &&
406
+ !this._adapter.sameMonthAndYear(oldActiveDate, this._activeDate)) {
407
+ this._init();
408
+ if (this._adapter.isInNextMonth(oldActiveDate, this._activeDate)) {
409
+ this.calendarState('right');
410
+ }
411
+ else {
412
+ this.calendarState('left');
413
+ }
414
+ }
415
+ }
416
+ /** The currently selected date. */
417
+ get selected() {
418
+ return this._selected;
419
+ }
420
+ set selected(value) {
421
+ this._selected = value;
422
+ this._selectedDate = this._getDateInCurrentMonth(this.selected);
423
+ }
424
+ ngAfterContentInit() {
425
+ this._init();
426
+ }
427
+ /** Handles when a new date is selected. */
428
+ _dateSelected(date) {
429
+ this.selectedChange.emit(this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), date, this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate)));
430
+ if (this.type === 'date') {
431
+ this._userSelection.emit();
432
+ }
433
+ }
434
+ _calendarStateDone() {
435
+ this._calendarState = '';
436
+ }
437
+ /** Initializes this month view. */
438
+ _init() {
439
+ this._selectedDate = this._getDateInCurrentMonth(this.selected);
440
+ this._todayDate = this._getDateInCurrentMonth(this._adapter.today());
441
+ const firstOfMonth = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), 1, this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate));
442
+ this._firstWeekOffset =
443
+ (DAYS_PER_WEEK +
444
+ this._adapter.getDayOfWeek(firstOfMonth) -
445
+ this._adapter.getFirstDayOfWeek()) %
446
+ DAYS_PER_WEEK;
447
+ this._createWeekCells();
448
+ }
449
+ /** Creates MdCalendarCells for the dates in this month. */
450
+ _createWeekCells() {
451
+ const daysInMonth = this._adapter.getNumDaysInMonth(this.activeDate);
452
+ const dateNames = this._adapter.getDateNames();
453
+ this._weeks = [[]];
454
+ for (let i = 0, cell = this._firstWeekOffset; i < daysInMonth; i++, cell++) {
455
+ if (cell === DAYS_PER_WEEK) {
456
+ this._weeks.push([]);
457
+ cell = 0;
458
+ }
459
+ const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), i + 1, this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate));
460
+ const enabled = !this.dateFilter || this.dateFilter(date);
461
+ const ariaLabel = this._adapter.format(date, this._dateFormats.display.dateA11yLabel);
462
+ this._weeks[this._weeks.length - 1].push(new MtxCalendarCell(i + 1, dateNames[i], ariaLabel, enabled));
463
+ }
464
+ }
465
+ /**
466
+ * Gets the date in this month that the given Date falls on.
467
+ * Returns null if the given Date is in another month.
468
+ */
469
+ _getDateInCurrentMonth(date) {
470
+ return this._adapter.sameMonthAndYear(date, this.activeDate)
471
+ ? this._adapter.getDate(date)
472
+ : null;
473
+ }
474
+ calendarState(direction) {
475
+ this._calendarState = direction;
476
+ }
477
+ }
478
+ /** @nocollapse */ /** @nocollapse */ MtxMonthView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxMonthView, deps: [{ token: i1.DatetimeAdapter, optional: true }, { token: MTX_DATETIME_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
479
+ /** @nocollapse */ /** @nocollapse */ MtxMonthView.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: MtxMonthView, selector: "mtx-month-view", inputs: { type: "type", dateFilter: "dateFilter", activeDate: "activeDate", selected: "selected" }, outputs: { selectedChange: "selectedChange", _userSelection: "_userSelection" }, exportAs: ["mtxMonthView"], ngImport: i0, template: "<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\">\n <tr>\n <th *ngFor=\"let day of _weekdays\" [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\n </tr>\n </thead>\n <tbody mtx-calendar-body\n (@slideCalendar.done)=\"_calendarStateDone()\"\n [@slideCalendar]=\"_calendarState\"\n [rows]=\"_weeks\"\n [todayValue]=\"_todayDate!\"\n [activeCell]=\"_adapter.getDate(activeDate) - 1\"\n [selectedValue]=\"_selectedDate!\"\n (selectedValueChange)=\"_dateSelected($event)\"></tbody>\n</table>\n", components: [{ type: MtxCalendarBody, selector: "[mtx-calendar-body]", inputs: ["label", "rows", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "allowDisabledSelection", "activeCell"], outputs: ["selectedValueChange"], exportAs: ["mtxCalendarBody"] }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], animations: [mtxDatetimepickerAnimations.slideCalendar], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
480
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxMonthView, decorators: [{
481
+ type: Component,
482
+ args: [{ selector: 'mtx-month-view', exportAs: 'mtxMonthView', animations: [mtxDatetimepickerAnimations.slideCalendar], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\">\n <tr>\n <th *ngFor=\"let day of _weekdays\" [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\n </tr>\n </thead>\n <tbody mtx-calendar-body\n (@slideCalendar.done)=\"_calendarStateDone()\"\n [@slideCalendar]=\"_calendarState\"\n [rows]=\"_weeks\"\n [todayValue]=\"_todayDate!\"\n [activeCell]=\"_adapter.getDate(activeDate) - 1\"\n [selectedValue]=\"_selectedDate!\"\n (selectedValueChange)=\"_dateSelected($event)\"></tbody>\n</table>\n" }]
483
+ }], ctorParameters: function () { return [{ type: i1.DatetimeAdapter, decorators: [{
484
+ type: Optional
485
+ }] }, { type: undefined, decorators: [{
486
+ type: Optional
487
+ }, {
488
+ type: Inject,
489
+ args: [MTX_DATETIME_FORMATS]
490
+ }] }]; }, propDecorators: { type: [{
491
+ type: Input
492
+ }], dateFilter: [{
493
+ type: Input
494
+ }], selectedChange: [{
495
+ type: Output
496
+ }], _userSelection: [{
497
+ type: Output
498
+ }], activeDate: [{
499
+ type: Input
500
+ }], selected: [{
501
+ type: Input
502
+ }] } });
503
+
504
+ /**
505
+ * An internal component used to display a single year in the datetimepicker.
506
+ * @docs-private
507
+ */
508
+ class MtxYearView {
509
+ constructor(_adapter, _dateFormats) {
510
+ this._adapter = _adapter;
511
+ this._dateFormats = _dateFormats;
512
+ this.type = 'date';
513
+ /** Emits when a new month is selected. */
514
+ this.selectedChange = new EventEmitter();
515
+ /** Emits when any date is selected. */
516
+ this._userSelection = new EventEmitter();
517
+ if (!this._adapter) {
518
+ throw createMissingDateImplError('DatetimeAdapter');
519
+ }
520
+ if (!this._dateFormats) {
521
+ throw createMissingDateImplError('MTX_DATETIME_FORMATS');
522
+ }
523
+ this._activeDate = this._adapter.today();
524
+ }
525
+ /** The date to display in this year view (everything other than the year is ignored). */
526
+ get activeDate() {
527
+ return this._activeDate;
528
+ }
529
+ set activeDate(value) {
530
+ const oldActiveDate = this._activeDate;
531
+ this._activeDate = value || this._adapter.today();
532
+ if (oldActiveDate &&
533
+ this._activeDate &&
534
+ !this._adapter.sameYear(oldActiveDate, this._activeDate)) {
535
+ this._init();
536
+ // if (oldActiveDate < this._activeDate) {
537
+ // this.calendarState('right');
538
+ // } else {
539
+ // this.calendarState('left');
540
+ // }
541
+ }
542
+ }
543
+ /** The currently selected date. */
544
+ get selected() {
545
+ return this._selected;
546
+ }
547
+ set selected(value) {
548
+ this._selected = value;
549
+ this._selectedMonth = this._getMonthInCurrentYear(this.selected);
550
+ }
551
+ ngAfterContentInit() {
552
+ this._init();
553
+ }
554
+ /** Handles when a new month is selected. */
555
+ _monthSelected(month) {
556
+ const normalizedDate = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), month, 1, 0, 0);
557
+ this.selectedChange.emit(this._adapter.createDatetime(this._adapter.getYear(this.activeDate), month, Math.min(this._adapter.getDate(this.activeDate), this._adapter.getNumDaysInMonth(normalizedDate)), this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate)));
558
+ if (this.type === 'month') {
559
+ this._userSelection.emit();
560
+ }
561
+ }
562
+ _calendarStateDone() {
563
+ this._calendarState = '';
564
+ }
565
+ /** Initializes this month view. */
566
+ _init() {
567
+ this._selectedMonth = this._getMonthInCurrentYear(this.selected);
568
+ this._todayMonth = this._getMonthInCurrentYear(this._adapter.today());
569
+ this._yearLabel = this._adapter.getYearName(this.activeDate);
570
+ const monthNames = this._adapter.getMonthNames('short');
571
+ // First row of months only contains 5 elements so we can fit the year label on the same row.
572
+ this._months = [
573
+ [0, 1, 2, 3],
574
+ [4, 5, 6, 7],
575
+ [8, 9, 10, 11],
576
+ ].map(row => row.map(month => this._createCellForMonth(month, monthNames[month])));
577
+ }
578
+ /**
579
+ * Gets the month in this year that the given Date falls on.
580
+ * Returns null if the given Date is in another year.
581
+ */
582
+ _getMonthInCurrentYear(date) {
583
+ return this._adapter.sameYear(date, this.activeDate) ? this._adapter.getMonth(date) : null;
584
+ }
585
+ /** Creates an MdCalendarCell for the given month. */
586
+ _createCellForMonth(month, monthName) {
587
+ const ariaLabel = this._adapter.format(this._adapter.createDatetime(this._adapter.getYear(this.activeDate), month, 1, this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate)), this._dateFormats.display.monthYearA11yLabel);
588
+ return new MtxCalendarCell(month, monthName.toLocaleUpperCase(), ariaLabel, this._isMonthEnabled(month));
589
+ }
590
+ // private calendarState(direction: string): void {
591
+ // this._calendarState = direction;
592
+ // }
593
+ /** Whether the given month is enabled. */
594
+ _isMonthEnabled(month) {
595
+ if (!this.dateFilter) {
596
+ return true;
597
+ }
598
+ const firstOfMonth = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), month, 1, this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate));
599
+ // If any date in the month is enabled count the month as enabled.
600
+ for (let date = firstOfMonth; this._adapter.getMonth(date) === month; date = this._adapter.addCalendarDays(date, 1)) {
601
+ if (this.dateFilter(date)) {
602
+ return true;
603
+ }
604
+ }
605
+ return false;
606
+ }
607
+ }
608
+ /** @nocollapse */ /** @nocollapse */ MtxYearView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxYearView, deps: [{ token: i1.DatetimeAdapter, optional: true }, { token: MTX_DATETIME_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
609
+ /** @nocollapse */ /** @nocollapse */ MtxYearView.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: MtxYearView, selector: "mtx-year-view", inputs: { type: "type", dateFilter: "dateFilter", activeDate: "activeDate", selected: "selected" }, outputs: { selectedChange: "selectedChange", _userSelection: "_userSelection" }, exportAs: ["mtxYearView"], ngImport: i0, template: "<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\"></thead>\n <tbody mtx-calendar-body\n (@slideCalendar.done)=\"_calendarStateDone()\"\n [@slideCalendar]=\"_calendarState\"\n [label]=\"_yearLabel\"\n [rows]=\"_months\"\n [todayValue]=\"_todayMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [activeCell]=\"_adapter.getMonth(activeDate)\"\n [selectedValue]=\"_selectedMonth!\"\n (selectedValueChange)=\"_monthSelected($event)\"\n [allowDisabledSelection]=\"true\"></tbody>\n</table>\n", components: [{ type: MtxCalendarBody, selector: "[mtx-calendar-body]", inputs: ["label", "rows", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "allowDisabledSelection", "activeCell"], outputs: ["selectedValueChange"], exportAs: ["mtxCalendarBody"] }], animations: [mtxDatetimepickerAnimations.slideCalendar], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
610
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxYearView, decorators: [{
611
+ type: Component,
612
+ args: [{ selector: 'mtx-year-view', exportAs: 'mtxYearView', animations: [mtxDatetimepickerAnimations.slideCalendar], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\"></thead>\n <tbody mtx-calendar-body\n (@slideCalendar.done)=\"_calendarStateDone()\"\n [@slideCalendar]=\"_calendarState\"\n [label]=\"_yearLabel\"\n [rows]=\"_months\"\n [todayValue]=\"_todayMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [activeCell]=\"_adapter.getMonth(activeDate)\"\n [selectedValue]=\"_selectedMonth!\"\n (selectedValueChange)=\"_monthSelected($event)\"\n [allowDisabledSelection]=\"true\"></tbody>\n</table>\n" }]
613
+ }], ctorParameters: function () { return [{ type: i1.DatetimeAdapter, decorators: [{
614
+ type: Optional
615
+ }] }, { type: undefined, decorators: [{
616
+ type: Optional
617
+ }, {
618
+ type: Inject,
619
+ args: [MTX_DATETIME_FORMATS]
620
+ }] }]; }, propDecorators: { type: [{
621
+ type: Input
622
+ }], dateFilter: [{
623
+ type: Input
624
+ }], selectedChange: [{
625
+ type: Output
626
+ }], _userSelection: [{
627
+ type: Output
628
+ }], activeDate: [{
629
+ type: Input
630
+ }], selected: [{
631
+ type: Input
632
+ }] } });
633
+
634
+ const CLOCK_RADIUS = 50;
635
+ const CLOCK_INNER_RADIUS = 27.5;
636
+ const CLOCK_OUTER_RADIUS = 41.25;
637
+ const CLOCK_TICK_RADIUS = 7.0833;
638
+ /**
639
+ * A clock that is used as part of the datetimepicker.
640
+ * @docs-private
641
+ */
642
+ class MtxClock {
643
+ constructor(_element, _adapter) {
644
+ this._element = _element;
645
+ this._adapter = _adapter;
646
+ this.interval = 1;
647
+ this.twelvehour = false;
648
+ /** Emits when the currently selected date changes. */
649
+ this.selectedChange = new EventEmitter();
650
+ /** Emits when any date is activated. */
651
+ this.activeDateChange = new EventEmitter();
652
+ /** Emits when any date is selected. */
653
+ this._userSelection = new EventEmitter();
654
+ /** Hours and Minutes representing the clock view. */
655
+ this._hours = [];
656
+ this._minutes = [];
657
+ /** Whether the clock is in hour view. */
658
+ this._hourView = true;
659
+ this._timeChanged = false;
660
+ this.mouseMoveListener = (event) => {
661
+ this._handleMousemove(event);
662
+ };
663
+ this.mouseUpListener = () => {
664
+ this._handleMouseup();
665
+ };
666
+ }
667
+ /**
668
+ * The date to display in this clock view.
669
+ */
670
+ get activeDate() {
671
+ return this._activeDate;
672
+ }
673
+ set activeDate(value) {
674
+ const oldActiveDate = this._activeDate;
675
+ this._activeDate = this._adapter.clampDate(value, this.minDate, this.maxDate);
676
+ if (!this._adapter.sameMinute(oldActiveDate, this._activeDate)) {
677
+ this._init();
678
+ }
679
+ }
680
+ /** The currently selected date. */
681
+ get selected() {
682
+ return this._selected;
683
+ }
684
+ set selected(value) {
685
+ this._selected = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
686
+ if (this._selected) {
687
+ this.activeDate = this._selected;
688
+ }
689
+ }
690
+ /** The minimum selectable date. */
691
+ get minDate() {
692
+ return this._minDate;
693
+ }
694
+ set minDate(value) {
695
+ this._minDate = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
696
+ }
697
+ /** The maximum selectable date. */
698
+ get maxDate() {
699
+ return this._maxDate;
700
+ }
701
+ set maxDate(value) {
702
+ this._maxDate = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
703
+ }
704
+ /** Whether the clock should be started in hour or minute view. */
705
+ set startView(value) {
706
+ this._hourView = value !== 'minute';
707
+ }
708
+ get _hand() {
709
+ let hour = this._adapter.getHour(this.activeDate);
710
+ if (this.twelvehour) {
711
+ if (hour === 0) {
712
+ hour = 24;
713
+ }
714
+ this._selectedHour = hour > 12 ? hour - 12 : hour;
715
+ }
716
+ else {
717
+ this._selectedHour = hour;
718
+ }
719
+ this._selectedMinute = this._adapter.getMinute(this.activeDate);
720
+ let deg = 0;
721
+ let radius = CLOCK_OUTER_RADIUS;
722
+ if (this._hourView) {
723
+ const outer = this._selectedHour > 0 && this._selectedHour < 13;
724
+ radius = outer ? CLOCK_OUTER_RADIUS : CLOCK_INNER_RADIUS;
725
+ if (this.twelvehour) {
726
+ radius = CLOCK_OUTER_RADIUS;
727
+ }
728
+ deg = Math.round(this._selectedHour * (360 / (24 / 2)));
729
+ }
730
+ else {
731
+ deg = Math.round(this._selectedMinute * (360 / 60));
732
+ }
733
+ return {
734
+ 'transform': `rotate(${deg}deg)`,
735
+ 'height': `${radius}%`,
736
+ 'margin-top': `${50 - radius}%`,
737
+ };
738
+ }
739
+ ngAfterContentInit() {
740
+ this.activeDate = this._activeDate || this._adapter.today();
741
+ this._init();
742
+ }
743
+ /** Handles mousedown events on the clock body. */
744
+ _handleMousedown(event) {
745
+ this._timeChanged = false;
746
+ this.setTime(event);
747
+ document.addEventListener('mousemove', this.mouseMoveListener);
748
+ document.addEventListener('touchmove', this.mouseMoveListener);
749
+ document.addEventListener('mouseup', this.mouseUpListener);
750
+ document.addEventListener('touchend', this.mouseUpListener);
751
+ }
752
+ _handleMousemove(event) {
753
+ event.preventDefault();
754
+ this.setTime(event);
755
+ }
756
+ _handleMouseup() {
757
+ document.removeEventListener('mousemove', this.mouseMoveListener);
758
+ document.removeEventListener('touchmove', this.mouseMoveListener);
759
+ document.removeEventListener('mouseup', this.mouseUpListener);
760
+ document.removeEventListener('touchend', this.mouseUpListener);
761
+ if (this._timeChanged) {
762
+ this.selectedChange.emit(this.activeDate);
763
+ if (!this._hourView) {
764
+ this._userSelection.emit();
765
+ }
766
+ }
767
+ }
768
+ /** Initializes this clock view. */
769
+ _init() {
770
+ this._hours.length = 0;
771
+ this._minutes.length = 0;
772
+ const hourNames = this._adapter.getHourNames();
773
+ const minuteNames = this._adapter.getMinuteNames();
774
+ if (this.twelvehour) {
775
+ for (let i = 1; i < hourNames.length / 2 + 1; i++) {
776
+ const radian = (i / 6) * Math.PI;
777
+ const radius = CLOCK_OUTER_RADIUS;
778
+ const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), i + 1, 0);
779
+ const enabled = (!this.minDate || this._adapter.compareDatetime(date, this.minDate) >= 0) &&
780
+ (!this.maxDate || this._adapter.compareDatetime(date, this.maxDate) <= 0);
781
+ this._hours.push({
782
+ value: i,
783
+ displayValue: i === 0 ? '00' : hourNames[i],
784
+ enabled,
785
+ top: CLOCK_RADIUS - Math.cos(radian) * radius - CLOCK_TICK_RADIUS,
786
+ left: CLOCK_RADIUS + Math.sin(radian) * radius - CLOCK_TICK_RADIUS,
787
+ });
788
+ }
789
+ }
790
+ else {
791
+ for (let i = 0; i < hourNames.length; i++) {
792
+ const radian = (i / 6) * Math.PI;
793
+ const outer = i > 0 && i < 13;
794
+ const radius = outer ? CLOCK_OUTER_RADIUS : CLOCK_INNER_RADIUS;
795
+ const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), i, 0);
796
+ const enabled = (!this.minDate || this._adapter.compareDatetime(date, this.minDate, false) >= 0) &&
797
+ (!this.maxDate || this._adapter.compareDatetime(date, this.maxDate, false) <= 0) &&
798
+ (!this.dateFilter || this.dateFilter(date, MtxDatetimepickerFilterType.HOUR));
799
+ this._hours.push({
800
+ value: i,
801
+ displayValue: i === 0 ? '00' : hourNames[i],
802
+ enabled,
803
+ top: CLOCK_RADIUS - Math.cos(radian) * radius - CLOCK_TICK_RADIUS,
804
+ left: CLOCK_RADIUS + Math.sin(radian) * radius - CLOCK_TICK_RADIUS,
805
+ fontSize: i > 0 && i < 13 ? '' : '80%',
806
+ });
807
+ }
808
+ }
809
+ for (let i = 0; i < minuteNames.length; i += 5) {
810
+ const radian = (i / 30) * Math.PI;
811
+ const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), this._adapter.getHour(this.activeDate), i);
812
+ const enabled = (!this.minDate || this._adapter.compareDatetime(date, this.minDate) >= 0) &&
813
+ (!this.maxDate || this._adapter.compareDatetime(date, this.maxDate) <= 0) &&
814
+ (!this.dateFilter || this.dateFilter(date, MtxDatetimepickerFilterType.MINUTE));
815
+ this._minutes.push({
816
+ value: i,
817
+ displayValue: i === 0 ? '00' : minuteNames[i],
818
+ enabled,
819
+ top: CLOCK_RADIUS - Math.cos(radian) * CLOCK_OUTER_RADIUS - CLOCK_TICK_RADIUS,
820
+ left: CLOCK_RADIUS + Math.sin(radian) * CLOCK_OUTER_RADIUS - CLOCK_TICK_RADIUS,
821
+ });
822
+ }
823
+ }
824
+ /**
825
+ * Set Time
826
+ * @param event
827
+ */
828
+ setTime(event) {
829
+ const trigger = this._element.nativeElement;
830
+ const triggerRect = trigger.getBoundingClientRect();
831
+ const width = trigger.offsetWidth;
832
+ const height = trigger.offsetHeight;
833
+ const pageX = event.pageX !== undefined ? event.pageX : event.touches[0].pageX;
834
+ const pageY = event.pageY !== undefined ? event.pageY : event.touches[0].pageY;
835
+ const x = width / 2 - (pageX - triggerRect.left - window.pageXOffset);
836
+ const y = height / 2 - (pageY - triggerRect.top - window.pageYOffset);
837
+ let radian = Math.atan2(-x, y);
838
+ const unit = Math.PI / (this._hourView ? 6 : this.interval ? 30 / this.interval : 30);
839
+ const z = Math.sqrt(x * x + y * y);
840
+ const outer = this._hourView &&
841
+ z > (width * (CLOCK_OUTER_RADIUS / 100) + width * (CLOCK_INNER_RADIUS / 100)) / 2;
842
+ if (radian < 0) {
843
+ radian = Math.PI * 2 + radian;
844
+ }
845
+ let value = Math.round(radian / unit);
846
+ let date;
847
+ if (this._hourView) {
848
+ if (this.twelvehour) {
849
+ value = value === 0 ? 12 : value;
850
+ }
851
+ else {
852
+ if (value === 12) {
853
+ value = 0;
854
+ }
855
+ value = outer ? (value === 0 ? 12 : value) : value === 0 ? 0 : value + 12;
856
+ }
857
+ date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), value, this._adapter.getMinute(this.activeDate));
858
+ }
859
+ else {
860
+ if (this.interval) {
861
+ value *= this.interval;
862
+ }
863
+ if (value === 60) {
864
+ value = 0;
865
+ }
866
+ date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), this._adapter.getHour(this.activeDate), value);
867
+ }
868
+ this._timeChanged = true;
869
+ this.activeDate = date;
870
+ this.activeDateChange.emit(this.activeDate);
871
+ }
872
+ }
873
+ /** @nocollapse */ /** @nocollapse */ MtxClock.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxClock, deps: [{ token: i0.ElementRef }, { token: i1.DatetimeAdapter }], target: i0.ɵɵFactoryTarget.Component });
874
+ /** @nocollapse */ /** @nocollapse */ MtxClock.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: MtxClock, selector: "mtx-clock", inputs: { dateFilter: "dateFilter", interval: "interval", twelvehour: "twelvehour", activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate", startView: "startView" }, outputs: { selectedChange: "selectedChange", activeDateChange: "activeDateChange", _userSelection: "_userSelection" }, host: { attributes: { "role": "clock" }, listeners: { "mousedown": "_handleMousedown($event)" }, properties: { "class.mtx-clock": "true" } }, exportAs: ["mtxClock"], ngImport: i0, template: "<div class=\"mtx-clock-wrapper\">\n <div class=\"mtx-clock-center\"></div>\n <div [ngStyle]=\"_hand\" class=\"mtx-clock-hand\"></div>\n <div [class.active]=\"_hourView\" class=\"mtx-clock-hours\">\n <div *ngFor=\"let item of _hours\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedHour === item.value\"\n [style.fontSize]=\"item.fontSize\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\"\n class=\"mtx-clock-cell\">{{ item.displayValue }}</div>\n </div>\n <div [class.active]=\"!_hourView\" class=\"mtx-clock-minutes\">\n <div *ngFor=\"let item of _minutes\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedMinute === item.value\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\"\n class=\"mtx-clock-cell\">{{ item.displayValue }}</div>\n </div>\n</div>\n", styles: [".mtx-clock{position:relative;display:block;min-width:224px;margin:8px;box-sizing:border-box;-webkit-user-select:none;user-select:none}.mtx-clock-wrapper{position:relative;width:100%;height:0;padding-top:100%;border-radius:50%}.mtx-clock-center{position:absolute;top:50%;left:50%;width:2%;height:2%;margin:-1%;border-radius:50%}.mtx-clock-hand{position:absolute;top:0;right:0;bottom:0;left:0;width:1px;margin:0 auto;transform-origin:bottom}.mtx-clock-hand:before{content:\"\";position:absolute;top:-4px;left:-4px;width:8px;height:8px;border-radius:50%}.mtx-clock-hours,.mtx-clock-minutes{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;visibility:hidden;transition:.35s;transform:scale(1.2)}.mtx-clock-hours.active,.mtx-clock-minutes.active{opacity:1;visibility:visible;transform:scale(1)}.mtx-clock-minutes{transform:scale(.8)}.mtx-clock-cell{position:absolute;display:flex;width:14.1666%;height:14.1666%;justify-content:center;box-sizing:border-box;border-radius:50%;align-items:center;cursor:pointer}.mtx-clock-cell.mtx-clock-cell-disabled{pointer-events:none}\n"], directives: [{ type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], encapsulation: i0.ViewEncapsulation.None });
875
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxClock, decorators: [{
876
+ type: Component,
877
+ args: [{ selector: 'mtx-clock', host: {
878
+ '[class.mtx-clock]': 'true',
879
+ 'role': 'clock',
880
+ '(mousedown)': '_handleMousedown($event)',
881
+ }, exportAs: 'mtxClock', encapsulation: ViewEncapsulation.None, template: "<div class=\"mtx-clock-wrapper\">\n <div class=\"mtx-clock-center\"></div>\n <div [ngStyle]=\"_hand\" class=\"mtx-clock-hand\"></div>\n <div [class.active]=\"_hourView\" class=\"mtx-clock-hours\">\n <div *ngFor=\"let item of _hours\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedHour === item.value\"\n [style.fontSize]=\"item.fontSize\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\"\n class=\"mtx-clock-cell\">{{ item.displayValue }}</div>\n </div>\n <div [class.active]=\"!_hourView\" class=\"mtx-clock-minutes\">\n <div *ngFor=\"let item of _minutes\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedMinute === item.value\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\"\n class=\"mtx-clock-cell\">{{ item.displayValue }}</div>\n </div>\n</div>\n", styles: [".mtx-clock{position:relative;display:block;min-width:224px;margin:8px;box-sizing:border-box;-webkit-user-select:none;user-select:none}.mtx-clock-wrapper{position:relative;width:100%;height:0;padding-top:100%;border-radius:50%}.mtx-clock-center{position:absolute;top:50%;left:50%;width:2%;height:2%;margin:-1%;border-radius:50%}.mtx-clock-hand{position:absolute;top:0;right:0;bottom:0;left:0;width:1px;margin:0 auto;transform-origin:bottom}.mtx-clock-hand:before{content:\"\";position:absolute;top:-4px;left:-4px;width:8px;height:8px;border-radius:50%}.mtx-clock-hours,.mtx-clock-minutes{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;visibility:hidden;transition:.35s;transform:scale(1.2)}.mtx-clock-hours.active,.mtx-clock-minutes.active{opacity:1;visibility:visible;transform:scale(1)}.mtx-clock-minutes{transform:scale(.8)}.mtx-clock-cell{position:absolute;display:flex;width:14.1666%;height:14.1666%;justify-content:center;box-sizing:border-box;border-radius:50%;align-items:center;cursor:pointer}.mtx-clock-cell.mtx-clock-cell-disabled{pointer-events:none}\n"] }]
882
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DatetimeAdapter }]; }, propDecorators: { dateFilter: [{
883
+ type: Input
884
+ }], interval: [{
885
+ type: Input
886
+ }], twelvehour: [{
887
+ type: Input
888
+ }], selectedChange: [{
889
+ type: Output
890
+ }], activeDateChange: [{
891
+ type: Output
892
+ }], _userSelection: [{
893
+ type: Output
894
+ }], activeDate: [{
895
+ type: Input
896
+ }], selected: [{
897
+ type: Input
898
+ }], minDate: [{
899
+ type: Input
900
+ }], maxDate: [{
901
+ type: Input
902
+ }], startView: [{
903
+ type: Input
904
+ }] } });
905
+
906
+ /**
907
+ * A calendar that is used as part of the datetimepicker.
908
+ * @docs-private
909
+ */
910
+ class MtxCalendar {
911
+ constructor(_elementRef, _intl, _ngZone, _adapter, _dateFormats, changeDetectorRef) {
912
+ this._elementRef = _elementRef;
913
+ this._intl = _intl;
914
+ this._ngZone = _ngZone;
915
+ this._adapter = _adapter;
916
+ this._dateFormats = _dateFormats;
917
+ this._multiYearSelector = false;
918
+ this._twelvehour = false;
919
+ /** Whether the calendar should be started in month or year view. */
920
+ this.startView = 'month';
921
+ this.timeInterval = 1;
922
+ /** Prevent user to select same date time */
923
+ this.preventSameDateTimeSelection = false;
924
+ /** Emits when the currently selected date changes. */
925
+ this.selectedChange = new EventEmitter();
926
+ /** Emits when the view has been changed. */
927
+ this.viewChanged = new EventEmitter();
928
+ this._userSelection = new EventEmitter();
929
+ this._clockView = 'hour';
930
+ this._type = 'date';
931
+ /** Date filter for the month and year views. */
932
+ this._dateFilterForViews = (date) => {
933
+ return (!!date &&
934
+ (!this.dateFilter || this.dateFilter(date, MtxDatetimepickerFilterType.DATE)) &&
935
+ (!this.minDate || this._adapter.compareDate(date, this.minDate) >= 0) &&
936
+ (!this.maxDate || this._adapter.compareDate(date, this.maxDate) <= 0));
937
+ };
938
+ if (!this._adapter) {
939
+ throw createMissingDateImplError('DatetimeAdapter');
940
+ }
941
+ if (!this._dateFormats) {
942
+ throw createMissingDateImplError('MTX_DATETIME_FORMATS');
943
+ }
944
+ this._intlChanges = _intl.changes.subscribe(() => changeDetectorRef.markForCheck());
945
+ }
946
+ get multiYearSelector() {
947
+ return this._multiYearSelector;
948
+ }
949
+ set multiYearSelector(value) {
950
+ this._multiYearSelector = coerceBooleanProperty(value);
951
+ }
952
+ /** if true change the clock to 12 hour format. */
953
+ get twelvehour() {
954
+ return this._twelvehour;
955
+ }
956
+ set twelvehour(value) {
957
+ this._twelvehour = coerceBooleanProperty(value);
958
+ }
959
+ get type() {
960
+ return this._type;
961
+ }
962
+ set type(value) {
963
+ this._type = value || 'date';
964
+ if (this.type === 'year') {
965
+ this.multiYearSelector = true;
966
+ }
967
+ }
968
+ /** A date representing the period (month or year) to start the calendar in. */
969
+ get startAt() {
970
+ return this._startAt;
971
+ }
972
+ set startAt(value) {
973
+ this._startAt = this._adapter.getValidDateOrNull(value);
974
+ }
975
+ /** The currently selected date. */
976
+ get selected() {
977
+ return this._selected;
978
+ }
979
+ set selected(value) {
980
+ this._selected = this._adapter.getValidDateOrNull(value);
981
+ }
982
+ /** The minimum selectable date. */
983
+ get minDate() {
984
+ return this._minDate;
985
+ }
986
+ set minDate(value) {
987
+ this._minDate = this._adapter.getValidDateOrNull(value);
988
+ }
989
+ /** The maximum selectable date. */
990
+ get maxDate() {
991
+ return this._maxDate;
992
+ }
993
+ set maxDate(value) {
994
+ this._maxDate = this._adapter.getValidDateOrNull(value);
995
+ }
996
+ /**
997
+ * The current active date. This determines which time period is shown and which date is
998
+ * highlighted when using keyboard navigation.
999
+ */
1000
+ get _activeDate() {
1001
+ return this._clampedActiveDate;
1002
+ }
1003
+ set _activeDate(value) {
1004
+ const oldActiveDate = this._clampedActiveDate;
1005
+ this._clampedActiveDate = this._adapter.clampDate(value, this.minDate, this.maxDate);
1006
+ if (oldActiveDate &&
1007
+ this._clampedActiveDate &&
1008
+ this.currentView === 'month' &&
1009
+ !this._adapter.sameMonthAndYear(oldActiveDate, this._clampedActiveDate)) {
1010
+ if (this._adapter.isInNextMonth(oldActiveDate, this._clampedActiveDate)) {
1011
+ this.calendarState('right');
1012
+ }
1013
+ else {
1014
+ this.calendarState('left');
1015
+ }
1016
+ }
1017
+ }
1018
+ /** Whether the calendar is in month view. */
1019
+ get currentView() {
1020
+ return this._currentView;
1021
+ }
1022
+ set currentView(view) {
1023
+ this._currentView = view;
1024
+ this.viewChanged.emit(view);
1025
+ }
1026
+ /** The label for the current calendar view. */
1027
+ get _yearLabel() {
1028
+ return this._adapter.getYearName(this._activeDate);
1029
+ }
1030
+ get _monthYearLabel() {
1031
+ if (this.currentView === 'multi-year') {
1032
+ // The offset from the active year to the "slot" for the starting year is the
1033
+ // *actual* first rendered year in the multi-year view, and the last year is
1034
+ // just yearsPerPage - 1 away.
1035
+ const activeYear = this._adapter.getYear(this._activeDate);
1036
+ const minYearOfPage = activeYear - getActiveOffset(this._adapter, this._activeDate, this.minDate, this.maxDate);
1037
+ const maxYearOfPage = minYearOfPage + yearsPerPage - 1;
1038
+ const minYearName = this._adapter.getYearName(this._adapter.createDate(minYearOfPage, 0, 1));
1039
+ const maxYearName = this._adapter.getYearName(this._adapter.createDate(maxYearOfPage, 0, 1));
1040
+ return this._intl.formatYearRange(minYearName, maxYearName);
1041
+ }
1042
+ return this.currentView === 'month'
1043
+ ? this._adapter.getMonthNames('long')[this._adapter.getMonth(this._activeDate)]
1044
+ : this._adapter.getYearName(this._activeDate);
1045
+ }
1046
+ get _dateLabel() {
1047
+ switch (this.type) {
1048
+ case 'month':
1049
+ return this._adapter.getMonthNames('long')[this._adapter.getMonth(this._activeDate)];
1050
+ default:
1051
+ return this._adapter.format(this._activeDate, this._dateFormats.display.popupHeaderDateLabel);
1052
+ }
1053
+ }
1054
+ get _hoursLabel() {
1055
+ let hour = this._adapter.getHour(this._activeDate);
1056
+ if (this.twelvehour) {
1057
+ if (hour === 0) {
1058
+ hour = 24;
1059
+ }
1060
+ hour = hour > 12 ? hour - 12 : hour;
1061
+ }
1062
+ return this._2digit(hour);
1063
+ }
1064
+ get _minutesLabel() {
1065
+ return this._2digit(this._adapter.getMinute(this._activeDate));
1066
+ }
1067
+ get _ariaLabelNext() {
1068
+ switch (this._currentView) {
1069
+ case 'month':
1070
+ return this._intl.nextMonthLabel;
1071
+ case 'year':
1072
+ return this._intl.nextYearLabel;
1073
+ case 'multi-year':
1074
+ return this._intl.nextMultiYearLabel;
1075
+ default:
1076
+ return '';
1077
+ }
1078
+ }
1079
+ get _ariaLabelPrev() {
1080
+ switch (this._currentView) {
1081
+ case 'month':
1082
+ return this._intl.prevMonthLabel;
1083
+ case 'year':
1084
+ return this._intl.prevYearLabel;
1085
+ case 'multi-year':
1086
+ return this._intl.prevMultiYearLabel;
1087
+ default:
1088
+ return '';
1089
+ }
1090
+ }
1091
+ _userSelected() {
1092
+ this._userSelection.emit();
1093
+ }
1094
+ ngAfterContentInit() {
1095
+ this._activeDate = this.startAt || this._adapter.today();
1096
+ this._selectAMPM(this._activeDate);
1097
+ if (this.type === 'year') {
1098
+ this.currentView = 'multi-year';
1099
+ }
1100
+ else if (this.type === 'month') {
1101
+ this.currentView = 'year';
1102
+ }
1103
+ else if (this.type === 'time') {
1104
+ this.currentView = 'clock';
1105
+ }
1106
+ else {
1107
+ this.currentView = this.startView || 'month';
1108
+ }
1109
+ }
1110
+ ngOnDestroy() {
1111
+ this._intlChanges.unsubscribe();
1112
+ }
1113
+ /** Handles date selection in the month view. */
1114
+ _dateSelected(date) {
1115
+ if (this.type === 'date') {
1116
+ if (!this._adapter.sameDate(date, this.selected) || !this.preventSameDateTimeSelection) {
1117
+ this.selectedChange.emit(date);
1118
+ }
1119
+ }
1120
+ else {
1121
+ this._activeDate = date;
1122
+ this.currentView = 'clock';
1123
+ }
1124
+ }
1125
+ /** Handles month selection in the year view. */
1126
+ _monthSelected(month) {
1127
+ if (this.type === 'month') {
1128
+ if (!this._adapter.sameMonthAndYear(month, this.selected) ||
1129
+ !this.preventSameDateTimeSelection) {
1130
+ this.selectedChange.emit(this._adapter.getFirstDateOfMonth(month));
1131
+ }
1132
+ }
1133
+ else {
1134
+ this._activeDate = month;
1135
+ this.currentView = 'month';
1136
+ this._clockView = 'hour';
1137
+ }
1138
+ }
1139
+ /** Handles year selection in the multi year view. */
1140
+ _yearSelected(year) {
1141
+ if (this.type === 'year') {
1142
+ if (!this._adapter.sameYear(year, this.selected) || !this.preventSameDateTimeSelection) {
1143
+ const normalizedDate = this._adapter.createDatetime(this._adapter.getYear(year), 0, 1, 0, 0);
1144
+ this.selectedChange.emit(normalizedDate);
1145
+ }
1146
+ }
1147
+ else {
1148
+ this._activeDate = year;
1149
+ this.currentView = 'year';
1150
+ }
1151
+ }
1152
+ _timeSelected(date) {
1153
+ if (this._clockView !== 'minute') {
1154
+ this._activeDate = this._updateDate(date);
1155
+ this._clockView = 'minute';
1156
+ }
1157
+ else {
1158
+ if (!this._adapter.sameDatetime(date, this.selected) || !this.preventSameDateTimeSelection) {
1159
+ this.selectedChange.emit(date);
1160
+ }
1161
+ }
1162
+ }
1163
+ _onActiveDateChange(date) {
1164
+ this._activeDate = date;
1165
+ }
1166
+ _updateDate(date) {
1167
+ if (this.twelvehour) {
1168
+ const HOUR = this._adapter.getHour(date);
1169
+ if (HOUR === 12) {
1170
+ if (this._AMPM === 'AM') {
1171
+ return this._adapter.addCalendarHours(date, -12);
1172
+ }
1173
+ }
1174
+ else if (this._AMPM === 'PM') {
1175
+ return this._adapter.addCalendarHours(date, 12);
1176
+ }
1177
+ }
1178
+ return date;
1179
+ }
1180
+ _selectAMPM(date) {
1181
+ if (this._adapter.getHour(date) > 11) {
1182
+ this._AMPM = 'PM';
1183
+ }
1184
+ else {
1185
+ this._AMPM = 'AM';
1186
+ }
1187
+ }
1188
+ _ampmClicked(source) {
1189
+ if (source === this._AMPM) {
1190
+ return;
1191
+ }
1192
+ this._AMPM = source;
1193
+ if (this._AMPM === 'AM') {
1194
+ this._activeDate = this._adapter.addCalendarHours(this._activeDate, -12);
1195
+ }
1196
+ else {
1197
+ this._activeDate = this._adapter.addCalendarHours(this._activeDate, 12);
1198
+ }
1199
+ }
1200
+ _yearClicked() {
1201
+ if (this.type === 'year' || this.multiYearSelector) {
1202
+ this.currentView = 'multi-year';
1203
+ return;
1204
+ }
1205
+ this.currentView = 'year';
1206
+ }
1207
+ _dateClicked() {
1208
+ if (this.type !== 'month') {
1209
+ this.currentView = 'month';
1210
+ }
1211
+ }
1212
+ _hoursClicked() {
1213
+ this.currentView = 'clock';
1214
+ this._clockView = 'hour';
1215
+ }
1216
+ _minutesClicked() {
1217
+ this.currentView = 'clock';
1218
+ this._clockView = 'minute';
1219
+ }
1220
+ /** Handles user clicks on the previous button. */
1221
+ _previousClicked() {
1222
+ this._activeDate =
1223
+ this.currentView === 'month'
1224
+ ? this._adapter.addCalendarMonths(this._activeDate, -1)
1225
+ : this._adapter.addCalendarYears(this._activeDate, this.currentView === 'year' ? -1 : -yearsPerPage);
1226
+ }
1227
+ /** Handles user clicks on the next button. */
1228
+ _nextClicked() {
1229
+ this._activeDate =
1230
+ this.currentView === 'month'
1231
+ ? this._adapter.addCalendarMonths(this._activeDate, 1)
1232
+ : this._adapter.addCalendarYears(this._activeDate, this.currentView === 'year' ? 1 : yearsPerPage);
1233
+ }
1234
+ /** Whether the previous period button is enabled. */
1235
+ _previousEnabled() {
1236
+ if (!this.minDate) {
1237
+ return true;
1238
+ }
1239
+ return !this.minDate || !this._isSameView(this._activeDate, this.minDate);
1240
+ }
1241
+ /** Whether the next period button is enabled. */
1242
+ _nextEnabled() {
1243
+ return !this.maxDate || !this._isSameView(this._activeDate, this.maxDate);
1244
+ }
1245
+ /** Handles keydown events on the calendar body. */
1246
+ _handleCalendarBodyKeydown(event) {
1247
+ // TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
1248
+ // disabled ones from being selected. This may not be ideal, we should look into whether
1249
+ // navigation should skip over disabled dates, and if so, how to implement that efficiently.
1250
+ if (this.currentView === 'month') {
1251
+ this._handleCalendarBodyKeydownInMonthView(event);
1252
+ }
1253
+ else if (this.currentView === 'year') {
1254
+ this._handleCalendarBodyKeydownInYearView(event);
1255
+ }
1256
+ else if (this.currentView === 'multi-year') {
1257
+ this._handleCalendarBodyKeydownInMultiYearView(event);
1258
+ }
1259
+ else {
1260
+ this._handleCalendarBodyKeydownInClockView(event);
1261
+ }
1262
+ }
1263
+ _focusActiveCell() {
1264
+ this._ngZone.runOutsideAngular(() => {
1265
+ this._ngZone.onStable
1266
+ .asObservable()
1267
+ .pipe(first())
1268
+ .subscribe(() => {
1269
+ this._elementRef.nativeElement.focus();
1270
+ });
1271
+ });
1272
+ }
1273
+ _calendarStateDone() {
1274
+ this._calendarState = '';
1275
+ }
1276
+ /** Whether the two dates represent the same view in the current view mode (month or year). */
1277
+ _isSameView(date1, date2) {
1278
+ if (this.currentView === 'month') {
1279
+ return (this._adapter.getYear(date1) === this._adapter.getYear(date2) &&
1280
+ this._adapter.getMonth(date1) === this._adapter.getMonth(date2));
1281
+ }
1282
+ if (this.currentView === 'year') {
1283
+ return this._adapter.getYear(date1) === this._adapter.getYear(date2);
1284
+ }
1285
+ // Otherwise we are in 'multi-year' view.
1286
+ return isSameMultiYearView(this._adapter, date1, date2, this.minDate, this.maxDate);
1287
+ }
1288
+ /** Handles keydown events on the calendar body when calendar is in month view. */
1289
+ _handleCalendarBodyKeydownInMonthView(event) {
1290
+ switch (event.keyCode) {
1291
+ case LEFT_ARROW:
1292
+ this._activeDate = this._adapter.addCalendarDays(this._activeDate, -1);
1293
+ break;
1294
+ case RIGHT_ARROW:
1295
+ this._activeDate = this._adapter.addCalendarDays(this._activeDate, 1);
1296
+ break;
1297
+ case UP_ARROW:
1298
+ this._activeDate = this._adapter.addCalendarDays(this._activeDate, -7);
1299
+ break;
1300
+ case DOWN_ARROW:
1301
+ this._activeDate = this._adapter.addCalendarDays(this._activeDate, 7);
1302
+ break;
1303
+ case HOME:
1304
+ this._activeDate = this._adapter.addCalendarDays(this._activeDate, 1 - this._adapter.getDate(this._activeDate));
1305
+ break;
1306
+ case END:
1307
+ this._activeDate = this._adapter.addCalendarDays(this._activeDate, this._adapter.getNumDaysInMonth(this._activeDate) -
1308
+ this._adapter.getDate(this._activeDate));
1309
+ break;
1310
+ case PAGE_UP:
1311
+ this._activeDate = event.altKey
1312
+ ? this._adapter.addCalendarYears(this._activeDate, -1)
1313
+ : this._adapter.addCalendarMonths(this._activeDate, -1);
1314
+ break;
1315
+ case PAGE_DOWN:
1316
+ this._activeDate = event.altKey
1317
+ ? this._adapter.addCalendarYears(this._activeDate, 1)
1318
+ : this._adapter.addCalendarMonths(this._activeDate, 1);
1319
+ break;
1320
+ case ENTER:
1321
+ if (this._dateFilterForViews(this._activeDate)) {
1322
+ this._dateSelected(this._activeDate);
1323
+ // Prevent unexpected default actions such as form submission.
1324
+ event.preventDefault();
1325
+ }
1326
+ return;
1327
+ default:
1328
+ // Don't prevent default or focus active cell on keys that we don't explicitly handle.
1329
+ return;
1330
+ }
1331
+ // Prevent unexpected default actions such as form submission.
1332
+ event.preventDefault();
1333
+ }
1334
+ /** Handles keydown events on the calendar body when calendar is in year view. */
1335
+ _handleCalendarBodyKeydownInYearView(event) {
1336
+ switch (event.keyCode) {
1337
+ case LEFT_ARROW:
1338
+ this._activeDate = this._adapter.addCalendarMonths(this._activeDate, -1);
1339
+ break;
1340
+ case RIGHT_ARROW:
1341
+ this._activeDate = this._adapter.addCalendarMonths(this._activeDate, 1);
1342
+ break;
1343
+ case UP_ARROW:
1344
+ this._activeDate = this._prevMonthInSameCol(this._activeDate);
1345
+ break;
1346
+ case DOWN_ARROW:
1347
+ this._activeDate = this._nextMonthInSameCol(this._activeDate);
1348
+ break;
1349
+ case HOME:
1350
+ this._activeDate = this._adapter.addCalendarMonths(this._activeDate, -this._adapter.getMonth(this._activeDate));
1351
+ break;
1352
+ case END:
1353
+ this._activeDate = this._adapter.addCalendarMonths(this._activeDate, 11 - this._adapter.getMonth(this._activeDate));
1354
+ break;
1355
+ case PAGE_UP:
1356
+ this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? -10 : -1);
1357
+ break;
1358
+ case PAGE_DOWN:
1359
+ this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? 10 : 1);
1360
+ break;
1361
+ case ENTER:
1362
+ this._monthSelected(this._activeDate);
1363
+ break;
1364
+ default:
1365
+ // Don't prevent default or focus active cell on keys that we don't explicitly handle.
1366
+ return;
1367
+ }
1368
+ // Prevent unexpected default actions such as form submission.
1369
+ event.preventDefault();
1370
+ }
1371
+ /** Handles keydown events on the calendar body when calendar is in multi-year view. */
1372
+ _handleCalendarBodyKeydownInMultiYearView(event) {
1373
+ switch (event.keyCode) {
1374
+ case LEFT_ARROW:
1375
+ this._activeDate = this._adapter.addCalendarYears(this._activeDate, -1);
1376
+ break;
1377
+ case RIGHT_ARROW:
1378
+ this._activeDate = this._adapter.addCalendarYears(this._activeDate, 1);
1379
+ break;
1380
+ case UP_ARROW:
1381
+ this._activeDate = this._adapter.addCalendarYears(this._activeDate, -yearsPerRow);
1382
+ break;
1383
+ case DOWN_ARROW:
1384
+ this._activeDate = this._adapter.addCalendarYears(this._activeDate, yearsPerRow);
1385
+ break;
1386
+ case HOME:
1387
+ this._activeDate = this._adapter.addCalendarYears(this._activeDate, -getActiveOffset(this._adapter, this._activeDate, this.minDate, this.maxDate));
1388
+ break;
1389
+ case END:
1390
+ this._activeDate = this._adapter.addCalendarYears(this._activeDate, yearsPerPage -
1391
+ getActiveOffset(this._adapter, this._activeDate, this.minDate, this.maxDate) -
1392
+ 1);
1393
+ break;
1394
+ case PAGE_UP:
1395
+ this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? -yearsPerPage * 10 : -yearsPerPage);
1396
+ break;
1397
+ case PAGE_DOWN:
1398
+ this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? yearsPerPage * 10 : yearsPerPage);
1399
+ break;
1400
+ case ENTER:
1401
+ this._yearSelected(this._activeDate);
1402
+ break;
1403
+ default:
1404
+ // Don't prevent default or focus active cell on keys that we don't explicitly handle.
1405
+ return;
1406
+ }
1407
+ }
1408
+ /** Handles keydown events on the calendar body when calendar is in month view. */
1409
+ _handleCalendarBodyKeydownInClockView(event) {
1410
+ switch (event.keyCode) {
1411
+ case UP_ARROW:
1412
+ this._activeDate =
1413
+ this._clockView === 'hour'
1414
+ ? this._adapter.addCalendarHours(this._activeDate, 1)
1415
+ : this._adapter.addCalendarMinutes(this._activeDate, 1);
1416
+ break;
1417
+ case DOWN_ARROW:
1418
+ this._activeDate =
1419
+ this._clockView === 'hour'
1420
+ ? this._adapter.addCalendarHours(this._activeDate, -1)
1421
+ : this._adapter.addCalendarMinutes(this._activeDate, -1);
1422
+ break;
1423
+ case ENTER:
1424
+ this._timeSelected(this._activeDate);
1425
+ return;
1426
+ default:
1427
+ // Don't prevent default or focus active cell on keys that we don't explicitly handle.
1428
+ return;
1429
+ }
1430
+ // Prevent unexpected default actions such as form submission.
1431
+ event.preventDefault();
1432
+ }
1433
+ /**
1434
+ * Determine the date for the month that comes before the given month in the same column in the
1435
+ * calendar table.
1436
+ */
1437
+ _prevMonthInSameCol(date) {
1438
+ // Determine how many months to jump forward given that there are 2 empty slots at the beginning
1439
+ // of each year.
1440
+ const increment = this._adapter.getMonth(date) <= 4 ? -5 : this._adapter.getMonth(date) >= 7 ? -7 : -12;
1441
+ return this._adapter.addCalendarMonths(date, increment);
1442
+ }
1443
+ /**
1444
+ * Determine the date for the month that comes after the given month in the same column in the
1445
+ * calendar table.
1446
+ */
1447
+ _nextMonthInSameCol(date) {
1448
+ // Determine how many months to jump forward given that there are 2 empty slots at the beginning
1449
+ // of each year.
1450
+ const increment = this._adapter.getMonth(date) <= 4 ? 7 : this._adapter.getMonth(date) >= 7 ? 5 : 12;
1451
+ return this._adapter.addCalendarMonths(date, increment);
1452
+ }
1453
+ calendarState(direction) {
1454
+ this._calendarState = direction;
1455
+ }
1456
+ _2digit(n) {
1457
+ return ('00' + n).slice(-2);
1458
+ }
1459
+ }
1460
+ /** @nocollapse */ /** @nocollapse */ MtxCalendar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxCalendar, deps: [{ token: i0.ElementRef }, { token: i1$1.MatDatepickerIntl }, { token: i0.NgZone }, { token: i1.DatetimeAdapter, optional: true }, { token: MTX_DATETIME_FORMATS, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1461
+ /** @nocollapse */ /** @nocollapse */ MtxCalendar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: MtxCalendar, selector: "mtx-calendar", inputs: { multiYearSelector: "multiYearSelector", twelvehour: "twelvehour", startView: "startView", timeInterval: "timeInterval", dateFilter: "dateFilter", preventSameDateTimeSelection: "preventSameDateTimeSelection", type: "type", startAt: "startAt", selected: "selected", minDate: "minDate", maxDate: "maxDate" }, outputs: { selectedChange: "selectedChange", viewChanged: "viewChanged", _userSelection: "_userSelection" }, host: { attributes: { "tabindex": "0" }, listeners: { "keydown": "_handleCalendarBodyKeydown($event)" }, classAttribute: "mtx-calendar" }, exportAs: ["mtxCalendar"], ngImport: i0, template: "<div class=\"mtx-calendar-header\">\n <div (click)=\"_yearClicked()\"\n *ngIf=\"type !== 'time'\"\n [class.active]=\"currentView === 'year' || currentView === 'multi-year'\"\n class=\"mtx-calendar-header-year\"\n role=\"button\">\n <span>{{ _yearLabel }}</span>\n <svg *ngIf=\"multiYearSelector || type === 'year'\"\n class=\"mtx-calendar-header-year-dropdown\"\n width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M7,10L12,15L17,10H7Z\"></path>\n </svg>\n </div>\n <div class=\"mtx-calendar-header-date-time\">\n <span (click)=\"_dateClicked()\" *ngIf=\"type !== 'time' && type !== 'year'\"\n [class.active]=\"currentView === 'month'\"\n [class.not-clickable]=\"type === 'month'\"\n class=\"mtx-calendar-header-date\"\n role=\"button\">{{ _dateLabel }}</span>\n <span *ngIf=\"type.endsWith('time')\"\n [class.active]=\"currentView === 'clock'\"\n class=\"mtx-calendar-header-time\">\n <span (click)=\"_hoursClicked()\"\n [class.active]=\"_clockView === 'hour'\"\n class=\"mtx-calendar-header-hours\"\n role=\"button\">{{ _hoursLabel }}</span>:<span (click)=\"_minutesClicked()\"\n [class.active]=\"_clockView === 'minute'\"\n class=\"mtx-calendar-header-minutes\"\n role=\"button\">{{ _minutesLabel }}</span>\n <br />\n <span *ngIf=\"twelvehour\" class=\"mtx-calendar-header-ampm-container\">\n <span (click)=\"_ampmClicked('AM')\"\n [class.active]=\"_AMPM === 'AM'\"\n class=\"mtx-calendar-header-ampm\">AM</span>/<span\n (click)=\"_ampmClicked('PM')\"\n [class.active]=\"_AMPM === 'PM'\"\n class=\"mtx-calendar-header-ampm\">PM</span>\n </span>\n </span>\n </div>\n</div>\n<div class=\"mtx-calendar-content\" [ngSwitch]=\"currentView\">\n <div *ngIf=\"currentView === 'month' || currentView === 'year' || currentView === 'multi-year'\"\n class=\"mtx-month-content\">\n <div class=\"mtx-calendar-controls\">\n <button mat-icon-button type=\"button\" (click)=\"_previousClicked()\"\n [attr.aria-disabled]=\"!_previousEnabled()\"\n [attr.aria-label]=\"_ariaLabelPrev\"\n [class.disabled]=\"!_previousEnabled()\"\n class=\"mtx-calendar-previous-button\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\"></path>\n </svg>\n </button>\n <div [@slideCalendar]=\"_calendarState\"\n (@slideCalendar.done)=\"_calendarStateDone()\"\n class=\"mtx-calendar-period-button\">\n <strong>{{ _monthYearLabel }}</strong>\n </div>\n <button mat-icon-button type=\"button\" (click)=\"_nextClicked()\"\n [attr.aria-disabled]=\"!_nextEnabled()\"\n [attr.aria-label]=\"_ariaLabelNext\"\n [class.disabled]=\"!_nextEnabled()\"\n class=\"mtx-calendar-next-button\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"></path>\n </svg>\n </button>\n </div>\n </div>\n <mtx-month-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_dateSelected($event)\"\n *ngSwitchCase=\"'month'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-month-view>\n <mtx-year-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_monthSelected($event)\"\n *ngSwitchCase=\"'year'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-year-view>\n <mtx-multi-year-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_yearSelected($event)\"\n *ngSwitchCase=\"'multi-year'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-multi-year-view>\n <mtx-clock (_userSelection)=\"_userSelected()\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (selectedChange)=\"_timeSelected($event)\"\n *ngSwitchDefault\n [dateFilter]=\"dateFilter\"\n [interval]=\"timeInterval\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"_activeDate\"\n [startView]=\"_clockView\"\n [twelvehour]=\"twelvehour\">\n </mtx-clock>\n</div>\n", styles: [".mtx-calendar{display:block;outline:none}.mtx-calendar[mode=landscape]{display:flex}.mtx-calendar-header{padding:16px;box-sizing:border-box;border-radius:4px 4px 0 0}[mode=landscape] .mtx-calendar-header{width:150px;min-width:150px;border-radius:4px 0 0 4px}[dir=rtl] [mode=landscape] .mtx-calendar-header{border-radius:0 4px 4px 0}.mtx-calendar-header-year,.mtx-calendar-header-date-time{width:100%;white-space:nowrap}.mtx-calendar-header-year{height:32px;line-height:32px}.mtx-calendar-header-year>*{vertical-align:middle}.mtx-calendar-header-date-time{line-height:34px}[mode=landscape] .mtx-calendar-header-date-time{white-space:normal;word-wrap:break-word}.mtx-calendar-header-year:not(.active),.mtx-calendar-header-date:not(.active),.mtx-calendar-header-hours:not(.active),.mtx-calendar-header-minutes:not(.active),.mtx-calendar-header-ampm:not(.active){cursor:pointer;opacity:.6}.mtx-calendar-header-year.not-clickable,.mtx-calendar-header-date.not-clickable,.mtx-calendar-header-hours.not-clickable,.mtx-calendar-header-minutes.not-clickable,.mtx-calendar-header-ampm.not-clickable{cursor:initial}.mtx-calendar-header-time{display:inline-block;padding-left:8px}.mtx-calendar-header-time:not(.active){opacity:.6}.mtx-calendar-header-time:not(.active) .mtx-calendar-header-hours,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-minutes,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-ampm{cursor:pointer;opacity:1}[dir=rtl] .mtx-calendar-header-time{padding-right:8px}[mode=landscape] .mtx-calendar-header-time{display:block;padding:0}.mtx-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.mtx-calendar-controls{display:flex;justify-content:space-between;margin:0 calc(4.7142857143% - 16px)}.mtx-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:.04}.mtx-calendar-period-button{display:inline-block;height:40px;line-height:40px;outline:none;border:0;background:transparent;box-sizing:border-box}.mtx-calendar-previous-button.disabled,.mtx-calendar-next-button.disabled{pointer-events:none}.mtx-calendar-previous-button svg,.mtx-calendar-next-button svg{fill:currentColor;vertical-align:top}[dir=rtl] .mtx-calendar-previous-button svg,[dir=rtl] .mtx-calendar-next-button svg{transform:rotate(180deg)}.mtx-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.mtx-calendar-table-header th{text-align:center;padding:8px 0}@media all and (orientation: landscape){.mtx-calendar[mode=auto]{display:flex}.mtx-calendar[mode=auto] .mtx-calendar-header{width:150px;min-width:150px;border-radius:4px 0 0 4px}[dir=rtl] .mtx-calendar[mode=auto] .mtx-calendar-header{border-radius:0 4px 4px 0}.mtx-calendar[mode=auto] .mtx-calendar-header-date-time{white-space:normal;word-wrap:break-word}.mtx-calendar[mode=auto] .mtx-calendar-header-time{display:block;padding:0}}\n"], components: [{ type: i3$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: MtxMonthView, selector: "mtx-month-view", inputs: ["type", "dateFilter", "activeDate", "selected"], outputs: ["selectedChange", "_userSelection"], exportAs: ["mtxMonthView"] }, { type: MtxYearView, selector: "mtx-year-view", inputs: ["type", "dateFilter", "activeDate", "selected"], outputs: ["selectedChange", "_userSelection"], exportAs: ["mtxYearView"] }, { type: MtxMultiYearView, selector: "mtx-multi-year-view", inputs: ["type", "dateFilter", "activeDate", "selected", "minDate", "maxDate"], outputs: ["selectedChange", "_userSelection"], exportAs: ["mtxMultiYearView"] }, { type: MtxClock, selector: "mtx-clock", inputs: ["dateFilter", "interval", "twelvehour", "activeDate", "selected", "minDate", "maxDate", "startView"], outputs: ["selectedChange", "activeDateChange", "_userSelection"], exportAs: ["mtxClock"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3.NgSwitchDefault, selector: "[ngSwitchDefault]" }], animations: [mtxDatetimepickerAnimations.slideCalendar], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1462
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxCalendar, decorators: [{
1463
+ type: Component,
1464
+ args: [{ selector: 'mtx-calendar', host: {
1465
+ 'class': 'mtx-calendar',
1466
+ 'tabindex': '0',
1467
+ '(keydown)': '_handleCalendarBodyKeydown($event)',
1468
+ }, exportAs: 'mtxCalendar', animations: [mtxDatetimepickerAnimations.slideCalendar], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mtx-calendar-header\">\n <div (click)=\"_yearClicked()\"\n *ngIf=\"type !== 'time'\"\n [class.active]=\"currentView === 'year' || currentView === 'multi-year'\"\n class=\"mtx-calendar-header-year\"\n role=\"button\">\n <span>{{ _yearLabel }}</span>\n <svg *ngIf=\"multiYearSelector || type === 'year'\"\n class=\"mtx-calendar-header-year-dropdown\"\n width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M7,10L12,15L17,10H7Z\"></path>\n </svg>\n </div>\n <div class=\"mtx-calendar-header-date-time\">\n <span (click)=\"_dateClicked()\" *ngIf=\"type !== 'time' && type !== 'year'\"\n [class.active]=\"currentView === 'month'\"\n [class.not-clickable]=\"type === 'month'\"\n class=\"mtx-calendar-header-date\"\n role=\"button\">{{ _dateLabel }}</span>\n <span *ngIf=\"type.endsWith('time')\"\n [class.active]=\"currentView === 'clock'\"\n class=\"mtx-calendar-header-time\">\n <span (click)=\"_hoursClicked()\"\n [class.active]=\"_clockView === 'hour'\"\n class=\"mtx-calendar-header-hours\"\n role=\"button\">{{ _hoursLabel }}</span>:<span (click)=\"_minutesClicked()\"\n [class.active]=\"_clockView === 'minute'\"\n class=\"mtx-calendar-header-minutes\"\n role=\"button\">{{ _minutesLabel }}</span>\n <br />\n <span *ngIf=\"twelvehour\" class=\"mtx-calendar-header-ampm-container\">\n <span (click)=\"_ampmClicked('AM')\"\n [class.active]=\"_AMPM === 'AM'\"\n class=\"mtx-calendar-header-ampm\">AM</span>/<span\n (click)=\"_ampmClicked('PM')\"\n [class.active]=\"_AMPM === 'PM'\"\n class=\"mtx-calendar-header-ampm\">PM</span>\n </span>\n </span>\n </div>\n</div>\n<div class=\"mtx-calendar-content\" [ngSwitch]=\"currentView\">\n <div *ngIf=\"currentView === 'month' || currentView === 'year' || currentView === 'multi-year'\"\n class=\"mtx-month-content\">\n <div class=\"mtx-calendar-controls\">\n <button mat-icon-button type=\"button\" (click)=\"_previousClicked()\"\n [attr.aria-disabled]=\"!_previousEnabled()\"\n [attr.aria-label]=\"_ariaLabelPrev\"\n [class.disabled]=\"!_previousEnabled()\"\n class=\"mtx-calendar-previous-button\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\"></path>\n </svg>\n </button>\n <div [@slideCalendar]=\"_calendarState\"\n (@slideCalendar.done)=\"_calendarStateDone()\"\n class=\"mtx-calendar-period-button\">\n <strong>{{ _monthYearLabel }}</strong>\n </div>\n <button mat-icon-button type=\"button\" (click)=\"_nextClicked()\"\n [attr.aria-disabled]=\"!_nextEnabled()\"\n [attr.aria-label]=\"_ariaLabelNext\"\n [class.disabled]=\"!_nextEnabled()\"\n class=\"mtx-calendar-next-button\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"></path>\n </svg>\n </button>\n </div>\n </div>\n <mtx-month-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_dateSelected($event)\"\n *ngSwitchCase=\"'month'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-month-view>\n <mtx-year-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_monthSelected($event)\"\n *ngSwitchCase=\"'year'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-year-view>\n <mtx-multi-year-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_yearSelected($event)\"\n *ngSwitchCase=\"'multi-year'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-multi-year-view>\n <mtx-clock (_userSelection)=\"_userSelected()\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (selectedChange)=\"_timeSelected($event)\"\n *ngSwitchDefault\n [dateFilter]=\"dateFilter\"\n [interval]=\"timeInterval\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"_activeDate\"\n [startView]=\"_clockView\"\n [twelvehour]=\"twelvehour\">\n </mtx-clock>\n</div>\n", styles: [".mtx-calendar{display:block;outline:none}.mtx-calendar[mode=landscape]{display:flex}.mtx-calendar-header{padding:16px;box-sizing:border-box;border-radius:4px 4px 0 0}[mode=landscape] .mtx-calendar-header{width:150px;min-width:150px;border-radius:4px 0 0 4px}[dir=rtl] [mode=landscape] .mtx-calendar-header{border-radius:0 4px 4px 0}.mtx-calendar-header-year,.mtx-calendar-header-date-time{width:100%;white-space:nowrap}.mtx-calendar-header-year{height:32px;line-height:32px}.mtx-calendar-header-year>*{vertical-align:middle}.mtx-calendar-header-date-time{line-height:34px}[mode=landscape] .mtx-calendar-header-date-time{white-space:normal;word-wrap:break-word}.mtx-calendar-header-year:not(.active),.mtx-calendar-header-date:not(.active),.mtx-calendar-header-hours:not(.active),.mtx-calendar-header-minutes:not(.active),.mtx-calendar-header-ampm:not(.active){cursor:pointer;opacity:.6}.mtx-calendar-header-year.not-clickable,.mtx-calendar-header-date.not-clickable,.mtx-calendar-header-hours.not-clickable,.mtx-calendar-header-minutes.not-clickable,.mtx-calendar-header-ampm.not-clickable{cursor:initial}.mtx-calendar-header-time{display:inline-block;padding-left:8px}.mtx-calendar-header-time:not(.active){opacity:.6}.mtx-calendar-header-time:not(.active) .mtx-calendar-header-hours,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-minutes,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-ampm{cursor:pointer;opacity:1}[dir=rtl] .mtx-calendar-header-time{padding-right:8px}[mode=landscape] .mtx-calendar-header-time{display:block;padding:0}.mtx-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.mtx-calendar-controls{display:flex;justify-content:space-between;margin:0 calc(4.7142857143% - 16px)}.mtx-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:.04}.mtx-calendar-period-button{display:inline-block;height:40px;line-height:40px;outline:none;border:0;background:transparent;box-sizing:border-box}.mtx-calendar-previous-button.disabled,.mtx-calendar-next-button.disabled{pointer-events:none}.mtx-calendar-previous-button svg,.mtx-calendar-next-button svg{fill:currentColor;vertical-align:top}[dir=rtl] .mtx-calendar-previous-button svg,[dir=rtl] .mtx-calendar-next-button svg{transform:rotate(180deg)}.mtx-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.mtx-calendar-table-header th{text-align:center;padding:8px 0}@media all and (orientation: landscape){.mtx-calendar[mode=auto]{display:flex}.mtx-calendar[mode=auto] .mtx-calendar-header{width:150px;min-width:150px;border-radius:4px 0 0 4px}[dir=rtl] .mtx-calendar[mode=auto] .mtx-calendar-header{border-radius:0 4px 4px 0}.mtx-calendar[mode=auto] .mtx-calendar-header-date-time{white-space:normal;word-wrap:break-word}.mtx-calendar[mode=auto] .mtx-calendar-header-time{display:block;padding:0}}\n"] }]
1469
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.MatDatepickerIntl }, { type: i0.NgZone }, { type: i1.DatetimeAdapter, decorators: [{
1470
+ type: Optional
1471
+ }] }, { type: undefined, decorators: [{
1472
+ type: Optional
1473
+ }, {
1474
+ type: Inject,
1475
+ args: [MTX_DATETIME_FORMATS]
1476
+ }] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { multiYearSelector: [{
1477
+ type: Input
1478
+ }], twelvehour: [{
1479
+ type: Input
1480
+ }], startView: [{
1481
+ type: Input
1482
+ }], timeInterval: [{
1483
+ type: Input
1484
+ }], dateFilter: [{
1485
+ type: Input
1486
+ }], preventSameDateTimeSelection: [{
1487
+ type: Input
1488
+ }], selectedChange: [{
1489
+ type: Output
1490
+ }], viewChanged: [{
1491
+ type: Output
1492
+ }], _userSelection: [{
1493
+ type: Output
1494
+ }], type: [{
1495
+ type: Input
1496
+ }], startAt: [{
1497
+ type: Input
1498
+ }], selected: [{
1499
+ type: Input
1500
+ }], minDate: [{
1501
+ type: Input
1502
+ }], maxDate: [{
1503
+ type: Input
1504
+ }] } });
1505
+
1506
+ /** Used to generate a unique ID for each datetimepicker instance. */
1507
+ let datetimepickerUid = 0;
1508
+ /** Injection token that determines the scroll handling while the calendar is open. */
1509
+ const MTX_DATETIMEPICKER_SCROLL_STRATEGY = new InjectionToken('mtx-datetimepicker-scroll-strategy');
1510
+ function MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY(overlay) {
1511
+ return () => overlay.scrollStrategies.reposition();
1512
+ }
1513
+ const MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
1514
+ provide: MTX_DATETIMEPICKER_SCROLL_STRATEGY,
1515
+ deps: [Overlay],
1516
+ useFactory: MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY,
1517
+ };
1518
+ // Boilerplate for applying mixins to MtxDatetimepickerContent.
1519
+ /** @docs-private */
1520
+ const _MtxDatetimepickerContentBase = mixinColor(class {
1521
+ constructor(_elementRef) {
1522
+ this._elementRef = _elementRef;
1523
+ }
1524
+ });
1525
+ /**
1526
+ * Component used as the content for the datetimepicker dialog and popup. We use this instead of
1527
+ * using MtxCalendar directly as the content so we can control the initial focus. This also gives us
1528
+ * a place to put additional features of the popup that are not part of the calendar itself in the
1529
+ * future. (e.g. confirmation buttons).
1530
+ * @docs-private
1531
+ */
1532
+ class MtxDatetimepickerContent extends _MtxDatetimepickerContentBase {
1533
+ constructor(elementRef, _changeDetectorRef) {
1534
+ super(elementRef);
1535
+ this._changeDetectorRef = _changeDetectorRef;
1536
+ /** Emits when an animation has finished. */
1537
+ this._animationDone = new Subject();
1538
+ }
1539
+ ngOnInit() {
1540
+ this._animationState = this.datetimepicker.touchUi ? 'enter-dialog' : 'enter-dropdown';
1541
+ }
1542
+ ngAfterContentInit() {
1543
+ this._calendar._focusActiveCell();
1544
+ }
1545
+ _startExitAnimation() {
1546
+ this._animationState = 'void';
1547
+ this._changeDetectorRef.markForCheck();
1548
+ }
1549
+ ngOnDestroy() {
1550
+ this._animationDone.complete();
1551
+ }
1552
+ }
1553
+ /** @nocollapse */ /** @nocollapse */ MtxDatetimepickerContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxDatetimepickerContent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1554
+ /** @nocollapse */ /** @nocollapse */ MtxDatetimepickerContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: MtxDatetimepickerContent, selector: "mtx-datetimepicker-content", inputs: { color: "color" }, host: { listeners: { "@transformPanel.done": "_animationDone.next()" }, properties: { "class.mtx-datetimepicker-content-touch": "datetimepicker?.touchUi", "attr.mode": "datetimepicker.mode", "@transformPanel": "_animationState" }, classAttribute: "mtx-datetimepicker-content" }, viewQueries: [{ propertyName: "_calendar", first: true, predicate: MtxCalendar, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div cdkTrapFocus\n class=\"mtx-datetimepicker-content-container\"\n [attr.mode]=\"datetimepicker.mode\">\n <mtx-calendar [id]=\"datetimepicker.id\"\n [ngClass]=\"datetimepicker.panelClass\"\n [attr.mode]=\"datetimepicker.mode\"\n [type]=\"datetimepicker.type\"\n [startAt]=\"datetimepicker.startAt\"\n [startView]=\"datetimepicker.startView\"\n [maxDate]=\"datetimepicker._maxDate\"\n [minDate]=\"datetimepicker._minDate\"\n [dateFilter]=\"datetimepicker._dateFilter\"\n [multiYearSelector]=\"datetimepicker.multiYearSelector\"\n [preventSameDateTimeSelection]=\"datetimepicker.preventSameDateTimeSelection\"\n [timeInterval]=\"datetimepicker.timeInterval\"\n [twelvehour]=\"datetimepicker.twelvehour\"\n [selected]=\"datetimepicker._selected\"\n [@fadeInCalendar]=\"'enter'\"\n (selectedChange)=\"datetimepicker._select($event)\"\n (viewChanged)=\"datetimepicker._viewChanged($event)\"\n (_userSelection)=\"datetimepicker.close()\">\n </mtx-calendar>\n</div>\n", styles: [".mtx-datetimepicker-content{display:block;border-radius:4px}.mtx-datetimepicker-content-container{display:flex;flex-direction:column;justify-content:space-between}.mtx-datetimepicker-content .mtx-calendar{width:296px;height:404px}.mtx-datetimepicker-content .mtx-calendar[mode=landscape]{width:446px;height:328px}@media all and (orientation: landscape){.mtx-datetimepicker-content .mtx-calendar[mode=auto]{width:446px;height:328px}}.mtx-datetimepicker-content-touch{display:block;max-height:80vh;position:relative;overflow:visible}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container{min-height:300px;max-height:850px;min-width:250px;max-width:750px}.mtx-datetimepicker-content-touch .mtx-calendar{width:100%;height:auto}@media all and (orientation: landscape){.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto],.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape]{width:120vh;height:80vh}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto] .mtx-calendar,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape] .mtx-calendar{width:auto;height:100%}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait]{width:64vh;height:90vh}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait] .mtx-calendar{width:100%;height:auto}}@media all and (orientation: portrait){.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto],.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait]{width:80vw;height:120vw}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto] .mtx-calendar,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait] .mtx-calendar{width:100%;height:auto}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape]{width:90vw;height:64vw}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape] .mtx-calendar{width:auto;height:100%}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container-with-actions{height:135vw}}\n"], components: [{ type: MtxCalendar, selector: "mtx-calendar", inputs: ["multiYearSelector", "twelvehour", "startView", "timeInterval", "dateFilter", "preventSameDateTimeSelection", "type", "startAt", "selected", "minDate", "maxDate"], outputs: ["selectedChange", "viewChanged", "_userSelection"], exportAs: ["mtxCalendar"] }], directives: [{ type: i2.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], animations: [
1555
+ mtxDatetimepickerAnimations.transformPanel,
1556
+ mtxDatetimepickerAnimations.fadeInCalendar,
1557
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1558
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxDatetimepickerContent, decorators: [{
1559
+ type: Component,
1560
+ args: [{ selector: 'mtx-datetimepicker-content', host: {
1561
+ 'class': 'mtx-datetimepicker-content',
1562
+ '[class.mtx-datetimepicker-content-touch]': 'datetimepicker?.touchUi',
1563
+ '[attr.mode]': 'datetimepicker.mode',
1564
+ '[@transformPanel]': '_animationState',
1565
+ '(@transformPanel.done)': '_animationDone.next()',
1566
+ }, animations: [
1567
+ mtxDatetimepickerAnimations.transformPanel,
1568
+ mtxDatetimepickerAnimations.fadeInCalendar,
1569
+ ], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['color'], template: "<div cdkTrapFocus\n class=\"mtx-datetimepicker-content-container\"\n [attr.mode]=\"datetimepicker.mode\">\n <mtx-calendar [id]=\"datetimepicker.id\"\n [ngClass]=\"datetimepicker.panelClass\"\n [attr.mode]=\"datetimepicker.mode\"\n [type]=\"datetimepicker.type\"\n [startAt]=\"datetimepicker.startAt\"\n [startView]=\"datetimepicker.startView\"\n [maxDate]=\"datetimepicker._maxDate\"\n [minDate]=\"datetimepicker._minDate\"\n [dateFilter]=\"datetimepicker._dateFilter\"\n [multiYearSelector]=\"datetimepicker.multiYearSelector\"\n [preventSameDateTimeSelection]=\"datetimepicker.preventSameDateTimeSelection\"\n [timeInterval]=\"datetimepicker.timeInterval\"\n [twelvehour]=\"datetimepicker.twelvehour\"\n [selected]=\"datetimepicker._selected\"\n [@fadeInCalendar]=\"'enter'\"\n (selectedChange)=\"datetimepicker._select($event)\"\n (viewChanged)=\"datetimepicker._viewChanged($event)\"\n (_userSelection)=\"datetimepicker.close()\">\n </mtx-calendar>\n</div>\n", styles: [".mtx-datetimepicker-content{display:block;border-radius:4px}.mtx-datetimepicker-content-container{display:flex;flex-direction:column;justify-content:space-between}.mtx-datetimepicker-content .mtx-calendar{width:296px;height:404px}.mtx-datetimepicker-content .mtx-calendar[mode=landscape]{width:446px;height:328px}@media all and (orientation: landscape){.mtx-datetimepicker-content .mtx-calendar[mode=auto]{width:446px;height:328px}}.mtx-datetimepicker-content-touch{display:block;max-height:80vh;position:relative;overflow:visible}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container{min-height:300px;max-height:850px;min-width:250px;max-width:750px}.mtx-datetimepicker-content-touch .mtx-calendar{width:100%;height:auto}@media all and (orientation: landscape){.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto],.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape]{width:120vh;height:80vh}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto] .mtx-calendar,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape] .mtx-calendar{width:auto;height:100%}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait]{width:64vh;height:90vh}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait] .mtx-calendar{width:100%;height:auto}}@media all and (orientation: portrait){.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto],.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait]{width:80vw;height:120vw}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto] .mtx-calendar,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait] .mtx-calendar{width:100%;height:auto}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape]{width:90vw;height:64vw}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape] .mtx-calendar{width:auto;height:100%}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container-with-actions{height:135vw}}\n"] }]
1570
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { _calendar: [{
1571
+ type: ViewChild,
1572
+ args: [MtxCalendar, { static: true }]
1573
+ }] } });
1574
+ class MtxDatetimepicker {
1575
+ constructor(_overlay, _ngZone, _viewContainerRef, _scrollStrategy, _dateAdapter, _dir) {
1576
+ this._overlay = _overlay;
1577
+ this._ngZone = _ngZone;
1578
+ this._viewContainerRef = _viewContainerRef;
1579
+ this._scrollStrategy = _scrollStrategy;
1580
+ this._dateAdapter = _dateAdapter;
1581
+ this._dir = _dir;
1582
+ this._multiYearSelector = false;
1583
+ this._twelvehour = false;
1584
+ /** The view that the calendar should start in. */
1585
+ this.startView = 'month';
1586
+ this.mode = 'auto';
1587
+ this.timeInterval = 1;
1588
+ /** Prevent user to select same date time */
1589
+ this.preventSameDateTimeSelection = false;
1590
+ /**
1591
+ * Emits new selected date when selected date changes.
1592
+ * @deprecated Switch to the `dateChange` and `dateInput` binding on the input element.
1593
+ */
1594
+ this.selectedChanged = new EventEmitter();
1595
+ /** Emits when the datetimepicker has been opened. */
1596
+ this.openedStream = new EventEmitter();
1597
+ /** Emits when the datetimepicker has been closed. */
1598
+ this.closedStream = new EventEmitter();
1599
+ /** Emits when the view has been changed. */
1600
+ this.viewChanged = new EventEmitter();
1601
+ this._opened = false;
1602
+ /** The id for the datetimepicker calendar. */
1603
+ this.id = `mtx-datetimepicker-${datetimepickerUid++}`;
1604
+ /** Emits when the datetimepicker is disabled. */
1605
+ this._disabledChange = new Subject();
1606
+ this._validSelected = null;
1607
+ /** The element that was focused before the datetimepicker was opened. */
1608
+ this._focusedElementBeforeOpen = null;
1609
+ /** Unique class that will be added to the backdrop so that the test harnesses can look it up. */
1610
+ this._backdropHarnessClass = `${this.id}-backdrop`;
1611
+ this._inputStateChanges = Subscription.EMPTY;
1612
+ this._type = 'date';
1613
+ this._touchUi = false;
1614
+ /** Preferred position of the datetimepicker in the X axis. */
1615
+ this.xPosition = 'start';
1616
+ /** Preferred position of the datetimepicker in the Y axis. */
1617
+ this.yPosition = 'below';
1618
+ this._restoreFocus = true;
1619
+ if (!this._dateAdapter) {
1620
+ throw createMissingDateImplError('DateAdapter');
1621
+ }
1622
+ }
1623
+ /** Active multi year view when click on year. */
1624
+ get multiYearSelector() {
1625
+ return this._multiYearSelector;
1626
+ }
1627
+ set multiYearSelector(value) {
1628
+ this._multiYearSelector = coerceBooleanProperty(value);
1629
+ }
1630
+ /** if true change the clock to 12 hour format. */
1631
+ get twelvehour() {
1632
+ return this._twelvehour;
1633
+ }
1634
+ set twelvehour(value) {
1635
+ this._twelvehour = coerceBooleanProperty(value);
1636
+ }
1637
+ /**
1638
+ * Classes to be passed to the date picker panel.
1639
+ * Supports string and string array values, similar to `ngClass`.
1640
+ */
1641
+ get panelClass() {
1642
+ return this._panelClass;
1643
+ }
1644
+ set panelClass(value) {
1645
+ this._panelClass = coerceStringArray(value);
1646
+ }
1647
+ /** Whether the calendar is open. */
1648
+ get opened() {
1649
+ return this._opened;
1650
+ }
1651
+ set opened(value) {
1652
+ coerceBooleanProperty(value) ? this.open() : this.close();
1653
+ }
1654
+ /** Color palette to use on the datetimepicker's calendar. */
1655
+ get color() {
1656
+ return (this._color ||
1657
+ (this.datetimepickerInput ? this.datetimepickerInput.getThemePalette() : undefined));
1658
+ }
1659
+ set color(value) {
1660
+ this._color = value;
1661
+ }
1662
+ /** The date to open the calendar to initially. */
1663
+ get startAt() {
1664
+ // If an explicit startAt is set we start there, otherwise we start at whatever the currently
1665
+ // selected value is.
1666
+ return this._startAt || (this.datetimepickerInput ? this.datetimepickerInput.value : null);
1667
+ }
1668
+ set startAt(date) {
1669
+ this._startAt = this._dateAdapter.getValidDateOrNull(date);
1670
+ }
1671
+ get type() {
1672
+ return this._type;
1673
+ }
1674
+ set type(value) {
1675
+ this._type = value || 'date';
1676
+ }
1677
+ /**
1678
+ * Whether the calendar UI is in touch mode. In touch mode the calendar opens in a dialog rather
1679
+ * than a popup and elements have more padding to allow for bigger touch targets.
1680
+ */
1681
+ get touchUi() {
1682
+ return this._touchUi;
1683
+ }
1684
+ set touchUi(value) {
1685
+ this._touchUi = coerceBooleanProperty(value);
1686
+ }
1687
+ /** Whether the datetimepicker pop-up should be disabled. */
1688
+ get disabled() {
1689
+ return this._disabled === undefined && this.datetimepickerInput
1690
+ ? this.datetimepickerInput.disabled
1691
+ : !!this._disabled;
1692
+ }
1693
+ set disabled(value) {
1694
+ const newValue = coerceBooleanProperty(value);
1695
+ if (newValue !== this._disabled) {
1696
+ this._disabled = newValue;
1697
+ this._disabledChange.next(newValue);
1698
+ }
1699
+ }
1700
+ /**
1701
+ * Whether to restore focus to the previously-focused element when the panel is closed.
1702
+ * Note that automatic focus restoration is an accessibility feature and it is recommended that
1703
+ * you provide your own equivalent, if you decide to turn it off.
1704
+ */
1705
+ get restoreFocus() {
1706
+ return this._restoreFocus;
1707
+ }
1708
+ set restoreFocus(value) {
1709
+ this._restoreFocus = coerceBooleanProperty(value);
1710
+ }
1711
+ /** The currently selected date. */
1712
+ get _selected() {
1713
+ return this._validSelected;
1714
+ }
1715
+ set _selected(value) {
1716
+ this._validSelected = value;
1717
+ }
1718
+ /** The minimum selectable date. */
1719
+ get _minDate() {
1720
+ return this.datetimepickerInput && this.datetimepickerInput.min;
1721
+ }
1722
+ /** The maximum selectable date. */
1723
+ get _maxDate() {
1724
+ return this.datetimepickerInput && this.datetimepickerInput.max;
1725
+ }
1726
+ get _dateFilter() {
1727
+ return this.datetimepickerInput && this.datetimepickerInput._dateFilter;
1728
+ }
1729
+ _viewChanged(type) {
1730
+ this.viewChanged.emit(type);
1731
+ }
1732
+ ngOnDestroy() {
1733
+ this._destroyOverlay();
1734
+ this.close();
1735
+ this._inputStateChanges.unsubscribe();
1736
+ this._disabledChange.complete();
1737
+ }
1738
+ /** Selects the given date */
1739
+ _select(date) {
1740
+ const oldValue = this._selected;
1741
+ this._selected = date;
1742
+ if (!this._dateAdapter.sameDatetime(oldValue, this._selected)) {
1743
+ this.selectedChanged.emit(date);
1744
+ }
1745
+ }
1746
+ /**
1747
+ * Register an input with this datetimepicker.
1748
+ * @param input The datetimepicker input to register with this datetimepicker.
1749
+ */
1750
+ _registerInput(input) {
1751
+ if (this.datetimepickerInput) {
1752
+ throw Error('A MtxDatetimepicker can only be associated with a single input.');
1753
+ }
1754
+ this.datetimepickerInput = input;
1755
+ this._inputStateChanges = this.datetimepickerInput._valueChange.subscribe((value) => (this._selected = value));
1756
+ }
1757
+ /** Open the calendar. */
1758
+ open() {
1759
+ if (this._opened || this.disabled) {
1760
+ return;
1761
+ }
1762
+ if (!this.datetimepickerInput) {
1763
+ throw Error('Attempted to open an MtxDatetimepicker with no associated input.');
1764
+ }
1765
+ this._focusedElementBeforeOpen = _getFocusedElementPierceShadowDom();
1766
+ this._openOverlay();
1767
+ this._opened = true;
1768
+ this.openedStream.emit();
1769
+ }
1770
+ /** Close the calendar. */
1771
+ close() {
1772
+ if (!this._opened) {
1773
+ return;
1774
+ }
1775
+ if (this._componentRef) {
1776
+ this._destroyOverlay();
1777
+ }
1778
+ const completeClose = () => {
1779
+ // The `_opened` could've been reset already if
1780
+ // we got two events in quick succession.
1781
+ if (this._opened) {
1782
+ this._opened = false;
1783
+ this.closedStream.emit();
1784
+ this._focusedElementBeforeOpen = null;
1785
+ }
1786
+ };
1787
+ if (this._restoreFocus &&
1788
+ this._focusedElementBeforeOpen &&
1789
+ typeof this._focusedElementBeforeOpen.focus === 'function') {
1790
+ // Because IE moves focus asynchronously, we can't count on it being restored before we've
1791
+ // marked the datetimepicker as closed. If the event fires out of sequence and the element
1792
+ // that we're refocusing opens the datetimepicker on focus, the user could be stuck with not
1793
+ // being able to close the calendar at all. We work around it by making the logic, that marks
1794
+ // the datetimepicker as closed, async as well.
1795
+ this._focusedElementBeforeOpen.focus();
1796
+ setTimeout(completeClose);
1797
+ }
1798
+ else {
1799
+ completeClose();
1800
+ }
1801
+ }
1802
+ /**
1803
+ * Forwards relevant values from the datetimepicker to the
1804
+ * datetimepicker content inside the overlay.
1805
+ */
1806
+ _forwardContentValues(instance) {
1807
+ instance.datetimepicker = this;
1808
+ instance.color = this.color;
1809
+ }
1810
+ /** Opens the overlay with the calendar. */
1811
+ _openOverlay() {
1812
+ this._destroyOverlay();
1813
+ const isDialog = this.touchUi;
1814
+ const labelId = this.datetimepickerInput.getOverlayLabelId();
1815
+ const portal = new ComponentPortal(MtxDatetimepickerContent, this._viewContainerRef);
1816
+ const overlayRef = (this._overlayRef = this._overlay.create(new OverlayConfig({
1817
+ positionStrategy: isDialog ? this._getDialogStrategy() : this._getDropdownStrategy(),
1818
+ hasBackdrop: true,
1819
+ backdropClass: [
1820
+ isDialog ? 'cdk-overlay-dark-backdrop' : 'mat-overlay-transparent-backdrop',
1821
+ this._backdropHarnessClass,
1822
+ ],
1823
+ direction: this._dir,
1824
+ scrollStrategy: isDialog ? this._overlay.scrollStrategies.block() : this._scrollStrategy(),
1825
+ panelClass: `mtx-datetimepicker-${isDialog ? 'dialog' : 'popup'}`,
1826
+ })));
1827
+ const overlayElement = overlayRef.overlayElement;
1828
+ overlayElement.setAttribute('role', 'dialog');
1829
+ if (labelId) {
1830
+ overlayElement.setAttribute('aria-labelledby', labelId);
1831
+ }
1832
+ if (isDialog) {
1833
+ overlayElement.setAttribute('aria-modal', 'true');
1834
+ }
1835
+ this._getCloseStream(overlayRef).subscribe(event => {
1836
+ if (event) {
1837
+ event.preventDefault();
1838
+ }
1839
+ this.close();
1840
+ });
1841
+ this._componentRef = overlayRef.attach(portal);
1842
+ this._forwardContentValues(this._componentRef.instance);
1843
+ // Update the position once the calendar has rendered. Only relevant in dropdown mode.
1844
+ if (!isDialog) {
1845
+ this._ngZone.onStable.pipe(take(1)).subscribe(() => overlayRef.updatePosition());
1846
+ }
1847
+ }
1848
+ /** Destroys the current overlay. */
1849
+ _destroyOverlay() {
1850
+ if (this._overlayRef) {
1851
+ this._overlayRef.dispose();
1852
+ this._overlayRef = this._componentRef = null;
1853
+ }
1854
+ }
1855
+ /** Gets a position strategy that will open the calendar as a dropdown. */
1856
+ _getDialogStrategy() {
1857
+ return this._overlay.position().global().centerHorizontally().centerVertically();
1858
+ }
1859
+ /** Gets a position strategy that will open the calendar as a dropdown. */
1860
+ _getDropdownStrategy() {
1861
+ const strategy = this._overlay
1862
+ .position()
1863
+ .flexibleConnectedTo(this.datetimepickerInput.getConnectedOverlayOrigin())
1864
+ .withTransformOriginOn('.mtx-datetimepicker-content')
1865
+ .withFlexibleDimensions(false)
1866
+ .withViewportMargin(8)
1867
+ .withLockedPosition();
1868
+ return this._setConnectedPositions(strategy);
1869
+ }
1870
+ /**
1871
+ * Sets the positions of the datetimepicker in dropdown mode based on the current configuration.
1872
+ */
1873
+ _setConnectedPositions(strategy) {
1874
+ const primaryX = this.xPosition === 'end' ? 'end' : 'start';
1875
+ const secondaryX = primaryX === 'start' ? 'end' : 'start';
1876
+ const primaryY = this.yPosition === 'above' ? 'bottom' : 'top';
1877
+ const secondaryY = primaryY === 'top' ? 'bottom' : 'top';
1878
+ return strategy.withPositions([
1879
+ {
1880
+ originX: primaryX,
1881
+ originY: secondaryY,
1882
+ overlayX: primaryX,
1883
+ overlayY: primaryY,
1884
+ },
1885
+ {
1886
+ originX: primaryX,
1887
+ originY: primaryY,
1888
+ overlayX: primaryX,
1889
+ overlayY: secondaryY,
1890
+ },
1891
+ {
1892
+ originX: secondaryX,
1893
+ originY: secondaryY,
1894
+ overlayX: secondaryX,
1895
+ overlayY: primaryY,
1896
+ },
1897
+ {
1898
+ originX: secondaryX,
1899
+ originY: primaryY,
1900
+ overlayX: secondaryX,
1901
+ overlayY: secondaryY,
1902
+ },
1903
+ ]);
1904
+ }
1905
+ /** Gets an observable that will emit when the overlay is supposed to be closed. */
1906
+ _getCloseStream(overlayRef) {
1907
+ return merge(overlayRef.backdropClick(), overlayRef.detachments(), overlayRef.keydownEvents().pipe(filter(event => {
1908
+ // Closing on alt + up is only valid when there's an input associated with the datetimepicker.
1909
+ return ((event.keyCode === ESCAPE && !hasModifierKey(event)) ||
1910
+ (this.datetimepickerInput &&
1911
+ hasModifierKey(event, 'altKey') &&
1912
+ event.keyCode === UP_ARROW));
1913
+ })));
1914
+ }
1915
+ }
1916
+ /** @nocollapse */ /** @nocollapse */ MtxDatetimepicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxDatetimepicker, deps: [{ token: i4.Overlay }, { token: i0.NgZone }, { token: i0.ViewContainerRef }, { token: MTX_DATETIMEPICKER_SCROLL_STRATEGY }, { token: i1.DatetimeAdapter, optional: true }, { token: i6.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1917
+ /** @nocollapse */ /** @nocollapse */ MtxDatetimepicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: MtxDatetimepicker, selector: "mtx-datetimepicker", inputs: { multiYearSelector: "multiYearSelector", twelvehour: "twelvehour", startView: "startView", mode: "mode", timeInterval: "timeInterval", preventSameDateTimeSelection: "preventSameDateTimeSelection", panelClass: "panelClass", opened: "opened", color: "color", startAt: "startAt", type: "type", touchUi: "touchUi", disabled: "disabled", xPosition: "xPosition", yPosition: "yPosition", restoreFocus: "restoreFocus" }, outputs: { selectedChanged: "selectedChanged", openedStream: "opened", closedStream: "closed", viewChanged: "viewChanged" }, exportAs: ["mtxDatetimepicker"], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1918
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxDatetimepicker, decorators: [{
1919
+ type: Component,
1920
+ args: [{
1921
+ selector: 'mtx-datetimepicker',
1922
+ exportAs: 'mtxDatetimepicker',
1923
+ template: '',
1924
+ changeDetection: ChangeDetectionStrategy.OnPush,
1925
+ encapsulation: ViewEncapsulation.None,
1926
+ preserveWhitespaces: false,
1927
+ }]
1928
+ }], ctorParameters: function () { return [{ type: i4.Overlay }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
1929
+ type: Inject,
1930
+ args: [MTX_DATETIMEPICKER_SCROLL_STRATEGY]
1931
+ }] }, { type: i1.DatetimeAdapter, decorators: [{
1932
+ type: Optional
1933
+ }] }, { type: i6.Directionality, decorators: [{
1934
+ type: Optional
1935
+ }] }]; }, propDecorators: { multiYearSelector: [{
1936
+ type: Input
1937
+ }], twelvehour: [{
1938
+ type: Input
1939
+ }], startView: [{
1940
+ type: Input
1941
+ }], mode: [{
1942
+ type: Input
1943
+ }], timeInterval: [{
1944
+ type: Input
1945
+ }], preventSameDateTimeSelection: [{
1946
+ type: Input
1947
+ }], selectedChanged: [{
1948
+ type: Output
1949
+ }], openedStream: [{
1950
+ type: Output,
1951
+ args: ['opened']
1952
+ }], closedStream: [{
1953
+ type: Output,
1954
+ args: ['closed']
1955
+ }], viewChanged: [{
1956
+ type: Output
1957
+ }], panelClass: [{
1958
+ type: Input
1959
+ }], opened: [{
1960
+ type: Input
1961
+ }], color: [{
1962
+ type: Input
1963
+ }], startAt: [{
1964
+ type: Input
1965
+ }], type: [{
1966
+ type: Input
1967
+ }], touchUi: [{
1968
+ type: Input
1969
+ }], disabled: [{
1970
+ type: Input
1971
+ }], xPosition: [{
1972
+ type: Input
1973
+ }], yPosition: [{
1974
+ type: Input
1975
+ }], restoreFocus: [{
1976
+ type: Input
1977
+ }] } });
1978
+
1979
+ const MAT_DATETIMEPICKER_VALUE_ACCESSOR = {
1980
+ provide: NG_VALUE_ACCESSOR,
1981
+ useExisting: forwardRef(() => MtxDatetimepickerInput),
1982
+ multi: true,
1983
+ };
1984
+ const MAT_DATETIMEPICKER_VALIDATORS = {
1985
+ provide: NG_VALIDATORS,
1986
+ useExisting: forwardRef(() => MtxDatetimepickerInput),
1987
+ multi: true,
1988
+ };
1989
+ /**
1990
+ * An event used for datetimepicker input and change events. We don't always have access to a native
1991
+ * input or change event because the event may have been triggered by the user clicking on the
1992
+ * calendar popup. For consistency, we always use MtxDatetimepickerInputEvent instead.
1993
+ */
1994
+ class MtxDatetimepickerInputEvent {
1995
+ constructor(target, targetElement) {
1996
+ this.target = target;
1997
+ this.targetElement = targetElement;
1998
+ this.value = this.target.value;
1999
+ }
2000
+ }
2001
+ /** Directive used to connect an input to a MtxDatetimepicker. */
2002
+ class MtxDatetimepickerInput {
2003
+ constructor(_elementRef, _dateAdapter, _dateFormats, _formField) {
2004
+ this._elementRef = _elementRef;
2005
+ this._dateAdapter = _dateAdapter;
2006
+ this._dateFormats = _dateFormats;
2007
+ this._formField = _formField;
2008
+ /** Emits when a `change` event is fired on this `<input>`. */
2009
+ this.dateChange = new EventEmitter();
2010
+ /** Emits when an `input` event is fired on this `<input>`. */
2011
+ this.dateInput = new EventEmitter();
2012
+ /** Emits when the value changes (either due to user input or programmatic change). */
2013
+ this._valueChange = new EventEmitter();
2014
+ /** Emits when the disabled state has changed */
2015
+ this._disabledChange = new EventEmitter();
2016
+ this._datetimepickerSubscription = Subscription.EMPTY;
2017
+ this._localeSubscription = Subscription.EMPTY;
2018
+ /** Whether the last value set on the input was valid. */
2019
+ this._lastValueValid = false;
2020
+ this._onTouched = () => { };
2021
+ this._cvaOnChange = () => { };
2022
+ this._validatorOnChange = () => { };
2023
+ /** The form control validator for whether the input parses. */
2024
+ this._parseValidator = () => {
2025
+ return this._lastValueValid
2026
+ ? null
2027
+ : { mtxDatetimepickerParse: { text: this._elementRef.nativeElement.value } };
2028
+ };
2029
+ /** The form control validator for the min date. */
2030
+ this._minValidator = (control) => {
2031
+ const controlValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(control.value));
2032
+ return !this.min ||
2033
+ !controlValue ||
2034
+ this._dateAdapter.compareDatetime(this.min, controlValue) <= 0
2035
+ ? null
2036
+ : { mtxDatetimepickerMin: { min: this.min, actual: controlValue } };
2037
+ };
2038
+ /** The form control validator for the max date. */
2039
+ this._maxValidator = (control) => {
2040
+ const controlValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(control.value));
2041
+ return !this.max ||
2042
+ !controlValue ||
2043
+ this._dateAdapter.compareDatetime(this.max, controlValue) >= 0
2044
+ ? null
2045
+ : { mtxDatetimepickerMax: { max: this.max, actual: controlValue } };
2046
+ };
2047
+ /** The form control validator for the date filter. */
2048
+ this._filterValidator = (control) => {
2049
+ const controlValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(control.value));
2050
+ return !this._dateFilter ||
2051
+ !controlValue ||
2052
+ this._dateFilter(controlValue, MtxDatetimepickerFilterType.DATE)
2053
+ ? null
2054
+ : { mtxDatetimepickerFilter: true };
2055
+ };
2056
+ /** The combined form control validator for this input. */
2057
+ this._validator = Validators.compose([
2058
+ this._parseValidator,
2059
+ this._minValidator,
2060
+ this._maxValidator,
2061
+ this._filterValidator,
2062
+ ]);
2063
+ if (!this._dateAdapter) {
2064
+ throw createMissingDateImplError('DatetimeAdapter');
2065
+ }
2066
+ if (!this._dateFormats) {
2067
+ throw createMissingDateImplError('MTX_DATETIME_FORMATS');
2068
+ }
2069
+ // Update the displayed date when the locale changes.
2070
+ this._localeSubscription = _dateAdapter.localeChanges.subscribe(() => {
2071
+ this.value = this._dateAdapter.deserialize(this.value);
2072
+ });
2073
+ }
2074
+ /** The datetimepicker that this input is associated with. */
2075
+ set mtxDatetimepicker(value) {
2076
+ this.registerDatetimepicker(value);
2077
+ }
2078
+ set mtxDatetimepickerFilter(filter) {
2079
+ this._dateFilter = filter;
2080
+ this._validatorOnChange();
2081
+ }
2082
+ /** The value of the input. */
2083
+ get value() {
2084
+ return this._value;
2085
+ }
2086
+ set value(value) {
2087
+ value = this._dateAdapter.deserialize(value);
2088
+ this._lastValueValid = !value || this._dateAdapter.isValid(value);
2089
+ value = this._dateAdapter.getValidDateOrNull(value);
2090
+ const oldDate = this.value;
2091
+ this._value = value;
2092
+ this._formatValue(value);
2093
+ // use timeout to ensure the datetimepicker is instantiated and we get the correct format
2094
+ setTimeout(() => {
2095
+ if (!this._dateAdapter.sameDatetime(oldDate, value)) {
2096
+ this._valueChange.emit(value);
2097
+ }
2098
+ });
2099
+ }
2100
+ /** The minimum valid date. */
2101
+ get min() {
2102
+ return this._min;
2103
+ }
2104
+ set min(value) {
2105
+ this._min = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
2106
+ this._validatorOnChange();
2107
+ }
2108
+ /** The maximum valid date. */
2109
+ get max() {
2110
+ return this._max;
2111
+ }
2112
+ set max(value) {
2113
+ this._max = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
2114
+ this._validatorOnChange();
2115
+ }
2116
+ /** Whether the datetimepicker-input is disabled. */
2117
+ get disabled() {
2118
+ return !!this._disabled;
2119
+ }
2120
+ set disabled(value) {
2121
+ const newValue = coerceBooleanProperty(value);
2122
+ if (this._disabled !== newValue) {
2123
+ this._disabled = newValue;
2124
+ this._disabledChange.emit(newValue);
2125
+ }
2126
+ }
2127
+ ngAfterContentInit() {
2128
+ if (this._datetimepicker) {
2129
+ this._datetimepickerSubscription = this._datetimepicker.selectedChanged.subscribe((selected) => {
2130
+ this.value = selected;
2131
+ this._cvaOnChange(selected);
2132
+ this._onTouched();
2133
+ this.dateInput.emit(new MtxDatetimepickerInputEvent(this, this._elementRef.nativeElement));
2134
+ this.dateChange.emit(new MtxDatetimepickerInputEvent(this, this._elementRef.nativeElement));
2135
+ });
2136
+ }
2137
+ }
2138
+ ngOnDestroy() {
2139
+ this._datetimepickerSubscription.unsubscribe();
2140
+ this._localeSubscription.unsubscribe();
2141
+ this._valueChange.complete();
2142
+ this._disabledChange.complete();
2143
+ }
2144
+ registerOnValidatorChange(fn) {
2145
+ this._validatorOnChange = fn;
2146
+ }
2147
+ validate(c) {
2148
+ return this._validator ? this._validator(c) : null;
2149
+ }
2150
+ /**
2151
+ * Gets the element that the datetimepicker popup should be connected to.
2152
+ * @return The element to connect the popup to.
2153
+ */
2154
+ getConnectedOverlayOrigin() {
2155
+ return this._formField ? this._formField.getConnectedOverlayOrigin() : this._elementRef;
2156
+ }
2157
+ /** Gets the ID of an element that should be used a description for the calendar overlay. */
2158
+ getOverlayLabelId() {
2159
+ if (this._formField) {
2160
+ return this._formField.getLabelId();
2161
+ }
2162
+ return this._elementRef.nativeElement.getAttribute('aria-labelledby');
2163
+ }
2164
+ // Implemented as part of ControlValueAccessor
2165
+ writeValue(value) {
2166
+ this.value = value;
2167
+ }
2168
+ // Implemented as part of ControlValueAccessor
2169
+ registerOnChange(fn) {
2170
+ this._cvaOnChange = fn;
2171
+ }
2172
+ // Implemented as part of ControlValueAccessor
2173
+ registerOnTouched(fn) {
2174
+ this._onTouched = fn;
2175
+ }
2176
+ // Implemented as part of ControlValueAccessor
2177
+ setDisabledState(disabled) {
2178
+ this.disabled = disabled;
2179
+ }
2180
+ _onKeydown(event) {
2181
+ if (event.altKey && event.keyCode === DOWN_ARROW) {
2182
+ this._datetimepicker.open();
2183
+ event.preventDefault();
2184
+ }
2185
+ }
2186
+ _onInput(value) {
2187
+ let date = this._dateAdapter.parse(value, this.getParseFormat());
2188
+ this._lastValueValid = !date || this._dateAdapter.isValid(date);
2189
+ date = this._dateAdapter.getValidDateOrNull(date);
2190
+ this._value = date;
2191
+ this._cvaOnChange(date);
2192
+ this._valueChange.emit(date);
2193
+ this.dateInput.emit(new MtxDatetimepickerInputEvent(this, this._elementRef.nativeElement));
2194
+ }
2195
+ _onChange() {
2196
+ this.dateChange.emit(new MtxDatetimepickerInputEvent(this, this._elementRef.nativeElement));
2197
+ }
2198
+ /** Handles blur events on the input. */
2199
+ _onBlur() {
2200
+ // Reformat the input only if we have a valid value.
2201
+ if (this.value) {
2202
+ this._formatValue(this.value);
2203
+ }
2204
+ this._onTouched();
2205
+ }
2206
+ registerDatetimepicker(value) {
2207
+ if (value) {
2208
+ this._datetimepicker = value;
2209
+ this._datetimepicker._registerInput(this);
2210
+ }
2211
+ }
2212
+ getDisplayFormat() {
2213
+ switch (this._datetimepicker.type) {
2214
+ case 'date':
2215
+ return this._dateFormats.display.dateInput;
2216
+ case 'datetime':
2217
+ return this._dateFormats.display.datetimeInput;
2218
+ case 'time':
2219
+ return this._dateFormats.display.timeInput;
2220
+ case 'month':
2221
+ return this._dateFormats.display.monthInput;
2222
+ }
2223
+ }
2224
+ getParseFormat() {
2225
+ let parseFormat;
2226
+ switch (this._datetimepicker.type) {
2227
+ case 'date':
2228
+ parseFormat = this._dateFormats.parse.dateInput;
2229
+ break;
2230
+ case 'datetime':
2231
+ parseFormat = this._dateFormats.parse.datetimeInput;
2232
+ break;
2233
+ case 'time':
2234
+ parseFormat = this._dateFormats.parse.timeInput;
2235
+ break;
2236
+ case 'month':
2237
+ parseFormat = this._dateFormats.parse.monthInput;
2238
+ break;
2239
+ }
2240
+ if (!parseFormat) {
2241
+ parseFormat = this._dateFormats.parse.dateInput;
2242
+ }
2243
+ return parseFormat;
2244
+ }
2245
+ /** Formats a value and sets it on the input element. */
2246
+ _formatValue(value) {
2247
+ this._elementRef.nativeElement.value = value
2248
+ ? this._dateAdapter.format(value, this.getDisplayFormat())
2249
+ : '';
2250
+ }
2251
+ /** Returns the palette used by the input's form field, if any. */
2252
+ getThemePalette() {
2253
+ return this._formField ? this._formField.color : undefined;
2254
+ }
2255
+ }
2256
+ /** @nocollapse */ /** @nocollapse */ MtxDatetimepickerInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxDatetimepickerInput, deps: [{ token: i0.ElementRef }, { token: i1.DatetimeAdapter, optional: true }, { token: MTX_DATETIME_FORMATS, optional: true }, { token: i2$1.MatFormField, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
2257
+ /** @nocollapse */ /** @nocollapse */ MtxDatetimepickerInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: MtxDatetimepickerInput, selector: "input[mtxDatetimepicker]", inputs: { mtxDatetimepicker: "mtxDatetimepicker", mtxDatetimepickerFilter: "mtxDatetimepickerFilter", value: "value", min: "min", max: "max", disabled: "disabled" }, outputs: { dateChange: "dateChange", dateInput: "dateInput" }, host: { listeners: { "input": "_onInput($event.target.value)", "change": "_onChange()", "blur": "_onBlur()", "keydown": "_onKeydown($event)" }, properties: { "attr.aria-haspopup": "true", "attr.aria-owns": "(_datetimepicker?.opened && _datetimepicker.id) || null", "attr.min": "min ? _dateAdapter.toIso8601(min) : null", "attr.max": "max ? _dateAdapter.toIso8601(max) : null", "disabled": "disabled" } }, providers: [
2258
+ MAT_DATETIMEPICKER_VALUE_ACCESSOR,
2259
+ MAT_DATETIMEPICKER_VALIDATORS,
2260
+ { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxDatetimepickerInput },
2261
+ ], exportAs: ["mtxDatetimepickerInput"], ngImport: i0 });
2262
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxDatetimepickerInput, decorators: [{
2263
+ type: Directive,
2264
+ args: [{
2265
+ selector: 'input[mtxDatetimepicker]',
2266
+ providers: [
2267
+ MAT_DATETIMEPICKER_VALUE_ACCESSOR,
2268
+ MAT_DATETIMEPICKER_VALIDATORS,
2269
+ { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxDatetimepickerInput },
2270
+ ],
2271
+ host: {
2272
+ '[attr.aria-haspopup]': 'true',
2273
+ '[attr.aria-owns]': '(_datetimepicker?.opened && _datetimepicker.id) || null',
2274
+ '[attr.min]': 'min ? _dateAdapter.toIso8601(min) : null',
2275
+ '[attr.max]': 'max ? _dateAdapter.toIso8601(max) : null',
2276
+ '[disabled]': 'disabled',
2277
+ '(input)': '_onInput($event.target.value)',
2278
+ '(change)': '_onChange()',
2279
+ '(blur)': '_onBlur()',
2280
+ '(keydown)': '_onKeydown($event)',
2281
+ },
2282
+ exportAs: 'mtxDatetimepickerInput',
2283
+ }]
2284
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DatetimeAdapter, decorators: [{
2285
+ type: Optional
2286
+ }] }, { type: undefined, decorators: [{
2287
+ type: Optional
2288
+ }, {
2289
+ type: Inject,
2290
+ args: [MTX_DATETIME_FORMATS]
2291
+ }] }, { type: i2$1.MatFormField, decorators: [{
2292
+ type: Optional
2293
+ }] }]; }, propDecorators: { dateChange: [{
2294
+ type: Output
2295
+ }], dateInput: [{
2296
+ type: Output
2297
+ }], mtxDatetimepicker: [{
2298
+ type: Input
2299
+ }], mtxDatetimepickerFilter: [{
2300
+ type: Input
2301
+ }], value: [{
2302
+ type: Input
2303
+ }], min: [{
2304
+ type: Input
2305
+ }], max: [{
2306
+ type: Input
2307
+ }], disabled: [{
2308
+ type: Input
2309
+ }] } });
2310
+
2311
+ /** Can be used to override the icon of a `mtxDatetimepickerToggle`. */
2312
+ class MtxDatetimepickerToggleIcon {
2313
+ }
2314
+ /** @nocollapse */ /** @nocollapse */ MtxDatetimepickerToggleIcon.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxDatetimepickerToggleIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2315
+ /** @nocollapse */ /** @nocollapse */ MtxDatetimepickerToggleIcon.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.0", type: MtxDatetimepickerToggleIcon, selector: "[mtxDatetimepickerToggleIcon]", ngImport: i0 });
2316
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxDatetimepickerToggleIcon, decorators: [{
2317
+ type: Directive,
2318
+ args: [{
2319
+ selector: '[mtxDatetimepickerToggleIcon]',
2320
+ }]
2321
+ }] });
2322
+ class MtxDatetimepickerToggle {
2323
+ constructor(_intl, _changeDetectorRef) {
2324
+ this._intl = _intl;
2325
+ this._changeDetectorRef = _changeDetectorRef;
2326
+ this._stateChanges = Subscription.EMPTY;
2327
+ }
2328
+ /** Whether the toggle button is disabled. */
2329
+ get disabled() {
2330
+ return this._disabled === undefined ? this.datetimepicker.disabled : !!this._disabled;
2331
+ }
2332
+ set disabled(value) {
2333
+ this._disabled = coerceBooleanProperty(value);
2334
+ }
2335
+ ngOnChanges(changes) {
2336
+ if (changes.datetimepicker) {
2337
+ this._watchStateChanges();
2338
+ }
2339
+ }
2340
+ ngOnDestroy() {
2341
+ this._stateChanges.unsubscribe();
2342
+ }
2343
+ ngAfterContentInit() {
2344
+ this._watchStateChanges();
2345
+ }
2346
+ _open(event) {
2347
+ if (this.datetimepicker && !this.disabled) {
2348
+ this.datetimepicker.open();
2349
+ event.stopPropagation();
2350
+ }
2351
+ }
2352
+ _watchStateChanges() {
2353
+ const datetimepickerDisabled = this.datetimepicker
2354
+ ? this.datetimepicker._disabledChange
2355
+ : of();
2356
+ const inputDisabled = this.datetimepicker && this.datetimepicker.datetimepickerInput
2357
+ ? this.datetimepicker.datetimepickerInput._disabledChange
2358
+ : of();
2359
+ this._stateChanges.unsubscribe();
2360
+ this._stateChanges = merge([
2361
+ this._intl.changes,
2362
+ datetimepickerDisabled,
2363
+ inputDisabled,
2364
+ ]).subscribe(() => this._changeDetectorRef.markForCheck());
2365
+ }
2366
+ }
2367
+ /** @nocollapse */ /** @nocollapse */ MtxDatetimepickerToggle.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxDatetimepickerToggle, deps: [{ token: i1$1.MatDatepickerIntl }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2368
+ /** @nocollapse */ /** @nocollapse */ MtxDatetimepickerToggle.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: MtxDatetimepickerToggle, selector: "mtx-datetimepicker-toggle", inputs: { datetimepicker: ["for", "datetimepicker"], tabIndex: "tabIndex", disabled: "disabled", disableRipple: "disableRipple" }, host: { listeners: { "focus": "_button.focus()" }, properties: { "attr.tabindex": "disabled ? null : -1", "class.mtx-datetimepicker-toggle-active": "datetimepicker && datetimepicker.opened", "class.mat-accent": "datetimepicker && datetimepicker.color === \"accent\"", "class.mat-warn": "datetimepicker && datetimepicker.color === \"warn\"" }, classAttribute: "mtx-datetimepicker-toggle" }, queries: [{ propertyName: "_customIcon", first: true, predicate: MtxDatetimepickerToggleIcon, descendants: true }], viewQueries: [{ propertyName: "_button", first: true, predicate: ["button"], descendants: true }], exportAs: ["mtxDatetimepickerToggle"], usesOnChanges: true, ngImport: i0, template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"datetimepicker ? 'dialog' : null\"\n [attr.aria-label]=\"_intl.openCalendarLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\"\n (click)=\"_open($event)\">\n\n <ng-container *ngIf=\"!_customIcon\" [ngSwitch]=\"datetimepicker.type\">\n <svg *ngSwitchCase=\"'time'\"\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path\n d=\"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z\">\n </path>\n </svg>\n <svg *ngSwitchCase=\"'datetime'\"\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path\n d=\"M15,13H16.5V15.82L18.94,17.23L18.19,18.53L15,16.69V13M19,8H5V19H9.67C9.24,18.09 9,17.07 9,16A7,7 0 0,1 16,9C17.07,9 18.09,9.24 19,9.67V8M5,21C3.89,21 3,20.1 3,19V5C3,3.89 3.89,3 5,3H6V1H8V3H16V1H18V3H19A2,2 0 0,1 21,5V11.1C22.24,12.36 23,14.09 23,16A7,7 0 0,1 16,23C14.09,23 12.36,22.24 11.1,21H5M16,11.15A4.85,4.85 0 0,0 11.15,16C11.15,18.68 13.32,20.85 16,20.85A4.85,4.85 0 0,0 20.85,16C20.85,13.32 18.68,11.15 16,11.15Z\">\n </path>\n </svg>\n <svg *ngSwitchDefault\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path\n d=\"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z\" />\n </svg>\n </ng-container>\n\n <ng-content select=\"[mtxDatetimepickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mat-form-field-appearance-legacy .mat-form-field-prefix .mtx-datetimepicker-toggle-default-icon,.mat-form-field-appearance-legacy .mat-form-field-suffix .mtx-datetimepicker-toggle-default-icon{width:1em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mtx-datetimepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mtx-datetimepicker-toggle-default-icon{display:block;width:1.5em;height:1.5em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button .mtx-datetimepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mtx-datetimepicker-toggle-default-icon{margin:auto}\n"], components: [{ type: i3$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3.NgSwitchDefault, selector: "[ngSwitchDefault]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2369
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxDatetimepickerToggle, decorators: [{
2370
+ type: Component,
2371
+ args: [{ selector: 'mtx-datetimepicker-toggle', host: {
2372
+ 'class': 'mtx-datetimepicker-toggle',
2373
+ // Always set the tabindex to -1 so that it doesn't overlap with any custom tabindex the
2374
+ // consumer may have provided, while still being able to receive focus.
2375
+ '[attr.tabindex]': 'disabled ? null : -1',
2376
+ '[class.mtx-datetimepicker-toggle-active]': 'datetimepicker && datetimepicker.opened',
2377
+ '[class.mat-accent]': 'datetimepicker && datetimepicker.color === "accent"',
2378
+ '[class.mat-warn]': 'datetimepicker && datetimepicker.color === "warn"',
2379
+ '(focus)': '_button.focus()',
2380
+ }, exportAs: 'mtxDatetimepickerToggle', encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"datetimepicker ? 'dialog' : null\"\n [attr.aria-label]=\"_intl.openCalendarLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\"\n (click)=\"_open($event)\">\n\n <ng-container *ngIf=\"!_customIcon\" [ngSwitch]=\"datetimepicker.type\">\n <svg *ngSwitchCase=\"'time'\"\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path\n d=\"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z\">\n </path>\n </svg>\n <svg *ngSwitchCase=\"'datetime'\"\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path\n d=\"M15,13H16.5V15.82L18.94,17.23L18.19,18.53L15,16.69V13M19,8H5V19H9.67C9.24,18.09 9,17.07 9,16A7,7 0 0,1 16,9C17.07,9 18.09,9.24 19,9.67V8M5,21C3.89,21 3,20.1 3,19V5C3,3.89 3.89,3 5,3H6V1H8V3H16V1H18V3H19A2,2 0 0,1 21,5V11.1C22.24,12.36 23,14.09 23,16A7,7 0 0,1 16,23C14.09,23 12.36,22.24 11.1,21H5M16,11.15A4.85,4.85 0 0,0 11.15,16C11.15,18.68 13.32,20.85 16,20.85A4.85,4.85 0 0,0 20.85,16C20.85,13.32 18.68,11.15 16,11.15Z\">\n </path>\n </svg>\n <svg *ngSwitchDefault\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path\n d=\"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z\" />\n </svg>\n </ng-container>\n\n <ng-content select=\"[mtxDatetimepickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mat-form-field-appearance-legacy .mat-form-field-prefix .mtx-datetimepicker-toggle-default-icon,.mat-form-field-appearance-legacy .mat-form-field-suffix .mtx-datetimepicker-toggle-default-icon{width:1em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mtx-datetimepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mtx-datetimepicker-toggle-default-icon{display:block;width:1.5em;height:1.5em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button .mtx-datetimepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mtx-datetimepicker-toggle-default-icon{margin:auto}\n"] }]
2381
+ }], ctorParameters: function () { return [{ type: i1$1.MatDatepickerIntl }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { datetimepicker: [{
2382
+ type: Input,
2383
+ args: ['for']
2384
+ }], tabIndex: [{
2385
+ type: Input
2386
+ }], disabled: [{
2387
+ type: Input
2388
+ }], disableRipple: [{
2389
+ type: Input
2390
+ }], _customIcon: [{
2391
+ type: ContentChild,
2392
+ args: [MtxDatetimepickerToggleIcon]
2393
+ }], _button: [{
2394
+ type: ViewChild,
2395
+ args: ['button']
2396
+ }] } });
2397
+
2398
+ class MtxDatetimepickerModule {
2399
+ }
2400
+ /** @nocollapse */ /** @nocollapse */ MtxDatetimepickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxDatetimepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2401
+ /** @nocollapse */ /** @nocollapse */ MtxDatetimepickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxDatetimepickerModule, declarations: [MtxCalendar,
2402
+ MtxCalendarBody,
2403
+ MtxClock,
2404
+ MtxDatetimepicker,
2405
+ MtxDatetimepickerToggle,
2406
+ MtxDatetimepickerToggleIcon,
2407
+ MtxDatetimepickerInput,
2408
+ MtxDatetimepickerContent,
2409
+ MtxMonthView,
2410
+ MtxYearView,
2411
+ MtxMultiYearView], imports: [CommonModule, MatButtonModule, OverlayModule, A11yModule, PortalModule], exports: [MtxCalendar,
2412
+ MtxCalendarBody,
2413
+ MtxClock,
2414
+ MtxDatetimepicker,
2415
+ MtxDatetimepickerToggle,
2416
+ MtxDatetimepickerToggleIcon,
2417
+ MtxDatetimepickerInput,
2418
+ MtxDatetimepickerContent,
2419
+ MtxMonthView,
2420
+ MtxYearView,
2421
+ MtxMultiYearView] });
2422
+ /** @nocollapse */ /** @nocollapse */ MtxDatetimepickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxDatetimepickerModule, providers: [MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER], imports: [[CommonModule, MatButtonModule, OverlayModule, A11yModule, PortalModule]] });
2423
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: MtxDatetimepickerModule, decorators: [{
2424
+ type: NgModule,
2425
+ args: [{
2426
+ imports: [CommonModule, MatButtonModule, OverlayModule, A11yModule, PortalModule],
2427
+ declarations: [
2428
+ MtxCalendar,
2429
+ MtxCalendarBody,
2430
+ MtxClock,
2431
+ MtxDatetimepicker,
2432
+ MtxDatetimepickerToggle,
2433
+ MtxDatetimepickerToggleIcon,
2434
+ MtxDatetimepickerInput,
2435
+ MtxDatetimepickerContent,
2436
+ MtxMonthView,
2437
+ MtxYearView,
2438
+ MtxMultiYearView,
2439
+ ],
2440
+ exports: [
2441
+ MtxCalendar,
2442
+ MtxCalendarBody,
2443
+ MtxClock,
2444
+ MtxDatetimepicker,
2445
+ MtxDatetimepickerToggle,
2446
+ MtxDatetimepickerToggleIcon,
2447
+ MtxDatetimepickerInput,
2448
+ MtxDatetimepickerContent,
2449
+ MtxMonthView,
2450
+ MtxYearView,
2451
+ MtxMultiYearView,
2452
+ ],
2453
+ providers: [MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER],
2454
+ }]
2455
+ }] });
2456
+
2457
+ /**
2458
+ * Generated bundle index. Do not edit.
2459
+ */
2460
+
2461
+ export { CLOCK_INNER_RADIUS, CLOCK_OUTER_RADIUS, CLOCK_RADIUS, CLOCK_TICK_RADIUS, MAT_DATETIMEPICKER_VALIDATORS, MAT_DATETIMEPICKER_VALUE_ACCESSOR, MTX_DATETIMEPICKER_SCROLL_STRATEGY, MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY, MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER, MtxCalendar, MtxCalendarBody, MtxCalendarCell, MtxClock, MtxDatetimepicker, MtxDatetimepickerContent, MtxDatetimepickerFilterType, MtxDatetimepickerInput, MtxDatetimepickerInputEvent, MtxDatetimepickerModule, MtxDatetimepickerToggle, MtxDatetimepickerToggleIcon, MtxMonthView, MtxMultiYearView, MtxYearView, getActiveOffset, isSameMultiYearView, mtxDatetimepickerAnimations, yearsPerPage, yearsPerRow };
2462
+ //# sourceMappingURL=mtxDatetimepicker.mjs.map