@taiga-ui/cdk 2.24.0 → 2.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (483) hide show
  1. package/abstract/control.d.ts +1 -1
  2. package/abstract/dialog.directive.d.ts +12 -0
  3. package/abstract/index.d.ts +1 -0
  4. package/abstract/interactive.d.ts +4 -4
  5. package/abstract/taiga-ui-cdk-abstract.metadata.json +1 -1
  6. package/bundles/taiga-ui-cdk-abstract.umd.js +45 -7
  7. package/bundles/taiga-ui-cdk-abstract.umd.js.map +1 -1
  8. package/bundles/taiga-ui-cdk-abstract.umd.min.js +2 -2
  9. package/bundles/taiga-ui-cdk-abstract.umd.min.js.map +1 -1
  10. package/bundles/taiga-ui-cdk-components-dialog-host.umd.js.map +1 -1
  11. package/bundles/taiga-ui-cdk-components-dialog-host.umd.min.js.map +1 -1
  12. package/bundles/taiga-ui-cdk-components-portal-host.umd.js.map +1 -1
  13. package/bundles/taiga-ui-cdk-components-portal-host.umd.min.js.map +1 -1
  14. package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
  15. package/bundles/taiga-ui-cdk-constants.umd.min.js.map +1 -1
  16. package/bundles/taiga-ui-cdk-date-time.umd.js +349 -349
  17. package/bundles/taiga-ui-cdk-date-time.umd.js.map +1 -1
  18. package/bundles/taiga-ui-cdk-date-time.umd.min.js +2 -2
  19. package/bundles/taiga-ui-cdk-date-time.umd.min.js.map +1 -1
  20. package/bundles/taiga-ui-cdk-directives-active-zone.umd.js.map +1 -1
  21. package/bundles/taiga-ui-cdk-directives-active-zone.umd.min.js.map +1 -1
  22. package/bundles/taiga-ui-cdk-directives-auto-focus.umd.js.map +1 -1
  23. package/bundles/taiga-ui-cdk-directives-auto-focus.umd.min.js.map +1 -1
  24. package/bundles/taiga-ui-cdk-directives-autofilled.umd.js.map +1 -1
  25. package/bundles/taiga-ui-cdk-directives-autofilled.umd.min.js.map +1 -1
  26. package/bundles/taiga-ui-cdk-directives-checked.umd.js.map +1 -1
  27. package/bundles/taiga-ui-cdk-directives-checked.umd.min.js.map +1 -1
  28. package/bundles/taiga-ui-cdk-directives-copy-processor.umd.js +276 -0
  29. package/bundles/taiga-ui-cdk-directives-copy-processor.umd.js.map +1 -0
  30. package/bundles/taiga-ui-cdk-directives-copy-processor.umd.min.js +16 -0
  31. package/bundles/taiga-ui-cdk-directives-copy-processor.umd.min.js.map +1 -0
  32. package/bundles/taiga-ui-cdk-directives-drag.umd.js.map +1 -1
  33. package/bundles/taiga-ui-cdk-directives-drag.umd.min.js.map +1 -1
  34. package/bundles/taiga-ui-cdk-directives-droppable.umd.js.map +1 -1
  35. package/bundles/taiga-ui-cdk-directives-droppable.umd.min.js.map +1 -1
  36. package/bundles/taiga-ui-cdk-directives-element.umd.js.map +1 -1
  37. package/bundles/taiga-ui-cdk-directives-element.umd.min.js.map +1 -1
  38. package/bundles/taiga-ui-cdk-directives-focus-trap.umd.js.map +1 -1
  39. package/bundles/taiga-ui-cdk-directives-focus-trap.umd.min.js.map +1 -1
  40. package/bundles/taiga-ui-cdk-directives-focus-visible.umd.js.map +1 -1
  41. package/bundles/taiga-ui-cdk-directives-focus-visible.umd.min.js.map +1 -1
  42. package/bundles/taiga-ui-cdk-directives-focusable.umd.js.map +1 -1
  43. package/bundles/taiga-ui-cdk-directives-focusable.umd.min.js.map +1 -1
  44. package/bundles/taiga-ui-cdk-directives-focused.umd.js.map +1 -1
  45. package/bundles/taiga-ui-cdk-directives-focused.umd.min.js.map +1 -1
  46. package/bundles/taiga-ui-cdk-directives-for.umd.js.map +1 -1
  47. package/bundles/taiga-ui-cdk-directives-for.umd.min.js.map +1 -1
  48. package/bundles/taiga-ui-cdk-directives-high-dpi.umd.js.map +1 -1
  49. package/bundles/taiga-ui-cdk-directives-high-dpi.umd.min.js.map +1 -1
  50. package/bundles/taiga-ui-cdk-directives-hovered.umd.js.map +1 -1
  51. package/bundles/taiga-ui-cdk-directives-hovered.umd.min.js.map +1 -1
  52. package/bundles/taiga-ui-cdk-directives-input-mode.umd.js.map +1 -1
  53. package/bundles/taiga-ui-cdk-directives-input-mode.umd.min.js.map +1 -1
  54. package/bundles/taiga-ui-cdk-directives-item.umd.js +259 -0
  55. package/bundles/taiga-ui-cdk-directives-item.umd.js.map +1 -0
  56. package/bundles/taiga-ui-cdk-directives-item.umd.min.js +16 -0
  57. package/bundles/taiga-ui-cdk-directives-item.umd.min.js.map +1 -0
  58. package/bundles/taiga-ui-cdk-directives-let.umd.js.map +1 -1
  59. package/bundles/taiga-ui-cdk-directives-let.umd.min.js.map +1 -1
  60. package/bundles/taiga-ui-cdk-directives-media.umd.js +1 -1
  61. package/bundles/taiga-ui-cdk-directives-media.umd.js.map +1 -1
  62. package/bundles/taiga-ui-cdk-directives-media.umd.min.js +1 -1
  63. package/bundles/taiga-ui-cdk-directives-media.umd.min.js.map +1 -1
  64. package/bundles/taiga-ui-cdk-directives-obscured.umd.js.map +1 -1
  65. package/bundles/taiga-ui-cdk-directives-obscured.umd.min.js.map +1 -1
  66. package/bundles/taiga-ui-cdk-directives-overscroll.umd.js.map +1 -1
  67. package/bundles/taiga-ui-cdk-directives-overscroll.umd.min.js.map +1 -1
  68. package/bundles/taiga-ui-cdk-directives-pan.umd.js +5 -5
  69. package/bundles/taiga-ui-cdk-directives-pan.umd.js.map +1 -1
  70. package/bundles/taiga-ui-cdk-directives-pan.umd.min.js +2 -2
  71. package/bundles/taiga-ui-cdk-directives-pan.umd.min.js.map +1 -1
  72. package/bundles/taiga-ui-cdk-directives-pressed.umd.js.map +1 -1
  73. package/bundles/taiga-ui-cdk-directives-pressed.umd.min.js.map +1 -1
  74. package/bundles/taiga-ui-cdk-directives-prevent-default.umd.js.map +1 -1
  75. package/bundles/taiga-ui-cdk-directives-prevent-default.umd.min.js.map +1 -1
  76. package/bundles/taiga-ui-cdk-directives-repeat-times.umd.js.map +1 -1
  77. package/bundles/taiga-ui-cdk-directives-repeat-times.umd.min.js.map +1 -1
  78. package/bundles/taiga-ui-cdk-directives-resize.umd.js.map +1 -1
  79. package/bundles/taiga-ui-cdk-directives-resize.umd.min.js.map +1 -1
  80. package/bundles/taiga-ui-cdk-directives-swipe.umd.js +5 -5
  81. package/bundles/taiga-ui-cdk-directives-swipe.umd.js.map +1 -1
  82. package/bundles/taiga-ui-cdk-directives-swipe.umd.min.js +2 -2
  83. package/bundles/taiga-ui-cdk-directives-swipe.umd.min.js.map +1 -1
  84. package/bundles/taiga-ui-cdk-directives-validator.umd.js.map +1 -1
  85. package/bundles/taiga-ui-cdk-directives-validator.umd.min.js.map +1 -1
  86. package/bundles/taiga-ui-cdk-directives-zoom.umd.js +5 -5
  87. package/bundles/taiga-ui-cdk-directives-zoom.umd.js.map +1 -1
  88. package/bundles/taiga-ui-cdk-directives-zoom.umd.min.js +2 -2
  89. package/bundles/taiga-ui-cdk-directives-zoom.umd.min.js.map +1 -1
  90. package/bundles/taiga-ui-cdk-directives.umd.js +26 -18
  91. package/bundles/taiga-ui-cdk-directives.umd.js.map +1 -1
  92. package/bundles/taiga-ui-cdk-directives.umd.min.js +1 -1
  93. package/bundles/taiga-ui-cdk-enums.umd.js +11 -11
  94. package/bundles/taiga-ui-cdk-enums.umd.js.map +1 -1
  95. package/bundles/taiga-ui-cdk-enums.umd.min.js +1 -1
  96. package/bundles/taiga-ui-cdk-enums.umd.min.js.map +1 -1
  97. package/bundles/taiga-ui-cdk-observables.umd.js.map +1 -1
  98. package/bundles/taiga-ui-cdk-observables.umd.min.js.map +1 -1
  99. package/bundles/taiga-ui-cdk-pipes-filter.umd.js.map +1 -1
  100. package/bundles/taiga-ui-cdk-pipes-filter.umd.min.js.map +1 -1
  101. package/bundles/taiga-ui-cdk-pipes-mapper.umd.js.map +1 -1
  102. package/bundles/taiga-ui-cdk-pipes-mapper.umd.min.js.map +1 -1
  103. package/bundles/taiga-ui-cdk-services.umd.js +38 -38
  104. package/bundles/taiga-ui-cdk-services.umd.js.map +1 -1
  105. package/bundles/taiga-ui-cdk-services.umd.min.js +1 -1
  106. package/bundles/taiga-ui-cdk-services.umd.min.js.map +1 -1
  107. package/bundles/taiga-ui-cdk-tokens.umd.js +7 -7
  108. package/bundles/taiga-ui-cdk-tokens.umd.js.map +1 -1
  109. package/bundles/taiga-ui-cdk-tokens.umd.min.js +1 -1
  110. package/bundles/taiga-ui-cdk-tokens.umd.min.js.map +1 -1
  111. package/bundles/taiga-ui-cdk-utils-dom.umd.js +7 -7
  112. package/bundles/taiga-ui-cdk-utils-dom.umd.js.map +1 -1
  113. package/bundles/taiga-ui-cdk-utils-dom.umd.min.js.map +1 -1
  114. package/bundles/taiga-ui-cdk-utils-focus.umd.js.map +1 -1
  115. package/bundles/taiga-ui-cdk-utils-focus.umd.min.js.map +1 -1
  116. package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js +14 -14
  117. package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js.map +1 -1
  118. package/components/dialog-host/taiga-ui-cdk-components-dialog-host.metadata.json +1 -1
  119. package/components/portal-host/taiga-ui-cdk-components-portal-host.metadata.json +1 -1
  120. package/constants/taiga-ui-cdk-constants.metadata.json +1 -1
  121. package/date-time/day-range.d.ts +14 -14
  122. package/date-time/day.d.ts +57 -57
  123. package/date-time/index.d.ts +4 -4
  124. package/date-time/month-range.d.ts +1 -1
  125. package/date-time/month.d.ts +26 -26
  126. package/date-time/taiga-ui-cdk-date-time.metadata.json +1 -1
  127. package/date-time/time.d.ts +12 -12
  128. package/date-time/year.d.ts +27 -27
  129. package/directives/active-zone/taiga-ui-cdk-directives-active-zone.metadata.json +1 -1
  130. package/directives/auto-focus/taiga-ui-cdk-directives-auto-focus.metadata.json +1 -1
  131. package/directives/autofilled/taiga-ui-cdk-directives-autofilled.metadata.json +1 -1
  132. package/directives/checked/taiga-ui-cdk-directives-checked.metadata.json +1 -1
  133. package/directives/copy-processor/copy-processor.directive.d.ts +7 -0
  134. package/directives/copy-processor/copy-processor.module.d.ts +2 -0
  135. package/directives/copy-processor/index.d.ts +2 -0
  136. package/directives/copy-processor/package.json +13 -0
  137. package/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.d.ts +4 -0
  138. package/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.metadata.json +1 -0
  139. package/directives/drag/taiga-ui-cdk-directives-drag.metadata.json +1 -1
  140. package/directives/droppable/taiga-ui-cdk-directives-droppable.metadata.json +1 -1
  141. package/directives/element/taiga-ui-cdk-directives-element.metadata.json +1 -1
  142. package/directives/focus-trap/taiga-ui-cdk-directives-focus-trap.metadata.json +1 -1
  143. package/directives/focus-visible/taiga-ui-cdk-directives-focus-visible.metadata.json +1 -1
  144. package/directives/focusable/taiga-ui-cdk-directives-focusable.metadata.json +1 -1
  145. package/directives/focused/taiga-ui-cdk-directives-focused.metadata.json +1 -1
  146. package/directives/for/for.directive.d.ts +1 -1
  147. package/directives/for/taiga-ui-cdk-directives-for.metadata.json +1 -1
  148. package/directives/high-dpi/taiga-ui-cdk-directives-high-dpi.metadata.json +1 -1
  149. package/directives/hovered/taiga-ui-cdk-directives-hovered.metadata.json +1 -1
  150. package/directives/index.d.ts +5 -4
  151. package/directives/input-mode/taiga-ui-cdk-directives-input-mode.metadata.json +1 -1
  152. package/directives/item/index.d.ts +2 -0
  153. package/directives/item/item.directive.d.ts +6 -0
  154. package/directives/item/item.module.d.ts +2 -0
  155. package/directives/item/package.json +13 -0
  156. package/directives/item/taiga-ui-cdk-directives-item.d.ts +4 -0
  157. package/directives/item/taiga-ui-cdk-directives-item.metadata.json +1 -0
  158. package/directives/let/taiga-ui-cdk-directives-let.metadata.json +1 -1
  159. package/directives/media/media.directive.d.ts +1 -1
  160. package/directives/media/taiga-ui-cdk-directives-media.metadata.json +1 -1
  161. package/directives/obscured/taiga-ui-cdk-directives-obscured.metadata.json +1 -1
  162. package/directives/overscroll/taiga-ui-cdk-directives-overscroll.metadata.json +1 -1
  163. package/directives/pan/pan.directive.d.ts +3 -3
  164. package/directives/pan/taiga-ui-cdk-directives-pan.metadata.json +1 -1
  165. package/directives/pressed/taiga-ui-cdk-directives-pressed.metadata.json +1 -1
  166. package/directives/prevent-default/taiga-ui-cdk-directives-prevent-default.metadata.json +1 -1
  167. package/directives/repeat-times/taiga-ui-cdk-directives-repeat-times.metadata.json +1 -1
  168. package/directives/resize/taiga-ui-cdk-directives-resize.metadata.json +1 -1
  169. package/directives/swipe/swipe.directive.d.ts +4 -3
  170. package/directives/swipe/taiga-ui-cdk-directives-swipe.metadata.json +1 -1
  171. package/directives/taiga-ui-cdk-directives.metadata.json +1 -1
  172. package/directives/validator/taiga-ui-cdk-directives-validator.metadata.json +1 -1
  173. package/directives/zoom/taiga-ui-cdk-directives-zoom.metadata.json +1 -1
  174. package/directives/zoom/zoom.directive.d.ts +4 -3
  175. package/enums/index.d.ts +1 -1
  176. package/enums/taiga-ui-cdk-enums.metadata.json +1 -1
  177. package/esm2015/abstract/control.js +1 -1
  178. package/esm2015/abstract/dialog.directive.js +35 -0
  179. package/esm2015/abstract/index.js +2 -1
  180. package/esm2015/abstract/interactive.js +4 -4
  181. package/esm2015/abstract/multiple-control.js +1 -1
  182. package/esm2015/abstract/nullable-control.js +1 -1
  183. package/esm2015/components/dialog-host/dialog-host.component.js +2 -2
  184. package/esm2015/components/dialog-host/dialog-host.module.js +1 -1
  185. package/esm2015/components/portal-host/portal-host.component.js +1 -1
  186. package/esm2015/components/portal-host/portal-host.module.js +1 -1
  187. package/esm2015/components/portal-host/portal.service.js +1 -1
  188. package/esm2015/constants/matcher.js +1 -1
  189. package/esm2015/date-time/date-fillers.js +1 -1
  190. package/esm2015/date-time/day-range.js +26 -26
  191. package/esm2015/date-time/day.js +120 -120
  192. package/esm2015/date-time/index.js +5 -5
  193. package/esm2015/date-time/month-range.js +6 -6
  194. package/esm2015/date-time/month.js +56 -56
  195. package/esm2015/date-time/time.js +40 -40
  196. package/esm2015/date-time/year.js +49 -49
  197. package/esm2015/directives/active-zone/active-zone.module.js +1 -1
  198. package/esm2015/directives/auto-focus/autofocus.module.js +1 -1
  199. package/esm2015/directives/autofilled/autofilled.module.js +1 -1
  200. package/esm2015/directives/checked/checked.module.js +1 -1
  201. package/esm2015/directives/copy-processor/copy-processor.directive.js +37 -0
  202. package/esm2015/directives/copy-processor/copy-processor.module.js +13 -0
  203. package/esm2015/directives/copy-processor/index.js +3 -0
  204. package/esm2015/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.js +5 -0
  205. package/esm2015/directives/drag/drag.module.js +1 -1
  206. package/esm2015/directives/droppable/droppable.module.js +1 -1
  207. package/esm2015/directives/element/element.module.js +1 -1
  208. package/esm2015/directives/focus-trap/focus-trap.module.js +1 -1
  209. package/esm2015/directives/focus-visible/focus-visible.module.js +1 -1
  210. package/esm2015/directives/focusable/focusable.module.js +1 -1
  211. package/esm2015/directives/focused/focused.module.js +1 -1
  212. package/esm2015/directives/for/for.directive.js +1 -1
  213. package/esm2015/directives/for/for.module.js +1 -1
  214. package/esm2015/directives/high-dpi/high-dpi.module.js +1 -1
  215. package/esm2015/directives/hovered/hovered.module.js +1 -1
  216. package/esm2015/directives/index.js +6 -5
  217. package/esm2015/directives/input-mode/input-mode.module.js +1 -1
  218. package/esm2015/directives/item/index.js +3 -0
  219. package/esm2015/directives/item/item.directive.js +15 -0
  220. package/esm2015/directives/item/item.module.js +13 -0
  221. package/esm2015/directives/item/taiga-ui-cdk-directives-item.js +5 -0
  222. package/esm2015/directives/let/let.directive.js +1 -1
  223. package/esm2015/directives/let/let.module.js +1 -1
  224. package/esm2015/directives/media/media.directive.js +2 -2
  225. package/esm2015/directives/media/media.module.js +1 -1
  226. package/esm2015/directives/obscured/obscured.module.js +1 -1
  227. package/esm2015/directives/overscroll/overscroll.module.js +1 -1
  228. package/esm2015/directives/pan/pan.directive.js +3 -2
  229. package/esm2015/directives/pan/pan.module.js +1 -1
  230. package/esm2015/directives/pressed/pressed.module.js +1 -1
  231. package/esm2015/directives/prevent-default/prevent-default.module.js +1 -1
  232. package/esm2015/directives/repeat-times/repeat-times.module.js +1 -1
  233. package/esm2015/directives/resize/resize.module.js +1 -1
  234. package/esm2015/directives/swipe/swipe.directive.js +3 -2
  235. package/esm2015/directives/swipe/swipe.module.js +1 -1
  236. package/esm2015/directives/validator/validator.module.js +1 -1
  237. package/esm2015/directives/zoom/zoom.directive.js +3 -2
  238. package/esm2015/directives/zoom/zoom.module.js +1 -1
  239. package/esm2015/enums/index.js +2 -2
  240. package/esm2015/interfaces/base-dialog-context.js +1 -1
  241. package/esm2015/interfaces/base-dialog.js +1 -1
  242. package/esm2015/interfaces/focusable-element-accessor.js +1 -1
  243. package/esm2015/interfaces/index.js +1 -1
  244. package/esm2015/observables/drag-and-drop-from.js +1 -1
  245. package/esm2015/observables/focus-visible-observable.js +1 -1
  246. package/esm2015/observables/mouse-drag-finish-from.js +1 -1
  247. package/esm2015/observables/pressed-observable.js +1 -1
  248. package/esm2015/pipes/filter/filter.module.js +1 -1
  249. package/esm2015/pipes/mapper/mapper.module.js +1 -1
  250. package/esm2015/services/focus-visible.service.js +1 -1
  251. package/esm2015/services/index.js +2 -2
  252. package/esm2015/services/obscured.service.js +1 -1
  253. package/esm2015/services/pan.service.js +3 -3
  254. package/esm2015/services/resize.service.js +1 -1
  255. package/esm2015/services/static-request.service.js +1 -1
  256. package/esm2015/tokens/active-element.js +1 -1
  257. package/esm2015/tokens/index.js +3 -3
  258. package/esm2015/tokens/is-android.js +1 -1
  259. package/esm2015/types/index.js +1 -1
  260. package/esm2015/utils/dom/get-element-obscurers.js +1 -1
  261. package/esm2015/utils/dom/index.js +2 -2
  262. package/esm2015/utils/focus/get-closest-keyboard-focusable.js +1 -1
  263. package/esm2015/utils/miscellaneous/index.js +3 -3
  264. package/esm5/abstract/control.js +1 -1
  265. package/esm5/abstract/dialog.directive.js +44 -0
  266. package/esm5/abstract/index.js +2 -1
  267. package/esm5/abstract/interactive.js +4 -4
  268. package/esm5/abstract/multiple-control.js +1 -1
  269. package/esm5/abstract/nullable-control.js +1 -1
  270. package/esm5/components/dialog-host/dialog-host.component.js +2 -2
  271. package/esm5/components/dialog-host/dialog-host.module.js +1 -1
  272. package/esm5/components/portal-host/portal-host.component.js +1 -1
  273. package/esm5/components/portal-host/portal-host.module.js +1 -1
  274. package/esm5/components/portal-host/portal.service.js +1 -1
  275. package/esm5/constants/matcher.js +1 -1
  276. package/esm5/date-time/date-fillers.js +1 -1
  277. package/esm5/date-time/day-range.js +26 -26
  278. package/esm5/date-time/day.js +120 -120
  279. package/esm5/date-time/index.js +5 -5
  280. package/esm5/date-time/month-range.js +6 -6
  281. package/esm5/date-time/month.js +56 -56
  282. package/esm5/date-time/time.js +41 -41
  283. package/esm5/date-time/year.js +49 -49
  284. package/esm5/directives/active-zone/active-zone.module.js +1 -1
  285. package/esm5/directives/auto-focus/autofocus.module.js +1 -1
  286. package/esm5/directives/autofilled/autofilled.module.js +1 -1
  287. package/esm5/directives/checked/checked.module.js +1 -1
  288. package/esm5/directives/copy-processor/copy-processor.directive.js +38 -0
  289. package/esm5/directives/copy-processor/copy-processor.module.js +16 -0
  290. package/esm5/directives/copy-processor/index.js +3 -0
  291. package/esm5/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.js +5 -0
  292. package/esm5/directives/drag/drag.module.js +1 -1
  293. package/esm5/directives/droppable/droppable.module.js +1 -1
  294. package/esm5/directives/element/element.module.js +1 -1
  295. package/esm5/directives/focus-trap/focus-trap.module.js +1 -1
  296. package/esm5/directives/focus-visible/focus-visible.module.js +1 -1
  297. package/esm5/directives/focusable/focusable.module.js +1 -1
  298. package/esm5/directives/focused/focused.module.js +1 -1
  299. package/esm5/directives/for/for.directive.js +1 -1
  300. package/esm5/directives/for/for.module.js +1 -1
  301. package/esm5/directives/high-dpi/high-dpi.module.js +1 -1
  302. package/esm5/directives/hovered/hovered.module.js +1 -1
  303. package/esm5/directives/index.js +6 -5
  304. package/esm5/directives/input-mode/input-mode.module.js +1 -1
  305. package/esm5/directives/item/index.js +3 -0
  306. package/esm5/directives/item/item.directive.js +18 -0
  307. package/esm5/directives/item/item.module.js +16 -0
  308. package/esm5/directives/item/taiga-ui-cdk-directives-item.js +5 -0
  309. package/esm5/directives/let/let.directive.js +1 -1
  310. package/esm5/directives/let/let.module.js +1 -1
  311. package/esm5/directives/media/media.directive.js +2 -2
  312. package/esm5/directives/media/media.module.js +1 -1
  313. package/esm5/directives/obscured/obscured.module.js +1 -1
  314. package/esm5/directives/overscroll/overscroll.module.js +1 -1
  315. package/esm5/directives/pan/pan.directive.js +3 -2
  316. package/esm5/directives/pan/pan.module.js +1 -1
  317. package/esm5/directives/pressed/pressed.module.js +1 -1
  318. package/esm5/directives/prevent-default/prevent-default.module.js +1 -1
  319. package/esm5/directives/repeat-times/repeat-times.module.js +1 -1
  320. package/esm5/directives/resize/resize.module.js +1 -1
  321. package/esm5/directives/swipe/swipe.directive.js +3 -2
  322. package/esm5/directives/swipe/swipe.module.js +1 -1
  323. package/esm5/directives/validator/validator.module.js +1 -1
  324. package/esm5/directives/zoom/zoom.directive.js +3 -2
  325. package/esm5/directives/zoom/zoom.module.js +1 -1
  326. package/esm5/enums/index.js +2 -2
  327. package/esm5/interfaces/base-dialog-context.js +1 -1
  328. package/esm5/interfaces/base-dialog.js +1 -1
  329. package/esm5/interfaces/focusable-element-accessor.js +1 -1
  330. package/esm5/interfaces/index.js +1 -1
  331. package/esm5/observables/drag-and-drop-from.js +1 -1
  332. package/esm5/observables/focus-visible-observable.js +1 -1
  333. package/esm5/observables/mouse-drag-finish-from.js +1 -1
  334. package/esm5/observables/pressed-observable.js +1 -1
  335. package/esm5/pipes/filter/filter.module.js +1 -1
  336. package/esm5/pipes/mapper/mapper.module.js +1 -1
  337. package/esm5/services/focus-visible.service.js +1 -1
  338. package/esm5/services/index.js +2 -2
  339. package/esm5/services/obscured.service.js +1 -1
  340. package/esm5/services/pan.service.js +3 -3
  341. package/esm5/services/resize.service.js +1 -1
  342. package/esm5/services/static-request.service.js +1 -1
  343. package/esm5/tokens/active-element.js +1 -1
  344. package/esm5/tokens/index.js +3 -3
  345. package/esm5/tokens/is-android.js +1 -1
  346. package/esm5/types/index.js +1 -1
  347. package/esm5/utils/dom/get-element-obscurers.js +1 -1
  348. package/esm5/utils/dom/index.js +2 -2
  349. package/esm5/utils/focus/get-closest-keyboard-focusable.js +1 -1
  350. package/esm5/utils/miscellaneous/index.js +3 -3
  351. package/fesm2015/taiga-ui-cdk-abstract.js +36 -7
  352. package/fesm2015/taiga-ui-cdk-abstract.js.map +1 -1
  353. package/fesm2015/taiga-ui-cdk-components-dialog-host.js.map +1 -1
  354. package/fesm2015/taiga-ui-cdk-components-portal-host.js.map +1 -1
  355. package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
  356. package/fesm2015/taiga-ui-cdk-date-time.js +343 -343
  357. package/fesm2015/taiga-ui-cdk-date-time.js.map +1 -1
  358. package/fesm2015/taiga-ui-cdk-directives-active-zone.js.map +1 -1
  359. package/fesm2015/taiga-ui-cdk-directives-auto-focus.js.map +1 -1
  360. package/fesm2015/taiga-ui-cdk-directives-autofilled.js.map +1 -1
  361. package/fesm2015/taiga-ui-cdk-directives-checked.js.map +1 -1
  362. package/fesm2015/taiga-ui-cdk-directives-copy-processor.js +52 -0
  363. package/fesm2015/taiga-ui-cdk-directives-copy-processor.js.map +1 -0
  364. package/fesm2015/taiga-ui-cdk-directives-drag.js.map +1 -1
  365. package/fesm2015/taiga-ui-cdk-directives-droppable.js.map +1 -1
  366. package/fesm2015/taiga-ui-cdk-directives-element.js.map +1 -1
  367. package/fesm2015/taiga-ui-cdk-directives-focus-trap.js.map +1 -1
  368. package/fesm2015/taiga-ui-cdk-directives-focus-visible.js.map +1 -1
  369. package/fesm2015/taiga-ui-cdk-directives-focusable.js.map +1 -1
  370. package/fesm2015/taiga-ui-cdk-directives-focused.js.map +1 -1
  371. package/fesm2015/taiga-ui-cdk-directives-for.js.map +1 -1
  372. package/fesm2015/taiga-ui-cdk-directives-high-dpi.js.map +1 -1
  373. package/fesm2015/taiga-ui-cdk-directives-hovered.js.map +1 -1
  374. package/fesm2015/taiga-ui-cdk-directives-input-mode.js.map +1 -1
  375. package/fesm2015/taiga-ui-cdk-directives-item.js +30 -0
  376. package/fesm2015/taiga-ui-cdk-directives-item.js.map +1 -0
  377. package/fesm2015/taiga-ui-cdk-directives-let.js.map +1 -1
  378. package/fesm2015/taiga-ui-cdk-directives-media.js +1 -1
  379. package/fesm2015/taiga-ui-cdk-directives-media.js.map +1 -1
  380. package/fesm2015/taiga-ui-cdk-directives-obscured.js.map +1 -1
  381. package/fesm2015/taiga-ui-cdk-directives-overscroll.js.map +1 -1
  382. package/fesm2015/taiga-ui-cdk-directives-pan.js +2 -1
  383. package/fesm2015/taiga-ui-cdk-directives-pan.js.map +1 -1
  384. package/fesm2015/taiga-ui-cdk-directives-pressed.js.map +1 -1
  385. package/fesm2015/taiga-ui-cdk-directives-prevent-default.js.map +1 -1
  386. package/fesm2015/taiga-ui-cdk-directives-repeat-times.js.map +1 -1
  387. package/fesm2015/taiga-ui-cdk-directives-resize.js.map +1 -1
  388. package/fesm2015/taiga-ui-cdk-directives-swipe.js +2 -1
  389. package/fesm2015/taiga-ui-cdk-directives-swipe.js.map +1 -1
  390. package/fesm2015/taiga-ui-cdk-directives-validator.js.map +1 -1
  391. package/fesm2015/taiga-ui-cdk-directives-zoom.js +2 -1
  392. package/fesm2015/taiga-ui-cdk-directives-zoom.js.map +1 -1
  393. package/fesm2015/taiga-ui-cdk-directives.js +5 -4
  394. package/fesm2015/taiga-ui-cdk-directives.js.map +1 -1
  395. package/fesm2015/taiga-ui-cdk-enums.js +11 -11
  396. package/fesm2015/taiga-ui-cdk-enums.js.map +1 -1
  397. package/fesm2015/taiga-ui-cdk-observables.js.map +1 -1
  398. package/fesm2015/taiga-ui-cdk-pipes-filter.js.map +1 -1
  399. package/fesm2015/taiga-ui-cdk-pipes-mapper.js.map +1 -1
  400. package/fesm2015/taiga-ui-cdk-services.js +29 -29
  401. package/fesm2015/taiga-ui-cdk-services.js.map +1 -1
  402. package/fesm2015/taiga-ui-cdk-tokens.js +7 -7
  403. package/fesm2015/taiga-ui-cdk-tokens.js.map +1 -1
  404. package/fesm2015/taiga-ui-cdk-utils-dom.js +7 -7
  405. package/fesm2015/taiga-ui-cdk-utils-dom.js.map +1 -1
  406. package/fesm2015/taiga-ui-cdk-utils-focus.js.map +1 -1
  407. package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js +13 -13
  408. package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js.map +1 -1
  409. package/fesm5/taiga-ui-cdk-abstract.js +45 -7
  410. package/fesm5/taiga-ui-cdk-abstract.js.map +1 -1
  411. package/fesm5/taiga-ui-cdk-components-dialog-host.js.map +1 -1
  412. package/fesm5/taiga-ui-cdk-components-portal-host.js.map +1 -1
  413. package/fesm5/taiga-ui-cdk-constants.js.map +1 -1
  414. package/fesm5/taiga-ui-cdk-date-time.js +343 -343
  415. package/fesm5/taiga-ui-cdk-date-time.js.map +1 -1
  416. package/fesm5/taiga-ui-cdk-directives-active-zone.js.map +1 -1
  417. package/fesm5/taiga-ui-cdk-directives-auto-focus.js.map +1 -1
  418. package/fesm5/taiga-ui-cdk-directives-autofilled.js.map +1 -1
  419. package/fesm5/taiga-ui-cdk-directives-checked.js.map +1 -1
  420. package/fesm5/taiga-ui-cdk-directives-copy-processor.js +56 -0
  421. package/fesm5/taiga-ui-cdk-directives-copy-processor.js.map +1 -0
  422. package/fesm5/taiga-ui-cdk-directives-drag.js.map +1 -1
  423. package/fesm5/taiga-ui-cdk-directives-droppable.js.map +1 -1
  424. package/fesm5/taiga-ui-cdk-directives-element.js.map +1 -1
  425. package/fesm5/taiga-ui-cdk-directives-focus-trap.js.map +1 -1
  426. package/fesm5/taiga-ui-cdk-directives-focus-visible.js.map +1 -1
  427. package/fesm5/taiga-ui-cdk-directives-focusable.js.map +1 -1
  428. package/fesm5/taiga-ui-cdk-directives-focused.js.map +1 -1
  429. package/fesm5/taiga-ui-cdk-directives-for.js.map +1 -1
  430. package/fesm5/taiga-ui-cdk-directives-high-dpi.js.map +1 -1
  431. package/fesm5/taiga-ui-cdk-directives-hovered.js.map +1 -1
  432. package/fesm5/taiga-ui-cdk-directives-input-mode.js.map +1 -1
  433. package/fesm5/taiga-ui-cdk-directives-item.js +36 -0
  434. package/fesm5/taiga-ui-cdk-directives-item.js.map +1 -0
  435. package/fesm5/taiga-ui-cdk-directives-let.js.map +1 -1
  436. package/fesm5/taiga-ui-cdk-directives-media.js +1 -1
  437. package/fesm5/taiga-ui-cdk-directives-media.js.map +1 -1
  438. package/fesm5/taiga-ui-cdk-directives-obscured.js.map +1 -1
  439. package/fesm5/taiga-ui-cdk-directives-overscroll.js.map +1 -1
  440. package/fesm5/taiga-ui-cdk-directives-pan.js +2 -1
  441. package/fesm5/taiga-ui-cdk-directives-pan.js.map +1 -1
  442. package/fesm5/taiga-ui-cdk-directives-pressed.js.map +1 -1
  443. package/fesm5/taiga-ui-cdk-directives-prevent-default.js.map +1 -1
  444. package/fesm5/taiga-ui-cdk-directives-repeat-times.js.map +1 -1
  445. package/fesm5/taiga-ui-cdk-directives-resize.js.map +1 -1
  446. package/fesm5/taiga-ui-cdk-directives-swipe.js +2 -1
  447. package/fesm5/taiga-ui-cdk-directives-swipe.js.map +1 -1
  448. package/fesm5/taiga-ui-cdk-directives-validator.js.map +1 -1
  449. package/fesm5/taiga-ui-cdk-directives-zoom.js +2 -1
  450. package/fesm5/taiga-ui-cdk-directives-zoom.js.map +1 -1
  451. package/fesm5/taiga-ui-cdk-directives.js +5 -4
  452. package/fesm5/taiga-ui-cdk-directives.js.map +1 -1
  453. package/fesm5/taiga-ui-cdk-enums.js +11 -11
  454. package/fesm5/taiga-ui-cdk-enums.js.map +1 -1
  455. package/fesm5/taiga-ui-cdk-observables.js.map +1 -1
  456. package/fesm5/taiga-ui-cdk-pipes-filter.js.map +1 -1
  457. package/fesm5/taiga-ui-cdk-pipes-mapper.js.map +1 -1
  458. package/fesm5/taiga-ui-cdk-services.js +39 -39
  459. package/fesm5/taiga-ui-cdk-services.js.map +1 -1
  460. package/fesm5/taiga-ui-cdk-tokens.js +7 -7
  461. package/fesm5/taiga-ui-cdk-tokens.js.map +1 -1
  462. package/fesm5/taiga-ui-cdk-utils-dom.js +7 -7
  463. package/fesm5/taiga-ui-cdk-utils-dom.js.map +1 -1
  464. package/fesm5/taiga-ui-cdk-utils-focus.js.map +1 -1
  465. package/fesm5/taiga-ui-cdk-utils-miscellaneous.js +14 -14
  466. package/fesm5/taiga-ui-cdk-utils-miscellaneous.js.map +1 -1
  467. package/interfaces/focusable-element-accessor.d.ts +2 -0
  468. package/interfaces/index.d.ts +1 -1
  469. package/interfaces/taiga-ui-cdk-interfaces.metadata.json +1 -1
  470. package/observables/taiga-ui-cdk-observables.metadata.json +1 -1
  471. package/package.json +2 -2
  472. package/pipes/filter/taiga-ui-cdk-pipes-filter.metadata.json +1 -1
  473. package/pipes/mapper/taiga-ui-cdk-pipes-mapper.metadata.json +1 -1
  474. package/services/index.d.ts +1 -1
  475. package/services/taiga-ui-cdk-services.metadata.json +1 -1
  476. package/tokens/index.d.ts +2 -2
  477. package/tokens/taiga-ui-cdk-tokens.metadata.json +1 -1
  478. package/types/index.d.ts +1 -1
  479. package/types/taiga-ui-cdk-types.metadata.json +1 -1
  480. package/utils/dom/index.d.ts +1 -1
  481. package/utils/dom/taiga-ui-cdk-utils-dom.metadata.json +1 -1
  482. package/utils/miscellaneous/index.d.ts +2 -2
  483. package/utils/miscellaneous/taiga-ui-cdk-utils-miscellaneous.metadata.json +1 -1
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@taiga-ui/cdk/classes'), require('@taiga-ui/cdk/utils/format'), require('@taiga-ui/cdk/utils/math'), require('@taiga-ui/cdk/constants'), require('@angular/core')) :
3
- typeof define === 'function' && define.amd ? define('@taiga-ui/cdk/date-time', ['exports', '@taiga-ui/cdk/classes', '@taiga-ui/cdk/utils/format', '@taiga-ui/cdk/utils/math', '@taiga-ui/cdk/constants', '@angular/core'], factory) :
4
- (global = global || self, factory((global['taiga-ui'] = global['taiga-ui'] || {}, global['taiga-ui'].cdk = global['taiga-ui'].cdk || {}, global['taiga-ui'].cdk['date-time'] = {}), global['taiga-ui'].cdk.classes, global['taiga-ui'].cdk.utils.format, global['taiga-ui'].cdk.utils.math, global['taiga-ui'].cdk.constants, global.ng.core));
5
- }(this, (function (exports, classes, format, math, constants, core) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@taiga-ui/cdk/constants'), require('@taiga-ui/cdk/classes'), require('@taiga-ui/cdk/utils/format'), require('@taiga-ui/cdk/utils/math')) :
3
+ typeof define === 'function' && define.amd ? define('@taiga-ui/cdk/date-time', ['exports', '@angular/core', '@taiga-ui/cdk/constants', '@taiga-ui/cdk/classes', '@taiga-ui/cdk/utils/format', '@taiga-ui/cdk/utils/math'], factory) :
4
+ (global = global || self, factory((global['taiga-ui'] = global['taiga-ui'] || {}, global['taiga-ui'].cdk = global['taiga-ui'].cdk || {}, global['taiga-ui'].cdk['date-time'] = {}), global.ng.core, global['taiga-ui'].cdk.constants, global['taiga-ui'].cdk.classes, global['taiga-ui'].cdk.utils.format, global['taiga-ui'].cdk.utils.math));
5
+ }(this, (function (exports, core, constants, classes, format, math) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -241,6 +241,44 @@
241
241
  var MILLISECONDS_IN_HOUR = MILLISECONDS_IN_MINUTE * MINUTES_IN_HOUR;
242
242
  var MILLISECONDS_IN_DAY = MILLISECONDS_IN_HOUR * HOURS_IN_DAY;
243
243
 
244
+ /**
245
+ * @deprecated dont use it. See {@link TUI_DATE_FORMAT}
246
+ * TODO: get rid of this in v3.0
247
+ */
248
+ var TUI_DATE_FILLER = new core.InjectionToken('date filler for Taiga UI', {
249
+ factory: function () { return "dd.mm.yyyy"; },
250
+ });
251
+ /**
252
+ * @deprecated dont use it
253
+ * TODO: get rid of this in v3.0
254
+ */
255
+ var TUI_DATE_RANGE_FILLER = new core.InjectionToken('date range filler for Taiga UI', {
256
+ factory: function () {
257
+ var dateFiller = core.inject(TUI_DATE_FILLER);
258
+ return "" + dateFiller + RANGE_SEPARATOR_CHAR + dateFiller;
259
+ },
260
+ });
261
+ /**
262
+ * @internal 'dd.mm.yyyy'.length
263
+ * Used in:
264
+ * - {@link TuiInputDateComponent}
265
+ * - {@link TuiInputDateRangeComponent}
266
+ * - {@link TuiInputDateTimeComponent}
267
+ */
268
+ var DATE_FILLER_LENGTH = 10;
269
+ /**
270
+ * @internal
271
+ * Used in {@link TuiInputDateRangeComponent}
272
+ */
273
+ var DATE_RANGE_FILLER_LENGTH = 2 * DATE_FILLER_LENGTH + RANGE_SEPARATOR_CHAR.length;
274
+
275
+ /**
276
+ * TODO This token supports only DMY now. Add other {@link TuiDateMode} support
277
+ */
278
+ var TUI_DATE_FORMAT = new core.InjectionToken('Active date format for Taiga UI', {
279
+ factory: function () { return 'DMY'; },
280
+ });
281
+
244
282
  /**
245
283
  * Immutable year object
246
284
  * @nosideeffects
@@ -250,6 +288,54 @@
250
288
  this.year = year;
251
289
  classes.tuiAssert.assert(TuiYear.isValidYear(year));
252
290
  }
291
+ /**
292
+ * Checks year for validity
293
+ */
294
+ TuiYear.isValidYear = function (year) {
295
+ return Number.isInteger(year) && math.inRange(year, MIN_YEAR, MAX_YEAR + 1);
296
+ };
297
+ /**
298
+ * Check if passed year is a leap year
299
+ */
300
+ TuiYear.isLeapYear = function (year) {
301
+ classes.tuiAssert.assert(TuiYear.isValidYear(year));
302
+ return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0);
303
+ };
304
+ /**
305
+ * Returns amount of leap years from year 0 to the passed one
306
+ */
307
+ TuiYear.getAbsoluteLeapYears = function (year) {
308
+ classes.tuiAssert.assert(TuiYear.isValidYear(year));
309
+ return Math.ceil(year / 400) + (Math.ceil(year / 4) - Math.ceil(year / 100));
310
+ };
311
+ /**
312
+ * @deprecated DONT USE IT (will be deleted soon)
313
+ *
314
+ * Returns day of week offset of the beginning of the passed year
315
+ *
316
+ * @param year
317
+ * @param absoluteLeapYears amount of leap years prior to the passed one
318
+ * @return offset in days
319
+ */
320
+ TuiYear.getYearStartDaysOffset = function (year, absoluteLeapYears) {
321
+ classes.tuiAssert.assert(TuiYear.isValidYear(year));
322
+ classes.tuiAssert.assert(Number.isInteger(absoluteLeapYears));
323
+ classes.tuiAssert.assert(year >= absoluteLeapYears);
324
+ classes.tuiAssert.assert(absoluteLeapYears >= 0);
325
+ return ((absoluteLeapYears * DAYS_IN_LEAP_YEAR +
326
+ (year - absoluteLeapYears) * DAYS_IN_NORMAL_YEAR +
327
+ 5) %
328
+ DAYS_IN_WEEK);
329
+ };
330
+ TuiYear.lengthBetween = function (from, to) {
331
+ return to.year - from.year;
332
+ };
333
+ /**
334
+ * Normalizes year by clamping it between min and max years
335
+ */
336
+ TuiYear.normalizeYearPart = function (year) {
337
+ return math.normalizeToIntNumber(year, MIN_YEAR, MAX_YEAR);
338
+ };
253
339
  Object.defineProperty(TuiYear.prototype, "formattedYear", {
254
340
  get: function () {
255
341
  return format.padStart(this.year.toString(), 4, '0');
@@ -342,54 +428,6 @@
342
428
  TuiYear.prototype.toJSON = function () {
343
429
  return this.formattedYear;
344
430
  };
345
- /**
346
- * Checks year for validity
347
- */
348
- TuiYear.isValidYear = function (year) {
349
- return Number.isInteger(year) && math.inRange(year, MIN_YEAR, MAX_YEAR + 1);
350
- };
351
- /**
352
- * Check if passed year is a leap year
353
- */
354
- TuiYear.isLeapYear = function (year) {
355
- classes.tuiAssert.assert(TuiYear.isValidYear(year));
356
- return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0);
357
- };
358
- /**
359
- * Returns amount of leap years from year 0 to the passed one
360
- */
361
- TuiYear.getAbsoluteLeapYears = function (year) {
362
- classes.tuiAssert.assert(TuiYear.isValidYear(year));
363
- return Math.ceil(year / 400) + (Math.ceil(year / 4) - Math.ceil(year / 100));
364
- };
365
- /**
366
- * @deprecated DONT USE IT (will be deleted soon)
367
- *
368
- * Returns day of week offset of the beginning of the passed year
369
- *
370
- * @param year
371
- * @param absoluteLeapYears amount of leap years prior to the passed one
372
- * @return offset in days
373
- */
374
- TuiYear.getYearStartDaysOffset = function (year, absoluteLeapYears) {
375
- classes.tuiAssert.assert(TuiYear.isValidYear(year));
376
- classes.tuiAssert.assert(Number.isInteger(absoluteLeapYears));
377
- classes.tuiAssert.assert(year >= absoluteLeapYears);
378
- classes.tuiAssert.assert(absoluteLeapYears >= 0);
379
- return ((absoluteLeapYears * DAYS_IN_LEAP_YEAR +
380
- (year - absoluteLeapYears) * DAYS_IN_NORMAL_YEAR +
381
- 5) %
382
- DAYS_IN_WEEK);
383
- };
384
- TuiYear.lengthBetween = function (from, to) {
385
- return to.year - from.year;
386
- };
387
- /**
388
- * Normalizes year by clamping it between min and max years
389
- */
390
- TuiYear.normalizeYearPart = function (year) {
391
- return math.normalizeToIntNumber(year, MIN_YEAR, MAX_YEAR);
392
- };
393
431
  return TuiYear;
394
432
  }());
395
433
 
@@ -408,6 +446,61 @@
408
446
  classes.tuiAssert.assert(TuiMonth.isValidMonth(year, month));
409
447
  return _this;
410
448
  }
449
+ /**
450
+ * Tests month and year for validity
451
+ */
452
+ TuiMonth.isValidMonth = function (year, month) {
453
+ return TuiYear.isValidYear(year) && TuiMonth.isValidMonthPart(month);
454
+ };
455
+ /**
456
+ * Returns number of days in a month
457
+ */
458
+ TuiMonth.getMonthDaysCount = function (month, isLeapYear) {
459
+ classes.tuiAssert.assert(TuiMonth.isValidMonthPart(month));
460
+ switch (month) {
461
+ case 1 /* February */:
462
+ return isLeapYear ? 29 : 28;
463
+ case 3 /* April */:
464
+ case 5 /* June */:
465
+ case 8 /* September */:
466
+ case 10 /* November */:
467
+ return 30;
468
+ default:
469
+ return 31;
470
+ }
471
+ };
472
+ /**
473
+ * Returns current month and year based on local time zone
474
+ * @nosideeffects
475
+ */
476
+ TuiMonth.currentLocal = function () {
477
+ var nativeDate = new Date();
478
+ return new TuiMonth(nativeDate.getFullYear(), nativeDate.getMonth());
479
+ };
480
+ /**
481
+ * Returns current month and year based on UTC
482
+ */
483
+ TuiMonth.currentUtc = function () {
484
+ var nativeDate = new Date();
485
+ return new TuiMonth(nativeDate.getUTCFullYear(), nativeDate.getUTCMonth());
486
+ };
487
+ TuiMonth.lengthBetween = function (from, to) {
488
+ var absoluteFrom = from.month + from.year * 12;
489
+ var absoluteTo = to.month + to.year * 12;
490
+ return absoluteTo - absoluteFrom;
491
+ };
492
+ /**
493
+ * Normalizes number by clamping it between min and max month
494
+ */
495
+ TuiMonth.normalizeMonthPart = function (month) {
496
+ return math.normalizeToIntNumber(month, MIN_MONTH, MAX_MONTH);
497
+ };
498
+ /**
499
+ * Tests month for validity
500
+ */
501
+ TuiMonth.isValidMonthPart = function (month) {
502
+ return Number.isInteger(month) && math.inRange(month, MIN_MONTH, MAX_MONTH + 1);
503
+ };
411
504
  Object.defineProperty(TuiMonth.prototype, "formattedMonthPart", {
412
505
  get: function () {
413
506
  return format.padStart((this.month + 1).toString(), 2, '0');
@@ -533,61 +626,6 @@
533
626
  TuiMonth.prototype.toUtcNativeDate = function () {
534
627
  return new Date(Date.UTC(this.year, this.month));
535
628
  };
536
- /**
537
- * Tests month and year for validity
538
- */
539
- TuiMonth.isValidMonth = function (year, month) {
540
- return TuiYear.isValidYear(year) && TuiMonth.isValidMonthPart(month);
541
- };
542
- /**
543
- * Returns number of days in a month
544
- */
545
- TuiMonth.getMonthDaysCount = function (month, isLeapYear) {
546
- classes.tuiAssert.assert(TuiMonth.isValidMonthPart(month));
547
- switch (month) {
548
- case 1 /* February */:
549
- return isLeapYear ? 29 : 28;
550
- case 3 /* April */:
551
- case 5 /* June */:
552
- case 8 /* September */:
553
- case 10 /* November */:
554
- return 30;
555
- default:
556
- return 31;
557
- }
558
- };
559
- /**
560
- * Returns current month and year based on local time zone
561
- * @nosideeffects
562
- */
563
- TuiMonth.currentLocal = function () {
564
- var nativeDate = new Date();
565
- return new TuiMonth(nativeDate.getFullYear(), nativeDate.getMonth());
566
- };
567
- /**
568
- * Returns current month and year based on UTC
569
- */
570
- TuiMonth.currentUtc = function () {
571
- var nativeDate = new Date();
572
- return new TuiMonth(nativeDate.getUTCFullYear(), nativeDate.getUTCMonth());
573
- };
574
- TuiMonth.lengthBetween = function (from, to) {
575
- var absoluteFrom = from.month + from.year * 12;
576
- var absoluteTo = to.month + to.year * 12;
577
- return absoluteTo - absoluteFrom;
578
- };
579
- /**
580
- * Normalizes number by clamping it between min and max month
581
- */
582
- TuiMonth.normalizeMonthPart = function (month) {
583
- return math.normalizeToIntNumber(month, MIN_MONTH, MAX_MONTH);
584
- };
585
- /**
586
- * Tests month for validity
587
- */
588
- TuiMonth.isValidMonthPart = function (month) {
589
- return Number.isInteger(month) && math.inRange(month, MIN_MONTH, MAX_MONTH + 1);
590
- };
591
629
  return TuiMonth;
592
630
  }(TuiYear));
593
631
 
@@ -603,18 +641,137 @@
603
641
  classes.tuiAssert.assert(TuiDay.isValidDay(year, month, day));
604
642
  return _this;
605
643
  }
606
- Object.defineProperty(TuiDay.prototype, "formattedDayPart", {
607
- get: function () {
608
- return format.padStart(this.day.toString(), 2, '0');
609
- },
610
- enumerable: true,
611
- configurable: true
612
- });
613
- Object.defineProperty(TuiDay.prototype, "formattedDay", {
614
- /**
615
- * Formatted whole date
616
- */
617
- get: function () {
644
+ /**
645
+ * Creates {@link TuiDay} from native {@link Date} based on local time zone
646
+ */
647
+ TuiDay.fromLocalNativeDate = function (date) {
648
+ return new TuiDay(date.getFullYear(), date.getMonth(), date.getDate());
649
+ };
650
+ /**
651
+ * Creates {@link TuiDay} from native {@link Date} using UTC
652
+ */
653
+ TuiDay.fromUtcNativeDate = function (date) {
654
+ return new TuiDay(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
655
+ };
656
+ /**
657
+ * Check validity of year, month and day
658
+ *
659
+ * @param year
660
+ * @param month
661
+ * @param day
662
+ * @return boolean validity
663
+ */
664
+ TuiDay.isValidDay = function (year, month, day) {
665
+ return (TuiMonth.isValidMonth(year, month) &&
666
+ Number.isInteger(day) &&
667
+ math.inRange(day, MIN_DAY, TuiMonth.getMonthDaysCount(month, TuiYear.isLeapYear(year)) + 1));
668
+ };
669
+ /**
670
+ * @deprecated DONT USE IT (will be deleted soon)
671
+ *
672
+ * Calculated day on a calendar grid
673
+ *
674
+ * @param month
675
+ * @param row row in a calendar
676
+ * @param col column in a calendar
677
+ * @return resulting day on these coordinates (could exceed passed month)
678
+ */
679
+ TuiDay.getDayFromMonthRowCol = function (month, row, col) {
680
+ classes.tuiAssert.assert(Number.isInteger(row));
681
+ classes.tuiAssert.assert(math.inRange(row, 0, 6));
682
+ classes.tuiAssert.assert(Number.isInteger(col));
683
+ classes.tuiAssert.assert(math.inRange(col, 0, DAYS_IN_WEEK));
684
+ var day = row * DAYS_IN_WEEK + col - month.monthStartDaysOffset + 1;
685
+ if (day > month.daysCount) {
686
+ day = day - month.daysCount;
687
+ month = month.append({ month: 1 });
688
+ }
689
+ if (day <= 0) {
690
+ month = month.append({ month: -1 });
691
+ day = month.daysCount + day;
692
+ }
693
+ return new TuiDay(month.year, month.month, day);
694
+ };
695
+ /**
696
+ * Current day based on local time zone
697
+ */
698
+ TuiDay.currentLocal = function () {
699
+ var nativeDate = new Date();
700
+ var year = nativeDate.getFullYear();
701
+ var month = nativeDate.getMonth();
702
+ var day = nativeDate.getDate();
703
+ return new TuiDay(year, month, day);
704
+ };
705
+ /**
706
+ * Calculates {@link TuiDay} normalizing year, month and day. {@link NaN} is turned into minimal value.
707
+ *
708
+ * @param year any year value, including invalid
709
+ * @param month any month value, including invalid (months start with 0)
710
+ * @param day any day value, including invalid
711
+ * @return normalized date
712
+ */
713
+ TuiDay.normalizeOf = function (year, month, day) {
714
+ var normalizedYear = TuiYear.normalizeYearPart(year);
715
+ var normalizedMonth = TuiMonth.normalizeMonthPart(month);
716
+ var normalizedDay = TuiDay.normalizeDayPart(day, normalizedMonth, normalizedYear);
717
+ return new TuiDay(normalizedYear, normalizedMonth, normalizedDay);
718
+ };
719
+ TuiDay.lengthBetween = function (from, to) {
720
+ return Math.round((to.toLocalNativeDate().getTime() - from.toLocalNativeDate().getTime()) /
721
+ (1000 * 60 * 60 * 24));
722
+ };
723
+ // TODO: Move month and year related code corresponding classes
724
+ /**
725
+ * Parsing a string with date with normalization
726
+ *
727
+ * @param yearMonthDayString date string in format of DD.MM.Yyyy
728
+ * @return normalized date
729
+ */
730
+ TuiDay.normalizeParse = function (yearMonthDayString) {
731
+ var day = parseInt(yearMonthDayString.slice(0, 2), 10);
732
+ var month = parseInt(yearMonthDayString.slice(3, 5), 10) - 1;
733
+ var year = parseInt(yearMonthDayString.slice(6, 10), 10);
734
+ return TuiDay.normalizeOf(year, month, day);
735
+ };
736
+ /**
737
+ * Parsing a date stringified in a toJSON format
738
+ * @param yearMonthDayString date string in format of YYYY-MM-DD
739
+ * @return date
740
+ * @throws exceptions if any part of the date is invalid
741
+ */
742
+ TuiDay.jsonParse = function (yearMonthDayString) {
743
+ var day = parseInt(yearMonthDayString.slice(8, 10), 10);
744
+ var month = parseInt(yearMonthDayString.slice(5, 7), 10) - 1;
745
+ var year = parseInt(yearMonthDayString.slice(0, 4), 10);
746
+ if (!TuiYear.isValidYear(year)) {
747
+ throw new Error('Invalid year: ' + year);
748
+ }
749
+ if (!TuiMonth.isValidMonth(year, month)) {
750
+ throw new Error('Invalid month: ' + month);
751
+ }
752
+ if (!Number.isInteger(day) ||
753
+ !math.inRange(day, MIN_DAY, TuiMonth.getMonthDaysCount(month, TuiYear.isLeapYear(year)) + 1)) {
754
+ throw new Error('Invalid day: ' + day);
755
+ }
756
+ return new TuiDay(year, month, day);
757
+ };
758
+ TuiDay.normalizeDayPart = function (day, month, year) {
759
+ classes.tuiAssert.assert(TuiMonth.isValidMonth(year, month));
760
+ var monthDaysCount = TuiMonth.getMonthDaysCount(month, TuiYear.isLeapYear(year));
761
+ return math.normalizeToIntNumber(day, 1, monthDaysCount);
762
+ };
763
+ Object.defineProperty(TuiDay.prototype, "formattedDayPart", {
764
+ get: function () {
765
+ return format.padStart(this.day.toString(), 2, '0');
766
+ },
767
+ enumerable: true,
768
+ configurable: true
769
+ });
770
+ Object.defineProperty(TuiDay.prototype, "formattedDay", {
771
+ /**
772
+ * Formatted whole date
773
+ */
774
+ get: function () {
618
775
  return this.formattedDayPart + "." + this.formattedMonth;
619
776
  },
620
777
  enumerable: true,
@@ -755,162 +912,9 @@
755
912
  TuiDay.prototype.toUtcNativeDate = function () {
756
913
  return new Date(Date.UTC(this.year, this.month, this.day));
757
914
  };
758
- /**
759
- * Creates {@link TuiDay} from native {@link Date} based on local time zone
760
- */
761
- TuiDay.fromLocalNativeDate = function (date) {
762
- return new TuiDay(date.getFullYear(), date.getMonth(), date.getDate());
763
- };
764
- /**
765
- * Creates {@link TuiDay} from native {@link Date} using UTC
766
- */
767
- TuiDay.fromUtcNativeDate = function (date) {
768
- return new TuiDay(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
769
- };
770
- /**
771
- * Check validity of year, month and day
772
- *
773
- * @param year
774
- * @param month
775
- * @param day
776
- * @return boolean validity
777
- */
778
- TuiDay.isValidDay = function (year, month, day) {
779
- return (TuiMonth.isValidMonth(year, month) &&
780
- Number.isInteger(day) &&
781
- math.inRange(day, MIN_DAY, TuiMonth.getMonthDaysCount(month, TuiYear.isLeapYear(year)) + 1));
782
- };
783
- /**
784
- * @deprecated DONT USE IT (will be deleted soon)
785
- *
786
- * Calculated day on a calendar grid
787
- *
788
- * @param month
789
- * @param row row in a calendar
790
- * @param col column in a calendar
791
- * @return resulting day on these coordinates (could exceed passed month)
792
- */
793
- TuiDay.getDayFromMonthRowCol = function (month, row, col) {
794
- classes.tuiAssert.assert(Number.isInteger(row));
795
- classes.tuiAssert.assert(math.inRange(row, 0, 6));
796
- classes.tuiAssert.assert(Number.isInteger(col));
797
- classes.tuiAssert.assert(math.inRange(col, 0, DAYS_IN_WEEK));
798
- var day = row * DAYS_IN_WEEK + col - month.monthStartDaysOffset + 1;
799
- if (day > month.daysCount) {
800
- day = day - month.daysCount;
801
- month = month.append({ month: 1 });
802
- }
803
- if (day <= 0) {
804
- month = month.append({ month: -1 });
805
- day = month.daysCount + day;
806
- }
807
- return new TuiDay(month.year, month.month, day);
808
- };
809
- /**
810
- * Current day based on local time zone
811
- */
812
- TuiDay.currentLocal = function () {
813
- var nativeDate = new Date();
814
- var year = nativeDate.getFullYear();
815
- var month = nativeDate.getMonth();
816
- var day = nativeDate.getDate();
817
- return new TuiDay(year, month, day);
818
- };
819
- /**
820
- * Calculates {@link TuiDay} normalizing year, month and day. {@link NaN} is turned into minimal value.
821
- *
822
- * @param year any year value, including invalid
823
- * @param month any month value, including invalid (months start with 0)
824
- * @param day any day value, including invalid
825
- * @return normalized date
826
- */
827
- TuiDay.normalizeOf = function (year, month, day) {
828
- var normalizedYear = TuiYear.normalizeYearPart(year);
829
- var normalizedMonth = TuiMonth.normalizeMonthPart(month);
830
- var normalizedDay = TuiDay.normalizeDayPart(day, normalizedMonth, normalizedYear);
831
- return new TuiDay(normalizedYear, normalizedMonth, normalizedDay);
832
- };
833
- TuiDay.lengthBetween = function (from, to) {
834
- return Math.round((to.toLocalNativeDate().getTime() - from.toLocalNativeDate().getTime()) /
835
- (1000 * 60 * 60 * 24));
836
- };
837
- // TODO: Move month and year related code corresponding classes
838
- /**
839
- * Parsing a string with date with normalization
840
- *
841
- * @param yearMonthDayString date string in format of DD.MM.Yyyy
842
- * @return normalized date
843
- */
844
- TuiDay.normalizeParse = function (yearMonthDayString) {
845
- var day = parseInt(yearMonthDayString.slice(0, 2), 10);
846
- var month = parseInt(yearMonthDayString.slice(3, 5), 10) - 1;
847
- var year = parseInt(yearMonthDayString.slice(6, 10), 10);
848
- return TuiDay.normalizeOf(year, month, day);
849
- };
850
- /**
851
- * Parsing a date stringified in a toJSON format
852
- * @param yearMonthDayString date string in format of YYYY-MM-DD
853
- * @return date
854
- * @throws exceptions if any part of the date is invalid
855
- */
856
- TuiDay.jsonParse = function (yearMonthDayString) {
857
- var day = parseInt(yearMonthDayString.slice(8, 10), 10);
858
- var month = parseInt(yearMonthDayString.slice(5, 7), 10) - 1;
859
- var year = parseInt(yearMonthDayString.slice(0, 4), 10);
860
- if (!TuiYear.isValidYear(year)) {
861
- throw new Error('Invalid year: ' + year);
862
- }
863
- if (!TuiMonth.isValidMonth(year, month)) {
864
- throw new Error('Invalid month: ' + month);
865
- }
866
- if (!Number.isInteger(day) ||
867
- !math.inRange(day, MIN_DAY, TuiMonth.getMonthDaysCount(month, TuiYear.isLeapYear(year)) + 1)) {
868
- throw new Error('Invalid day: ' + day);
869
- }
870
- return new TuiDay(year, month, day);
871
- };
872
- TuiDay.normalizeDayPart = function (day, month, year) {
873
- classes.tuiAssert.assert(TuiMonth.isValidMonth(year, month));
874
- var monthDaysCount = TuiMonth.getMonthDaysCount(month, TuiYear.isLeapYear(year));
875
- return math.normalizeToIntNumber(day, 1, monthDaysCount);
876
- };
877
915
  return TuiDay;
878
916
  }(TuiMonth));
879
917
 
880
- var TUI_FIRST_DAY = new TuiDay(MIN_YEAR, MIN_MONTH, MIN_DAY);
881
- var TUI_LAST_DAY = new TuiDay(MAX_YEAR, MAX_MONTH, 31);
882
-
883
- /**
884
- * @deprecated dont use it. See {@link TUI_DATE_FORMAT}
885
- * TODO: get rid of this in v3.0
886
- */
887
- var TUI_DATE_FILLER = new core.InjectionToken('date filler for Taiga UI', {
888
- factory: function () { return "dd.mm.yyyy"; },
889
- });
890
- /**
891
- * @deprecated dont use it
892
- * TODO: get rid of this in v3.0
893
- */
894
- var TUI_DATE_RANGE_FILLER = new core.InjectionToken('date range filler for Taiga UI', {
895
- factory: function () {
896
- var dateFiller = core.inject(TUI_DATE_FILLER);
897
- return "" + dateFiller + RANGE_SEPARATOR_CHAR + dateFiller;
898
- },
899
- });
900
- /**
901
- * @internal 'dd.mm.yyyy'.length
902
- * Used in:
903
- * - {@link TuiInputDateComponent}
904
- * - {@link TuiInputDateRangeComponent}
905
- * - {@link TuiInputDateTimeComponent}
906
- */
907
- var DATE_FILLER_LENGTH = 10;
908
- /**
909
- * @internal
910
- * Used in {@link TuiInputDateRangeComponent}
911
- */
912
- var DATE_RANGE_FILLER_LENGTH = 2 * DATE_FILLER_LENGTH + RANGE_SEPARATOR_CHAR.length;
913
-
914
918
  /**
915
919
  * An immutable range of two {@link TuiMonth} objects
916
920
  */
@@ -920,6 +924,11 @@
920
924
  this.to = to;
921
925
  classes.tuiAssert.assert(from.monthSameOrBefore(to));
922
926
  }
927
+ TuiMonthRange.sort = function (month1, month2) {
928
+ return month1.monthSameOrBefore(month2)
929
+ ? new TuiMonthRange(month1, month2)
930
+ : new TuiMonthRange(month2, month1);
931
+ };
923
932
  Object.defineProperty(TuiMonthRange.prototype, "isSingleMonth", {
924
933
  get: function () {
925
934
  return this.from.monthSame(this.to);
@@ -940,11 +949,6 @@
940
949
  TuiMonthRange.prototype.toString = function () {
941
950
  return "" + this.from + RANGE_SEPARATOR_CHAR + this.to;
942
951
  };
943
- TuiMonthRange.sort = function (month1, month2) {
944
- return month1.monthSameOrBefore(month2)
945
- ? new TuiMonthRange(month1, month2)
946
- : new TuiMonthRange(month2, month1);
947
- };
948
952
  return TuiMonthRange;
949
953
  }());
950
954
 
@@ -960,6 +964,31 @@
960
964
  classes.tuiAssert.assert(from.daySameOrBefore(to));
961
965
  return _this;
962
966
  }
967
+ /**
968
+ * Creates range from two days after sorting them
969
+ *
970
+ * @param day1
971
+ * @param day2
972
+ * @return new range with sorted days
973
+ */
974
+ TuiDayRange.sort = function (day1, day2) {
975
+ return day1.daySameOrBefore(day2)
976
+ ? new TuiDayRange(day1, day2)
977
+ : new TuiDayRange(day2, day1);
978
+ };
979
+ /**
980
+ * Parse and correct a day range in string format
981
+ *
982
+ * @param rangeString a string of dates in a format dd.mm.yyyy - dd.mm.yyyy
983
+ * @return normalized day range object
984
+ */
985
+ TuiDayRange.normalizeParse = function (rangeString) {
986
+ var leftDay = TuiDay.normalizeParse(rangeString.slice(0, DATE_FILLER_LENGTH));
987
+ if (rangeString.length < DATE_RANGE_FILLER_LENGTH) {
988
+ return new TuiDayRange(leftDay, leftDay);
989
+ }
990
+ return TuiDayRange.sort(leftDay, TuiDay.normalizeParse(rangeString.slice(DATE_FILLER_LENGTH + RANGE_SEPARATOR_CHAR.length)));
991
+ };
963
992
  Object.defineProperty(TuiDayRange.prototype, "isSingleDay", {
964
993
  get: function () {
965
994
  return this.from.daySame(this.to);
@@ -996,34 +1025,12 @@
996
1025
  TuiDayRange.prototype.dayLimit = function (min, max) {
997
1026
  return new TuiDayRange(this.from.dayLimit(min, max), this.to.dayLimit(min, max));
998
1027
  };
999
- /**
1000
- * Creates range from two days after sorting them
1001
- *
1002
- * @param day1
1003
- * @param day2
1004
- * @return new range with sorted days
1005
- */
1006
- TuiDayRange.sort = function (day1, day2) {
1007
- return day1.daySameOrBefore(day2)
1008
- ? new TuiDayRange(day1, day2)
1009
- : new TuiDayRange(day2, day1);
1010
- };
1011
- /**
1012
- * Parse and correct a day range in string format
1013
- *
1014
- * @param rangeString a string of dates in a format dd.mm.yyyy - dd.mm.yyyy
1015
- * @return normalized day range object
1016
- */
1017
- TuiDayRange.normalizeParse = function (rangeString) {
1018
- var leftDay = TuiDay.normalizeParse(rangeString.slice(0, DATE_FILLER_LENGTH));
1019
- if (rangeString.length < DATE_RANGE_FILLER_LENGTH) {
1020
- return new TuiDayRange(leftDay, leftDay);
1021
- }
1022
- return TuiDayRange.sort(leftDay, TuiDay.normalizeParse(rangeString.slice(DATE_FILLER_LENGTH + RANGE_SEPARATOR_CHAR.length)));
1023
- };
1024
1028
  return TuiDayRange;
1025
1029
  }(TuiMonthRange));
1026
1030
 
1031
+ var TUI_FIRST_DAY = new TuiDay(MIN_YEAR, MIN_MONTH, MIN_DAY);
1032
+ var TUI_LAST_DAY = new TuiDay(MAX_YEAR, MAX_MONTH, 31);
1033
+
1027
1034
  /**
1028
1035
  * Immutable time object with hours, minutes, seconds and ms
1029
1036
  */
@@ -1037,46 +1044,6 @@
1037
1044
  this.ms = ms;
1038
1045
  classes.tuiAssert.assert(TuiTime.isValidTime(hours, minutes, seconds, ms), 'Time must be real, but got:', hours, minutes, seconds, ms);
1039
1046
  }
1040
- /**
1041
- * Shifts time by hours and minutes
1042
- */
1043
- TuiTime.prototype.shift = function (_a) {
1044
- var _b = _a.hours, hours = _b === void 0 ? 0 : _b, _c = _a.minutes, minutes = _c === void 0 ? 0 : _c, _d = _a.seconds, seconds = _d === void 0 ? 0 : _d, _e = _a.ms, ms = _e === void 0 ? 0 : _e;
1045
- var newMs = (1000 + this.ms + (ms % 1000)) % 1000;
1046
- var secondsInMs = ms < 0 ? Math.ceil(ms / 1000) : Math.floor(ms / 1000);
1047
- var secondsToAdd = secondsInMs + seconds;
1048
- var newSeconds = (60 + this.seconds + (secondsToAdd % 60)) % 60;
1049
- var minutesInSeconds = secondsToAdd < 0
1050
- ? Math.ceil(secondsToAdd / 60)
1051
- : Math.floor(secondsToAdd / 60);
1052
- var minutesToAdd = minutesInSeconds + minutes;
1053
- var newMinutes = (60 + this.minutes + (minutesToAdd % 60)) % 60;
1054
- var hoursInMinutes = minutesToAdd < 0
1055
- ? Math.ceil(minutesToAdd / 60)
1056
- : Math.floor(minutesToAdd / 60);
1057
- var hoursToAdd = hoursInMinutes + hours;
1058
- var newHours = (24 + this.hours + (hoursToAdd % 24)) % 24;
1059
- return new TuiTime(newHours, newMinutes, newSeconds, newMs);
1060
- };
1061
- /**
1062
- * Converts TuiTime to string
1063
- */
1064
- TuiTime.prototype.toString = function (mode) {
1065
- var needAddMs = mode === 'HH:MM:SS.MSS' || (!mode && this.ms > 0);
1066
- var needAddSeconds = needAddMs || mode === 'HH:MM:SS' || (!mode && this.seconds > 0);
1067
- return (this.formatTime(this.hours) + ":" + this.formatTime(this.minutes) +
1068
- ("" + (needAddSeconds ? ':' + this.formatTime(this.seconds) : '')) +
1069
- ("" + (needAddMs ? '.' + this.formatTime(this.ms, 3) : '')));
1070
- };
1071
- /**
1072
- * Converts TuiTime to milliseconds
1073
- */
1074
- TuiTime.prototype.toAbsoluteMilliseconds = function () {
1075
- return (this.hours * MILLISECONDS_IN_HOUR +
1076
- this.minutes * MILLISECONDS_IN_MINUTE +
1077
- this.seconds * 1000 +
1078
- this.ms);
1079
- };
1080
1047
  /**
1081
1048
  * Checks if time is valid
1082
1049
  */
@@ -1135,6 +1102,46 @@
1135
1102
  TuiTime.fromLocalNativeDate = function (date) {
1136
1103
  return new TuiTime(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
1137
1104
  };
1105
+ /**
1106
+ * Shifts time by hours and minutes
1107
+ */
1108
+ TuiTime.prototype.shift = function (_a) {
1109
+ var _b = _a.hours, hours = _b === void 0 ? 0 : _b, _c = _a.minutes, minutes = _c === void 0 ? 0 : _c, _d = _a.seconds, seconds = _d === void 0 ? 0 : _d, _e = _a.ms, ms = _e === void 0 ? 0 : _e;
1110
+ var newMs = (1000 + this.ms + (ms % 1000)) % 1000;
1111
+ var secondsInMs = ms < 0 ? Math.ceil(ms / 1000) : Math.floor(ms / 1000);
1112
+ var secondsToAdd = secondsInMs + seconds;
1113
+ var newSeconds = (60 + this.seconds + (secondsToAdd % 60)) % 60;
1114
+ var minutesInSeconds = secondsToAdd < 0
1115
+ ? Math.ceil(secondsToAdd / 60)
1116
+ : Math.floor(secondsToAdd / 60);
1117
+ var minutesToAdd = minutesInSeconds + minutes;
1118
+ var newMinutes = (60 + this.minutes + (minutesToAdd % 60)) % 60;
1119
+ var hoursInMinutes = minutesToAdd < 0
1120
+ ? Math.ceil(minutesToAdd / 60)
1121
+ : Math.floor(minutesToAdd / 60);
1122
+ var hoursToAdd = hoursInMinutes + hours;
1123
+ var newHours = (24 + this.hours + (hoursToAdd % 24)) % 24;
1124
+ return new TuiTime(newHours, newMinutes, newSeconds, newMs);
1125
+ };
1126
+ /**
1127
+ * Converts TuiTime to string
1128
+ */
1129
+ TuiTime.prototype.toString = function (mode) {
1130
+ var needAddMs = mode === 'HH:MM:SS.MSS' || (!mode && this.ms > 0);
1131
+ var needAddSeconds = needAddMs || mode === 'HH:MM:SS' || (!mode && this.seconds > 0);
1132
+ return (this.formatTime(this.hours) + ":" + this.formatTime(this.minutes) +
1133
+ ("" + (needAddSeconds ? ':' + this.formatTime(this.seconds) : '')) +
1134
+ ("" + (needAddMs ? '.' + this.formatTime(this.ms, 3) : '')));
1135
+ };
1136
+ /**
1137
+ * Converts TuiTime to milliseconds
1138
+ */
1139
+ TuiTime.prototype.toAbsoluteMilliseconds = function () {
1140
+ return (this.hours * MILLISECONDS_IN_HOUR +
1141
+ this.minutes * MILLISECONDS_IN_MINUTE +
1142
+ this.seconds * 1000 +
1143
+ this.ms);
1144
+ };
1138
1145
  TuiTime.prototype.formatTime = function (time, digits) {
1139
1146
  if (digits === void 0) { digits = 2; }
1140
1147
  return format.padStart(time.toString(), digits, '0');
@@ -1142,13 +1149,6 @@
1142
1149
  return TuiTime;
1143
1150
  }());
1144
1151
 
1145
- /**
1146
- * TODO This token supports only DMY now. Add other {@link TuiDateMode} support
1147
- */
1148
- var TUI_DATE_FORMAT = new core.InjectionToken('Active date format for Taiga UI', {
1149
- factory: function () { return 'DMY'; },
1150
- });
1151
-
1152
1152
  exports.DATE_FILLER_LENGTH = DATE_FILLER_LENGTH;
1153
1153
  exports.DATE_RANGE_FILLER_LENGTH = DATE_RANGE_FILLER_LENGTH;
1154
1154
  exports.DAYS_IN_LEAP_YEAR = DAYS_IN_LEAP_YEAR;