@ng-matero/extensions 12.7.0 → 13.0.2
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/_index.scss +1 -1
- package/_theming.scss +1 -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 +3 -0
- 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.scss +2 -2
- package/colorpicker/colorpicker-input.d.ts +3 -0
- package/colorpicker/colorpicker-module.d.ts +13 -0
- package/colorpicker/colorpicker-toggle.d.ts +5 -0
- package/colorpicker/colorpicker.d.ts +6 -1
- package/colorpicker/mtxColorpicker.d.ts +1 -0
- package/colorpicker/package.json +5 -6
- 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 +5 -5
- package/datetimepicker/calendar-body.d.ts +3 -0
- package/datetimepicker/calendar-body.scss +5 -4
- package/datetimepicker/calendar.d.ts +4 -1
- package/datetimepicker/clock.d.ts +3 -0
- package/datetimepicker/datetimepicker-input.d.ts +3 -0
- package/datetimepicker/datetimepicker-module.d.ts +18 -0
- package/datetimepicker/datetimepicker-toggle.d.ts +5 -0
- package/datetimepicker/datetimepicker-types.d.ts +1 -0
- package/datetimepicker/datetimepicker.d.ts +7 -2
- package/datetimepicker/month-view.d.ts +4 -1
- package/datetimepicker/mtxDatetimepicker.d.ts +1 -0
- package/datetimepicker/multi-year-view.d.ts +4 -1
- package/datetimepicker/package.json +5 -6
- package/datetimepicker/public-api.d.ts +1 -0
- package/datetimepicker/year-view.d.ts +4 -1
- package/dialog/dialog.component.d.ts +3 -0
- package/dialog/dialog.d.ts +3 -0
- package/dialog/dialog.module.d.ts +10 -0
- package/dialog/mtxDialog.d.ts +1 -0
- package/dialog/package.json +5 -6
- 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/{esm2015/colorpicker/colorpicker-animations.js → esm2020/colorpicker/colorpicker-animations.mjs} +0 -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/{esm2015/colorpicker/mtxColorpicker.js → esm2020/colorpicker/mtxColorpicker.mjs} +0 -0
- package/{esm2015/colorpicker/public-api.js → esm2020/colorpicker/public-api.mjs} +0 -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/{esm2015/datetimepicker/datetimepicker-animations.js → esm2020/datetimepicker/datetimepicker-animations.mjs} +0 -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/{esm2015/datetimepicker/mtxDatetimepicker.js → esm2020/datetimepicker/mtxDatetimepicker.mjs} +0 -0
- package/esm2020/datetimepicker/multi-year-view.mjs +214 -0
- package/{esm2015/datetimepicker/public-api.js → esm2020/datetimepicker/public-api.mjs} +2 -1
- package/esm2020/datetimepicker/year-view.mjs +138 -0
- package/{esm2015/dialog/dialog-config.js → esm2020/dialog/dialog-config.mjs} +0 -0
- 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/{esm2015/dialog/public-api.js → esm2020/dialog/public-api.mjs} +0 -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 +459 -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} +0 -0
- 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/{esm2015/split/utils.js → esm2020/split/utils.mjs} +0 -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 +713 -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} +75 -85
- 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} +83 -86
- 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/{fesm2015/mtxColorpicker.js → fesm2020/mtxColorpicker.mjs} +420 -413
- 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/{fesm2015/mtxDatetimepicker.js → fesm2020/mtxDatetimepicker.mjs} +1300 -1306
- 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 +710 -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 +3 -0
- 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 +3 -0
- package/loader/loader.module.d.ts +8 -0
- package/loader/mtxLoader.d.ts +1 -0
- package/loader/package.json +5 -6
- package/{extensions.d.ts → ng-matero-extensions.d.ts} +1 -0
- package/package.json +178 -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 +3 -0
- 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 +3 -0
- 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 +4 -4
- 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 +7 -7
- package/split/_split-theme.scss +1 -1
- 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 +4 -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 -0
- 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 -164
- 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 -284
- package/bundles/mtxCheckboxGroup.umd.js.map +0 -1
- package/bundles/mtxColorpicker.umd.js +0 -1123
- 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 -3045
- package/bundles/mtxDatetimepicker.umd.js.map +0 -1
- package/bundles/mtxDialog.umd.js +0 -158
- package/bundles/mtxDialog.umd.js.map +0 -1
- package/bundles/mtxFormGroup.umd.js +0 -73
- package/bundles/mtxFormGroup.umd.js.map +0 -1
- package/bundles/mtxGrid.umd.js +0 -1581
- package/bundles/mtxGrid.umd.js.map +0 -1
- package/bundles/mtxLoader.umd.js +0 -107
- 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 -1431
- package/bundles/mtxSplit.umd.js.map +0 -1
- package/bundles/mtxText3d.umd.js +0 -84
- package/bundles/mtxText3d.umd.js.map +0 -1
- package/bundles/mtxTooltip.umd.js +0 -1083
- package/bundles/mtxTooltip.umd.js.map +0 -1
- package/button/mtxButton.metadata.json +0 -1
- package/checkbox-group/mtxCheckboxGroup.metadata.json +0 -1
- package/colorpicker/mtxColorpicker.metadata.json +0 -1
- package/column-resize/mtxColumnResize.metadata.json +0 -1
- package/core/mtxCore.metadata.json +0 -1
- 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 -235
- package/esm2015/checkbox-group/checkbox-group.module.js +0 -17
- package/esm2015/colorpicker/colorpicker-input.js +0 -228
- package/esm2015/colorpicker/colorpicker-module.js +0 -41
- package/esm2015/colorpicker/colorpicker-toggle.js +0 -97
- package/esm2015/colorpicker/colorpicker.js +0 -372
- 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 -76
- package/esm2015/datetimepicker/calendar.js +0 -614
- package/esm2015/datetimepicker/clock.js +0 -283
- package/esm2015/datetimepicker/datetimepicker-input.js +0 -336
- package/esm2015/datetimepicker/datetimepicker-module.js +0 -52
- package/esm2015/datetimepicker/datetimepicker-toggle.js +0 -103
- package/esm2015/datetimepicker/datetimepicker.js +0 -490
- package/esm2015/datetimepicker/month-view.js +0 -150
- package/esm2015/datetimepicker/multi-year-view.js +0 -215
- package/esm2015/datetimepicker/year-view.js +0 -141
- 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/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 -40
- 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 -69
- 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 -624
- package/esm2015/split/split.module.js +0 -15
- package/esm2015/text3d/text3d.component.js +0 -45
- package/esm2015/text3d/text3d.module.js +0 -14
- package/esm2015/tooltip/tooltip-module.js +0 -20
- package/esm2015/tooltip/tooltip.js +0 -683
- 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 -255
- package/fesm2015/mtxCheckboxGroup.js.map +0 -1
- 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.map +0 -1
- package/fesm2015/mtxDialog.js +0 -141
- package/fesm2015/mtxDialog.js.map +0 -1
- package/fesm2015/mtxFormGroup.js +0 -59
- 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 -90
- 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 -64
- package/fesm2015/mtxText3d.js.map +0 -1
- package/fesm2015/mtxTooltip.js.map +0 -1
- package/form-group/mtxFormGroup.metadata.json +0 -1
- package/grid/cell-selection.directive.d.ts +0 -17
- package/grid/mtxGrid.metadata.json +0 -1
- package/loader/mtxLoader.metadata.json +0 -1
- package/pipes/mtxPipes.d.ts +0 -4
- package/pipes/mtxPipes.metadata.json +0 -1
- package/pipes/package.json +0 -11
- package/pipes/pipes.module.d.ts +0 -2
- package/popover/mtxPopover.metadata.json +0 -1
- package/progress/mtxProgress.metadata.json +0 -1
- package/select/mtxSelect.metadata.json +0 -1
- package/slider/mtxSlider.metadata.json +0 -1
- package/split/mtxSplit.metadata.json +0 -1
- package/text3d/mtxText3d.metadata.json +0 -1
- package/tooltip/mtxTooltip.metadata.json +0 -1
|
@@ -1,22 +1,28 @@
|
|
|
1
|
+
import * as i2 from '@angular/cdk/a11y';
|
|
1
2
|
import { A11yModule } from '@angular/cdk/a11y';
|
|
3
|
+
import * as i4 from '@angular/cdk/overlay';
|
|
2
4
|
import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
|
|
3
5
|
import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
|
|
6
|
+
import * as i3 from '@angular/common';
|
|
4
7
|
import { CommonModule } from '@angular/common';
|
|
5
|
-
import
|
|
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';
|
|
6
11
|
import { MatButtonModule } from '@angular/material/button';
|
|
7
12
|
import { ENTER, PAGE_DOWN, PAGE_UP, END, HOME, DOWN_ARROW, UP_ARROW, RIGHT_ARROW, LEFT_ARROW, ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
|
|
8
13
|
import { coerceBooleanProperty, coerceStringArray } from '@angular/cdk/coercion';
|
|
9
|
-
import { MatDatepickerIntl } from '@angular/material/datepicker';
|
|
10
14
|
import { first, take, filter } from 'rxjs/operators';
|
|
11
|
-
import
|
|
15
|
+
import * as i1 from '@ng-matero/extensions/core';
|
|
16
|
+
import { MTX_DATETIME_FORMATS } from '@ng-matero/extensions/core';
|
|
12
17
|
import { trigger, transition, animate, keyframes, style, state } from '@angular/animations';
|
|
13
|
-
import
|
|
18
|
+
import * as i1$1 from '@angular/material/datepicker';
|
|
14
19
|
import { _getFocusedElementPierceShadowDom } from '@angular/cdk/platform';
|
|
15
20
|
import { mixinColor } from '@angular/material/core';
|
|
16
21
|
import { Subject, Subscription, merge, of } from 'rxjs';
|
|
22
|
+
import * as i6 from '@angular/cdk/bidi';
|
|
17
23
|
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators } from '@angular/forms';
|
|
18
24
|
import { MAT_INPUT_VALUE_ACCESSOR } from '@angular/material/input';
|
|
19
|
-
import
|
|
25
|
+
import * as i2$1 from '@angular/material/form-field';
|
|
20
26
|
|
|
21
27
|
/**
|
|
22
28
|
* Animations used by the Material datepicker.
|
|
@@ -123,32 +129,32 @@ class MtxCalendarBody {
|
|
|
123
129
|
return cellNumber === this.activeCell;
|
|
124
130
|
}
|
|
125
131
|
}
|
|
126
|
-
/** @
|
|
127
|
-
MtxCalendarBody.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
class: 'mtx-calendar-body
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
]
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
};
|
|
132
|
+
/** @nocollapse */ /** @nocollapse */ MtxCalendarBody.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxCalendarBody, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
133
|
+
/** @nocollapse */ /** @nocollapse */ MtxCalendarBody.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.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.2.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
|
+
}] } });
|
|
152
158
|
|
|
153
159
|
const yearsPerPage = 24;
|
|
154
160
|
const yearsPerRow = 4;
|
|
@@ -291,39 +297,35 @@ class MtxMultiYearView {
|
|
|
291
297
|
return this._adapter.isDateInstance(obj) && this._adapter.isValid(obj) ? obj : null;
|
|
292
298
|
}
|
|
293
299
|
}
|
|
294
|
-
/** @type {
|
|
295
|
-
MtxMultiYearView
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
selected: [{ type: Input }],
|
|
324
|
-
minDate: [{ type: Input }],
|
|
325
|
-
maxDate: [{ type: Input }]
|
|
326
|
-
};
|
|
300
|
+
/** @nocollapse */ /** @nocollapse */ MtxMultiYearView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.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.2.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.2.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 () { return [{ type: i1.DatetimeAdapter, decorators: [{
|
|
306
|
+
type: Optional
|
|
307
|
+
}] }, { type: undefined, decorators: [{
|
|
308
|
+
type: Optional
|
|
309
|
+
}, {
|
|
310
|
+
type: Inject,
|
|
311
|
+
args: [MTX_DATETIME_FORMATS]
|
|
312
|
+
}] }]; }, propDecorators: { type: [{
|
|
313
|
+
type: Input
|
|
314
|
+
}], dateFilter: [{
|
|
315
|
+
type: Input
|
|
316
|
+
}], selectedChange: [{
|
|
317
|
+
type: Output
|
|
318
|
+
}], _userSelection: [{
|
|
319
|
+
type: Output
|
|
320
|
+
}], activeDate: [{
|
|
321
|
+
type: Input
|
|
322
|
+
}], selected: [{
|
|
323
|
+
type: Input
|
|
324
|
+
}], minDate: [{
|
|
325
|
+
type: Input
|
|
326
|
+
}], maxDate: [{
|
|
327
|
+
type: Input
|
|
328
|
+
}] } });
|
|
327
329
|
function isSameMultiYearView(dateAdapter, date1, date2, minDate, maxDate) {
|
|
328
330
|
const year1 = dateAdapter.getYear(date1);
|
|
329
331
|
const year2 = dateAdapter.getYear(date2);
|
|
@@ -360,111 +362,50 @@ function euclideanModulo(a, b) {
|
|
|
360
362
|
return ((a % b) + b) % b;
|
|
361
363
|
}
|
|
362
364
|
|
|
365
|
+
const DAYS_PER_WEEK = 7;
|
|
363
366
|
/**
|
|
364
|
-
*
|
|
367
|
+
* An internal component used to display a single month in the datetimepicker.
|
|
365
368
|
* @docs-private
|
|
366
369
|
*/
|
|
367
|
-
class
|
|
368
|
-
constructor(
|
|
369
|
-
this._elementRef = _elementRef;
|
|
370
|
-
this._intl = _intl;
|
|
371
|
-
this._ngZone = _ngZone;
|
|
370
|
+
class MtxMonthView {
|
|
371
|
+
constructor(_adapter, _dateFormats) {
|
|
372
372
|
this._adapter = _adapter;
|
|
373
373
|
this._dateFormats = _dateFormats;
|
|
374
|
-
this.
|
|
375
|
-
|
|
376
|
-
/** Whether the calendar should be started in month or year view. */
|
|
377
|
-
this.startView = 'month';
|
|
378
|
-
this.timeInterval = 1;
|
|
379
|
-
/** Prevent user to select same date time */
|
|
380
|
-
this.preventSameDateTimeSelection = false;
|
|
381
|
-
/** Emits when the currently selected date changes. */
|
|
374
|
+
this.type = 'date';
|
|
375
|
+
/** Emits when a new date is selected. */
|
|
382
376
|
this.selectedChange = new EventEmitter();
|
|
383
|
-
/** Emits when
|
|
384
|
-
this.viewChanged = new EventEmitter();
|
|
377
|
+
/** Emits when any date is selected. */
|
|
385
378
|
this._userSelection = new EventEmitter();
|
|
386
|
-
this._clockView = 'hour';
|
|
387
|
-
this._type = 'date';
|
|
388
|
-
/** Date filter for the month and year views. */
|
|
389
|
-
this._dateFilterForViews = (date) => {
|
|
390
|
-
return (!!date &&
|
|
391
|
-
(!this.dateFilter || this.dateFilter(date, MtxDatetimepickerFilterType.DATE)) &&
|
|
392
|
-
(!this.minDate || this._adapter.compareDate(date, this.minDate) >= 0) &&
|
|
393
|
-
(!this.maxDate || this._adapter.compareDate(date, this.maxDate) <= 0));
|
|
394
|
-
};
|
|
395
379
|
if (!this._adapter) {
|
|
396
380
|
throw createMissingDateImplError('DatetimeAdapter');
|
|
397
381
|
}
|
|
398
382
|
if (!this._dateFormats) {
|
|
399
383
|
throw createMissingDateImplError('MTX_DATETIME_FORMATS');
|
|
400
384
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
get twelvehour() {
|
|
411
|
-
return this._twelvehour;
|
|
412
|
-
}
|
|
413
|
-
set twelvehour(value) {
|
|
414
|
-
this._twelvehour = coerceBooleanProperty(value);
|
|
415
|
-
}
|
|
416
|
-
get type() {
|
|
417
|
-
return this._type;
|
|
418
|
-
}
|
|
419
|
-
set type(value) {
|
|
420
|
-
this._type = value || 'date';
|
|
421
|
-
if (this.type === 'year') {
|
|
422
|
-
this.multiYearSelector = true;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
/** A date representing the period (month or year) to start the calendar in. */
|
|
426
|
-
get startAt() {
|
|
427
|
-
return this._startAt;
|
|
428
|
-
}
|
|
429
|
-
set startAt(value) {
|
|
430
|
-
this._startAt = this._adapter.getValidDateOrNull(value);
|
|
431
|
-
}
|
|
432
|
-
/** The currently selected date. */
|
|
433
|
-
get selected() {
|
|
434
|
-
return this._selected;
|
|
435
|
-
}
|
|
436
|
-
set selected(value) {
|
|
437
|
-
this._selected = this._adapter.getValidDateOrNull(value);
|
|
438
|
-
}
|
|
439
|
-
/** The minimum selectable date. */
|
|
440
|
-
get minDate() {
|
|
441
|
-
return this._minDate;
|
|
442
|
-
}
|
|
443
|
-
set minDate(value) {
|
|
444
|
-
this._minDate = this._adapter.getValidDateOrNull(value);
|
|
445
|
-
}
|
|
446
|
-
/** The maximum selectable date. */
|
|
447
|
-
get maxDate() {
|
|
448
|
-
return this._maxDate;
|
|
449
|
-
}
|
|
450
|
-
set maxDate(value) {
|
|
451
|
-
this._maxDate = this._adapter.getValidDateOrNull(value);
|
|
385
|
+
const firstDayOfWeek = this._adapter.getFirstDayOfWeek();
|
|
386
|
+
const narrowWeekdays = this._adapter.getDayOfWeekNames('narrow');
|
|
387
|
+
const longWeekdays = this._adapter.getDayOfWeekNames('long');
|
|
388
|
+
// Rotate the labels for days of the week based on the configured first day of the week.
|
|
389
|
+
const weekdays = longWeekdays.map((long, i) => {
|
|
390
|
+
return { long, narrow: narrowWeekdays[i] };
|
|
391
|
+
});
|
|
392
|
+
this._weekdays = weekdays.slice(firstDayOfWeek).concat(weekdays.slice(0, firstDayOfWeek));
|
|
393
|
+
this._activeDate = this._adapter.today();
|
|
452
394
|
}
|
|
453
395
|
/**
|
|
454
|
-
* The
|
|
455
|
-
* highlighted when using keyboard navigation.
|
|
396
|
+
* The date to display in this month view (everything other than the month and year is ignored).
|
|
456
397
|
*/
|
|
457
|
-
get
|
|
458
|
-
return this.
|
|
398
|
+
get activeDate() {
|
|
399
|
+
return this._activeDate;
|
|
459
400
|
}
|
|
460
|
-
set
|
|
461
|
-
const oldActiveDate = this.
|
|
462
|
-
this.
|
|
401
|
+
set activeDate(value) {
|
|
402
|
+
const oldActiveDate = this._activeDate;
|
|
403
|
+
this._activeDate = value || this._adapter.today();
|
|
463
404
|
if (oldActiveDate &&
|
|
464
|
-
this.
|
|
465
|
-
this.
|
|
466
|
-
|
|
467
|
-
if (this._adapter.isInNextMonth(oldActiveDate, this.
|
|
405
|
+
this._activeDate &&
|
|
406
|
+
!this._adapter.sameMonthAndYear(oldActiveDate, this._activeDate)) {
|
|
407
|
+
this._init();
|
|
408
|
+
if (this._adapter.isInNextMonth(oldActiveDate, this._activeDate)) {
|
|
468
409
|
this.calendarState('right');
|
|
469
410
|
}
|
|
470
411
|
else {
|
|
@@ -472,777 +413,1095 @@ class MtxCalendar {
|
|
|
472
413
|
}
|
|
473
414
|
}
|
|
474
415
|
}
|
|
475
|
-
/**
|
|
476
|
-
get
|
|
477
|
-
return this.
|
|
416
|
+
/** The currently selected date. */
|
|
417
|
+
get selected() {
|
|
418
|
+
return this._selected;
|
|
478
419
|
}
|
|
479
|
-
set
|
|
480
|
-
this.
|
|
481
|
-
this.
|
|
420
|
+
set selected(value) {
|
|
421
|
+
this._selected = value;
|
|
422
|
+
this._selectedDate = this._getDateInCurrentMonth(this.selected);
|
|
482
423
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
return this._adapter.getYearName(this._activeDate);
|
|
424
|
+
ngAfterContentInit() {
|
|
425
|
+
this._init();
|
|
486
426
|
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
const activeYear = this._adapter.getYear(this._activeDate);
|
|
493
|
-
const minYearOfPage = activeYear - getActiveOffset(this._adapter, this._activeDate, this.minDate, this.maxDate);
|
|
494
|
-
const maxYearOfPage = minYearOfPage + yearsPerPage - 1;
|
|
495
|
-
const minYearName = this._adapter.getYearName(this._adapter.createDate(minYearOfPage, 0, 1));
|
|
496
|
-
const maxYearName = this._adapter.getYearName(this._adapter.createDate(maxYearOfPage, 0, 1));
|
|
497
|
-
return this._intl.formatYearRange(minYearName, maxYearName);
|
|
427
|
+
/** Handles when a new date is selected. */
|
|
428
|
+
_dateSelected(date) {
|
|
429
|
+
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)));
|
|
430
|
+
if (this.type === 'date') {
|
|
431
|
+
this._userSelection.emit();
|
|
498
432
|
}
|
|
499
|
-
return this.currentView === 'month'
|
|
500
|
-
? this._adapter.getMonthNames('long')[this._adapter.getMonth(this._activeDate)]
|
|
501
|
-
: this._adapter.getYearName(this._activeDate);
|
|
502
433
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
case 'month':
|
|
506
|
-
return this._adapter.getMonthNames('long')[this._adapter.getMonth(this._activeDate)];
|
|
507
|
-
default:
|
|
508
|
-
return this._adapter.format(this._activeDate, this._dateFormats.display.popupHeaderDateLabel);
|
|
509
|
-
}
|
|
434
|
+
_calendarStateDone() {
|
|
435
|
+
this._calendarState = '';
|
|
510
436
|
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
437
|
+
/** Initializes this month view. */
|
|
438
|
+
_init() {
|
|
439
|
+
this._selectedDate = this._getDateInCurrentMonth(this.selected);
|
|
440
|
+
this._todayDate = this._getDateInCurrentMonth(this._adapter.today());
|
|
441
|
+
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));
|
|
442
|
+
this._firstWeekOffset =
|
|
443
|
+
(DAYS_PER_WEEK +
|
|
444
|
+
this._adapter.getDayOfWeek(firstOfMonth) -
|
|
445
|
+
this._adapter.getFirstDayOfWeek()) %
|
|
446
|
+
DAYS_PER_WEEK;
|
|
447
|
+
this._createWeekCells();
|
|
448
|
+
}
|
|
449
|
+
/** Creates MdCalendarCells for the dates in this month. */
|
|
450
|
+
_createWeekCells() {
|
|
451
|
+
const daysInMonth = this._adapter.getNumDaysInMonth(this.activeDate);
|
|
452
|
+
const dateNames = this._adapter.getDateNames();
|
|
453
|
+
this._weeks = [[]];
|
|
454
|
+
for (let i = 0, cell = this._firstWeekOffset; i < daysInMonth; i++, cell++) {
|
|
455
|
+
if (cell === DAYS_PER_WEEK) {
|
|
456
|
+
this._weeks.push([]);
|
|
457
|
+
cell = 0;
|
|
516
458
|
}
|
|
517
|
-
|
|
459
|
+
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));
|
|
460
|
+
const enabled = !this.dateFilter || this.dateFilter(date);
|
|
461
|
+
const ariaLabel = this._adapter.format(date, this._dateFormats.display.dateA11yLabel);
|
|
462
|
+
this._weeks[this._weeks.length - 1].push(new MtxCalendarCell(i + 1, dateNames[i], ariaLabel, enabled));
|
|
518
463
|
}
|
|
519
|
-
return this._2digit(hour);
|
|
520
464
|
}
|
|
521
|
-
|
|
522
|
-
|
|
465
|
+
/**
|
|
466
|
+
* Gets the date in this month that the given Date falls on.
|
|
467
|
+
* Returns null if the given Date is in another month.
|
|
468
|
+
*/
|
|
469
|
+
_getDateInCurrentMonth(date) {
|
|
470
|
+
return this._adapter.sameMonthAndYear(date, this.activeDate)
|
|
471
|
+
? this._adapter.getDate(date)
|
|
472
|
+
: null;
|
|
523
473
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
case 'month':
|
|
527
|
-
return this._intl.nextMonthLabel;
|
|
528
|
-
case 'year':
|
|
529
|
-
return this._intl.nextYearLabel;
|
|
530
|
-
case 'multi-year':
|
|
531
|
-
return this._intl.nextMultiYearLabel;
|
|
532
|
-
default:
|
|
533
|
-
return '';
|
|
534
|
-
}
|
|
474
|
+
calendarState(direction) {
|
|
475
|
+
this._calendarState = direction;
|
|
535
476
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
477
|
+
}
|
|
478
|
+
/** @nocollapse */ /** @nocollapse */ MtxMonthView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxMonthView, deps: [{ token: i1.DatetimeAdapter, optional: true }, { token: MTX_DATETIME_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
479
|
+
/** @nocollapse */ /** @nocollapse */ MtxMonthView.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.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 });
|
|
480
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxMonthView, decorators: [{
|
|
481
|
+
type: Component,
|
|
482
|
+
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" }]
|
|
483
|
+
}], ctorParameters: function () { return [{ type: i1.DatetimeAdapter, decorators: [{
|
|
484
|
+
type: Optional
|
|
485
|
+
}] }, { type: undefined, decorators: [{
|
|
486
|
+
type: Optional
|
|
487
|
+
}, {
|
|
488
|
+
type: Inject,
|
|
489
|
+
args: [MTX_DATETIME_FORMATS]
|
|
490
|
+
}] }]; }, propDecorators: { type: [{
|
|
491
|
+
type: Input
|
|
492
|
+
}], dateFilter: [{
|
|
493
|
+
type: Input
|
|
494
|
+
}], selectedChange: [{
|
|
495
|
+
type: Output
|
|
496
|
+
}], _userSelection: [{
|
|
497
|
+
type: Output
|
|
498
|
+
}], activeDate: [{
|
|
499
|
+
type: Input
|
|
500
|
+
}], selected: [{
|
|
501
|
+
type: Input
|
|
502
|
+
}] } });
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* An internal component used to display a single year in the datetimepicker.
|
|
506
|
+
* @docs-private
|
|
507
|
+
*/
|
|
508
|
+
class MtxYearView {
|
|
509
|
+
constructor(_adapter, _dateFormats) {
|
|
510
|
+
this._adapter = _adapter;
|
|
511
|
+
this._dateFormats = _dateFormats;
|
|
512
|
+
this.type = 'date';
|
|
513
|
+
/** Emits when a new month is selected. */
|
|
514
|
+
this.selectedChange = new EventEmitter();
|
|
515
|
+
/** Emits when any date is selected. */
|
|
516
|
+
this._userSelection = new EventEmitter();
|
|
517
|
+
if (!this._adapter) {
|
|
518
|
+
throw createMissingDateImplError('DatetimeAdapter');
|
|
546
519
|
}
|
|
520
|
+
if (!this._dateFormats) {
|
|
521
|
+
throw createMissingDateImplError('MTX_DATETIME_FORMATS');
|
|
522
|
+
}
|
|
523
|
+
this._activeDate = this._adapter.today();
|
|
547
524
|
}
|
|
548
|
-
|
|
549
|
-
|
|
525
|
+
/** The date to display in this year view (everything other than the year is ignored). */
|
|
526
|
+
get activeDate() {
|
|
527
|
+
return this._activeDate;
|
|
550
528
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
this.
|
|
554
|
-
if (
|
|
555
|
-
this.
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
this.
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
this.
|
|
562
|
-
|
|
563
|
-
else {
|
|
564
|
-
this.currentView = this.startView || 'month';
|
|
529
|
+
set activeDate(value) {
|
|
530
|
+
const oldActiveDate = this._activeDate;
|
|
531
|
+
this._activeDate = value || this._adapter.today();
|
|
532
|
+
if (oldActiveDate &&
|
|
533
|
+
this._activeDate &&
|
|
534
|
+
!this._adapter.sameYear(oldActiveDate, this._activeDate)) {
|
|
535
|
+
this._init();
|
|
536
|
+
// if (oldActiveDate < this._activeDate) {
|
|
537
|
+
// this.calendarState('right');
|
|
538
|
+
// } else {
|
|
539
|
+
// this.calendarState('left');
|
|
540
|
+
// }
|
|
565
541
|
}
|
|
566
542
|
}
|
|
567
|
-
|
|
568
|
-
|
|
543
|
+
/** The currently selected date. */
|
|
544
|
+
get selected() {
|
|
545
|
+
return this._selected;
|
|
569
546
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
if (!this._adapter.sameDate(date, this.selected) || !this.preventSameDateTimeSelection) {
|
|
574
|
-
this.selectedChange.emit(date);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
else {
|
|
578
|
-
this._activeDate = date;
|
|
579
|
-
this.currentView = 'clock';
|
|
580
|
-
}
|
|
547
|
+
set selected(value) {
|
|
548
|
+
this._selected = value;
|
|
549
|
+
this._selectedMonth = this._getMonthInCurrentYear(this.selected);
|
|
581
550
|
}
|
|
582
|
-
|
|
551
|
+
ngAfterContentInit() {
|
|
552
|
+
this._init();
|
|
553
|
+
}
|
|
554
|
+
/** Handles when a new month is selected. */
|
|
583
555
|
_monthSelected(month) {
|
|
556
|
+
const normalizedDate = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), month, 1, 0, 0);
|
|
557
|
+
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)));
|
|
584
558
|
if (this.type === 'month') {
|
|
585
|
-
|
|
586
|
-
!this.preventSameDateTimeSelection) {
|
|
587
|
-
this.selectedChange.emit(this._adapter.getFirstDateOfMonth(month));
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
this._activeDate = month;
|
|
592
|
-
this.currentView = 'month';
|
|
593
|
-
this._clockView = 'hour';
|
|
559
|
+
this._userSelection.emit();
|
|
594
560
|
}
|
|
595
561
|
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
if (this.type === 'year') {
|
|
599
|
-
if (!this._adapter.sameYear(year, this.selected) || !this.preventSameDateTimeSelection) {
|
|
600
|
-
const normalizedDate = this._adapter.createDatetime(this._adapter.getYear(year), 0, 1, 0, 0);
|
|
601
|
-
this.selectedChange.emit(normalizedDate);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
else {
|
|
605
|
-
this._activeDate = year;
|
|
606
|
-
this.currentView = 'year';
|
|
607
|
-
}
|
|
562
|
+
_calendarStateDone() {
|
|
563
|
+
this._calendarState = '';
|
|
608
564
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
565
|
+
/** Initializes this month view. */
|
|
566
|
+
_init() {
|
|
567
|
+
this._selectedMonth = this._getMonthInCurrentYear(this.selected);
|
|
568
|
+
this._todayMonth = this._getMonthInCurrentYear(this._adapter.today());
|
|
569
|
+
this._yearLabel = this._adapter.getYearName(this.activeDate);
|
|
570
|
+
const monthNames = this._adapter.getMonthNames('short');
|
|
571
|
+
// First row of months only contains 5 elements so we can fit the year label on the same row.
|
|
572
|
+
this._months = [
|
|
573
|
+
[0, 1, 2, 3],
|
|
574
|
+
[4, 5, 6, 7],
|
|
575
|
+
[8, 9, 10, 11],
|
|
576
|
+
].map(row => row.map(month => this._createCellForMonth(month, monthNames[month])));
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Gets the month in this year that the given Date falls on.
|
|
580
|
+
* Returns null if the given Date is in another year.
|
|
581
|
+
*/
|
|
582
|
+
_getMonthInCurrentYear(date) {
|
|
583
|
+
return this._adapter.sameYear(date, this.activeDate) ? this._adapter.getMonth(date) : null;
|
|
584
|
+
}
|
|
585
|
+
/** Creates an MdCalendarCell for the given month. */
|
|
586
|
+
_createCellForMonth(month, monthName) {
|
|
587
|
+
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);
|
|
588
|
+
return new MtxCalendarCell(month, monthName.toLocaleUpperCase(), ariaLabel, this._isMonthEnabled(month));
|
|
589
|
+
}
|
|
590
|
+
// private calendarState(direction: string): void {
|
|
591
|
+
// this._calendarState = direction;
|
|
592
|
+
// }
|
|
593
|
+
/** Whether the given month is enabled. */
|
|
594
|
+
_isMonthEnabled(month) {
|
|
595
|
+
if (!this.dateFilter) {
|
|
596
|
+
return true;
|
|
613
597
|
}
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
598
|
+
const firstOfMonth = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), month, 1, this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate));
|
|
599
|
+
// If any date in the month is enabled count the month as enabled.
|
|
600
|
+
for (let date = firstOfMonth; this._adapter.getMonth(date) === month; date = this._adapter.addCalendarDays(date, 1)) {
|
|
601
|
+
if (this.dateFilter(date)) {
|
|
602
|
+
return true;
|
|
617
603
|
}
|
|
618
604
|
}
|
|
605
|
+
return false;
|
|
619
606
|
}
|
|
620
|
-
|
|
621
|
-
|
|
607
|
+
}
|
|
608
|
+
/** @nocollapse */ /** @nocollapse */ MtxYearView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxYearView, deps: [{ token: i1.DatetimeAdapter, optional: true }, { token: MTX_DATETIME_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
609
|
+
/** @nocollapse */ /** @nocollapse */ MtxYearView.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.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 });
|
|
610
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxYearView, decorators: [{
|
|
611
|
+
type: Component,
|
|
612
|
+
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" }]
|
|
613
|
+
}], ctorParameters: function () { return [{ type: i1.DatetimeAdapter, decorators: [{
|
|
614
|
+
type: Optional
|
|
615
|
+
}] }, { type: undefined, decorators: [{
|
|
616
|
+
type: Optional
|
|
617
|
+
}, {
|
|
618
|
+
type: Inject,
|
|
619
|
+
args: [MTX_DATETIME_FORMATS]
|
|
620
|
+
}] }]; }, propDecorators: { type: [{
|
|
621
|
+
type: Input
|
|
622
|
+
}], dateFilter: [{
|
|
623
|
+
type: Input
|
|
624
|
+
}], selectedChange: [{
|
|
625
|
+
type: Output
|
|
626
|
+
}], _userSelection: [{
|
|
627
|
+
type: Output
|
|
628
|
+
}], activeDate: [{
|
|
629
|
+
type: Input
|
|
630
|
+
}], selected: [{
|
|
631
|
+
type: Input
|
|
632
|
+
}] } });
|
|
633
|
+
|
|
634
|
+
const CLOCK_RADIUS = 50;
|
|
635
|
+
const CLOCK_INNER_RADIUS = 27.5;
|
|
636
|
+
const CLOCK_OUTER_RADIUS = 41.25;
|
|
637
|
+
const CLOCK_TICK_RADIUS = 7.0833;
|
|
638
|
+
/**
|
|
639
|
+
* A clock that is used as part of the datetimepicker.
|
|
640
|
+
* @docs-private
|
|
641
|
+
*/
|
|
642
|
+
class MtxClock {
|
|
643
|
+
constructor(_element, _adapter) {
|
|
644
|
+
this._element = _element;
|
|
645
|
+
this._adapter = _adapter;
|
|
646
|
+
this.interval = 1;
|
|
647
|
+
this.twelvehour = false;
|
|
648
|
+
/** Emits when the currently selected date changes. */
|
|
649
|
+
this.selectedChange = new EventEmitter();
|
|
650
|
+
/** Emits when any date is activated. */
|
|
651
|
+
this.activeDateChange = new EventEmitter();
|
|
652
|
+
/** Emits when any date is selected. */
|
|
653
|
+
this._userSelection = new EventEmitter();
|
|
654
|
+
/** Hours and Minutes representing the clock view. */
|
|
655
|
+
this._hours = [];
|
|
656
|
+
this._minutes = [];
|
|
657
|
+
/** Whether the clock is in hour view. */
|
|
658
|
+
this._hourView = true;
|
|
659
|
+
this._timeChanged = false;
|
|
660
|
+
this.mouseMoveListener = (event) => {
|
|
661
|
+
this._handleMousemove(event);
|
|
662
|
+
};
|
|
663
|
+
this.mouseUpListener = () => {
|
|
664
|
+
this._handleMouseup();
|
|
665
|
+
};
|
|
622
666
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
return this._adapter.addCalendarHours(date, -12);
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
else if (this._AMPM === 'PM') {
|
|
632
|
-
return this._adapter.addCalendarHours(date, 12);
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
return date;
|
|
667
|
+
/**
|
|
668
|
+
* The date to display in this clock view.
|
|
669
|
+
*/
|
|
670
|
+
get activeDate() {
|
|
671
|
+
return this._activeDate;
|
|
636
672
|
}
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
this._AMPM = 'AM';
|
|
673
|
+
set activeDate(value) {
|
|
674
|
+
const oldActiveDate = this._activeDate;
|
|
675
|
+
this._activeDate = this._adapter.clampDate(value, this.minDate, this.maxDate);
|
|
676
|
+
if (!this._adapter.sameMinute(oldActiveDate, this._activeDate)) {
|
|
677
|
+
this._init();
|
|
643
678
|
}
|
|
644
679
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
}
|
|
649
|
-
this._AMPM = source;
|
|
650
|
-
if (this._AMPM === 'AM') {
|
|
651
|
-
this._activeDate = this._adapter.addCalendarHours(this._activeDate, -12);
|
|
652
|
-
}
|
|
653
|
-
else {
|
|
654
|
-
this._activeDate = this._adapter.addCalendarHours(this._activeDate, 12);
|
|
655
|
-
}
|
|
680
|
+
/** The currently selected date. */
|
|
681
|
+
get selected() {
|
|
682
|
+
return this._selected;
|
|
656
683
|
}
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
684
|
+
set selected(value) {
|
|
685
|
+
this._selected = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
686
|
+
if (this._selected) {
|
|
687
|
+
this.activeDate = this._selected;
|
|
661
688
|
}
|
|
662
|
-
this.currentView = 'year';
|
|
663
689
|
}
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
}
|
|
690
|
+
/** The minimum selectable date. */
|
|
691
|
+
get minDate() {
|
|
692
|
+
return this._minDate;
|
|
668
693
|
}
|
|
669
|
-
|
|
670
|
-
this.
|
|
671
|
-
this._clockView = 'hour';
|
|
694
|
+
set minDate(value) {
|
|
695
|
+
this._minDate = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
672
696
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
this.
|
|
697
|
+
/** The maximum selectable date. */
|
|
698
|
+
get maxDate() {
|
|
699
|
+
return this._maxDate;
|
|
676
700
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
this._activeDate =
|
|
680
|
-
this.currentView === 'month'
|
|
681
|
-
? this._adapter.addCalendarMonths(this._activeDate, -1)
|
|
682
|
-
: this._adapter.addCalendarYears(this._activeDate, this.currentView === 'year' ? -1 : -yearsPerPage);
|
|
701
|
+
set maxDate(value) {
|
|
702
|
+
this._maxDate = this._adapter.getValidDateOrNull(this._adapter.deserialize(value));
|
|
683
703
|
}
|
|
684
|
-
/**
|
|
685
|
-
|
|
686
|
-
this.
|
|
687
|
-
this.currentView === 'month'
|
|
688
|
-
? this._adapter.addCalendarMonths(this._activeDate, 1)
|
|
689
|
-
: this._adapter.addCalendarYears(this._activeDate, this.currentView === 'year' ? 1 : yearsPerPage);
|
|
704
|
+
/** Whether the clock should be started in hour or minute view. */
|
|
705
|
+
set startView(value) {
|
|
706
|
+
this._hourView = value !== 'minute';
|
|
690
707
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
if (
|
|
694
|
-
|
|
708
|
+
get _hand() {
|
|
709
|
+
let hour = this._adapter.getHour(this.activeDate);
|
|
710
|
+
if (this.twelvehour) {
|
|
711
|
+
if (hour === 0) {
|
|
712
|
+
hour = 24;
|
|
713
|
+
}
|
|
714
|
+
this._selectedHour = hour > 12 ? hour - 12 : hour;
|
|
695
715
|
}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
/** Whether the next period button is enabled. */
|
|
699
|
-
_nextEnabled() {
|
|
700
|
-
return !this.maxDate || !this._isSameView(this._activeDate, this.maxDate);
|
|
701
|
-
}
|
|
702
|
-
/** Handles keydown events on the calendar body. */
|
|
703
|
-
_handleCalendarBodyKeydown(event) {
|
|
704
|
-
// TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
|
|
705
|
-
// disabled ones from being selected. This may not be ideal, we should look into whether
|
|
706
|
-
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
|
|
707
|
-
if (this.currentView === 'month') {
|
|
708
|
-
this._handleCalendarBodyKeydownInMonthView(event);
|
|
709
|
-
}
|
|
710
|
-
else if (this.currentView === 'year') {
|
|
711
|
-
this._handleCalendarBodyKeydownInYearView(event);
|
|
716
|
+
else {
|
|
717
|
+
this._selectedHour = hour;
|
|
712
718
|
}
|
|
713
|
-
|
|
714
|
-
|
|
719
|
+
this._selectedMinute = this._adapter.getMinute(this.activeDate);
|
|
720
|
+
let deg = 0;
|
|
721
|
+
let radius = CLOCK_OUTER_RADIUS;
|
|
722
|
+
if (this._hourView) {
|
|
723
|
+
const outer = this._selectedHour > 0 && this._selectedHour < 13;
|
|
724
|
+
radius = outer ? CLOCK_OUTER_RADIUS : CLOCK_INNER_RADIUS;
|
|
725
|
+
if (this.twelvehour) {
|
|
726
|
+
radius = CLOCK_OUTER_RADIUS;
|
|
727
|
+
}
|
|
728
|
+
deg = Math.round(this._selectedHour * (360 / (24 / 2)));
|
|
715
729
|
}
|
|
716
730
|
else {
|
|
717
|
-
this.
|
|
731
|
+
deg = Math.round(this._selectedMinute * (360 / 60));
|
|
718
732
|
}
|
|
733
|
+
return {
|
|
734
|
+
'transform': `rotate(${deg}deg)`,
|
|
735
|
+
'height': `${radius}%`,
|
|
736
|
+
'margin-top': `${50 - radius}%`,
|
|
737
|
+
};
|
|
719
738
|
}
|
|
720
|
-
|
|
721
|
-
this.
|
|
722
|
-
|
|
723
|
-
.asObservable()
|
|
724
|
-
.pipe(first())
|
|
725
|
-
.subscribe(() => {
|
|
726
|
-
this._elementRef.nativeElement.focus();
|
|
727
|
-
});
|
|
728
|
-
});
|
|
739
|
+
ngAfterContentInit() {
|
|
740
|
+
this.activeDate = this._activeDate || this._adapter.today();
|
|
741
|
+
this._init();
|
|
729
742
|
}
|
|
730
|
-
|
|
731
|
-
|
|
743
|
+
/** Handles mousedown events on the clock body. */
|
|
744
|
+
_handleMousedown(event) {
|
|
745
|
+
this._timeChanged = false;
|
|
746
|
+
this.setTime(event);
|
|
747
|
+
document.addEventListener('mousemove', this.mouseMoveListener);
|
|
748
|
+
document.addEventListener('touchmove', this.mouseMoveListener);
|
|
749
|
+
document.addEventListener('mouseup', this.mouseUpListener);
|
|
750
|
+
document.addEventListener('touchend', this.mouseUpListener);
|
|
732
751
|
}
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
752
|
+
_handleMousemove(event) {
|
|
753
|
+
event.preventDefault();
|
|
754
|
+
this.setTime(event);
|
|
755
|
+
}
|
|
756
|
+
_handleMouseup() {
|
|
757
|
+
document.removeEventListener('mousemove', this.mouseMoveListener);
|
|
758
|
+
document.removeEventListener('touchmove', this.mouseMoveListener);
|
|
759
|
+
document.removeEventListener('mouseup', this.mouseUpListener);
|
|
760
|
+
document.removeEventListener('touchend', this.mouseUpListener);
|
|
761
|
+
if (this._timeChanged) {
|
|
762
|
+
this.selectedChange.emit(this.activeDate);
|
|
763
|
+
if (!this._hourView) {
|
|
764
|
+
this._userSelection.emit();
|
|
765
|
+
}
|
|
738
766
|
}
|
|
739
|
-
|
|
740
|
-
|
|
767
|
+
}
|
|
768
|
+
/** Initializes this clock view. */
|
|
769
|
+
_init() {
|
|
770
|
+
this._hours.length = 0;
|
|
771
|
+
this._minutes.length = 0;
|
|
772
|
+
const hourNames = this._adapter.getHourNames();
|
|
773
|
+
const minuteNames = this._adapter.getMinuteNames();
|
|
774
|
+
if (this.twelvehour) {
|
|
775
|
+
for (let i = 1; i < hourNames.length / 2 + 1; i++) {
|
|
776
|
+
const radian = (i / 6) * Math.PI;
|
|
777
|
+
const radius = CLOCK_OUTER_RADIUS;
|
|
778
|
+
const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), i + 1, 0);
|
|
779
|
+
const enabled = (!this.minDate || this._adapter.compareDatetime(date, this.minDate) >= 0) &&
|
|
780
|
+
(!this.maxDate || this._adapter.compareDatetime(date, this.maxDate) <= 0);
|
|
781
|
+
this._hours.push({
|
|
782
|
+
value: i,
|
|
783
|
+
displayValue: i === 0 ? '00' : hourNames[i],
|
|
784
|
+
enabled,
|
|
785
|
+
top: CLOCK_RADIUS - Math.cos(radian) * radius - CLOCK_TICK_RADIUS,
|
|
786
|
+
left: CLOCK_RADIUS + Math.sin(radian) * radius - CLOCK_TICK_RADIUS,
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
else {
|
|
791
|
+
for (let i = 0; i < hourNames.length; i++) {
|
|
792
|
+
const radian = (i / 6) * Math.PI;
|
|
793
|
+
const outer = i > 0 && i < 13;
|
|
794
|
+
const radius = outer ? CLOCK_OUTER_RADIUS : CLOCK_INNER_RADIUS;
|
|
795
|
+
const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), i, 0);
|
|
796
|
+
const enabled = (!this.minDate || this._adapter.compareDatetime(date, this.minDate, false) >= 0) &&
|
|
797
|
+
(!this.maxDate || this._adapter.compareDatetime(date, this.maxDate, false) <= 0) &&
|
|
798
|
+
(!this.dateFilter || this.dateFilter(date, MtxDatetimepickerFilterType.HOUR));
|
|
799
|
+
this._hours.push({
|
|
800
|
+
value: i,
|
|
801
|
+
displayValue: i === 0 ? '00' : hourNames[i],
|
|
802
|
+
enabled,
|
|
803
|
+
top: CLOCK_RADIUS - Math.cos(radian) * radius - CLOCK_TICK_RADIUS,
|
|
804
|
+
left: CLOCK_RADIUS + Math.sin(radian) * radius - CLOCK_TICK_RADIUS,
|
|
805
|
+
fontSize: i > 0 && i < 13 ? '' : '80%',
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
for (let i = 0; i < minuteNames.length; i += 5) {
|
|
810
|
+
const radian = (i / 30) * Math.PI;
|
|
811
|
+
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);
|
|
812
|
+
const enabled = (!this.minDate || this._adapter.compareDatetime(date, this.minDate) >= 0) &&
|
|
813
|
+
(!this.maxDate || this._adapter.compareDatetime(date, this.maxDate) <= 0) &&
|
|
814
|
+
(!this.dateFilter || this.dateFilter(date, MtxDatetimepickerFilterType.MINUTE));
|
|
815
|
+
this._minutes.push({
|
|
816
|
+
value: i,
|
|
817
|
+
displayValue: i === 0 ? '00' : minuteNames[i],
|
|
818
|
+
enabled,
|
|
819
|
+
top: CLOCK_RADIUS - Math.cos(radian) * CLOCK_OUTER_RADIUS - CLOCK_TICK_RADIUS,
|
|
820
|
+
left: CLOCK_RADIUS + Math.sin(radian) * CLOCK_OUTER_RADIUS - CLOCK_TICK_RADIUS,
|
|
821
|
+
});
|
|
741
822
|
}
|
|
742
|
-
// Otherwise we are in 'multi-year' view.
|
|
743
|
-
return isSameMultiYearView(this._adapter, date1, date2, this.minDate, this.maxDate);
|
|
744
823
|
}
|
|
745
|
-
/**
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
: this._adapter.addCalendarMonths(this._activeDate, 1);
|
|
776
|
-
break;
|
|
777
|
-
case ENTER:
|
|
778
|
-
if (this._dateFilterForViews(this._activeDate)) {
|
|
779
|
-
this._dateSelected(this._activeDate);
|
|
780
|
-
// Prevent unexpected default actions such as form submission.
|
|
781
|
-
event.preventDefault();
|
|
824
|
+
/**
|
|
825
|
+
* Set Time
|
|
826
|
+
* @param event
|
|
827
|
+
*/
|
|
828
|
+
setTime(event) {
|
|
829
|
+
const trigger = this._element.nativeElement;
|
|
830
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
831
|
+
const width = trigger.offsetWidth;
|
|
832
|
+
const height = trigger.offsetHeight;
|
|
833
|
+
const pageX = event.pageX !== undefined ? event.pageX : event.touches[0].pageX;
|
|
834
|
+
const pageY = event.pageY !== undefined ? event.pageY : event.touches[0].pageY;
|
|
835
|
+
const x = width / 2 - (pageX - triggerRect.left - window.pageXOffset);
|
|
836
|
+
const y = height / 2 - (pageY - triggerRect.top - window.pageYOffset);
|
|
837
|
+
let radian = Math.atan2(-x, y);
|
|
838
|
+
const unit = Math.PI / (this._hourView ? 6 : this.interval ? 30 / this.interval : 30);
|
|
839
|
+
const z = Math.sqrt(x * x + y * y);
|
|
840
|
+
const outer = this._hourView &&
|
|
841
|
+
z > (width * (CLOCK_OUTER_RADIUS / 100) + width * (CLOCK_INNER_RADIUS / 100)) / 2;
|
|
842
|
+
if (radian < 0) {
|
|
843
|
+
radian = Math.PI * 2 + radian;
|
|
844
|
+
}
|
|
845
|
+
let value = Math.round(radian / unit);
|
|
846
|
+
let date;
|
|
847
|
+
if (this._hourView) {
|
|
848
|
+
if (this.twelvehour) {
|
|
849
|
+
value = value === 0 ? 12 : value;
|
|
850
|
+
}
|
|
851
|
+
else {
|
|
852
|
+
if (value === 12) {
|
|
853
|
+
value = 0;
|
|
782
854
|
}
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
return;
|
|
855
|
+
value = outer ? (value === 0 ? 12 : value) : value === 0 ? 0 : value + 12;
|
|
856
|
+
}
|
|
857
|
+
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));
|
|
787
858
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
break;
|
|
797
|
-
case RIGHT_ARROW:
|
|
798
|
-
this._activeDate = this._adapter.addCalendarMonths(this._activeDate, 1);
|
|
799
|
-
break;
|
|
800
|
-
case UP_ARROW:
|
|
801
|
-
this._activeDate = this._prevMonthInSameCol(this._activeDate);
|
|
802
|
-
break;
|
|
803
|
-
case DOWN_ARROW:
|
|
804
|
-
this._activeDate = this._nextMonthInSameCol(this._activeDate);
|
|
805
|
-
break;
|
|
806
|
-
case HOME:
|
|
807
|
-
this._activeDate = this._adapter.addCalendarMonths(this._activeDate, -this._adapter.getMonth(this._activeDate));
|
|
808
|
-
break;
|
|
809
|
-
case END:
|
|
810
|
-
this._activeDate = this._adapter.addCalendarMonths(this._activeDate, 11 - this._adapter.getMonth(this._activeDate));
|
|
811
|
-
break;
|
|
812
|
-
case PAGE_UP:
|
|
813
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? -10 : -1);
|
|
814
|
-
break;
|
|
815
|
-
case PAGE_DOWN:
|
|
816
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? 10 : 1);
|
|
817
|
-
break;
|
|
818
|
-
case ENTER:
|
|
819
|
-
this._monthSelected(this._activeDate);
|
|
820
|
-
break;
|
|
821
|
-
default:
|
|
822
|
-
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
823
|
-
return;
|
|
859
|
+
else {
|
|
860
|
+
if (this.interval) {
|
|
861
|
+
value *= this.interval;
|
|
862
|
+
}
|
|
863
|
+
if (value === 60) {
|
|
864
|
+
value = 0;
|
|
865
|
+
}
|
|
866
|
+
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);
|
|
824
867
|
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
/** Handles keydown events on the calendar body when calendar is in multi-year view. */
|
|
829
|
-
_handleCalendarBodyKeydownInMultiYearView(event) {
|
|
830
|
-
switch (event.keyCode) {
|
|
831
|
-
case LEFT_ARROW:
|
|
832
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, -1);
|
|
833
|
-
break;
|
|
834
|
-
case RIGHT_ARROW:
|
|
835
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, 1);
|
|
836
|
-
break;
|
|
837
|
-
case UP_ARROW:
|
|
838
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, -yearsPerRow);
|
|
839
|
-
break;
|
|
840
|
-
case DOWN_ARROW:
|
|
841
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, yearsPerRow);
|
|
842
|
-
break;
|
|
843
|
-
case HOME:
|
|
844
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, -getActiveOffset(this._adapter, this._activeDate, this.minDate, this.maxDate));
|
|
845
|
-
break;
|
|
846
|
-
case END:
|
|
847
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, yearsPerPage -
|
|
848
|
-
getActiveOffset(this._adapter, this._activeDate, this.minDate, this.maxDate) -
|
|
849
|
-
1);
|
|
850
|
-
break;
|
|
851
|
-
case PAGE_UP:
|
|
852
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? -yearsPerPage * 10 : -yearsPerPage);
|
|
853
|
-
break;
|
|
854
|
-
case PAGE_DOWN:
|
|
855
|
-
this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? yearsPerPage * 10 : yearsPerPage);
|
|
856
|
-
break;
|
|
857
|
-
case ENTER:
|
|
858
|
-
this._yearSelected(this._activeDate);
|
|
859
|
-
break;
|
|
860
|
-
default:
|
|
861
|
-
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
862
|
-
return;
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
/** Handles keydown events on the calendar body when calendar is in month view. */
|
|
866
|
-
_handleCalendarBodyKeydownInClockView(event) {
|
|
867
|
-
switch (event.keyCode) {
|
|
868
|
-
case UP_ARROW:
|
|
869
|
-
this._activeDate =
|
|
870
|
-
this._clockView === 'hour'
|
|
871
|
-
? this._adapter.addCalendarHours(this._activeDate, 1)
|
|
872
|
-
: this._adapter.addCalendarMinutes(this._activeDate, 1);
|
|
873
|
-
break;
|
|
874
|
-
case DOWN_ARROW:
|
|
875
|
-
this._activeDate =
|
|
876
|
-
this._clockView === 'hour'
|
|
877
|
-
? this._adapter.addCalendarHours(this._activeDate, -1)
|
|
878
|
-
: this._adapter.addCalendarMinutes(this._activeDate, -1);
|
|
879
|
-
break;
|
|
880
|
-
case ENTER:
|
|
881
|
-
this._timeSelected(this._activeDate);
|
|
882
|
-
return;
|
|
883
|
-
default:
|
|
884
|
-
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
885
|
-
return;
|
|
886
|
-
}
|
|
887
|
-
// Prevent unexpected default actions such as form submission.
|
|
888
|
-
event.preventDefault();
|
|
889
|
-
}
|
|
890
|
-
/**
|
|
891
|
-
* Determine the date for the month that comes before the given month in the same column in the
|
|
892
|
-
* calendar table.
|
|
893
|
-
*/
|
|
894
|
-
_prevMonthInSameCol(date) {
|
|
895
|
-
// Determine how many months to jump forward given that there are 2 empty slots at the beginning
|
|
896
|
-
// of each year.
|
|
897
|
-
const increment = this._adapter.getMonth(date) <= 4 ? -5 : this._adapter.getMonth(date) >= 7 ? -7 : -12;
|
|
898
|
-
return this._adapter.addCalendarMonths(date, increment);
|
|
899
|
-
}
|
|
900
|
-
/**
|
|
901
|
-
* Determine the date for the month that comes after the given month in the same column in the
|
|
902
|
-
* calendar table.
|
|
903
|
-
*/
|
|
904
|
-
_nextMonthInSameCol(date) {
|
|
905
|
-
// Determine how many months to jump forward given that there are 2 empty slots at the beginning
|
|
906
|
-
// of each year.
|
|
907
|
-
const increment = this._adapter.getMonth(date) <= 4 ? 7 : this._adapter.getMonth(date) >= 7 ? 5 : 12;
|
|
908
|
-
return this._adapter.addCalendarMonths(date, increment);
|
|
909
|
-
}
|
|
910
|
-
calendarState(direction) {
|
|
911
|
-
this._calendarState = direction;
|
|
912
|
-
}
|
|
913
|
-
_2digit(n) {
|
|
914
|
-
return ('00' + n).slice(-2);
|
|
868
|
+
this._timeChanged = true;
|
|
869
|
+
this.activeDate = date;
|
|
870
|
+
this.activeDateChange.emit(this.activeDate);
|
|
915
871
|
}
|
|
916
872
|
}
|
|
917
|
-
/** @
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
'
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
},
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
];
|
|
949
|
-
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
950
|
-
MtxCalendar.propDecorators = {
|
|
951
|
-
multiYearSelector: [{ type: Input }],
|
|
952
|
-
twelvehour: [{ type: Input }],
|
|
953
|
-
startView: [{ type: Input }],
|
|
954
|
-
timeInterval: [{ type: Input }],
|
|
955
|
-
dateFilter: [{ type: Input }],
|
|
956
|
-
preventSameDateTimeSelection: [{ type: Input }],
|
|
957
|
-
selectedChange: [{ type: Output }],
|
|
958
|
-
viewChanged: [{ type: Output }],
|
|
959
|
-
_userSelection: [{ type: Output }],
|
|
960
|
-
type: [{ type: Input }],
|
|
961
|
-
startAt: [{ type: Input }],
|
|
962
|
-
selected: [{ type: Input }],
|
|
963
|
-
minDate: [{ type: Input }],
|
|
964
|
-
maxDate: [{ type: Input }]
|
|
965
|
-
};
|
|
873
|
+
/** @nocollapse */ /** @nocollapse */ MtxClock.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxClock, deps: [{ token: i0.ElementRef }, { token: i1.DatetimeAdapter }], target: i0.ɵɵFactoryTarget.Component });
|
|
874
|
+
/** @nocollapse */ /** @nocollapse */ MtxClock.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.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 });
|
|
875
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxClock, decorators: [{
|
|
876
|
+
type: Component,
|
|
877
|
+
args: [{ selector: 'mtx-clock', host: {
|
|
878
|
+
'[class.mtx-clock]': 'true',
|
|
879
|
+
'role': 'clock',
|
|
880
|
+
'(mousedown)': '_handleMousedown($event)',
|
|
881
|
+
}, 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"] }]
|
|
882
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DatetimeAdapter }]; }, propDecorators: { dateFilter: [{
|
|
883
|
+
type: Input
|
|
884
|
+
}], interval: [{
|
|
885
|
+
type: Input
|
|
886
|
+
}], twelvehour: [{
|
|
887
|
+
type: Input
|
|
888
|
+
}], selectedChange: [{
|
|
889
|
+
type: Output
|
|
890
|
+
}], activeDateChange: [{
|
|
891
|
+
type: Output
|
|
892
|
+
}], _userSelection: [{
|
|
893
|
+
type: Output
|
|
894
|
+
}], activeDate: [{
|
|
895
|
+
type: Input
|
|
896
|
+
}], selected: [{
|
|
897
|
+
type: Input
|
|
898
|
+
}], minDate: [{
|
|
899
|
+
type: Input
|
|
900
|
+
}], maxDate: [{
|
|
901
|
+
type: Input
|
|
902
|
+
}], startView: [{
|
|
903
|
+
type: Input
|
|
904
|
+
}] } });
|
|
966
905
|
|
|
967
|
-
const CLOCK_RADIUS = 50;
|
|
968
|
-
const CLOCK_INNER_RADIUS = 27.5;
|
|
969
|
-
const CLOCK_OUTER_RADIUS = 41.25;
|
|
970
|
-
const CLOCK_TICK_RADIUS = 7.0833;
|
|
971
906
|
/**
|
|
972
|
-
* A
|
|
907
|
+
* A calendar that is used as part of the datetimepicker.
|
|
973
908
|
* @docs-private
|
|
974
909
|
*/
|
|
975
|
-
class
|
|
976
|
-
constructor(
|
|
977
|
-
this.
|
|
910
|
+
class MtxCalendar {
|
|
911
|
+
constructor(_elementRef, _intl, _ngZone, _adapter, _dateFormats, changeDetectorRef) {
|
|
912
|
+
this._elementRef = _elementRef;
|
|
913
|
+
this._intl = _intl;
|
|
914
|
+
this._ngZone = _ngZone;
|
|
978
915
|
this._adapter = _adapter;
|
|
979
|
-
this.
|
|
980
|
-
this.
|
|
916
|
+
this._dateFormats = _dateFormats;
|
|
917
|
+
this._multiYearSelector = false;
|
|
918
|
+
this._twelvehour = false;
|
|
919
|
+
/** Whether the calendar should be started in month or year view. */
|
|
920
|
+
this.startView = 'month';
|
|
921
|
+
this.timeInterval = 1;
|
|
922
|
+
/** Prevent user to select same date time */
|
|
923
|
+
this.preventSameDateTimeSelection = false;
|
|
981
924
|
/** Emits when the currently selected date changes. */
|
|
982
925
|
this.selectedChange = new EventEmitter();
|
|
983
|
-
/** Emits when
|
|
984
|
-
this.
|
|
985
|
-
/** Emits when any date is selected. */
|
|
926
|
+
/** Emits when the view has been changed. */
|
|
927
|
+
this.viewChanged = new EventEmitter();
|
|
986
928
|
this._userSelection = new EventEmitter();
|
|
987
|
-
|
|
988
|
-
this.
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
};
|
|
996
|
-
this.mouseUpListener = () => {
|
|
997
|
-
this._handleMouseup();
|
|
929
|
+
this._clockView = 'hour';
|
|
930
|
+
this._type = 'date';
|
|
931
|
+
/** Date filter for the month and year views. */
|
|
932
|
+
this._dateFilterForViews = (date) => {
|
|
933
|
+
return (!!date &&
|
|
934
|
+
(!this.dateFilter || this.dateFilter(date, MtxDatetimepickerFilterType.DATE)) &&
|
|
935
|
+
(!this.minDate || this._adapter.compareDate(date, this.minDate) >= 0) &&
|
|
936
|
+
(!this.maxDate || this._adapter.compareDate(date, this.maxDate) <= 0));
|
|
998
937
|
};
|
|
938
|
+
if (!this._adapter) {
|
|
939
|
+
throw createMissingDateImplError('DatetimeAdapter');
|
|
940
|
+
}
|
|
941
|
+
if (!this._dateFormats) {
|
|
942
|
+
throw createMissingDateImplError('MTX_DATETIME_FORMATS');
|
|
943
|
+
}
|
|
944
|
+
this._intlChanges = _intl.changes.subscribe(() => changeDetectorRef.markForCheck());
|
|
999
945
|
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
*/
|
|
1003
|
-
get activeDate() {
|
|
1004
|
-
return this._activeDate;
|
|
946
|
+
get multiYearSelector() {
|
|
947
|
+
return this._multiYearSelector;
|
|
1005
948
|
}
|
|
1006
|
-
set
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
949
|
+
set multiYearSelector(value) {
|
|
950
|
+
this._multiYearSelector = coerceBooleanProperty(value);
|
|
951
|
+
}
|
|
952
|
+
/** if true change the clock to 12 hour format. */
|
|
953
|
+
get twelvehour() {
|
|
954
|
+
return this._twelvehour;
|
|
955
|
+
}
|
|
956
|
+
set twelvehour(value) {
|
|
957
|
+
this._twelvehour = coerceBooleanProperty(value);
|
|
958
|
+
}
|
|
959
|
+
get type() {
|
|
960
|
+
return this._type;
|
|
961
|
+
}
|
|
962
|
+
set type(value) {
|
|
963
|
+
this._type = value || 'date';
|
|
964
|
+
if (this.type === 'year') {
|
|
965
|
+
this.multiYearSelector = true;
|
|
1011
966
|
}
|
|
1012
967
|
}
|
|
968
|
+
/** A date representing the period (month or year) to start the calendar in. */
|
|
969
|
+
get startAt() {
|
|
970
|
+
return this._startAt;
|
|
971
|
+
}
|
|
972
|
+
set startAt(value) {
|
|
973
|
+
this._startAt = this._adapter.getValidDateOrNull(value);
|
|
974
|
+
}
|
|
1013
975
|
/** The currently selected date. */
|
|
1014
976
|
get selected() {
|
|
1015
977
|
return this._selected;
|
|
1016
978
|
}
|
|
1017
979
|
set selected(value) {
|
|
1018
|
-
this._selected = this._adapter.getValidDateOrNull(
|
|
1019
|
-
if (this._selected) {
|
|
1020
|
-
this.activeDate = this._selected;
|
|
1021
|
-
}
|
|
980
|
+
this._selected = this._adapter.getValidDateOrNull(value);
|
|
1022
981
|
}
|
|
1023
982
|
/** The minimum selectable date. */
|
|
1024
983
|
get minDate() {
|
|
1025
984
|
return this._minDate;
|
|
1026
985
|
}
|
|
1027
986
|
set minDate(value) {
|
|
1028
|
-
this._minDate = this._adapter.getValidDateOrNull(
|
|
987
|
+
this._minDate = this._adapter.getValidDateOrNull(value);
|
|
1029
988
|
}
|
|
1030
989
|
/** The maximum selectable date. */
|
|
1031
990
|
get maxDate() {
|
|
1032
991
|
return this._maxDate;
|
|
1033
992
|
}
|
|
1034
993
|
set maxDate(value) {
|
|
1035
|
-
this._maxDate = this._adapter.getValidDateOrNull(
|
|
994
|
+
this._maxDate = this._adapter.getValidDateOrNull(value);
|
|
1036
995
|
}
|
|
1037
|
-
/**
|
|
1038
|
-
|
|
1039
|
-
|
|
996
|
+
/**
|
|
997
|
+
* The current active date. This determines which time period is shown and which date is
|
|
998
|
+
* highlighted when using keyboard navigation.
|
|
999
|
+
*/
|
|
1000
|
+
get _activeDate() {
|
|
1001
|
+
return this._clampedActiveDate;
|
|
1040
1002
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1003
|
+
set _activeDate(value) {
|
|
1004
|
+
const oldActiveDate = this._clampedActiveDate;
|
|
1005
|
+
this._clampedActiveDate = this._adapter.clampDate(value, this.minDate, this.maxDate);
|
|
1006
|
+
if (oldActiveDate &&
|
|
1007
|
+
this._clampedActiveDate &&
|
|
1008
|
+
this.currentView === 'month' &&
|
|
1009
|
+
!this._adapter.sameMonthAndYear(oldActiveDate, this._clampedActiveDate)) {
|
|
1010
|
+
if (this._adapter.isInNextMonth(oldActiveDate, this._clampedActiveDate)) {
|
|
1011
|
+
this.calendarState('right');
|
|
1046
1012
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
else {
|
|
1050
|
-
this._selectedHour = hour;
|
|
1051
|
-
}
|
|
1052
|
-
this._selectedMinute = this._adapter.getMinute(this.activeDate);
|
|
1053
|
-
let deg = 0;
|
|
1054
|
-
let radius = CLOCK_OUTER_RADIUS;
|
|
1055
|
-
if (this._hourView) {
|
|
1056
|
-
const outer = this._selectedHour > 0 && this._selectedHour < 13;
|
|
1057
|
-
radius = outer ? CLOCK_OUTER_RADIUS : CLOCK_INNER_RADIUS;
|
|
1058
|
-
if (this.twelvehour) {
|
|
1059
|
-
radius = CLOCK_OUTER_RADIUS;
|
|
1013
|
+
else {
|
|
1014
|
+
this.calendarState('left');
|
|
1060
1015
|
}
|
|
1061
|
-
deg = Math.round(this._selectedHour * (360 / (24 / 2)));
|
|
1062
|
-
}
|
|
1063
|
-
else {
|
|
1064
|
-
deg = Math.round(this._selectedMinute * (360 / 60));
|
|
1065
1016
|
}
|
|
1066
|
-
return {
|
|
1067
|
-
'transform': `rotate(${deg}deg)`,
|
|
1068
|
-
'height': `${radius}%`,
|
|
1069
|
-
'margin-top': `${50 - radius}%`,
|
|
1070
|
-
};
|
|
1071
1017
|
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
this.
|
|
1018
|
+
/** Whether the calendar is in month view. */
|
|
1019
|
+
get currentView() {
|
|
1020
|
+
return this._currentView;
|
|
1075
1021
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
this.
|
|
1079
|
-
this.setTime(event);
|
|
1080
|
-
document.addEventListener('mousemove', this.mouseMoveListener);
|
|
1081
|
-
document.addEventListener('touchmove', this.mouseMoveListener);
|
|
1082
|
-
document.addEventListener('mouseup', this.mouseUpListener);
|
|
1083
|
-
document.addEventListener('touchend', this.mouseUpListener);
|
|
1022
|
+
set currentView(view) {
|
|
1023
|
+
this._currentView = view;
|
|
1024
|
+
this.viewChanged.emit(view);
|
|
1084
1025
|
}
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
this.
|
|
1026
|
+
/** The label for the current calendar view. */
|
|
1027
|
+
get _yearLabel() {
|
|
1028
|
+
return this._adapter.getYearName(this._activeDate);
|
|
1088
1029
|
}
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
this.
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1030
|
+
get _monthYearLabel() {
|
|
1031
|
+
if (this.currentView === 'multi-year') {
|
|
1032
|
+
// The offset from the active year to the "slot" for the starting year is the
|
|
1033
|
+
// *actual* first rendered year in the multi-year view, and the last year is
|
|
1034
|
+
// just yearsPerPage - 1 away.
|
|
1035
|
+
const activeYear = this._adapter.getYear(this._activeDate);
|
|
1036
|
+
const minYearOfPage = activeYear - getActiveOffset(this._adapter, this._activeDate, this.minDate, this.maxDate);
|
|
1037
|
+
const maxYearOfPage = minYearOfPage + yearsPerPage - 1;
|
|
1038
|
+
const minYearName = this._adapter.getYearName(this._adapter.createDate(minYearOfPage, 0, 1));
|
|
1039
|
+
const maxYearName = this._adapter.getYearName(this._adapter.createDate(maxYearOfPage, 0, 1));
|
|
1040
|
+
return this._intl.formatYearRange(minYearName, maxYearName);
|
|
1099
1041
|
}
|
|
1042
|
+
return this.currentView === 'month'
|
|
1043
|
+
? this._adapter.getMonthNames('long')[this._adapter.getMonth(this._activeDate)]
|
|
1044
|
+
: this._adapter.getYearName(this._activeDate);
|
|
1100
1045
|
}
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1046
|
+
get _dateLabel() {
|
|
1047
|
+
switch (this.type) {
|
|
1048
|
+
case 'month':
|
|
1049
|
+
return this._adapter.getMonthNames('long')[this._adapter.getMonth(this._activeDate)];
|
|
1050
|
+
default:
|
|
1051
|
+
return this._adapter.format(this._activeDate, this._dateFormats.display.popupHeaderDateLabel);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
get _hoursLabel() {
|
|
1055
|
+
let hour = this._adapter.getHour(this._activeDate);
|
|
1107
1056
|
if (this.twelvehour) {
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
const radius = CLOCK_OUTER_RADIUS;
|
|
1111
|
-
const date = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), this._adapter.getMonth(this.activeDate), this._adapter.getDate(this.activeDate), i + 1, 0);
|
|
1112
|
-
const enabled = (!this.minDate || this._adapter.compareDatetime(date, this.minDate) >= 0) &&
|
|
1113
|
-
(!this.maxDate || this._adapter.compareDatetime(date, this.maxDate) <= 0);
|
|
1114
|
-
this._hours.push({
|
|
1115
|
-
value: i,
|
|
1116
|
-
displayValue: i === 0 ? '00' : hourNames[i],
|
|
1117
|
-
enabled,
|
|
1118
|
-
top: CLOCK_RADIUS - Math.cos(radian) * radius - CLOCK_TICK_RADIUS,
|
|
1119
|
-
left: CLOCK_RADIUS + Math.sin(radian) * radius - CLOCK_TICK_RADIUS,
|
|
1120
|
-
});
|
|
1057
|
+
if (hour === 0) {
|
|
1058
|
+
hour = 24;
|
|
1121
1059
|
}
|
|
1060
|
+
hour = hour > 12 ? hour - 12 : hour;
|
|
1061
|
+
}
|
|
1062
|
+
return this._2digit(hour);
|
|
1063
|
+
}
|
|
1064
|
+
get _minutesLabel() {
|
|
1065
|
+
return this._2digit(this._adapter.getMinute(this._activeDate));
|
|
1066
|
+
}
|
|
1067
|
+
get _ariaLabelNext() {
|
|
1068
|
+
switch (this._currentView) {
|
|
1069
|
+
case 'month':
|
|
1070
|
+
return this._intl.nextMonthLabel;
|
|
1071
|
+
case 'year':
|
|
1072
|
+
return this._intl.nextYearLabel;
|
|
1073
|
+
case 'multi-year':
|
|
1074
|
+
return this._intl.nextMultiYearLabel;
|
|
1075
|
+
default:
|
|
1076
|
+
return '';
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
get _ariaLabelPrev() {
|
|
1080
|
+
switch (this._currentView) {
|
|
1081
|
+
case 'month':
|
|
1082
|
+
return this._intl.prevMonthLabel;
|
|
1083
|
+
case 'year':
|
|
1084
|
+
return this._intl.prevYearLabel;
|
|
1085
|
+
case 'multi-year':
|
|
1086
|
+
return this._intl.prevMultiYearLabel;
|
|
1087
|
+
default:
|
|
1088
|
+
return '';
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
_userSelected() {
|
|
1092
|
+
this._userSelection.emit();
|
|
1093
|
+
}
|
|
1094
|
+
ngAfterContentInit() {
|
|
1095
|
+
this._activeDate = this.startAt || this._adapter.today();
|
|
1096
|
+
this._selectAMPM(this._activeDate);
|
|
1097
|
+
if (this.type === 'year') {
|
|
1098
|
+
this.currentView = 'multi-year';
|
|
1099
|
+
}
|
|
1100
|
+
else if (this.type === 'month') {
|
|
1101
|
+
this.currentView = 'year';
|
|
1102
|
+
}
|
|
1103
|
+
else if (this.type === 'time') {
|
|
1104
|
+
this.currentView = 'clock';
|
|
1122
1105
|
}
|
|
1123
1106
|
else {
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
enabled,
|
|
1136
|
-
top: CLOCK_RADIUS - Math.cos(radian) * radius - CLOCK_TICK_RADIUS,
|
|
1137
|
-
left: CLOCK_RADIUS + Math.sin(radian) * radius - CLOCK_TICK_RADIUS,
|
|
1138
|
-
fontSize: i > 0 && i < 13 ? '' : '80%',
|
|
1139
|
-
});
|
|
1107
|
+
this.currentView = this.startView || 'month';
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
ngOnDestroy() {
|
|
1111
|
+
this._intlChanges.unsubscribe();
|
|
1112
|
+
}
|
|
1113
|
+
/** Handles date selection in the month view. */
|
|
1114
|
+
_dateSelected(date) {
|
|
1115
|
+
if (this.type === 'date') {
|
|
1116
|
+
if (!this._adapter.sameDate(date, this.selected) || !this.preventSameDateTimeSelection) {
|
|
1117
|
+
this.selectedChange.emit(date);
|
|
1140
1118
|
}
|
|
1141
1119
|
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
const enabled = (!this.minDate || this._adapter.compareDatetime(date, this.minDate) >= 0) &&
|
|
1146
|
-
(!this.maxDate || this._adapter.compareDatetime(date, this.maxDate) <= 0) &&
|
|
1147
|
-
(!this.dateFilter || this.dateFilter(date, MtxDatetimepickerFilterType.MINUTE));
|
|
1148
|
-
this._minutes.push({
|
|
1149
|
-
value: i,
|
|
1150
|
-
displayValue: i === 0 ? '00' : minuteNames[i],
|
|
1151
|
-
enabled,
|
|
1152
|
-
top: CLOCK_RADIUS - Math.cos(radian) * CLOCK_OUTER_RADIUS - CLOCK_TICK_RADIUS,
|
|
1153
|
-
left: CLOCK_RADIUS + Math.sin(radian) * CLOCK_OUTER_RADIUS - CLOCK_TICK_RADIUS,
|
|
1154
|
-
});
|
|
1120
|
+
else {
|
|
1121
|
+
this._activeDate = date;
|
|
1122
|
+
this.currentView = 'clock';
|
|
1155
1123
|
}
|
|
1156
1124
|
}
|
|
1157
|
-
/**
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
const triggerRect = trigger.getBoundingClientRect();
|
|
1164
|
-
const width = trigger.offsetWidth;
|
|
1165
|
-
const height = trigger.offsetHeight;
|
|
1166
|
-
const pageX = event.pageX !== undefined ? event.pageX : event.touches[0].pageX;
|
|
1167
|
-
const pageY = event.pageY !== undefined ? event.pageY : event.touches[0].pageY;
|
|
1168
|
-
const x = width / 2 - (pageX - triggerRect.left - window.pageXOffset);
|
|
1169
|
-
const y = height / 2 - (pageY - triggerRect.top - window.pageYOffset);
|
|
1170
|
-
let radian = Math.atan2(-x, y);
|
|
1171
|
-
const unit = Math.PI / (this._hourView ? 6 : this.interval ? 30 / this.interval : 30);
|
|
1172
|
-
const z = Math.sqrt(x * x + y * y);
|
|
1173
|
-
const outer = this._hourView &&
|
|
1174
|
-
z > (width * (CLOCK_OUTER_RADIUS / 100) + width * (CLOCK_INNER_RADIUS / 100)) / 2;
|
|
1175
|
-
if (radian < 0) {
|
|
1176
|
-
radian = Math.PI * 2 + radian;
|
|
1177
|
-
}
|
|
1178
|
-
let value = Math.round(radian / unit);
|
|
1179
|
-
let date;
|
|
1180
|
-
if (this._hourView) {
|
|
1181
|
-
if (this.twelvehour) {
|
|
1182
|
-
value = value === 0 ? 12 : value;
|
|
1125
|
+
/** Handles month selection in the year view. */
|
|
1126
|
+
_monthSelected(month) {
|
|
1127
|
+
if (this.type === 'month') {
|
|
1128
|
+
if (!this._adapter.sameMonthAndYear(month, this.selected) ||
|
|
1129
|
+
!this.preventSameDateTimeSelection) {
|
|
1130
|
+
this.selectedChange.emit(this._adapter.getFirstDateOfMonth(month));
|
|
1183
1131
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1132
|
+
}
|
|
1133
|
+
else {
|
|
1134
|
+
this._activeDate = month;
|
|
1135
|
+
this.currentView = 'month';
|
|
1136
|
+
this._clockView = 'hour';
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
/** Handles year selection in the multi year view. */
|
|
1140
|
+
_yearSelected(year) {
|
|
1141
|
+
if (this.type === 'year') {
|
|
1142
|
+
if (!this._adapter.sameYear(year, this.selected) || !this.preventSameDateTimeSelection) {
|
|
1143
|
+
const normalizedDate = this._adapter.createDatetime(this._adapter.getYear(year), 0, 1, 0, 0);
|
|
1144
|
+
this.selectedChange.emit(normalizedDate);
|
|
1189
1145
|
}
|
|
1190
|
-
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));
|
|
1191
1146
|
}
|
|
1192
1147
|
else {
|
|
1193
|
-
|
|
1194
|
-
|
|
1148
|
+
this._activeDate = year;
|
|
1149
|
+
this.currentView = 'year';
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
_timeSelected(date) {
|
|
1153
|
+
if (this._clockView !== 'minute') {
|
|
1154
|
+
this._activeDate = this._updateDate(date);
|
|
1155
|
+
this._clockView = 'minute';
|
|
1156
|
+
}
|
|
1157
|
+
else {
|
|
1158
|
+
if (!this._adapter.sameDatetime(date, this.selected) || !this.preventSameDateTimeSelection) {
|
|
1159
|
+
this.selectedChange.emit(date);
|
|
1195
1160
|
}
|
|
1196
|
-
|
|
1197
|
-
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
_onActiveDateChange(date) {
|
|
1164
|
+
this._activeDate = date;
|
|
1165
|
+
}
|
|
1166
|
+
_updateDate(date) {
|
|
1167
|
+
if (this.twelvehour) {
|
|
1168
|
+
const HOUR = this._adapter.getHour(date);
|
|
1169
|
+
if (HOUR === 12) {
|
|
1170
|
+
if (this._AMPM === 'AM') {
|
|
1171
|
+
return this._adapter.addCalendarHours(date, -12);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
else if (this._AMPM === 'PM') {
|
|
1175
|
+
return this._adapter.addCalendarHours(date, 12);
|
|
1198
1176
|
}
|
|
1199
|
-
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);
|
|
1200
1177
|
}
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1178
|
+
return date;
|
|
1179
|
+
}
|
|
1180
|
+
_selectAMPM(date) {
|
|
1181
|
+
if (this._adapter.getHour(date) > 11) {
|
|
1182
|
+
this._AMPM = 'PM';
|
|
1183
|
+
}
|
|
1184
|
+
else {
|
|
1185
|
+
this._AMPM = 'AM';
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
_ampmClicked(source) {
|
|
1189
|
+
if (source === this._AMPM) {
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
this._AMPM = source;
|
|
1193
|
+
if (this._AMPM === 'AM') {
|
|
1194
|
+
this._activeDate = this._adapter.addCalendarHours(this._activeDate, -12);
|
|
1195
|
+
}
|
|
1196
|
+
else {
|
|
1197
|
+
this._activeDate = this._adapter.addCalendarHours(this._activeDate, 12);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
_yearClicked() {
|
|
1201
|
+
if (this.type === 'year' || this.multiYearSelector) {
|
|
1202
|
+
this.currentView = 'multi-year';
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1205
|
+
this.currentView = 'year';
|
|
1206
|
+
}
|
|
1207
|
+
_dateClicked() {
|
|
1208
|
+
if (this.type !== 'month') {
|
|
1209
|
+
this.currentView = 'month';
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
_hoursClicked() {
|
|
1213
|
+
this.currentView = 'clock';
|
|
1214
|
+
this._clockView = 'hour';
|
|
1215
|
+
}
|
|
1216
|
+
_minutesClicked() {
|
|
1217
|
+
this.currentView = 'clock';
|
|
1218
|
+
this._clockView = 'minute';
|
|
1219
|
+
}
|
|
1220
|
+
/** Handles user clicks on the previous button. */
|
|
1221
|
+
_previousClicked() {
|
|
1222
|
+
this._activeDate =
|
|
1223
|
+
this.currentView === 'month'
|
|
1224
|
+
? this._adapter.addCalendarMonths(this._activeDate, -1)
|
|
1225
|
+
: this._adapter.addCalendarYears(this._activeDate, this.currentView === 'year' ? -1 : -yearsPerPage);
|
|
1226
|
+
}
|
|
1227
|
+
/** Handles user clicks on the next button. */
|
|
1228
|
+
_nextClicked() {
|
|
1229
|
+
this._activeDate =
|
|
1230
|
+
this.currentView === 'month'
|
|
1231
|
+
? this._adapter.addCalendarMonths(this._activeDate, 1)
|
|
1232
|
+
: this._adapter.addCalendarYears(this._activeDate, this.currentView === 'year' ? 1 : yearsPerPage);
|
|
1233
|
+
}
|
|
1234
|
+
/** Whether the previous period button is enabled. */
|
|
1235
|
+
_previousEnabled() {
|
|
1236
|
+
if (!this.minDate) {
|
|
1237
|
+
return true;
|
|
1238
|
+
}
|
|
1239
|
+
return !this.minDate || !this._isSameView(this._activeDate, this.minDate);
|
|
1240
|
+
}
|
|
1241
|
+
/** Whether the next period button is enabled. */
|
|
1242
|
+
_nextEnabled() {
|
|
1243
|
+
return !this.maxDate || !this._isSameView(this._activeDate, this.maxDate);
|
|
1244
|
+
}
|
|
1245
|
+
/** Handles keydown events on the calendar body. */
|
|
1246
|
+
_handleCalendarBodyKeydown(event) {
|
|
1247
|
+
// TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
|
|
1248
|
+
// disabled ones from being selected. This may not be ideal, we should look into whether
|
|
1249
|
+
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
|
|
1250
|
+
if (this.currentView === 'month') {
|
|
1251
|
+
this._handleCalendarBodyKeydownInMonthView(event);
|
|
1252
|
+
}
|
|
1253
|
+
else if (this.currentView === 'year') {
|
|
1254
|
+
this._handleCalendarBodyKeydownInYearView(event);
|
|
1255
|
+
}
|
|
1256
|
+
else if (this.currentView === 'multi-year') {
|
|
1257
|
+
this._handleCalendarBodyKeydownInMultiYearView(event);
|
|
1258
|
+
}
|
|
1259
|
+
else {
|
|
1260
|
+
this._handleCalendarBodyKeydownInClockView(event);
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
_focusActiveCell() {
|
|
1264
|
+
this._ngZone.runOutsideAngular(() => {
|
|
1265
|
+
this._ngZone.onStable
|
|
1266
|
+
.asObservable()
|
|
1267
|
+
.pipe(first())
|
|
1268
|
+
.subscribe(() => {
|
|
1269
|
+
this._elementRef.nativeElement.focus();
|
|
1270
|
+
});
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
_calendarStateDone() {
|
|
1274
|
+
this._calendarState = '';
|
|
1275
|
+
}
|
|
1276
|
+
/** Whether the two dates represent the same view in the current view mode (month or year). */
|
|
1277
|
+
_isSameView(date1, date2) {
|
|
1278
|
+
if (this.currentView === 'month') {
|
|
1279
|
+
return (this._adapter.getYear(date1) === this._adapter.getYear(date2) &&
|
|
1280
|
+
this._adapter.getMonth(date1) === this._adapter.getMonth(date2));
|
|
1281
|
+
}
|
|
1282
|
+
if (this.currentView === 'year') {
|
|
1283
|
+
return this._adapter.getYear(date1) === this._adapter.getYear(date2);
|
|
1284
|
+
}
|
|
1285
|
+
// Otherwise we are in 'multi-year' view.
|
|
1286
|
+
return isSameMultiYearView(this._adapter, date1, date2, this.minDate, this.maxDate);
|
|
1287
|
+
}
|
|
1288
|
+
/** Handles keydown events on the calendar body when calendar is in month view. */
|
|
1289
|
+
_handleCalendarBodyKeydownInMonthView(event) {
|
|
1290
|
+
switch (event.keyCode) {
|
|
1291
|
+
case LEFT_ARROW:
|
|
1292
|
+
this._activeDate = this._adapter.addCalendarDays(this._activeDate, -1);
|
|
1293
|
+
break;
|
|
1294
|
+
case RIGHT_ARROW:
|
|
1295
|
+
this._activeDate = this._adapter.addCalendarDays(this._activeDate, 1);
|
|
1296
|
+
break;
|
|
1297
|
+
case UP_ARROW:
|
|
1298
|
+
this._activeDate = this._adapter.addCalendarDays(this._activeDate, -7);
|
|
1299
|
+
break;
|
|
1300
|
+
case DOWN_ARROW:
|
|
1301
|
+
this._activeDate = this._adapter.addCalendarDays(this._activeDate, 7);
|
|
1302
|
+
break;
|
|
1303
|
+
case HOME:
|
|
1304
|
+
this._activeDate = this._adapter.addCalendarDays(this._activeDate, 1 - this._adapter.getDate(this._activeDate));
|
|
1305
|
+
break;
|
|
1306
|
+
case END:
|
|
1307
|
+
this._activeDate = this._adapter.addCalendarDays(this._activeDate, this._adapter.getNumDaysInMonth(this._activeDate) -
|
|
1308
|
+
this._adapter.getDate(this._activeDate));
|
|
1309
|
+
break;
|
|
1310
|
+
case PAGE_UP:
|
|
1311
|
+
this._activeDate = event.altKey
|
|
1312
|
+
? this._adapter.addCalendarYears(this._activeDate, -1)
|
|
1313
|
+
: this._adapter.addCalendarMonths(this._activeDate, -1);
|
|
1314
|
+
break;
|
|
1315
|
+
case PAGE_DOWN:
|
|
1316
|
+
this._activeDate = event.altKey
|
|
1317
|
+
? this._adapter.addCalendarYears(this._activeDate, 1)
|
|
1318
|
+
: this._adapter.addCalendarMonths(this._activeDate, 1);
|
|
1319
|
+
break;
|
|
1320
|
+
case ENTER:
|
|
1321
|
+
if (this._dateFilterForViews(this._activeDate)) {
|
|
1322
|
+
this._dateSelected(this._activeDate);
|
|
1323
|
+
// Prevent unexpected default actions such as form submission.
|
|
1324
|
+
event.preventDefault();
|
|
1325
|
+
}
|
|
1326
|
+
return;
|
|
1327
|
+
default:
|
|
1328
|
+
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
1329
|
+
return;
|
|
1330
|
+
}
|
|
1331
|
+
// Prevent unexpected default actions such as form submission.
|
|
1332
|
+
event.preventDefault();
|
|
1333
|
+
}
|
|
1334
|
+
/** Handles keydown events on the calendar body when calendar is in year view. */
|
|
1335
|
+
_handleCalendarBodyKeydownInYearView(event) {
|
|
1336
|
+
switch (event.keyCode) {
|
|
1337
|
+
case LEFT_ARROW:
|
|
1338
|
+
this._activeDate = this._adapter.addCalendarMonths(this._activeDate, -1);
|
|
1339
|
+
break;
|
|
1340
|
+
case RIGHT_ARROW:
|
|
1341
|
+
this._activeDate = this._adapter.addCalendarMonths(this._activeDate, 1);
|
|
1342
|
+
break;
|
|
1343
|
+
case UP_ARROW:
|
|
1344
|
+
this._activeDate = this._prevMonthInSameCol(this._activeDate);
|
|
1345
|
+
break;
|
|
1346
|
+
case DOWN_ARROW:
|
|
1347
|
+
this._activeDate = this._nextMonthInSameCol(this._activeDate);
|
|
1348
|
+
break;
|
|
1349
|
+
case HOME:
|
|
1350
|
+
this._activeDate = this._adapter.addCalendarMonths(this._activeDate, -this._adapter.getMonth(this._activeDate));
|
|
1351
|
+
break;
|
|
1352
|
+
case END:
|
|
1353
|
+
this._activeDate = this._adapter.addCalendarMonths(this._activeDate, 11 - this._adapter.getMonth(this._activeDate));
|
|
1354
|
+
break;
|
|
1355
|
+
case PAGE_UP:
|
|
1356
|
+
this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? -10 : -1);
|
|
1357
|
+
break;
|
|
1358
|
+
case PAGE_DOWN:
|
|
1359
|
+
this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? 10 : 1);
|
|
1360
|
+
break;
|
|
1361
|
+
case ENTER:
|
|
1362
|
+
this._monthSelected(this._activeDate);
|
|
1363
|
+
break;
|
|
1364
|
+
default:
|
|
1365
|
+
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
1366
|
+
return;
|
|
1367
|
+
}
|
|
1368
|
+
// Prevent unexpected default actions such as form submission.
|
|
1369
|
+
event.preventDefault();
|
|
1370
|
+
}
|
|
1371
|
+
/** Handles keydown events on the calendar body when calendar is in multi-year view. */
|
|
1372
|
+
_handleCalendarBodyKeydownInMultiYearView(event) {
|
|
1373
|
+
switch (event.keyCode) {
|
|
1374
|
+
case LEFT_ARROW:
|
|
1375
|
+
this._activeDate = this._adapter.addCalendarYears(this._activeDate, -1);
|
|
1376
|
+
break;
|
|
1377
|
+
case RIGHT_ARROW:
|
|
1378
|
+
this._activeDate = this._adapter.addCalendarYears(this._activeDate, 1);
|
|
1379
|
+
break;
|
|
1380
|
+
case UP_ARROW:
|
|
1381
|
+
this._activeDate = this._adapter.addCalendarYears(this._activeDate, -yearsPerRow);
|
|
1382
|
+
break;
|
|
1383
|
+
case DOWN_ARROW:
|
|
1384
|
+
this._activeDate = this._adapter.addCalendarYears(this._activeDate, yearsPerRow);
|
|
1385
|
+
break;
|
|
1386
|
+
case HOME:
|
|
1387
|
+
this._activeDate = this._adapter.addCalendarYears(this._activeDate, -getActiveOffset(this._adapter, this._activeDate, this.minDate, this.maxDate));
|
|
1388
|
+
break;
|
|
1389
|
+
case END:
|
|
1390
|
+
this._activeDate = this._adapter.addCalendarYears(this._activeDate, yearsPerPage -
|
|
1391
|
+
getActiveOffset(this._adapter, this._activeDate, this.minDate, this.maxDate) -
|
|
1392
|
+
1);
|
|
1393
|
+
break;
|
|
1394
|
+
case PAGE_UP:
|
|
1395
|
+
this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? -yearsPerPage * 10 : -yearsPerPage);
|
|
1396
|
+
break;
|
|
1397
|
+
case PAGE_DOWN:
|
|
1398
|
+
this._activeDate = this._adapter.addCalendarYears(this._activeDate, event.altKey ? yearsPerPage * 10 : yearsPerPage);
|
|
1399
|
+
break;
|
|
1400
|
+
case ENTER:
|
|
1401
|
+
this._yearSelected(this._activeDate);
|
|
1402
|
+
break;
|
|
1403
|
+
default:
|
|
1404
|
+
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
1405
|
+
return;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
/** Handles keydown events on the calendar body when calendar is in month view. */
|
|
1409
|
+
_handleCalendarBodyKeydownInClockView(event) {
|
|
1410
|
+
switch (event.keyCode) {
|
|
1411
|
+
case UP_ARROW:
|
|
1412
|
+
this._activeDate =
|
|
1413
|
+
this._clockView === 'hour'
|
|
1414
|
+
? this._adapter.addCalendarHours(this._activeDate, 1)
|
|
1415
|
+
: this._adapter.addCalendarMinutes(this._activeDate, 1);
|
|
1416
|
+
break;
|
|
1417
|
+
case DOWN_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 ENTER:
|
|
1424
|
+
this._timeSelected(this._activeDate);
|
|
1425
|
+
return;
|
|
1426
|
+
default:
|
|
1427
|
+
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
// Prevent unexpected default actions such as form submission.
|
|
1431
|
+
event.preventDefault();
|
|
1432
|
+
}
|
|
1433
|
+
/**
|
|
1434
|
+
* Determine the date for the month that comes before the given month in the same column in the
|
|
1435
|
+
* calendar table.
|
|
1436
|
+
*/
|
|
1437
|
+
_prevMonthInSameCol(date) {
|
|
1438
|
+
// Determine how many months to jump forward given that there are 2 empty slots at the beginning
|
|
1439
|
+
// of each year.
|
|
1440
|
+
const increment = this._adapter.getMonth(date) <= 4 ? -5 : this._adapter.getMonth(date) >= 7 ? -7 : -12;
|
|
1441
|
+
return this._adapter.addCalendarMonths(date, increment);
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Determine the date for the month that comes after the given month in the same column in the
|
|
1445
|
+
* calendar table.
|
|
1446
|
+
*/
|
|
1447
|
+
_nextMonthInSameCol(date) {
|
|
1448
|
+
// Determine how many months to jump forward given that there are 2 empty slots at the beginning
|
|
1449
|
+
// of each year.
|
|
1450
|
+
const increment = this._adapter.getMonth(date) <= 4 ? 7 : this._adapter.getMonth(date) >= 7 ? 5 : 12;
|
|
1451
|
+
return this._adapter.addCalendarMonths(date, increment);
|
|
1452
|
+
}
|
|
1453
|
+
calendarState(direction) {
|
|
1454
|
+
this._calendarState = direction;
|
|
1455
|
+
}
|
|
1456
|
+
_2digit(n) {
|
|
1457
|
+
return ('00' + n).slice(-2);
|
|
1204
1458
|
}
|
|
1205
1459
|
}
|
|
1206
|
-
/** @type {
|
|
1207
|
-
MtxClock.decorators = [
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
'(
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1460
|
+
/** @nocollapse */ /** @nocollapse */ MtxCalendar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.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 });
|
|
1461
|
+
/** @nocollapse */ /** @nocollapse */ MtxCalendar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.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 });
|
|
1462
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxCalendar, decorators: [{
|
|
1463
|
+
type: Component,
|
|
1464
|
+
args: [{ selector: 'mtx-calendar', host: {
|
|
1465
|
+
'class': 'mtx-calendar',
|
|
1466
|
+
'tabindex': '0',
|
|
1467
|
+
'(keydown)': '_handleCalendarBodyKeydown($event)',
|
|
1468
|
+
}, 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"] }]
|
|
1469
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.MatDatepickerIntl }, { type: i0.NgZone }, { type: i1.DatetimeAdapter, decorators: [{
|
|
1470
|
+
type: Optional
|
|
1471
|
+
}] }, { type: undefined, decorators: [{
|
|
1472
|
+
type: Optional
|
|
1473
|
+
}, {
|
|
1474
|
+
type: Inject,
|
|
1475
|
+
args: [MTX_DATETIME_FORMATS]
|
|
1476
|
+
}] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { multiYearSelector: [{
|
|
1477
|
+
type: Input
|
|
1478
|
+
}], twelvehour: [{
|
|
1479
|
+
type: Input
|
|
1480
|
+
}], startView: [{
|
|
1481
|
+
type: Input
|
|
1482
|
+
}], timeInterval: [{
|
|
1483
|
+
type: Input
|
|
1484
|
+
}], dateFilter: [{
|
|
1485
|
+
type: Input
|
|
1486
|
+
}], preventSameDateTimeSelection: [{
|
|
1487
|
+
type: Input
|
|
1488
|
+
}], selectedChange: [{
|
|
1489
|
+
type: Output
|
|
1490
|
+
}], viewChanged: [{
|
|
1491
|
+
type: Output
|
|
1492
|
+
}], _userSelection: [{
|
|
1493
|
+
type: Output
|
|
1494
|
+
}], type: [{
|
|
1495
|
+
type: Input
|
|
1496
|
+
}], startAt: [{
|
|
1497
|
+
type: Input
|
|
1498
|
+
}], selected: [{
|
|
1499
|
+
type: Input
|
|
1500
|
+
}], minDate: [{
|
|
1501
|
+
type: Input
|
|
1502
|
+
}], maxDate: [{
|
|
1503
|
+
type: Input
|
|
1504
|
+
}] } });
|
|
1246
1505
|
|
|
1247
1506
|
/** Used to generate a unique ID for each datetimepicker instance. */
|
|
1248
1507
|
let datetimepickerUid = 0;
|
|
@@ -1291,43 +1550,27 @@ class MtxDatetimepickerContent extends _MtxDatetimepickerContentBase {
|
|
|
1291
1550
|
this._animationDone.complete();
|
|
1292
1551
|
}
|
|
1293
1552
|
}
|
|
1294
|
-
/** @
|
|
1295
|
-
MtxDatetimepickerContent.
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
}
|
|
1315
|
-
];
|
|
1316
|
-
/**
|
|
1317
|
-
* @type {function(): !Array<(null|{
|
|
1318
|
-
* type: ?,
|
|
1319
|
-
* decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
|
|
1320
|
-
* })>}
|
|
1321
|
-
* @nocollapse
|
|
1322
|
-
*/
|
|
1323
|
-
MtxDatetimepickerContent.ctorParameters = () => [
|
|
1324
|
-
{ type: ElementRef },
|
|
1325
|
-
{ type: ChangeDetectorRef }
|
|
1326
|
-
];
|
|
1327
|
-
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
1328
|
-
MtxDatetimepickerContent.propDecorators = {
|
|
1329
|
-
_calendar: [{ type: ViewChild, args: [MtxCalendar, { static: true },] }]
|
|
1330
|
-
};
|
|
1553
|
+
/** @nocollapse */ /** @nocollapse */ MtxDatetimepickerContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxDatetimepickerContent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1554
|
+
/** @nocollapse */ /** @nocollapse */ MtxDatetimepickerContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.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: [
|
|
1555
|
+
mtxDatetimepickerAnimations.transformPanel,
|
|
1556
|
+
mtxDatetimepickerAnimations.fadeInCalendar,
|
|
1557
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1558
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxDatetimepickerContent, decorators: [{
|
|
1559
|
+
type: Component,
|
|
1560
|
+
args: [{ selector: 'mtx-datetimepicker-content', host: {
|
|
1561
|
+
'class': 'mtx-datetimepicker-content',
|
|
1562
|
+
'[class.mtx-datetimepicker-content-touch]': 'datetimepicker?.touchUi',
|
|
1563
|
+
'[attr.mode]': 'datetimepicker.mode',
|
|
1564
|
+
'[@transformPanel]': '_animationState',
|
|
1565
|
+
'(@transformPanel.done)': '_animationDone.next()',
|
|
1566
|
+
}, animations: [
|
|
1567
|
+
mtxDatetimepickerAnimations.transformPanel,
|
|
1568
|
+
mtxDatetimepickerAnimations.fadeInCalendar,
|
|
1569
|
+
], 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"] }]
|
|
1570
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { _calendar: [{
|
|
1571
|
+
type: ViewChild,
|
|
1572
|
+
args: [MtxCalendar, { static: true }]
|
|
1573
|
+
}] } });
|
|
1331
1574
|
class MtxDatetimepicker {
|
|
1332
1575
|
constructor(_overlay, _ngZone, _viewContainerRef, _scrollStrategy, _dateAdapter, _dir) {
|
|
1333
1576
|
this._overlay = _overlay;
|
|
@@ -1670,55 +1913,68 @@ class MtxDatetimepicker {
|
|
|
1670
1913
|
})));
|
|
1671
1914
|
}
|
|
1672
1915
|
}
|
|
1673
|
-
/** @type {
|
|
1674
|
-
MtxDatetimepicker
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
]
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1916
|
+
/** @nocollapse */ /** @nocollapse */ MtxDatetimepicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.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 });
|
|
1917
|
+
/** @nocollapse */ /** @nocollapse */ MtxDatetimepicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.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 });
|
|
1918
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxDatetimepicker, decorators: [{
|
|
1919
|
+
type: Component,
|
|
1920
|
+
args: [{
|
|
1921
|
+
selector: 'mtx-datetimepicker',
|
|
1922
|
+
exportAs: 'mtxDatetimepicker',
|
|
1923
|
+
template: '',
|
|
1924
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1925
|
+
encapsulation: ViewEncapsulation.None,
|
|
1926
|
+
preserveWhitespaces: false,
|
|
1927
|
+
}]
|
|
1928
|
+
}], ctorParameters: function () { return [{ type: i4.Overlay }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
|
|
1929
|
+
type: Inject,
|
|
1930
|
+
args: [MTX_DATETIMEPICKER_SCROLL_STRATEGY]
|
|
1931
|
+
}] }, { type: i1.DatetimeAdapter, decorators: [{
|
|
1932
|
+
type: Optional
|
|
1933
|
+
}] }, { type: i6.Directionality, decorators: [{
|
|
1934
|
+
type: Optional
|
|
1935
|
+
}] }]; }, propDecorators: { multiYearSelector: [{
|
|
1936
|
+
type: Input
|
|
1937
|
+
}], twelvehour: [{
|
|
1938
|
+
type: Input
|
|
1939
|
+
}], startView: [{
|
|
1940
|
+
type: Input
|
|
1941
|
+
}], mode: [{
|
|
1942
|
+
type: Input
|
|
1943
|
+
}], timeInterval: [{
|
|
1944
|
+
type: Input
|
|
1945
|
+
}], preventSameDateTimeSelection: [{
|
|
1946
|
+
type: Input
|
|
1947
|
+
}], selectedChanged: [{
|
|
1948
|
+
type: Output
|
|
1949
|
+
}], openedStream: [{
|
|
1950
|
+
type: Output,
|
|
1951
|
+
args: ['opened']
|
|
1952
|
+
}], closedStream: [{
|
|
1953
|
+
type: Output,
|
|
1954
|
+
args: ['closed']
|
|
1955
|
+
}], viewChanged: [{
|
|
1956
|
+
type: Output
|
|
1957
|
+
}], panelClass: [{
|
|
1958
|
+
type: Input
|
|
1959
|
+
}], opened: [{
|
|
1960
|
+
type: Input
|
|
1961
|
+
}], color: [{
|
|
1962
|
+
type: Input
|
|
1963
|
+
}], startAt: [{
|
|
1964
|
+
type: Input
|
|
1965
|
+
}], type: [{
|
|
1966
|
+
type: Input
|
|
1967
|
+
}], touchUi: [{
|
|
1968
|
+
type: Input
|
|
1969
|
+
}], disabled: [{
|
|
1970
|
+
type: Input
|
|
1971
|
+
}], xPosition: [{
|
|
1972
|
+
type: Input
|
|
1973
|
+
}], yPosition: [{
|
|
1974
|
+
type: Input
|
|
1975
|
+
}], restoreFocus: [{
|
|
1976
|
+
type: Input
|
|
1977
|
+
}] } });
|
|
1722
1978
|
|
|
1723
1979
|
const MAT_DATETIMEPICKER_VALUE_ACCESSOR = {
|
|
1724
1980
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -1997,63 +2253,72 @@ class MtxDatetimepickerInput {
|
|
|
1997
2253
|
return this._formField ? this._formField.color : undefined;
|
|
1998
2254
|
}
|
|
1999
2255
|
}
|
|
2000
|
-
/** @type {
|
|
2001
|
-
MtxDatetimepickerInput
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
]
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2256
|
+
/** @nocollapse */ /** @nocollapse */ MtxDatetimepickerInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.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 });
|
|
2257
|
+
/** @nocollapse */ /** @nocollapse */ MtxDatetimepickerInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.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: [
|
|
2258
|
+
MAT_DATETIMEPICKER_VALUE_ACCESSOR,
|
|
2259
|
+
MAT_DATETIMEPICKER_VALIDATORS,
|
|
2260
|
+
{ provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxDatetimepickerInput },
|
|
2261
|
+
], exportAs: ["mtxDatetimepickerInput"], ngImport: i0 });
|
|
2262
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxDatetimepickerInput, decorators: [{
|
|
2263
|
+
type: Directive,
|
|
2264
|
+
args: [{
|
|
2265
|
+
selector: 'input[mtxDatetimepicker]',
|
|
2266
|
+
providers: [
|
|
2267
|
+
MAT_DATETIMEPICKER_VALUE_ACCESSOR,
|
|
2268
|
+
MAT_DATETIMEPICKER_VALIDATORS,
|
|
2269
|
+
{ provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxDatetimepickerInput },
|
|
2270
|
+
],
|
|
2271
|
+
host: {
|
|
2272
|
+
'[attr.aria-haspopup]': 'true',
|
|
2273
|
+
'[attr.aria-owns]': '(_datetimepicker?.opened && _datetimepicker.id) || null',
|
|
2274
|
+
'[attr.min]': 'min ? _dateAdapter.toIso8601(min) : null',
|
|
2275
|
+
'[attr.max]': 'max ? _dateAdapter.toIso8601(max) : null',
|
|
2276
|
+
'[disabled]': 'disabled',
|
|
2277
|
+
'(input)': '_onInput($event.target.value)',
|
|
2278
|
+
'(change)': '_onChange()',
|
|
2279
|
+
'(blur)': '_onBlur()',
|
|
2280
|
+
'(keydown)': '_onKeydown($event)',
|
|
2281
|
+
},
|
|
2282
|
+
exportAs: 'mtxDatetimepickerInput',
|
|
2283
|
+
}]
|
|
2284
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DatetimeAdapter, decorators: [{
|
|
2285
|
+
type: Optional
|
|
2286
|
+
}] }, { type: undefined, decorators: [{
|
|
2287
|
+
type: Optional
|
|
2288
|
+
}, {
|
|
2289
|
+
type: Inject,
|
|
2290
|
+
args: [MTX_DATETIME_FORMATS]
|
|
2291
|
+
}] }, { type: i2$1.MatFormField, decorators: [{
|
|
2292
|
+
type: Optional
|
|
2293
|
+
}] }]; }, propDecorators: { dateChange: [{
|
|
2294
|
+
type: Output
|
|
2295
|
+
}], dateInput: [{
|
|
2296
|
+
type: Output
|
|
2297
|
+
}], mtxDatetimepicker: [{
|
|
2298
|
+
type: Input
|
|
2299
|
+
}], mtxDatetimepickerFilter: [{
|
|
2300
|
+
type: Input
|
|
2301
|
+
}], value: [{
|
|
2302
|
+
type: Input
|
|
2303
|
+
}], min: [{
|
|
2304
|
+
type: Input
|
|
2305
|
+
}], max: [{
|
|
2306
|
+
type: Input
|
|
2307
|
+
}], disabled: [{
|
|
2308
|
+
type: Input
|
|
2309
|
+
}] } });
|
|
2047
2310
|
|
|
2048
2311
|
/** Can be used to override the icon of a `mtxDatetimepickerToggle`. */
|
|
2049
2312
|
class MtxDatetimepickerToggleIcon {
|
|
2050
2313
|
}
|
|
2051
|
-
/** @
|
|
2052
|
-
MtxDatetimepickerToggleIcon
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
]
|
|
2314
|
+
/** @nocollapse */ /** @nocollapse */ MtxDatetimepickerToggleIcon.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxDatetimepickerToggleIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2315
|
+
/** @nocollapse */ /** @nocollapse */ MtxDatetimepickerToggleIcon.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: MtxDatetimepickerToggleIcon, selector: "[mtxDatetimepickerToggleIcon]", ngImport: i0 });
|
|
2316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxDatetimepickerToggleIcon, decorators: [{
|
|
2317
|
+
type: Directive,
|
|
2318
|
+
args: [{
|
|
2319
|
+
selector: '[mtxDatetimepickerToggleIcon]',
|
|
2320
|
+
}]
|
|
2321
|
+
}] });
|
|
2057
2322
|
class MtxDatetimepickerToggle {
|
|
2058
2323
|
constructor(_intl, _changeDetectorRef) {
|
|
2059
2324
|
this._intl = _intl;
|
|
@@ -2099,370 +2364,99 @@ class MtxDatetimepickerToggle {
|
|
|
2099
2364
|
]).subscribe(() => this._changeDetectorRef.markForCheck());
|
|
2100
2365
|
}
|
|
2101
2366
|
}
|
|
2102
|
-
/** @
|
|
2103
|
-
MtxDatetimepickerToggle
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
'
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
]
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
{ type: MatDatepickerIntl },
|
|
2133
|
-
{ type: ChangeDetectorRef }
|
|
2134
|
-
];
|
|
2135
|
-
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
2136
|
-
MtxDatetimepickerToggle.propDecorators = {
|
|
2137
|
-
datetimepicker: [{ type: Input, args: ['for',] }],
|
|
2138
|
-
tabIndex: [{ type: Input }],
|
|
2139
|
-
disabled: [{ type: Input }],
|
|
2140
|
-
disableRipple: [{ type: Input }],
|
|
2141
|
-
_customIcon: [{ type: ContentChild, args: [MtxDatetimepickerToggleIcon,] }],
|
|
2142
|
-
_button: [{ type: ViewChild, args: ['button',] }]
|
|
2143
|
-
};
|
|
2144
|
-
|
|
2145
|
-
const DAYS_PER_WEEK = 7;
|
|
2146
|
-
/**
|
|
2147
|
-
* An internal component used to display a single month in the datetimepicker.
|
|
2148
|
-
* @docs-private
|
|
2149
|
-
*/
|
|
2150
|
-
class MtxMonthView {
|
|
2151
|
-
constructor(_adapter, _dateFormats) {
|
|
2152
|
-
this._adapter = _adapter;
|
|
2153
|
-
this._dateFormats = _dateFormats;
|
|
2154
|
-
this.type = 'date';
|
|
2155
|
-
/** Emits when a new date is selected. */
|
|
2156
|
-
this.selectedChange = new EventEmitter();
|
|
2157
|
-
/** Emits when any date is selected. */
|
|
2158
|
-
this._userSelection = new EventEmitter();
|
|
2159
|
-
if (!this._adapter) {
|
|
2160
|
-
throw createMissingDateImplError('DatetimeAdapter');
|
|
2161
|
-
}
|
|
2162
|
-
if (!this._dateFormats) {
|
|
2163
|
-
throw createMissingDateImplError('MTX_DATETIME_FORMATS');
|
|
2164
|
-
}
|
|
2165
|
-
const firstDayOfWeek = this._adapter.getFirstDayOfWeek();
|
|
2166
|
-
const narrowWeekdays = this._adapter.getDayOfWeekNames('narrow');
|
|
2167
|
-
const longWeekdays = this._adapter.getDayOfWeekNames('long');
|
|
2168
|
-
// Rotate the labels for days of the week based on the configured first day of the week.
|
|
2169
|
-
const weekdays = longWeekdays.map((long, i) => {
|
|
2170
|
-
return { long, narrow: narrowWeekdays[i] };
|
|
2171
|
-
});
|
|
2172
|
-
this._weekdays = weekdays.slice(firstDayOfWeek).concat(weekdays.slice(0, firstDayOfWeek));
|
|
2173
|
-
this._activeDate = this._adapter.today();
|
|
2174
|
-
}
|
|
2175
|
-
/**
|
|
2176
|
-
* The date to display in this month view (everything other than the month and year is ignored).
|
|
2177
|
-
*/
|
|
2178
|
-
get activeDate() {
|
|
2179
|
-
return this._activeDate;
|
|
2180
|
-
}
|
|
2181
|
-
set activeDate(value) {
|
|
2182
|
-
const oldActiveDate = this._activeDate;
|
|
2183
|
-
this._activeDate = value || this._adapter.today();
|
|
2184
|
-
if (oldActiveDate &&
|
|
2185
|
-
this._activeDate &&
|
|
2186
|
-
!this._adapter.sameMonthAndYear(oldActiveDate, this._activeDate)) {
|
|
2187
|
-
this._init();
|
|
2188
|
-
if (this._adapter.isInNextMonth(oldActiveDate, this._activeDate)) {
|
|
2189
|
-
this.calendarState('right');
|
|
2190
|
-
}
|
|
2191
|
-
else {
|
|
2192
|
-
this.calendarState('left');
|
|
2193
|
-
}
|
|
2194
|
-
}
|
|
2195
|
-
}
|
|
2196
|
-
/** The currently selected date. */
|
|
2197
|
-
get selected() {
|
|
2198
|
-
return this._selected;
|
|
2199
|
-
}
|
|
2200
|
-
set selected(value) {
|
|
2201
|
-
this._selected = value;
|
|
2202
|
-
this._selectedDate = this._getDateInCurrentMonth(this.selected);
|
|
2203
|
-
}
|
|
2204
|
-
ngAfterContentInit() {
|
|
2205
|
-
this._init();
|
|
2206
|
-
}
|
|
2207
|
-
/** Handles when a new date is selected. */
|
|
2208
|
-
_dateSelected(date) {
|
|
2209
|
-
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)));
|
|
2210
|
-
if (this.type === 'date') {
|
|
2211
|
-
this._userSelection.emit();
|
|
2212
|
-
}
|
|
2213
|
-
}
|
|
2214
|
-
_calendarStateDone() {
|
|
2215
|
-
this._calendarState = '';
|
|
2216
|
-
}
|
|
2217
|
-
/** Initializes this month view. */
|
|
2218
|
-
_init() {
|
|
2219
|
-
this._selectedDate = this._getDateInCurrentMonth(this.selected);
|
|
2220
|
-
this._todayDate = this._getDateInCurrentMonth(this._adapter.today());
|
|
2221
|
-
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));
|
|
2222
|
-
this._firstWeekOffset =
|
|
2223
|
-
(DAYS_PER_WEEK +
|
|
2224
|
-
this._adapter.getDayOfWeek(firstOfMonth) -
|
|
2225
|
-
this._adapter.getFirstDayOfWeek()) %
|
|
2226
|
-
DAYS_PER_WEEK;
|
|
2227
|
-
this._createWeekCells();
|
|
2228
|
-
}
|
|
2229
|
-
/** Creates MdCalendarCells for the dates in this month. */
|
|
2230
|
-
_createWeekCells() {
|
|
2231
|
-
const daysInMonth = this._adapter.getNumDaysInMonth(this.activeDate);
|
|
2232
|
-
const dateNames = this._adapter.getDateNames();
|
|
2233
|
-
this._weeks = [[]];
|
|
2234
|
-
for (let i = 0, cell = this._firstWeekOffset; i < daysInMonth; i++, cell++) {
|
|
2235
|
-
if (cell === DAYS_PER_WEEK) {
|
|
2236
|
-
this._weeks.push([]);
|
|
2237
|
-
cell = 0;
|
|
2238
|
-
}
|
|
2239
|
-
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));
|
|
2240
|
-
const enabled = !this.dateFilter || this.dateFilter(date);
|
|
2241
|
-
const ariaLabel = this._adapter.format(date, this._dateFormats.display.dateA11yLabel);
|
|
2242
|
-
this._weeks[this._weeks.length - 1].push(new MtxCalendarCell(i + 1, dateNames[i], ariaLabel, enabled));
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2245
|
-
/**
|
|
2246
|
-
* Gets the date in this month that the given Date falls on.
|
|
2247
|
-
* Returns null if the given Date is in another month.
|
|
2248
|
-
*/
|
|
2249
|
-
_getDateInCurrentMonth(date) {
|
|
2250
|
-
return this._adapter.sameMonthAndYear(date, this.activeDate)
|
|
2251
|
-
? this._adapter.getDate(date)
|
|
2252
|
-
: null;
|
|
2253
|
-
}
|
|
2254
|
-
calendarState(direction) {
|
|
2255
|
-
this._calendarState = direction;
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2258
|
-
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
2259
|
-
MtxMonthView.decorators = [
|
|
2260
|
-
{ type: Component, args: [{
|
|
2261
|
-
selector: 'mtx-month-view',
|
|
2262
|
-
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",
|
|
2263
|
-
exportAs: 'mtxMonthView',
|
|
2264
|
-
animations: [mtxDatetimepickerAnimations.slideCalendar],
|
|
2265
|
-
encapsulation: ViewEncapsulation.None,
|
|
2266
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
2267
|
-
},] }
|
|
2268
|
-
];
|
|
2269
|
-
/**
|
|
2270
|
-
* @type {function(): !Array<(null|{
|
|
2271
|
-
* type: ?,
|
|
2272
|
-
* decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
|
|
2273
|
-
* })>}
|
|
2274
|
-
* @nocollapse
|
|
2275
|
-
*/
|
|
2276
|
-
MtxMonthView.ctorParameters = () => [
|
|
2277
|
-
{ type: DatetimeAdapter, decorators: [{ type: Optional }] },
|
|
2278
|
-
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MTX_DATETIME_FORMATS,] }] }
|
|
2279
|
-
];
|
|
2280
|
-
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
2281
|
-
MtxMonthView.propDecorators = {
|
|
2282
|
-
type: [{ type: Input }],
|
|
2283
|
-
dateFilter: [{ type: Input }],
|
|
2284
|
-
selectedChange: [{ type: Output }],
|
|
2285
|
-
_userSelection: [{ type: Output }],
|
|
2286
|
-
activeDate: [{ type: Input }],
|
|
2287
|
-
selected: [{ type: Input }]
|
|
2288
|
-
};
|
|
2289
|
-
|
|
2290
|
-
/**
|
|
2291
|
-
* An internal component used to display a single year in the datetimepicker.
|
|
2292
|
-
* @docs-private
|
|
2293
|
-
*/
|
|
2294
|
-
class MtxYearView {
|
|
2295
|
-
constructor(_adapter, _dateFormats) {
|
|
2296
|
-
this._adapter = _adapter;
|
|
2297
|
-
this._dateFormats = _dateFormats;
|
|
2298
|
-
this.type = 'date';
|
|
2299
|
-
/** Emits when a new month is selected. */
|
|
2300
|
-
this.selectedChange = new EventEmitter();
|
|
2301
|
-
/** Emits when any date is selected. */
|
|
2302
|
-
this._userSelection = new EventEmitter();
|
|
2303
|
-
if (!this._adapter) {
|
|
2304
|
-
throw createMissingDateImplError('DatetimeAdapter');
|
|
2305
|
-
}
|
|
2306
|
-
if (!this._dateFormats) {
|
|
2307
|
-
throw createMissingDateImplError('MTX_DATETIME_FORMATS');
|
|
2308
|
-
}
|
|
2309
|
-
this._activeDate = this._adapter.today();
|
|
2310
|
-
}
|
|
2311
|
-
/** The date to display in this year view (everything other than the year is ignored). */
|
|
2312
|
-
get activeDate() {
|
|
2313
|
-
return this._activeDate;
|
|
2314
|
-
}
|
|
2315
|
-
set activeDate(value) {
|
|
2316
|
-
const oldActiveDate = this._activeDate;
|
|
2317
|
-
this._activeDate = value || this._adapter.today();
|
|
2318
|
-
if (oldActiveDate &&
|
|
2319
|
-
this._activeDate &&
|
|
2320
|
-
!this._adapter.sameYear(oldActiveDate, this._activeDate)) {
|
|
2321
|
-
this._init();
|
|
2322
|
-
// if (oldActiveDate < this._activeDate) {
|
|
2323
|
-
// this.calendarState('right');
|
|
2324
|
-
// } else {
|
|
2325
|
-
// this.calendarState('left');
|
|
2326
|
-
// }
|
|
2327
|
-
}
|
|
2328
|
-
}
|
|
2329
|
-
/** The currently selected date. */
|
|
2330
|
-
get selected() {
|
|
2331
|
-
return this._selected;
|
|
2332
|
-
}
|
|
2333
|
-
set selected(value) {
|
|
2334
|
-
this._selected = value;
|
|
2335
|
-
this._selectedMonth = this._getMonthInCurrentYear(this.selected);
|
|
2336
|
-
}
|
|
2337
|
-
ngAfterContentInit() {
|
|
2338
|
-
this._init();
|
|
2339
|
-
}
|
|
2340
|
-
/** Handles when a new month is selected. */
|
|
2341
|
-
_monthSelected(month) {
|
|
2342
|
-
const normalizedDate = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), month, 1, 0, 0);
|
|
2343
|
-
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)));
|
|
2344
|
-
if (this.type === 'month') {
|
|
2345
|
-
this._userSelection.emit();
|
|
2346
|
-
}
|
|
2347
|
-
}
|
|
2348
|
-
_calendarStateDone() {
|
|
2349
|
-
this._calendarState = '';
|
|
2350
|
-
}
|
|
2351
|
-
/** Initializes this month view. */
|
|
2352
|
-
_init() {
|
|
2353
|
-
this._selectedMonth = this._getMonthInCurrentYear(this.selected);
|
|
2354
|
-
this._todayMonth = this._getMonthInCurrentYear(this._adapter.today());
|
|
2355
|
-
this._yearLabel = this._adapter.getYearName(this.activeDate);
|
|
2356
|
-
const monthNames = this._adapter.getMonthNames('short');
|
|
2357
|
-
// First row of months only contains 5 elements so we can fit the year label on the same row.
|
|
2358
|
-
this._months = [
|
|
2359
|
-
[0, 1, 2, 3],
|
|
2360
|
-
[4, 5, 6, 7],
|
|
2361
|
-
[8, 9, 10, 11],
|
|
2362
|
-
].map(row => row.map(month => this._createCellForMonth(month, monthNames[month])));
|
|
2363
|
-
}
|
|
2364
|
-
/**
|
|
2365
|
-
* Gets the month in this year that the given Date falls on.
|
|
2366
|
-
* Returns null if the given Date is in another year.
|
|
2367
|
-
*/
|
|
2368
|
-
_getMonthInCurrentYear(date) {
|
|
2369
|
-
return this._adapter.sameYear(date, this.activeDate) ? this._adapter.getMonth(date) : null;
|
|
2370
|
-
}
|
|
2371
|
-
/** Creates an MdCalendarCell for the given month. */
|
|
2372
|
-
_createCellForMonth(month, monthName) {
|
|
2373
|
-
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);
|
|
2374
|
-
return new MtxCalendarCell(month, monthName.toLocaleUpperCase(), ariaLabel, this._isMonthEnabled(month));
|
|
2375
|
-
}
|
|
2376
|
-
// private calendarState(direction: string): void {
|
|
2377
|
-
// this._calendarState = direction;
|
|
2378
|
-
// }
|
|
2379
|
-
/** Whether the given month is enabled. */
|
|
2380
|
-
_isMonthEnabled(month) {
|
|
2381
|
-
if (!this.dateFilter) {
|
|
2382
|
-
return true;
|
|
2383
|
-
}
|
|
2384
|
-
const firstOfMonth = this._adapter.createDatetime(this._adapter.getYear(this.activeDate), month, 1, this._adapter.getHour(this.activeDate), this._adapter.getMinute(this.activeDate));
|
|
2385
|
-
// If any date in the month is enabled count the month as enabled.
|
|
2386
|
-
for (let date = firstOfMonth; this._adapter.getMonth(date) === month; date = this._adapter.addCalendarDays(date, 1)) {
|
|
2387
|
-
if (this.dateFilter(date)) {
|
|
2388
|
-
return true;
|
|
2389
|
-
}
|
|
2390
|
-
}
|
|
2391
|
-
return false;
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2394
|
-
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
2395
|
-
MtxYearView.decorators = [
|
|
2396
|
-
{ type: Component, args: [{
|
|
2397
|
-
selector: 'mtx-year-view',
|
|
2398
|
-
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",
|
|
2399
|
-
exportAs: 'mtxYearView',
|
|
2400
|
-
animations: [mtxDatetimepickerAnimations.slideCalendar],
|
|
2401
|
-
encapsulation: ViewEncapsulation.None,
|
|
2402
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
2403
|
-
},] }
|
|
2404
|
-
];
|
|
2405
|
-
/**
|
|
2406
|
-
* @type {function(): !Array<(null|{
|
|
2407
|
-
* type: ?,
|
|
2408
|
-
* decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
|
|
2409
|
-
* })>}
|
|
2410
|
-
* @nocollapse
|
|
2411
|
-
*/
|
|
2412
|
-
MtxYearView.ctorParameters = () => [
|
|
2413
|
-
{ type: DatetimeAdapter, decorators: [{ type: Optional }] },
|
|
2414
|
-
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MTX_DATETIME_FORMATS,] }] }
|
|
2415
|
-
];
|
|
2416
|
-
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
2417
|
-
MtxYearView.propDecorators = {
|
|
2418
|
-
type: [{ type: Input }],
|
|
2419
|
-
dateFilter: [{ type: Input }],
|
|
2420
|
-
selectedChange: [{ type: Output }],
|
|
2421
|
-
_userSelection: [{ type: Output }],
|
|
2422
|
-
activeDate: [{ type: Input }],
|
|
2423
|
-
selected: [{ type: Input }]
|
|
2424
|
-
};
|
|
2367
|
+
/** @nocollapse */ /** @nocollapse */ MtxDatetimepickerToggle.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxDatetimepickerToggle, deps: [{ token: i1$1.MatDatepickerIntl }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2368
|
+
/** @nocollapse */ /** @nocollapse */ MtxDatetimepickerToggle.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.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 });
|
|
2369
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxDatetimepickerToggle, decorators: [{
|
|
2370
|
+
type: Component,
|
|
2371
|
+
args: [{ selector: 'mtx-datetimepicker-toggle', host: {
|
|
2372
|
+
'class': 'mtx-datetimepicker-toggle',
|
|
2373
|
+
// Always set the tabindex to -1 so that it doesn't overlap with any custom tabindex the
|
|
2374
|
+
// consumer may have provided, while still being able to receive focus.
|
|
2375
|
+
'[attr.tabindex]': 'disabled ? null : -1',
|
|
2376
|
+
'[class.mtx-datetimepicker-toggle-active]': 'datetimepicker && datetimepicker.opened',
|
|
2377
|
+
'[class.mat-accent]': 'datetimepicker && datetimepicker.color === "accent"',
|
|
2378
|
+
'[class.mat-warn]': 'datetimepicker && datetimepicker.color === "warn"',
|
|
2379
|
+
'(focus)': '_button.focus()',
|
|
2380
|
+
}, 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"] }]
|
|
2381
|
+
}], ctorParameters: function () { return [{ type: i1$1.MatDatepickerIntl }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { datetimepicker: [{
|
|
2382
|
+
type: Input,
|
|
2383
|
+
args: ['for']
|
|
2384
|
+
}], tabIndex: [{
|
|
2385
|
+
type: Input
|
|
2386
|
+
}], disabled: [{
|
|
2387
|
+
type: Input
|
|
2388
|
+
}], disableRipple: [{
|
|
2389
|
+
type: Input
|
|
2390
|
+
}], _customIcon: [{
|
|
2391
|
+
type: ContentChild,
|
|
2392
|
+
args: [MtxDatetimepickerToggleIcon]
|
|
2393
|
+
}], _button: [{
|
|
2394
|
+
type: ViewChild,
|
|
2395
|
+
args: ['button']
|
|
2396
|
+
}] } });
|
|
2425
2397
|
|
|
2426
2398
|
class MtxDatetimepickerModule {
|
|
2427
2399
|
}
|
|
2428
|
-
/** @
|
|
2429
|
-
MtxDatetimepickerModule
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2400
|
+
/** @nocollapse */ /** @nocollapse */ MtxDatetimepickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxDatetimepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2401
|
+
/** @nocollapse */ /** @nocollapse */ MtxDatetimepickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxDatetimepickerModule, declarations: [MtxCalendar,
|
|
2402
|
+
MtxCalendarBody,
|
|
2403
|
+
MtxClock,
|
|
2404
|
+
MtxDatetimepicker,
|
|
2405
|
+
MtxDatetimepickerToggle,
|
|
2406
|
+
MtxDatetimepickerToggleIcon,
|
|
2407
|
+
MtxDatetimepickerInput,
|
|
2408
|
+
MtxDatetimepickerContent,
|
|
2409
|
+
MtxMonthView,
|
|
2410
|
+
MtxYearView,
|
|
2411
|
+
MtxMultiYearView], imports: [CommonModule, MatButtonModule, OverlayModule, A11yModule, PortalModule], exports: [MtxCalendar,
|
|
2412
|
+
MtxCalendarBody,
|
|
2413
|
+
MtxClock,
|
|
2414
|
+
MtxDatetimepicker,
|
|
2415
|
+
MtxDatetimepickerToggle,
|
|
2416
|
+
MtxDatetimepickerToggleIcon,
|
|
2417
|
+
MtxDatetimepickerInput,
|
|
2418
|
+
MtxDatetimepickerContent,
|
|
2419
|
+
MtxMonthView,
|
|
2420
|
+
MtxYearView,
|
|
2421
|
+
MtxMultiYearView] });
|
|
2422
|
+
/** @nocollapse */ /** @nocollapse */ MtxDatetimepickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxDatetimepickerModule, providers: [MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER], imports: [[CommonModule, MatButtonModule, OverlayModule, A11yModule, PortalModule]] });
|
|
2423
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MtxDatetimepickerModule, decorators: [{
|
|
2424
|
+
type: NgModule,
|
|
2425
|
+
args: [{
|
|
2426
|
+
imports: [CommonModule, MatButtonModule, OverlayModule, A11yModule, PortalModule],
|
|
2427
|
+
declarations: [
|
|
2428
|
+
MtxCalendar,
|
|
2429
|
+
MtxCalendarBody,
|
|
2430
|
+
MtxClock,
|
|
2431
|
+
MtxDatetimepicker,
|
|
2432
|
+
MtxDatetimepickerToggle,
|
|
2433
|
+
MtxDatetimepickerToggleIcon,
|
|
2434
|
+
MtxDatetimepickerInput,
|
|
2435
|
+
MtxDatetimepickerContent,
|
|
2436
|
+
MtxMonthView,
|
|
2437
|
+
MtxYearView,
|
|
2438
|
+
MtxMultiYearView,
|
|
2439
|
+
],
|
|
2440
|
+
exports: [
|
|
2441
|
+
MtxCalendar,
|
|
2442
|
+
MtxCalendarBody,
|
|
2443
|
+
MtxClock,
|
|
2444
|
+
MtxDatetimepicker,
|
|
2445
|
+
MtxDatetimepickerToggle,
|
|
2446
|
+
MtxDatetimepickerToggleIcon,
|
|
2447
|
+
MtxDatetimepickerInput,
|
|
2448
|
+
MtxDatetimepickerContent,
|
|
2449
|
+
MtxMonthView,
|
|
2450
|
+
MtxYearView,
|
|
2451
|
+
MtxMultiYearView,
|
|
2452
|
+
],
|
|
2453
|
+
providers: [MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER],
|
|
2454
|
+
}]
|
|
2455
|
+
}] });
|
|
2462
2456
|
|
|
2463
2457
|
/**
|
|
2464
2458
|
* Generated bundle index. Do not edit.
|
|
2465
2459
|
*/
|
|
2466
2460
|
|
|
2467
2461
|
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 };
|
|
2468
|
-
//# sourceMappingURL=mtxDatetimepicker.
|
|
2462
|
+
//# sourceMappingURL=mtxDatetimepicker.mjs.map
|