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