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