@taiga-ui/cdk 2.23.0 → 2.27.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.
- package/README.md +7 -3
- package/abstract/control.d.ts +1 -1
- package/abstract/dialog.directive.d.ts +12 -0
- package/abstract/index.d.ts +1 -0
- package/abstract/interactive.d.ts +4 -4
- package/abstract/taiga-ui-cdk-abstract.metadata.json +1 -1
- package/bundles/taiga-ui-cdk-abstract.umd.js +45 -7
- package/bundles/taiga-ui-cdk-abstract.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-abstract.umd.min.js +2 -2
- package/bundles/taiga-ui-cdk-abstract.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-components-dialog-host.umd.js +1 -1
- package/bundles/taiga-ui-cdk-components-dialog-host.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-components-dialog-host.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-components-dialog-host.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-components-portal-host.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-components-portal-host.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-constants.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-date-time.umd.js +349 -349
- package/bundles/taiga-ui-cdk-date-time.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-date-time.umd.min.js +2 -2
- package/bundles/taiga-ui-cdk-date-time.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-active-zone.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-active-zone.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-auto-focus.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-auto-focus.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-autofilled.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-autofilled.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-checked.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-checked.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-copy-processor.umd.js +276 -0
- package/bundles/taiga-ui-cdk-directives-copy-processor.umd.js.map +1 -0
- package/bundles/taiga-ui-cdk-directives-copy-processor.umd.min.js +16 -0
- package/bundles/taiga-ui-cdk-directives-copy-processor.umd.min.js.map +1 -0
- package/bundles/taiga-ui-cdk-directives-drag.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-drag.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-droppable.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-droppable.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-element.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-element.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-focus-trap.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-focus-trap.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-focus-visible.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-focus-visible.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-focusable.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-focusable.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-focused.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-focused.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-for.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-for.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-high-dpi.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-high-dpi.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-hovered.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-hovered.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-input-mode.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-input-mode.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-item.umd.js +259 -0
- package/bundles/taiga-ui-cdk-directives-item.umd.js.map +1 -0
- package/bundles/taiga-ui-cdk-directives-item.umd.min.js +16 -0
- package/bundles/taiga-ui-cdk-directives-item.umd.min.js.map +1 -0
- package/bundles/taiga-ui-cdk-directives-let.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-let.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-media.umd.js +1 -1
- package/bundles/taiga-ui-cdk-directives-media.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-media.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-directives-media.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-obscured.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-obscured.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-pan.umd.js +5 -5
- package/bundles/taiga-ui-cdk-directives-pan.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-pan.umd.min.js +2 -2
- package/bundles/taiga-ui-cdk-directives-pan.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-pressed.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-pressed.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-prevent-default.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-prevent-default.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-repeat-times.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-repeat-times.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-resize.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-resize.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-swipe.umd.js +5 -5
- package/bundles/taiga-ui-cdk-directives-swipe.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-swipe.umd.min.js +2 -2
- package/bundles/taiga-ui-cdk-directives-swipe.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-validator.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-validator.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-zoom.umd.js +5 -5
- package/bundles/taiga-ui-cdk-directives-zoom.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-zoom.umd.min.js +2 -2
- package/bundles/taiga-ui-cdk-directives-zoom.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives.umd.js +26 -18
- package/bundles/taiga-ui-cdk-directives.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-enums.umd.js +11 -11
- package/bundles/taiga-ui-cdk-enums.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-enums.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-enums.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-observables.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-observables.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-pipes-filter.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-pipes-filter.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-pipes-mapper.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-pipes-mapper.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-services.umd.js +38 -38
- package/bundles/taiga-ui-cdk-services.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-services.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-services.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-tokens.umd.js +11 -11
- package/bundles/taiga-ui-cdk-tokens.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-tokens.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-tokens.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-dom.umd.js +8 -10
- package/bundles/taiga-ui-cdk-utils-dom.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-dom.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-focus.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-focus.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js +14 -14
- package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js.map +1 -1
- package/components/dialog-host/taiga-ui-cdk-components-dialog-host.metadata.json +1 -1
- package/components/portal-host/taiga-ui-cdk-components-portal-host.metadata.json +1 -1
- package/constants/taiga-ui-cdk-constants.metadata.json +1 -1
- package/date-time/day-range.d.ts +14 -14
- package/date-time/day.d.ts +57 -57
- package/date-time/index.d.ts +4 -4
- package/date-time/month-range.d.ts +1 -1
- package/date-time/month.d.ts +26 -26
- package/date-time/taiga-ui-cdk-date-time.metadata.json +1 -1
- package/date-time/time.d.ts +12 -12
- package/date-time/year.d.ts +27 -27
- package/directives/active-zone/taiga-ui-cdk-directives-active-zone.metadata.json +1 -1
- package/directives/auto-focus/taiga-ui-cdk-directives-auto-focus.metadata.json +1 -1
- package/directives/autofilled/taiga-ui-cdk-directives-autofilled.metadata.json +1 -1
- package/directives/checked/taiga-ui-cdk-directives-checked.metadata.json +1 -1
- package/directives/copy-processor/copy-processor.directive.d.ts +7 -0
- package/directives/copy-processor/copy-processor.module.d.ts +2 -0
- package/directives/copy-processor/index.d.ts +2 -0
- package/directives/copy-processor/package.json +13 -0
- package/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.d.ts +4 -0
- package/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.metadata.json +1 -0
- package/directives/drag/taiga-ui-cdk-directives-drag.metadata.json +1 -1
- package/directives/droppable/taiga-ui-cdk-directives-droppable.metadata.json +1 -1
- package/directives/element/taiga-ui-cdk-directives-element.metadata.json +1 -1
- package/directives/focus-trap/taiga-ui-cdk-directives-focus-trap.metadata.json +1 -1
- package/directives/focus-visible/taiga-ui-cdk-directives-focus-visible.metadata.json +1 -1
- package/directives/focusable/taiga-ui-cdk-directives-focusable.metadata.json +1 -1
- package/directives/focused/taiga-ui-cdk-directives-focused.metadata.json +1 -1
- package/directives/for/for.directive.d.ts +1 -1
- package/directives/for/taiga-ui-cdk-directives-for.metadata.json +1 -1
- package/directives/high-dpi/taiga-ui-cdk-directives-high-dpi.metadata.json +1 -1
- package/directives/hovered/taiga-ui-cdk-directives-hovered.metadata.json +1 -1
- package/directives/index.d.ts +5 -4
- package/directives/input-mode/taiga-ui-cdk-directives-input-mode.metadata.json +1 -1
- package/directives/item/index.d.ts +2 -0
- package/directives/item/item.directive.d.ts +6 -0
- package/directives/item/item.module.d.ts +2 -0
- package/directives/item/package.json +13 -0
- package/directives/item/taiga-ui-cdk-directives-item.d.ts +4 -0
- package/directives/item/taiga-ui-cdk-directives-item.metadata.json +1 -0
- package/directives/let/taiga-ui-cdk-directives-let.metadata.json +1 -1
- package/directives/media/media.directive.d.ts +1 -1
- package/directives/media/taiga-ui-cdk-directives-media.metadata.json +1 -1
- package/directives/obscured/taiga-ui-cdk-directives-obscured.metadata.json +1 -1
- package/directives/overscroll/taiga-ui-cdk-directives-overscroll.metadata.json +1 -1
- package/directives/pan/pan.directive.d.ts +3 -3
- package/directives/pan/taiga-ui-cdk-directives-pan.metadata.json +1 -1
- package/directives/pressed/taiga-ui-cdk-directives-pressed.metadata.json +1 -1
- package/directives/prevent-default/taiga-ui-cdk-directives-prevent-default.metadata.json +1 -1
- package/directives/repeat-times/taiga-ui-cdk-directives-repeat-times.metadata.json +1 -1
- package/directives/resize/taiga-ui-cdk-directives-resize.metadata.json +1 -1
- package/directives/swipe/swipe.directive.d.ts +4 -3
- package/directives/swipe/taiga-ui-cdk-directives-swipe.metadata.json +1 -1
- package/directives/taiga-ui-cdk-directives.metadata.json +1 -1
- package/directives/validator/taiga-ui-cdk-directives-validator.metadata.json +1 -1
- package/directives/zoom/taiga-ui-cdk-directives-zoom.metadata.json +1 -1
- package/directives/zoom/zoom.directive.d.ts +4 -3
- package/enums/index.d.ts +1 -1
- package/enums/taiga-ui-cdk-enums.metadata.json +1 -1
- package/esm2015/abstract/control.js +1 -1
- package/esm2015/abstract/dialog.directive.js +35 -0
- package/esm2015/abstract/index.js +2 -1
- package/esm2015/abstract/interactive.js +4 -4
- package/esm2015/abstract/multiple-control.js +1 -1
- package/esm2015/abstract/nullable-control.js +1 -1
- package/esm2015/components/dialog-host/dialog-host.component.js +3 -3
- package/esm2015/components/dialog-host/dialog-host.module.js +1 -1
- package/esm2015/components/portal-host/portal-host.component.js +1 -1
- package/esm2015/components/portal-host/portal-host.module.js +1 -1
- package/esm2015/components/portal-host/portal.service.js +1 -1
- package/esm2015/constants/matcher.js +1 -1
- package/esm2015/date-time/date-fillers.js +1 -1
- package/esm2015/date-time/day-range.js +26 -26
- package/esm2015/date-time/day.js +120 -120
- package/esm2015/date-time/index.js +5 -5
- package/esm2015/date-time/month-range.js +6 -6
- package/esm2015/date-time/month.js +56 -56
- package/esm2015/date-time/time.js +40 -40
- package/esm2015/date-time/year.js +49 -49
- package/esm2015/directives/active-zone/active-zone.module.js +1 -1
- package/esm2015/directives/auto-focus/autofocus.module.js +1 -1
- package/esm2015/directives/autofilled/autofilled.module.js +1 -1
- package/esm2015/directives/checked/checked.module.js +1 -1
- package/esm2015/directives/copy-processor/copy-processor.directive.js +37 -0
- package/esm2015/directives/copy-processor/copy-processor.module.js +13 -0
- package/esm2015/directives/copy-processor/index.js +3 -0
- package/esm2015/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.js +5 -0
- package/esm2015/directives/drag/drag.module.js +1 -1
- package/esm2015/directives/droppable/droppable.module.js +1 -1
- package/esm2015/directives/element/element.module.js +1 -1
- package/esm2015/directives/focus-trap/focus-trap.module.js +1 -1
- package/esm2015/directives/focus-visible/focus-visible.module.js +1 -1
- package/esm2015/directives/focusable/focusable.module.js +1 -1
- package/esm2015/directives/focused/focused.module.js +1 -1
- package/esm2015/directives/for/for.directive.js +1 -1
- package/esm2015/directives/for/for.module.js +1 -1
- package/esm2015/directives/high-dpi/high-dpi.module.js +1 -1
- package/esm2015/directives/hovered/hovered.module.js +1 -1
- package/esm2015/directives/index.js +6 -5
- package/esm2015/directives/input-mode/input-mode.module.js +1 -1
- package/esm2015/directives/item/index.js +3 -0
- package/esm2015/directives/item/item.directive.js +15 -0
- package/esm2015/directives/item/item.module.js +13 -0
- package/esm2015/directives/item/taiga-ui-cdk-directives-item.js +5 -0
- package/esm2015/directives/let/let.directive.js +1 -1
- package/esm2015/directives/let/let.module.js +1 -1
- package/esm2015/directives/media/media.directive.js +2 -2
- package/esm2015/directives/media/media.module.js +1 -1
- package/esm2015/directives/obscured/obscured.module.js +1 -1
- package/esm2015/directives/overscroll/overscroll.module.js +1 -1
- package/esm2015/directives/pan/pan.directive.js +3 -2
- package/esm2015/directives/pan/pan.module.js +1 -1
- package/esm2015/directives/pressed/pressed.module.js +1 -1
- package/esm2015/directives/prevent-default/prevent-default.module.js +1 -1
- package/esm2015/directives/repeat-times/repeat-times.module.js +1 -1
- package/esm2015/directives/resize/resize.module.js +1 -1
- package/esm2015/directives/swipe/swipe.directive.js +3 -2
- package/esm2015/directives/swipe/swipe.module.js +1 -1
- package/esm2015/directives/validator/validator.module.js +1 -1
- package/esm2015/directives/zoom/zoom.directive.js +3 -2
- package/esm2015/directives/zoom/zoom.module.js +1 -1
- package/esm2015/enums/index.js +2 -2
- package/esm2015/interfaces/base-dialog-context.js +1 -1
- package/esm2015/interfaces/base-dialog.js +1 -1
- package/esm2015/interfaces/focusable-element-accessor.js +1 -1
- package/esm2015/interfaces/index.js +1 -1
- package/esm2015/observables/drag-and-drop-from.js +1 -1
- package/esm2015/observables/focus-visible-observable.js +1 -1
- package/esm2015/observables/mouse-drag-finish-from.js +1 -1
- package/esm2015/observables/pressed-observable.js +1 -1
- package/esm2015/pipes/filter/filter.module.js +1 -1
- package/esm2015/pipes/mapper/mapper.module.js +1 -1
- package/esm2015/services/focus-visible.service.js +1 -1
- package/esm2015/services/index.js +2 -2
- package/esm2015/services/obscured.service.js +1 -1
- package/esm2015/services/pan.service.js +3 -3
- package/esm2015/services/resize.service.js +1 -1
- package/esm2015/services/static-request.service.js +1 -1
- package/esm2015/tokens/active-element.js +4 -5
- package/esm2015/tokens/index.js +3 -3
- package/esm2015/tokens/is-android.js +1 -1
- package/esm2015/types/index.js +1 -1
- package/esm2015/utils/dom/contains-or-after.js +2 -4
- package/esm2015/utils/dom/get-element-obscurers.js +1 -1
- package/esm2015/utils/dom/index.js +2 -2
- package/esm2015/utils/focus/get-closest-keyboard-focusable.js +1 -1
- package/esm2015/utils/miscellaneous/index.js +3 -3
- package/esm5/abstract/control.js +1 -1
- package/esm5/abstract/dialog.directive.js +44 -0
- package/esm5/abstract/index.js +2 -1
- package/esm5/abstract/interactive.js +4 -4
- package/esm5/abstract/multiple-control.js +1 -1
- package/esm5/abstract/nullable-control.js +1 -1
- package/esm5/components/dialog-host/dialog-host.component.js +3 -3
- package/esm5/components/dialog-host/dialog-host.module.js +1 -1
- package/esm5/components/portal-host/portal-host.component.js +1 -1
- package/esm5/components/portal-host/portal-host.module.js +1 -1
- package/esm5/components/portal-host/portal.service.js +1 -1
- package/esm5/constants/matcher.js +1 -1
- package/esm5/date-time/date-fillers.js +1 -1
- package/esm5/date-time/day-range.js +26 -26
- package/esm5/date-time/day.js +120 -120
- package/esm5/date-time/index.js +5 -5
- package/esm5/date-time/month-range.js +6 -6
- package/esm5/date-time/month.js +56 -56
- package/esm5/date-time/time.js +41 -41
- package/esm5/date-time/year.js +49 -49
- package/esm5/directives/active-zone/active-zone.module.js +1 -1
- package/esm5/directives/auto-focus/autofocus.module.js +1 -1
- package/esm5/directives/autofilled/autofilled.module.js +1 -1
- package/esm5/directives/checked/checked.module.js +1 -1
- package/esm5/directives/copy-processor/copy-processor.directive.js +38 -0
- package/esm5/directives/copy-processor/copy-processor.module.js +16 -0
- package/esm5/directives/copy-processor/index.js +3 -0
- package/esm5/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.js +5 -0
- package/esm5/directives/drag/drag.module.js +1 -1
- package/esm5/directives/droppable/droppable.module.js +1 -1
- package/esm5/directives/element/element.module.js +1 -1
- package/esm5/directives/focus-trap/focus-trap.module.js +1 -1
- package/esm5/directives/focus-visible/focus-visible.module.js +1 -1
- package/esm5/directives/focusable/focusable.module.js +1 -1
- package/esm5/directives/focused/focused.module.js +1 -1
- package/esm5/directives/for/for.directive.js +1 -1
- package/esm5/directives/for/for.module.js +1 -1
- package/esm5/directives/high-dpi/high-dpi.module.js +1 -1
- package/esm5/directives/hovered/hovered.module.js +1 -1
- package/esm5/directives/index.js +6 -5
- package/esm5/directives/input-mode/input-mode.module.js +1 -1
- package/esm5/directives/item/index.js +3 -0
- package/esm5/directives/item/item.directive.js +18 -0
- package/esm5/directives/item/item.module.js +16 -0
- package/esm5/directives/item/taiga-ui-cdk-directives-item.js +5 -0
- package/esm5/directives/let/let.directive.js +1 -1
- package/esm5/directives/let/let.module.js +1 -1
- package/esm5/directives/media/media.directive.js +2 -2
- package/esm5/directives/media/media.module.js +1 -1
- package/esm5/directives/obscured/obscured.module.js +1 -1
- package/esm5/directives/overscroll/overscroll.module.js +1 -1
- package/esm5/directives/pan/pan.directive.js +3 -2
- package/esm5/directives/pan/pan.module.js +1 -1
- package/esm5/directives/pressed/pressed.module.js +1 -1
- package/esm5/directives/prevent-default/prevent-default.module.js +1 -1
- package/esm5/directives/repeat-times/repeat-times.module.js +1 -1
- package/esm5/directives/resize/resize.module.js +1 -1
- package/esm5/directives/swipe/swipe.directive.js +3 -2
- package/esm5/directives/swipe/swipe.module.js +1 -1
- package/esm5/directives/validator/validator.module.js +1 -1
- package/esm5/directives/zoom/zoom.directive.js +3 -2
- package/esm5/directives/zoom/zoom.module.js +1 -1
- package/esm5/enums/index.js +2 -2
- package/esm5/interfaces/base-dialog-context.js +1 -1
- package/esm5/interfaces/base-dialog.js +1 -1
- package/esm5/interfaces/focusable-element-accessor.js +1 -1
- package/esm5/interfaces/index.js +1 -1
- package/esm5/observables/drag-and-drop-from.js +1 -1
- package/esm5/observables/focus-visible-observable.js +1 -1
- package/esm5/observables/mouse-drag-finish-from.js +1 -1
- package/esm5/observables/pressed-observable.js +1 -1
- package/esm5/pipes/filter/filter.module.js +1 -1
- package/esm5/pipes/mapper/mapper.module.js +1 -1
- package/esm5/services/focus-visible.service.js +1 -1
- package/esm5/services/index.js +2 -2
- package/esm5/services/obscured.service.js +1 -1
- package/esm5/services/pan.service.js +3 -3
- package/esm5/services/resize.service.js +1 -1
- package/esm5/services/static-request.service.js +1 -1
- package/esm5/tokens/active-element.js +5 -5
- package/esm5/tokens/index.js +3 -3
- package/esm5/tokens/is-android.js +1 -1
- package/esm5/types/index.js +1 -1
- package/esm5/utils/dom/contains-or-after.js +2 -4
- package/esm5/utils/dom/get-element-obscurers.js +1 -1
- package/esm5/utils/dom/index.js +2 -2
- package/esm5/utils/focus/get-closest-keyboard-focusable.js +1 -1
- package/esm5/utils/miscellaneous/index.js +3 -3
- package/fesm2015/taiga-ui-cdk-abstract.js +36 -7
- package/fesm2015/taiga-ui-cdk-abstract.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-components-dialog-host.js +1 -1
- package/fesm2015/taiga-ui-cdk-components-dialog-host.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-components-portal-host.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-date-time.js +343 -343
- package/fesm2015/taiga-ui-cdk-date-time.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-active-zone.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-auto-focus.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-autofilled.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-checked.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-copy-processor.js +52 -0
- package/fesm2015/taiga-ui-cdk-directives-copy-processor.js.map +1 -0
- package/fesm2015/taiga-ui-cdk-directives-drag.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-droppable.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-element.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-focus-trap.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-focus-visible.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-focusable.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-focused.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-for.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-high-dpi.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-hovered.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-input-mode.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-item.js +30 -0
- package/fesm2015/taiga-ui-cdk-directives-item.js.map +1 -0
- package/fesm2015/taiga-ui-cdk-directives-let.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-media.js +1 -1
- package/fesm2015/taiga-ui-cdk-directives-media.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-obscured.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-overscroll.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-pan.js +2 -1
- package/fesm2015/taiga-ui-cdk-directives-pan.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-pressed.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-prevent-default.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-repeat-times.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-resize.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-swipe.js +2 -1
- package/fesm2015/taiga-ui-cdk-directives-swipe.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-validator.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-zoom.js +2 -1
- package/fesm2015/taiga-ui-cdk-directives-zoom.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives.js +5 -4
- package/fesm2015/taiga-ui-cdk-directives.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-enums.js +11 -11
- package/fesm2015/taiga-ui-cdk-enums.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-observables.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-filter.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-mapper.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-services.js +29 -29
- package/fesm2015/taiga-ui-cdk-services.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-tokens.js +10 -11
- package/fesm2015/taiga-ui-cdk-tokens.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-dom.js +8 -10
- package/fesm2015/taiga-ui-cdk-utils-dom.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-focus.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js +13 -13
- package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js.map +1 -1
- package/fesm5/taiga-ui-cdk-abstract.js +45 -7
- package/fesm5/taiga-ui-cdk-abstract.js.map +1 -1
- package/fesm5/taiga-ui-cdk-components-dialog-host.js +1 -1
- package/fesm5/taiga-ui-cdk-components-dialog-host.js.map +1 -1
- package/fesm5/taiga-ui-cdk-components-portal-host.js.map +1 -1
- package/fesm5/taiga-ui-cdk-constants.js.map +1 -1
- package/fesm5/taiga-ui-cdk-date-time.js +343 -343
- package/fesm5/taiga-ui-cdk-date-time.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-active-zone.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-auto-focus.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-autofilled.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-checked.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-copy-processor.js +56 -0
- package/fesm5/taiga-ui-cdk-directives-copy-processor.js.map +1 -0
- package/fesm5/taiga-ui-cdk-directives-drag.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-droppable.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-element.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-focus-trap.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-focus-visible.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-focusable.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-focused.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-for.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-high-dpi.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-hovered.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-input-mode.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-item.js +36 -0
- package/fesm5/taiga-ui-cdk-directives-item.js.map +1 -0
- package/fesm5/taiga-ui-cdk-directives-let.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-media.js +1 -1
- package/fesm5/taiga-ui-cdk-directives-media.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-obscured.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-overscroll.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-pan.js +2 -1
- package/fesm5/taiga-ui-cdk-directives-pan.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-pressed.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-prevent-default.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-repeat-times.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-resize.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-swipe.js +2 -1
- package/fesm5/taiga-ui-cdk-directives-swipe.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-validator.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-zoom.js +2 -1
- package/fesm5/taiga-ui-cdk-directives-zoom.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives.js +5 -4
- package/fesm5/taiga-ui-cdk-directives.js.map +1 -1
- package/fesm5/taiga-ui-cdk-enums.js +11 -11
- package/fesm5/taiga-ui-cdk-enums.js.map +1 -1
- package/fesm5/taiga-ui-cdk-observables.js.map +1 -1
- package/fesm5/taiga-ui-cdk-pipes-filter.js.map +1 -1
- package/fesm5/taiga-ui-cdk-pipes-mapper.js.map +1 -1
- package/fesm5/taiga-ui-cdk-services.js +39 -39
- package/fesm5/taiga-ui-cdk-services.js.map +1 -1
- package/fesm5/taiga-ui-cdk-tokens.js +11 -11
- package/fesm5/taiga-ui-cdk-tokens.js.map +1 -1
- package/fesm5/taiga-ui-cdk-utils-dom.js +8 -10
- package/fesm5/taiga-ui-cdk-utils-dom.js.map +1 -1
- package/fesm5/taiga-ui-cdk-utils-focus.js.map +1 -1
- package/fesm5/taiga-ui-cdk-utils-miscellaneous.js +14 -14
- package/fesm5/taiga-ui-cdk-utils-miscellaneous.js.map +1 -1
- package/interfaces/focusable-element-accessor.d.ts +2 -0
- package/interfaces/index.d.ts +1 -1
- package/interfaces/taiga-ui-cdk-interfaces.metadata.json +1 -1
- package/observables/taiga-ui-cdk-observables.metadata.json +1 -1
- package/package.json +3 -3
- package/pipes/filter/taiga-ui-cdk-pipes-filter.metadata.json +1 -1
- package/pipes/mapper/taiga-ui-cdk-pipes-mapper.metadata.json +1 -1
- package/services/index.d.ts +1 -1
- package/services/taiga-ui-cdk-services.metadata.json +1 -1
- package/tokens/index.d.ts +2 -2
- package/tokens/taiga-ui-cdk-tokens.metadata.json +1 -1
- package/types/index.d.ts +1 -1
- package/types/taiga-ui-cdk-types.metadata.json +1 -1
- package/utils/dom/index.d.ts +1 -1
- package/utils/dom/taiga-ui-cdk-utils-dom.metadata.json +1 -1
- package/utils/miscellaneous/index.d.ts +2 -2
- package/utils/miscellaneous/taiga-ui-cdk-utils-miscellaneous.metadata.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { InjectionToken, inject } from '@angular/core';
|
|
2
|
+
import { CHAR_NO_BREAK_SPACE, CHAR_EN_DASH } from '@taiga-ui/cdk/constants';
|
|
1
3
|
import { __extends } from 'tslib';
|
|
2
4
|
import { tuiAssert } from '@taiga-ui/cdk/classes';
|
|
3
5
|
import { padStart } from '@taiga-ui/cdk/utils/format';
|
|
4
6
|
import { inRange, normalizeToIntNumber } from '@taiga-ui/cdk/utils/math';
|
|
5
|
-
import { CHAR_NO_BREAK_SPACE, CHAR_EN_DASH } from '@taiga-ui/cdk/constants';
|
|
6
|
-
import { InjectionToken, inject } from '@angular/core';
|
|
7
7
|
|
|
8
8
|
var DAYS_IN_WEEK = 7;
|
|
9
9
|
var DAYS_IN_NORMAL_YEAR = 365;
|
|
@@ -23,6 +23,44 @@ var MILLISECONDS_IN_MINUTE = MILLISECONDS_IN_SECOND * SECONDS_IN_MINUTE;
|
|
|
23
23
|
var MILLISECONDS_IN_HOUR = MILLISECONDS_IN_MINUTE * MINUTES_IN_HOUR;
|
|
24
24
|
var MILLISECONDS_IN_DAY = MILLISECONDS_IN_HOUR * HOURS_IN_DAY;
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated dont use it. See {@link TUI_DATE_FORMAT}
|
|
28
|
+
* TODO: get rid of this in v3.0
|
|
29
|
+
*/
|
|
30
|
+
var TUI_DATE_FILLER = new InjectionToken('date filler for Taiga UI', {
|
|
31
|
+
factory: function () { return "dd.mm.yyyy"; },
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated dont use it
|
|
35
|
+
* TODO: get rid of this in v3.0
|
|
36
|
+
*/
|
|
37
|
+
var TUI_DATE_RANGE_FILLER = new InjectionToken('date range filler for Taiga UI', {
|
|
38
|
+
factory: function () {
|
|
39
|
+
var dateFiller = inject(TUI_DATE_FILLER);
|
|
40
|
+
return "" + dateFiller + RANGE_SEPARATOR_CHAR + dateFiller;
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* @internal 'dd.mm.yyyy'.length
|
|
45
|
+
* Used in:
|
|
46
|
+
* - {@link TuiInputDateComponent}
|
|
47
|
+
* - {@link TuiInputDateRangeComponent}
|
|
48
|
+
* - {@link TuiInputDateTimeComponent}
|
|
49
|
+
*/
|
|
50
|
+
var DATE_FILLER_LENGTH = 10;
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
* Used in {@link TuiInputDateRangeComponent}
|
|
54
|
+
*/
|
|
55
|
+
var DATE_RANGE_FILLER_LENGTH = 2 * DATE_FILLER_LENGTH + RANGE_SEPARATOR_CHAR.length;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* TODO This token supports only DMY now. Add other {@link TuiDateMode} support
|
|
59
|
+
*/
|
|
60
|
+
var TUI_DATE_FORMAT = new InjectionToken('Active date format for Taiga UI', {
|
|
61
|
+
factory: function () { return 'DMY'; },
|
|
62
|
+
});
|
|
63
|
+
|
|
26
64
|
/**
|
|
27
65
|
* Immutable year object
|
|
28
66
|
* @nosideeffects
|
|
@@ -32,6 +70,54 @@ var TuiYear = /** @class */ (function () {
|
|
|
32
70
|
this.year = year;
|
|
33
71
|
tuiAssert.assert(TuiYear.isValidYear(year));
|
|
34
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Checks year for validity
|
|
75
|
+
*/
|
|
76
|
+
TuiYear.isValidYear = function (year) {
|
|
77
|
+
return Number.isInteger(year) && inRange(year, MIN_YEAR, MAX_YEAR + 1);
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Check if passed year is a leap year
|
|
81
|
+
*/
|
|
82
|
+
TuiYear.isLeapYear = function (year) {
|
|
83
|
+
tuiAssert.assert(TuiYear.isValidYear(year));
|
|
84
|
+
return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0);
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Returns amount of leap years from year 0 to the passed one
|
|
88
|
+
*/
|
|
89
|
+
TuiYear.getAbsoluteLeapYears = function (year) {
|
|
90
|
+
tuiAssert.assert(TuiYear.isValidYear(year));
|
|
91
|
+
return Math.ceil(year / 400) + (Math.ceil(year / 4) - Math.ceil(year / 100));
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* @deprecated DONT USE IT (will be deleted soon)
|
|
95
|
+
*
|
|
96
|
+
* Returns day of week offset of the beginning of the passed year
|
|
97
|
+
*
|
|
98
|
+
* @param year
|
|
99
|
+
* @param absoluteLeapYears amount of leap years prior to the passed one
|
|
100
|
+
* @return offset in days
|
|
101
|
+
*/
|
|
102
|
+
TuiYear.getYearStartDaysOffset = function (year, absoluteLeapYears) {
|
|
103
|
+
tuiAssert.assert(TuiYear.isValidYear(year));
|
|
104
|
+
tuiAssert.assert(Number.isInteger(absoluteLeapYears));
|
|
105
|
+
tuiAssert.assert(year >= absoluteLeapYears);
|
|
106
|
+
tuiAssert.assert(absoluteLeapYears >= 0);
|
|
107
|
+
return ((absoluteLeapYears * DAYS_IN_LEAP_YEAR +
|
|
108
|
+
(year - absoluteLeapYears) * DAYS_IN_NORMAL_YEAR +
|
|
109
|
+
5) %
|
|
110
|
+
DAYS_IN_WEEK);
|
|
111
|
+
};
|
|
112
|
+
TuiYear.lengthBetween = function (from, to) {
|
|
113
|
+
return to.year - from.year;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Normalizes year by clamping it between min and max years
|
|
117
|
+
*/
|
|
118
|
+
TuiYear.normalizeYearPart = function (year) {
|
|
119
|
+
return normalizeToIntNumber(year, MIN_YEAR, MAX_YEAR);
|
|
120
|
+
};
|
|
35
121
|
Object.defineProperty(TuiYear.prototype, "formattedYear", {
|
|
36
122
|
get: function () {
|
|
37
123
|
return padStart(this.year.toString(), 4, '0');
|
|
@@ -124,54 +210,6 @@ var TuiYear = /** @class */ (function () {
|
|
|
124
210
|
TuiYear.prototype.toJSON = function () {
|
|
125
211
|
return this.formattedYear;
|
|
126
212
|
};
|
|
127
|
-
/**
|
|
128
|
-
* Checks year for validity
|
|
129
|
-
*/
|
|
130
|
-
TuiYear.isValidYear = function (year) {
|
|
131
|
-
return Number.isInteger(year) && inRange(year, MIN_YEAR, MAX_YEAR + 1);
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* Check if passed year is a leap year
|
|
135
|
-
*/
|
|
136
|
-
TuiYear.isLeapYear = function (year) {
|
|
137
|
-
tuiAssert.assert(TuiYear.isValidYear(year));
|
|
138
|
-
return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0);
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Returns amount of leap years from year 0 to the passed one
|
|
142
|
-
*/
|
|
143
|
-
TuiYear.getAbsoluteLeapYears = function (year) {
|
|
144
|
-
tuiAssert.assert(TuiYear.isValidYear(year));
|
|
145
|
-
return Math.ceil(year / 400) + (Math.ceil(year / 4) - Math.ceil(year / 100));
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* @deprecated DONT USE IT (will be deleted soon)
|
|
149
|
-
*
|
|
150
|
-
* Returns day of week offset of the beginning of the passed year
|
|
151
|
-
*
|
|
152
|
-
* @param year
|
|
153
|
-
* @param absoluteLeapYears amount of leap years prior to the passed one
|
|
154
|
-
* @return offset in days
|
|
155
|
-
*/
|
|
156
|
-
TuiYear.getYearStartDaysOffset = function (year, absoluteLeapYears) {
|
|
157
|
-
tuiAssert.assert(TuiYear.isValidYear(year));
|
|
158
|
-
tuiAssert.assert(Number.isInteger(absoluteLeapYears));
|
|
159
|
-
tuiAssert.assert(year >= absoluteLeapYears);
|
|
160
|
-
tuiAssert.assert(absoluteLeapYears >= 0);
|
|
161
|
-
return ((absoluteLeapYears * DAYS_IN_LEAP_YEAR +
|
|
162
|
-
(year - absoluteLeapYears) * DAYS_IN_NORMAL_YEAR +
|
|
163
|
-
5) %
|
|
164
|
-
DAYS_IN_WEEK);
|
|
165
|
-
};
|
|
166
|
-
TuiYear.lengthBetween = function (from, to) {
|
|
167
|
-
return to.year - from.year;
|
|
168
|
-
};
|
|
169
|
-
/**
|
|
170
|
-
* Normalizes year by clamping it between min and max years
|
|
171
|
-
*/
|
|
172
|
-
TuiYear.normalizeYearPart = function (year) {
|
|
173
|
-
return normalizeToIntNumber(year, MIN_YEAR, MAX_YEAR);
|
|
174
|
-
};
|
|
175
213
|
return TuiYear;
|
|
176
214
|
}());
|
|
177
215
|
|
|
@@ -190,6 +228,61 @@ var TuiMonth = /** @class */ (function (_super) {
|
|
|
190
228
|
tuiAssert.assert(TuiMonth.isValidMonth(year, month));
|
|
191
229
|
return _this;
|
|
192
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Tests month and year for validity
|
|
233
|
+
*/
|
|
234
|
+
TuiMonth.isValidMonth = function (year, month) {
|
|
235
|
+
return TuiYear.isValidYear(year) && TuiMonth.isValidMonthPart(month);
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Returns number of days in a month
|
|
239
|
+
*/
|
|
240
|
+
TuiMonth.getMonthDaysCount = function (month, isLeapYear) {
|
|
241
|
+
tuiAssert.assert(TuiMonth.isValidMonthPart(month));
|
|
242
|
+
switch (month) {
|
|
243
|
+
case 1 /* February */:
|
|
244
|
+
return isLeapYear ? 29 : 28;
|
|
245
|
+
case 3 /* April */:
|
|
246
|
+
case 5 /* June */:
|
|
247
|
+
case 8 /* September */:
|
|
248
|
+
case 10 /* November */:
|
|
249
|
+
return 30;
|
|
250
|
+
default:
|
|
251
|
+
return 31;
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Returns current month and year based on local time zone
|
|
256
|
+
* @nosideeffects
|
|
257
|
+
*/
|
|
258
|
+
TuiMonth.currentLocal = function () {
|
|
259
|
+
var nativeDate = new Date();
|
|
260
|
+
return new TuiMonth(nativeDate.getFullYear(), nativeDate.getMonth());
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Returns current month and year based on UTC
|
|
264
|
+
*/
|
|
265
|
+
TuiMonth.currentUtc = function () {
|
|
266
|
+
var nativeDate = new Date();
|
|
267
|
+
return new TuiMonth(nativeDate.getUTCFullYear(), nativeDate.getUTCMonth());
|
|
268
|
+
};
|
|
269
|
+
TuiMonth.lengthBetween = function (from, to) {
|
|
270
|
+
var absoluteFrom = from.month + from.year * 12;
|
|
271
|
+
var absoluteTo = to.month + to.year * 12;
|
|
272
|
+
return absoluteTo - absoluteFrom;
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* Normalizes number by clamping it between min and max month
|
|
276
|
+
*/
|
|
277
|
+
TuiMonth.normalizeMonthPart = function (month) {
|
|
278
|
+
return normalizeToIntNumber(month, MIN_MONTH, MAX_MONTH);
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Tests month for validity
|
|
282
|
+
*/
|
|
283
|
+
TuiMonth.isValidMonthPart = function (month) {
|
|
284
|
+
return Number.isInteger(month) && inRange(month, MIN_MONTH, MAX_MONTH + 1);
|
|
285
|
+
};
|
|
193
286
|
Object.defineProperty(TuiMonth.prototype, "formattedMonthPart", {
|
|
194
287
|
get: function () {
|
|
195
288
|
return padStart((this.month + 1).toString(), 2, '0');
|
|
@@ -315,61 +408,6 @@ var TuiMonth = /** @class */ (function (_super) {
|
|
|
315
408
|
TuiMonth.prototype.toUtcNativeDate = function () {
|
|
316
409
|
return new Date(Date.UTC(this.year, this.month));
|
|
317
410
|
};
|
|
318
|
-
/**
|
|
319
|
-
* Tests month and year for validity
|
|
320
|
-
*/
|
|
321
|
-
TuiMonth.isValidMonth = function (year, month) {
|
|
322
|
-
return TuiYear.isValidYear(year) && TuiMonth.isValidMonthPart(month);
|
|
323
|
-
};
|
|
324
|
-
/**
|
|
325
|
-
* Returns number of days in a month
|
|
326
|
-
*/
|
|
327
|
-
TuiMonth.getMonthDaysCount = function (month, isLeapYear) {
|
|
328
|
-
tuiAssert.assert(TuiMonth.isValidMonthPart(month));
|
|
329
|
-
switch (month) {
|
|
330
|
-
case 1 /* February */:
|
|
331
|
-
return isLeapYear ? 29 : 28;
|
|
332
|
-
case 3 /* April */:
|
|
333
|
-
case 5 /* June */:
|
|
334
|
-
case 8 /* September */:
|
|
335
|
-
case 10 /* November */:
|
|
336
|
-
return 30;
|
|
337
|
-
default:
|
|
338
|
-
return 31;
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
/**
|
|
342
|
-
* Returns current month and year based on local time zone
|
|
343
|
-
* @nosideeffects
|
|
344
|
-
*/
|
|
345
|
-
TuiMonth.currentLocal = function () {
|
|
346
|
-
var nativeDate = new Date();
|
|
347
|
-
return new TuiMonth(nativeDate.getFullYear(), nativeDate.getMonth());
|
|
348
|
-
};
|
|
349
|
-
/**
|
|
350
|
-
* Returns current month and year based on UTC
|
|
351
|
-
*/
|
|
352
|
-
TuiMonth.currentUtc = function () {
|
|
353
|
-
var nativeDate = new Date();
|
|
354
|
-
return new TuiMonth(nativeDate.getUTCFullYear(), nativeDate.getUTCMonth());
|
|
355
|
-
};
|
|
356
|
-
TuiMonth.lengthBetween = function (from, to) {
|
|
357
|
-
var absoluteFrom = from.month + from.year * 12;
|
|
358
|
-
var absoluteTo = to.month + to.year * 12;
|
|
359
|
-
return absoluteTo - absoluteFrom;
|
|
360
|
-
};
|
|
361
|
-
/**
|
|
362
|
-
* Normalizes number by clamping it between min and max month
|
|
363
|
-
*/
|
|
364
|
-
TuiMonth.normalizeMonthPart = function (month) {
|
|
365
|
-
return normalizeToIntNumber(month, MIN_MONTH, MAX_MONTH);
|
|
366
|
-
};
|
|
367
|
-
/**
|
|
368
|
-
* Tests month for validity
|
|
369
|
-
*/
|
|
370
|
-
TuiMonth.isValidMonthPart = function (month) {
|
|
371
|
-
return Number.isInteger(month) && inRange(month, MIN_MONTH, MAX_MONTH + 1);
|
|
372
|
-
};
|
|
373
411
|
return TuiMonth;
|
|
374
412
|
}(TuiYear));
|
|
375
413
|
|
|
@@ -385,14 +423,133 @@ var TuiDay = /** @class */ (function (_super) {
|
|
|
385
423
|
tuiAssert.assert(TuiDay.isValidDay(year, month, day));
|
|
386
424
|
return _this;
|
|
387
425
|
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
426
|
+
/**
|
|
427
|
+
* Creates {@link TuiDay} from native {@link Date} based on local time zone
|
|
428
|
+
*/
|
|
429
|
+
TuiDay.fromLocalNativeDate = function (date) {
|
|
430
|
+
return new TuiDay(date.getFullYear(), date.getMonth(), date.getDate());
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* Creates {@link TuiDay} from native {@link Date} using UTC
|
|
434
|
+
*/
|
|
435
|
+
TuiDay.fromUtcNativeDate = function (date) {
|
|
436
|
+
return new TuiDay(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
|
|
437
|
+
};
|
|
438
|
+
/**
|
|
439
|
+
* Check validity of year, month and day
|
|
440
|
+
*
|
|
441
|
+
* @param year
|
|
442
|
+
* @param month
|
|
443
|
+
* @param day
|
|
444
|
+
* @return boolean validity
|
|
445
|
+
*/
|
|
446
|
+
TuiDay.isValidDay = function (year, month, day) {
|
|
447
|
+
return (TuiMonth.isValidMonth(year, month) &&
|
|
448
|
+
Number.isInteger(day) &&
|
|
449
|
+
inRange(day, MIN_DAY, TuiMonth.getMonthDaysCount(month, TuiYear.isLeapYear(year)) + 1));
|
|
450
|
+
};
|
|
451
|
+
/**
|
|
452
|
+
* @deprecated DONT USE IT (will be deleted soon)
|
|
453
|
+
*
|
|
454
|
+
* Calculated day on a calendar grid
|
|
455
|
+
*
|
|
456
|
+
* @param month
|
|
457
|
+
* @param row row in a calendar
|
|
458
|
+
* @param col column in a calendar
|
|
459
|
+
* @return resulting day on these coordinates (could exceed passed month)
|
|
460
|
+
*/
|
|
461
|
+
TuiDay.getDayFromMonthRowCol = function (month, row, col) {
|
|
462
|
+
tuiAssert.assert(Number.isInteger(row));
|
|
463
|
+
tuiAssert.assert(inRange(row, 0, 6));
|
|
464
|
+
tuiAssert.assert(Number.isInteger(col));
|
|
465
|
+
tuiAssert.assert(inRange(col, 0, DAYS_IN_WEEK));
|
|
466
|
+
var day = row * DAYS_IN_WEEK + col - month.monthStartDaysOffset + 1;
|
|
467
|
+
if (day > month.daysCount) {
|
|
468
|
+
day = day - month.daysCount;
|
|
469
|
+
month = month.append({ month: 1 });
|
|
470
|
+
}
|
|
471
|
+
if (day <= 0) {
|
|
472
|
+
month = month.append({ month: -1 });
|
|
473
|
+
day = month.daysCount + day;
|
|
474
|
+
}
|
|
475
|
+
return new TuiDay(month.year, month.month, day);
|
|
476
|
+
};
|
|
477
|
+
/**
|
|
478
|
+
* Current day based on local time zone
|
|
479
|
+
*/
|
|
480
|
+
TuiDay.currentLocal = function () {
|
|
481
|
+
var nativeDate = new Date();
|
|
482
|
+
var year = nativeDate.getFullYear();
|
|
483
|
+
var month = nativeDate.getMonth();
|
|
484
|
+
var day = nativeDate.getDate();
|
|
485
|
+
return new TuiDay(year, month, day);
|
|
486
|
+
};
|
|
487
|
+
/**
|
|
488
|
+
* Calculates {@link TuiDay} normalizing year, month and day. {@link NaN} is turned into minimal value.
|
|
489
|
+
*
|
|
490
|
+
* @param year any year value, including invalid
|
|
491
|
+
* @param month any month value, including invalid (months start with 0)
|
|
492
|
+
* @param day any day value, including invalid
|
|
493
|
+
* @return normalized date
|
|
494
|
+
*/
|
|
495
|
+
TuiDay.normalizeOf = function (year, month, day) {
|
|
496
|
+
var normalizedYear = TuiYear.normalizeYearPart(year);
|
|
497
|
+
var normalizedMonth = TuiMonth.normalizeMonthPart(month);
|
|
498
|
+
var normalizedDay = TuiDay.normalizeDayPart(day, normalizedMonth, normalizedYear);
|
|
499
|
+
return new TuiDay(normalizedYear, normalizedMonth, normalizedDay);
|
|
500
|
+
};
|
|
501
|
+
TuiDay.lengthBetween = function (from, to) {
|
|
502
|
+
return Math.round((to.toLocalNativeDate().getTime() - from.toLocalNativeDate().getTime()) /
|
|
503
|
+
(1000 * 60 * 60 * 24));
|
|
504
|
+
};
|
|
505
|
+
// TODO: Move month and year related code corresponding classes
|
|
506
|
+
/**
|
|
507
|
+
* Parsing a string with date with normalization
|
|
508
|
+
*
|
|
509
|
+
* @param yearMonthDayString date string in format of DD.MM.Yyyy
|
|
510
|
+
* @return normalized date
|
|
511
|
+
*/
|
|
512
|
+
TuiDay.normalizeParse = function (yearMonthDayString) {
|
|
513
|
+
var day = parseInt(yearMonthDayString.slice(0, 2), 10);
|
|
514
|
+
var month = parseInt(yearMonthDayString.slice(3, 5), 10) - 1;
|
|
515
|
+
var year = parseInt(yearMonthDayString.slice(6, 10), 10);
|
|
516
|
+
return TuiDay.normalizeOf(year, month, day);
|
|
517
|
+
};
|
|
518
|
+
/**
|
|
519
|
+
* Parsing a date stringified in a toJSON format
|
|
520
|
+
* @param yearMonthDayString date string in format of YYYY-MM-DD
|
|
521
|
+
* @return date
|
|
522
|
+
* @throws exceptions if any part of the date is invalid
|
|
523
|
+
*/
|
|
524
|
+
TuiDay.jsonParse = function (yearMonthDayString) {
|
|
525
|
+
var day = parseInt(yearMonthDayString.slice(8, 10), 10);
|
|
526
|
+
var month = parseInt(yearMonthDayString.slice(5, 7), 10) - 1;
|
|
527
|
+
var year = parseInt(yearMonthDayString.slice(0, 4), 10);
|
|
528
|
+
if (!TuiYear.isValidYear(year)) {
|
|
529
|
+
throw new Error('Invalid year: ' + year);
|
|
530
|
+
}
|
|
531
|
+
if (!TuiMonth.isValidMonth(year, month)) {
|
|
532
|
+
throw new Error('Invalid month: ' + month);
|
|
533
|
+
}
|
|
534
|
+
if (!Number.isInteger(day) ||
|
|
535
|
+
!inRange(day, MIN_DAY, TuiMonth.getMonthDaysCount(month, TuiYear.isLeapYear(year)) + 1)) {
|
|
536
|
+
throw new Error('Invalid day: ' + day);
|
|
537
|
+
}
|
|
538
|
+
return new TuiDay(year, month, day);
|
|
539
|
+
};
|
|
540
|
+
TuiDay.normalizeDayPart = function (day, month, year) {
|
|
541
|
+
tuiAssert.assert(TuiMonth.isValidMonth(year, month));
|
|
542
|
+
var monthDaysCount = TuiMonth.getMonthDaysCount(month, TuiYear.isLeapYear(year));
|
|
543
|
+
return normalizeToIntNumber(day, 1, monthDaysCount);
|
|
544
|
+
};
|
|
545
|
+
Object.defineProperty(TuiDay.prototype, "formattedDayPart", {
|
|
546
|
+
get: function () {
|
|
547
|
+
return padStart(this.day.toString(), 2, '0');
|
|
548
|
+
},
|
|
549
|
+
enumerable: true,
|
|
550
|
+
configurable: true
|
|
551
|
+
});
|
|
552
|
+
Object.defineProperty(TuiDay.prototype, "formattedDay", {
|
|
396
553
|
/**
|
|
397
554
|
* Formatted whole date
|
|
398
555
|
*/
|
|
@@ -537,162 +694,9 @@ var TuiDay = /** @class */ (function (_super) {
|
|
|
537
694
|
TuiDay.prototype.toUtcNativeDate = function () {
|
|
538
695
|
return new Date(Date.UTC(this.year, this.month, this.day));
|
|
539
696
|
};
|
|
540
|
-
/**
|
|
541
|
-
* Creates {@link TuiDay} from native {@link Date} based on local time zone
|
|
542
|
-
*/
|
|
543
|
-
TuiDay.fromLocalNativeDate = function (date) {
|
|
544
|
-
return new TuiDay(date.getFullYear(), date.getMonth(), date.getDate());
|
|
545
|
-
};
|
|
546
|
-
/**
|
|
547
|
-
* Creates {@link TuiDay} from native {@link Date} using UTC
|
|
548
|
-
*/
|
|
549
|
-
TuiDay.fromUtcNativeDate = function (date) {
|
|
550
|
-
return new TuiDay(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
|
|
551
|
-
};
|
|
552
|
-
/**
|
|
553
|
-
* Check validity of year, month and day
|
|
554
|
-
*
|
|
555
|
-
* @param year
|
|
556
|
-
* @param month
|
|
557
|
-
* @param day
|
|
558
|
-
* @return boolean validity
|
|
559
|
-
*/
|
|
560
|
-
TuiDay.isValidDay = function (year, month, day) {
|
|
561
|
-
return (TuiMonth.isValidMonth(year, month) &&
|
|
562
|
-
Number.isInteger(day) &&
|
|
563
|
-
inRange(day, MIN_DAY, TuiMonth.getMonthDaysCount(month, TuiYear.isLeapYear(year)) + 1));
|
|
564
|
-
};
|
|
565
|
-
/**
|
|
566
|
-
* @deprecated DONT USE IT (will be deleted soon)
|
|
567
|
-
*
|
|
568
|
-
* Calculated day on a calendar grid
|
|
569
|
-
*
|
|
570
|
-
* @param month
|
|
571
|
-
* @param row row in a calendar
|
|
572
|
-
* @param col column in a calendar
|
|
573
|
-
* @return resulting day on these coordinates (could exceed passed month)
|
|
574
|
-
*/
|
|
575
|
-
TuiDay.getDayFromMonthRowCol = function (month, row, col) {
|
|
576
|
-
tuiAssert.assert(Number.isInteger(row));
|
|
577
|
-
tuiAssert.assert(inRange(row, 0, 6));
|
|
578
|
-
tuiAssert.assert(Number.isInteger(col));
|
|
579
|
-
tuiAssert.assert(inRange(col, 0, DAYS_IN_WEEK));
|
|
580
|
-
var day = row * DAYS_IN_WEEK + col - month.monthStartDaysOffset + 1;
|
|
581
|
-
if (day > month.daysCount) {
|
|
582
|
-
day = day - month.daysCount;
|
|
583
|
-
month = month.append({ month: 1 });
|
|
584
|
-
}
|
|
585
|
-
if (day <= 0) {
|
|
586
|
-
month = month.append({ month: -1 });
|
|
587
|
-
day = month.daysCount + day;
|
|
588
|
-
}
|
|
589
|
-
return new TuiDay(month.year, month.month, day);
|
|
590
|
-
};
|
|
591
|
-
/**
|
|
592
|
-
* Current day based on local time zone
|
|
593
|
-
*/
|
|
594
|
-
TuiDay.currentLocal = function () {
|
|
595
|
-
var nativeDate = new Date();
|
|
596
|
-
var year = nativeDate.getFullYear();
|
|
597
|
-
var month = nativeDate.getMonth();
|
|
598
|
-
var day = nativeDate.getDate();
|
|
599
|
-
return new TuiDay(year, month, day);
|
|
600
|
-
};
|
|
601
|
-
/**
|
|
602
|
-
* Calculates {@link TuiDay} normalizing year, month and day. {@link NaN} is turned into minimal value.
|
|
603
|
-
*
|
|
604
|
-
* @param year any year value, including invalid
|
|
605
|
-
* @param month any month value, including invalid (months start with 0)
|
|
606
|
-
* @param day any day value, including invalid
|
|
607
|
-
* @return normalized date
|
|
608
|
-
*/
|
|
609
|
-
TuiDay.normalizeOf = function (year, month, day) {
|
|
610
|
-
var normalizedYear = TuiYear.normalizeYearPart(year);
|
|
611
|
-
var normalizedMonth = TuiMonth.normalizeMonthPart(month);
|
|
612
|
-
var normalizedDay = TuiDay.normalizeDayPart(day, normalizedMonth, normalizedYear);
|
|
613
|
-
return new TuiDay(normalizedYear, normalizedMonth, normalizedDay);
|
|
614
|
-
};
|
|
615
|
-
TuiDay.lengthBetween = function (from, to) {
|
|
616
|
-
return Math.round((to.toLocalNativeDate().getTime() - from.toLocalNativeDate().getTime()) /
|
|
617
|
-
(1000 * 60 * 60 * 24));
|
|
618
|
-
};
|
|
619
|
-
// TODO: Move month and year related code corresponding classes
|
|
620
|
-
/**
|
|
621
|
-
* Parsing a string with date with normalization
|
|
622
|
-
*
|
|
623
|
-
* @param yearMonthDayString date string in format of DD.MM.Yyyy
|
|
624
|
-
* @return normalized date
|
|
625
|
-
*/
|
|
626
|
-
TuiDay.normalizeParse = function (yearMonthDayString) {
|
|
627
|
-
var day = parseInt(yearMonthDayString.slice(0, 2), 10);
|
|
628
|
-
var month = parseInt(yearMonthDayString.slice(3, 5), 10) - 1;
|
|
629
|
-
var year = parseInt(yearMonthDayString.slice(6, 10), 10);
|
|
630
|
-
return TuiDay.normalizeOf(year, month, day);
|
|
631
|
-
};
|
|
632
|
-
/**
|
|
633
|
-
* Parsing a date stringified in a toJSON format
|
|
634
|
-
* @param yearMonthDayString date string in format of YYYY-MM-DD
|
|
635
|
-
* @return date
|
|
636
|
-
* @throws exceptions if any part of the date is invalid
|
|
637
|
-
*/
|
|
638
|
-
TuiDay.jsonParse = function (yearMonthDayString) {
|
|
639
|
-
var day = parseInt(yearMonthDayString.slice(8, 10), 10);
|
|
640
|
-
var month = parseInt(yearMonthDayString.slice(5, 7), 10) - 1;
|
|
641
|
-
var year = parseInt(yearMonthDayString.slice(0, 4), 10);
|
|
642
|
-
if (!TuiYear.isValidYear(year)) {
|
|
643
|
-
throw new Error('Invalid year: ' + year);
|
|
644
|
-
}
|
|
645
|
-
if (!TuiMonth.isValidMonth(year, month)) {
|
|
646
|
-
throw new Error('Invalid month: ' + month);
|
|
647
|
-
}
|
|
648
|
-
if (!Number.isInteger(day) ||
|
|
649
|
-
!inRange(day, MIN_DAY, TuiMonth.getMonthDaysCount(month, TuiYear.isLeapYear(year)) + 1)) {
|
|
650
|
-
throw new Error('Invalid day: ' + day);
|
|
651
|
-
}
|
|
652
|
-
return new TuiDay(year, month, day);
|
|
653
|
-
};
|
|
654
|
-
TuiDay.normalizeDayPart = function (day, month, year) {
|
|
655
|
-
tuiAssert.assert(TuiMonth.isValidMonth(year, month));
|
|
656
|
-
var monthDaysCount = TuiMonth.getMonthDaysCount(month, TuiYear.isLeapYear(year));
|
|
657
|
-
return normalizeToIntNumber(day, 1, monthDaysCount);
|
|
658
|
-
};
|
|
659
697
|
return TuiDay;
|
|
660
698
|
}(TuiMonth));
|
|
661
699
|
|
|
662
|
-
var TUI_FIRST_DAY = new TuiDay(MIN_YEAR, MIN_MONTH, MIN_DAY);
|
|
663
|
-
var TUI_LAST_DAY = new TuiDay(MAX_YEAR, MAX_MONTH, 31);
|
|
664
|
-
|
|
665
|
-
/**
|
|
666
|
-
* @deprecated dont use it. See {@link TUI_DATE_FORMAT}
|
|
667
|
-
* TODO: get rid of this in v3.0
|
|
668
|
-
*/
|
|
669
|
-
var TUI_DATE_FILLER = new InjectionToken('date filler for Taiga UI', {
|
|
670
|
-
factory: function () { return "dd.mm.yyyy"; },
|
|
671
|
-
});
|
|
672
|
-
/**
|
|
673
|
-
* @deprecated dont use it
|
|
674
|
-
* TODO: get rid of this in v3.0
|
|
675
|
-
*/
|
|
676
|
-
var TUI_DATE_RANGE_FILLER = new InjectionToken('date range filler for Taiga UI', {
|
|
677
|
-
factory: function () {
|
|
678
|
-
var dateFiller = inject(TUI_DATE_FILLER);
|
|
679
|
-
return "" + dateFiller + RANGE_SEPARATOR_CHAR + dateFiller;
|
|
680
|
-
},
|
|
681
|
-
});
|
|
682
|
-
/**
|
|
683
|
-
* @internal 'dd.mm.yyyy'.length
|
|
684
|
-
* Used in:
|
|
685
|
-
* - {@link TuiInputDateComponent}
|
|
686
|
-
* - {@link TuiInputDateRangeComponent}
|
|
687
|
-
* - {@link TuiInputDateTimeComponent}
|
|
688
|
-
*/
|
|
689
|
-
var DATE_FILLER_LENGTH = 10;
|
|
690
|
-
/**
|
|
691
|
-
* @internal
|
|
692
|
-
* Used in {@link TuiInputDateRangeComponent}
|
|
693
|
-
*/
|
|
694
|
-
var DATE_RANGE_FILLER_LENGTH = 2 * DATE_FILLER_LENGTH + RANGE_SEPARATOR_CHAR.length;
|
|
695
|
-
|
|
696
700
|
/**
|
|
697
701
|
* An immutable range of two {@link TuiMonth} objects
|
|
698
702
|
*/
|
|
@@ -702,6 +706,11 @@ var TuiMonthRange = /** @class */ (function () {
|
|
|
702
706
|
this.to = to;
|
|
703
707
|
tuiAssert.assert(from.monthSameOrBefore(to));
|
|
704
708
|
}
|
|
709
|
+
TuiMonthRange.sort = function (month1, month2) {
|
|
710
|
+
return month1.monthSameOrBefore(month2)
|
|
711
|
+
? new TuiMonthRange(month1, month2)
|
|
712
|
+
: new TuiMonthRange(month2, month1);
|
|
713
|
+
};
|
|
705
714
|
Object.defineProperty(TuiMonthRange.prototype, "isSingleMonth", {
|
|
706
715
|
get: function () {
|
|
707
716
|
return this.from.monthSame(this.to);
|
|
@@ -722,11 +731,6 @@ var TuiMonthRange = /** @class */ (function () {
|
|
|
722
731
|
TuiMonthRange.prototype.toString = function () {
|
|
723
732
|
return "" + this.from + RANGE_SEPARATOR_CHAR + this.to;
|
|
724
733
|
};
|
|
725
|
-
TuiMonthRange.sort = function (month1, month2) {
|
|
726
|
-
return month1.monthSameOrBefore(month2)
|
|
727
|
-
? new TuiMonthRange(month1, month2)
|
|
728
|
-
: new TuiMonthRange(month2, month1);
|
|
729
|
-
};
|
|
730
734
|
return TuiMonthRange;
|
|
731
735
|
}());
|
|
732
736
|
|
|
@@ -742,6 +746,31 @@ var TuiDayRange = /** @class */ (function (_super) {
|
|
|
742
746
|
tuiAssert.assert(from.daySameOrBefore(to));
|
|
743
747
|
return _this;
|
|
744
748
|
}
|
|
749
|
+
/**
|
|
750
|
+
* Creates range from two days after sorting them
|
|
751
|
+
*
|
|
752
|
+
* @param day1
|
|
753
|
+
* @param day2
|
|
754
|
+
* @return new range with sorted days
|
|
755
|
+
*/
|
|
756
|
+
TuiDayRange.sort = function (day1, day2) {
|
|
757
|
+
return day1.daySameOrBefore(day2)
|
|
758
|
+
? new TuiDayRange(day1, day2)
|
|
759
|
+
: new TuiDayRange(day2, day1);
|
|
760
|
+
};
|
|
761
|
+
/**
|
|
762
|
+
* Parse and correct a day range in string format
|
|
763
|
+
*
|
|
764
|
+
* @param rangeString a string of dates in a format dd.mm.yyyy - dd.mm.yyyy
|
|
765
|
+
* @return normalized day range object
|
|
766
|
+
*/
|
|
767
|
+
TuiDayRange.normalizeParse = function (rangeString) {
|
|
768
|
+
var leftDay = TuiDay.normalizeParse(rangeString.slice(0, DATE_FILLER_LENGTH));
|
|
769
|
+
if (rangeString.length < DATE_RANGE_FILLER_LENGTH) {
|
|
770
|
+
return new TuiDayRange(leftDay, leftDay);
|
|
771
|
+
}
|
|
772
|
+
return TuiDayRange.sort(leftDay, TuiDay.normalizeParse(rangeString.slice(DATE_FILLER_LENGTH + RANGE_SEPARATOR_CHAR.length)));
|
|
773
|
+
};
|
|
745
774
|
Object.defineProperty(TuiDayRange.prototype, "isSingleDay", {
|
|
746
775
|
get: function () {
|
|
747
776
|
return this.from.daySame(this.to);
|
|
@@ -778,34 +807,12 @@ var TuiDayRange = /** @class */ (function (_super) {
|
|
|
778
807
|
TuiDayRange.prototype.dayLimit = function (min, max) {
|
|
779
808
|
return new TuiDayRange(this.from.dayLimit(min, max), this.to.dayLimit(min, max));
|
|
780
809
|
};
|
|
781
|
-
/**
|
|
782
|
-
* Creates range from two days after sorting them
|
|
783
|
-
*
|
|
784
|
-
* @param day1
|
|
785
|
-
* @param day2
|
|
786
|
-
* @return new range with sorted days
|
|
787
|
-
*/
|
|
788
|
-
TuiDayRange.sort = function (day1, day2) {
|
|
789
|
-
return day1.daySameOrBefore(day2)
|
|
790
|
-
? new TuiDayRange(day1, day2)
|
|
791
|
-
: new TuiDayRange(day2, day1);
|
|
792
|
-
};
|
|
793
|
-
/**
|
|
794
|
-
* Parse and correct a day range in string format
|
|
795
|
-
*
|
|
796
|
-
* @param rangeString a string of dates in a format dd.mm.yyyy - dd.mm.yyyy
|
|
797
|
-
* @return normalized day range object
|
|
798
|
-
*/
|
|
799
|
-
TuiDayRange.normalizeParse = function (rangeString) {
|
|
800
|
-
var leftDay = TuiDay.normalizeParse(rangeString.slice(0, DATE_FILLER_LENGTH));
|
|
801
|
-
if (rangeString.length < DATE_RANGE_FILLER_LENGTH) {
|
|
802
|
-
return new TuiDayRange(leftDay, leftDay);
|
|
803
|
-
}
|
|
804
|
-
return TuiDayRange.sort(leftDay, TuiDay.normalizeParse(rangeString.slice(DATE_FILLER_LENGTH + RANGE_SEPARATOR_CHAR.length)));
|
|
805
|
-
};
|
|
806
810
|
return TuiDayRange;
|
|
807
811
|
}(TuiMonthRange));
|
|
808
812
|
|
|
813
|
+
var TUI_FIRST_DAY = new TuiDay(MIN_YEAR, MIN_MONTH, MIN_DAY);
|
|
814
|
+
var TUI_LAST_DAY = new TuiDay(MAX_YEAR, MAX_MONTH, 31);
|
|
815
|
+
|
|
809
816
|
/**
|
|
810
817
|
* Immutable time object with hours, minutes, seconds and ms
|
|
811
818
|
*/
|
|
@@ -819,46 +826,6 @@ var TuiTime = /** @class */ (function () {
|
|
|
819
826
|
this.ms = ms;
|
|
820
827
|
tuiAssert.assert(TuiTime.isValidTime(hours, minutes, seconds, ms), 'Time must be real, but got:', hours, minutes, seconds, ms);
|
|
821
828
|
}
|
|
822
|
-
/**
|
|
823
|
-
* Shifts time by hours and minutes
|
|
824
|
-
*/
|
|
825
|
-
TuiTime.prototype.shift = function (_a) {
|
|
826
|
-
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;
|
|
827
|
-
var newMs = (1000 + this.ms + (ms % 1000)) % 1000;
|
|
828
|
-
var secondsInMs = ms < 0 ? Math.ceil(ms / 1000) : Math.floor(ms / 1000);
|
|
829
|
-
var secondsToAdd = secondsInMs + seconds;
|
|
830
|
-
var newSeconds = (60 + this.seconds + (secondsToAdd % 60)) % 60;
|
|
831
|
-
var minutesInSeconds = secondsToAdd < 0
|
|
832
|
-
? Math.ceil(secondsToAdd / 60)
|
|
833
|
-
: Math.floor(secondsToAdd / 60);
|
|
834
|
-
var minutesToAdd = minutesInSeconds + minutes;
|
|
835
|
-
var newMinutes = (60 + this.minutes + (minutesToAdd % 60)) % 60;
|
|
836
|
-
var hoursInMinutes = minutesToAdd < 0
|
|
837
|
-
? Math.ceil(minutesToAdd / 60)
|
|
838
|
-
: Math.floor(minutesToAdd / 60);
|
|
839
|
-
var hoursToAdd = hoursInMinutes + hours;
|
|
840
|
-
var newHours = (24 + this.hours + (hoursToAdd % 24)) % 24;
|
|
841
|
-
return new TuiTime(newHours, newMinutes, newSeconds, newMs);
|
|
842
|
-
};
|
|
843
|
-
/**
|
|
844
|
-
* Converts TuiTime to string
|
|
845
|
-
*/
|
|
846
|
-
TuiTime.prototype.toString = function (mode) {
|
|
847
|
-
var needAddMs = mode === 'HH:MM:SS.MSS' || (!mode && this.ms > 0);
|
|
848
|
-
var needAddSeconds = needAddMs || mode === 'HH:MM:SS' || (!mode && this.seconds > 0);
|
|
849
|
-
return (this.formatTime(this.hours) + ":" + this.formatTime(this.minutes) +
|
|
850
|
-
("" + (needAddSeconds ? ':' + this.formatTime(this.seconds) : '')) +
|
|
851
|
-
("" + (needAddMs ? '.' + this.formatTime(this.ms, 3) : '')));
|
|
852
|
-
};
|
|
853
|
-
/**
|
|
854
|
-
* Converts TuiTime to milliseconds
|
|
855
|
-
*/
|
|
856
|
-
TuiTime.prototype.toAbsoluteMilliseconds = function () {
|
|
857
|
-
return (this.hours * MILLISECONDS_IN_HOUR +
|
|
858
|
-
this.minutes * MILLISECONDS_IN_MINUTE +
|
|
859
|
-
this.seconds * 1000 +
|
|
860
|
-
this.ms);
|
|
861
|
-
};
|
|
862
829
|
/**
|
|
863
830
|
* Checks if time is valid
|
|
864
831
|
*/
|
|
@@ -917,6 +884,46 @@ var TuiTime = /** @class */ (function () {
|
|
|
917
884
|
TuiTime.fromLocalNativeDate = function (date) {
|
|
918
885
|
return new TuiTime(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
|
|
919
886
|
};
|
|
887
|
+
/**
|
|
888
|
+
* Shifts time by hours and minutes
|
|
889
|
+
*/
|
|
890
|
+
TuiTime.prototype.shift = function (_a) {
|
|
891
|
+
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;
|
|
892
|
+
var newMs = (1000 + this.ms + (ms % 1000)) % 1000;
|
|
893
|
+
var secondsInMs = ms < 0 ? Math.ceil(ms / 1000) : Math.floor(ms / 1000);
|
|
894
|
+
var secondsToAdd = secondsInMs + seconds;
|
|
895
|
+
var newSeconds = (60 + this.seconds + (secondsToAdd % 60)) % 60;
|
|
896
|
+
var minutesInSeconds = secondsToAdd < 0
|
|
897
|
+
? Math.ceil(secondsToAdd / 60)
|
|
898
|
+
: Math.floor(secondsToAdd / 60);
|
|
899
|
+
var minutesToAdd = minutesInSeconds + minutes;
|
|
900
|
+
var newMinutes = (60 + this.minutes + (minutesToAdd % 60)) % 60;
|
|
901
|
+
var hoursInMinutes = minutesToAdd < 0
|
|
902
|
+
? Math.ceil(minutesToAdd / 60)
|
|
903
|
+
: Math.floor(minutesToAdd / 60);
|
|
904
|
+
var hoursToAdd = hoursInMinutes + hours;
|
|
905
|
+
var newHours = (24 + this.hours + (hoursToAdd % 24)) % 24;
|
|
906
|
+
return new TuiTime(newHours, newMinutes, newSeconds, newMs);
|
|
907
|
+
};
|
|
908
|
+
/**
|
|
909
|
+
* Converts TuiTime to string
|
|
910
|
+
*/
|
|
911
|
+
TuiTime.prototype.toString = function (mode) {
|
|
912
|
+
var needAddMs = mode === 'HH:MM:SS.MSS' || (!mode && this.ms > 0);
|
|
913
|
+
var needAddSeconds = needAddMs || mode === 'HH:MM:SS' || (!mode && this.seconds > 0);
|
|
914
|
+
return (this.formatTime(this.hours) + ":" + this.formatTime(this.minutes) +
|
|
915
|
+
("" + (needAddSeconds ? ':' + this.formatTime(this.seconds) : '')) +
|
|
916
|
+
("" + (needAddMs ? '.' + this.formatTime(this.ms, 3) : '')));
|
|
917
|
+
};
|
|
918
|
+
/**
|
|
919
|
+
* Converts TuiTime to milliseconds
|
|
920
|
+
*/
|
|
921
|
+
TuiTime.prototype.toAbsoluteMilliseconds = function () {
|
|
922
|
+
return (this.hours * MILLISECONDS_IN_HOUR +
|
|
923
|
+
this.minutes * MILLISECONDS_IN_MINUTE +
|
|
924
|
+
this.seconds * 1000 +
|
|
925
|
+
this.ms);
|
|
926
|
+
};
|
|
920
927
|
TuiTime.prototype.formatTime = function (time, digits) {
|
|
921
928
|
if (digits === void 0) { digits = 2; }
|
|
922
929
|
return padStart(time.toString(), digits, '0');
|
|
@@ -924,13 +931,6 @@ var TuiTime = /** @class */ (function () {
|
|
|
924
931
|
return TuiTime;
|
|
925
932
|
}());
|
|
926
933
|
|
|
927
|
-
/**
|
|
928
|
-
* TODO This token supports only DMY now. Add other {@link TuiDateMode} support
|
|
929
|
-
*/
|
|
930
|
-
var TUI_DATE_FORMAT = new InjectionToken('Active date format for Taiga UI', {
|
|
931
|
-
factory: function () { return 'DMY'; },
|
|
932
|
-
});
|
|
933
|
-
|
|
934
934
|
/**
|
|
935
935
|
* Generated bundle index. Do not edit.
|
|
936
936
|
*/
|