@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,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@taiga-ui/cdk/date-time', ['exports', '@taiga-ui/cdk/
|
|
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.
|
|
5
|
-
}(this, (function (exports,
|
|
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
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
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;
|