@ptsecurity/mosaic 12.1.0 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_theming.scss +113 -66
- package/_visual.scss +11 -9
- package/autocomplete/README.md +0 -0
- package/autocomplete/package.json +5 -5
- package/button/README.md +0 -0
- package/button/button.component.d.ts +17 -14
- package/button/button.module.d.ts +1 -1
- package/button/package.json +5 -5
- package/button-toggle/README.md +0 -0
- package/button-toggle/package.json +5 -5
- package/card/README.md +0 -0
- package/card/package.json +5 -5
- package/checkbox/README.md +1 -0
- package/checkbox/package.json +5 -5
- package/core/formatters/date/formatter.d.ts +4 -4
- package/core/formatters/date/templates/en-US.d.ts +8 -8
- package/core/formatters/date/templates/ru-RU.d.ts +8 -8
- package/core/package.json +5 -5
- package/core/pop-up/pop-up-trigger.d.ts +9 -12
- package/datepicker/README.md +0 -0
- package/datepicker/package.json +5 -5
- package/design-tokens/package.json +5 -5
- package/design-tokens/style-dictionary/build.js +6 -0
- package/design-tokens/style-dictionary/configs/index.js +2 -1
- package/design-tokens/tokens/components/navbar.json5 +12 -9
- package/design-tokens/tokens.d.ts +11 -9
- package/divider/README.md +0 -0
- package/divider/package.json +5 -5
- package/dropdown/dropdown-item.component.d.ts +1 -0
- package/dropdown/package.json +5 -5
- package/{esm2015/autocomplete/autocomplete-origin.directive.js → esm2020/autocomplete/autocomplete-origin.directive.mjs} +4 -4
- package/{esm2015/autocomplete/autocomplete-trigger.directive.js → esm2020/autocomplete/autocomplete-trigger.directive.mjs} +4 -4
- package/esm2020/autocomplete/autocomplete.component.mjs +154 -0
- package/{esm2015/autocomplete/autocomplete.module.js → esm2020/autocomplete/autocomplete.module.mjs} +5 -5
- package/{esm2015/autocomplete/index.js → esm2020/autocomplete/index.mjs} +0 -0
- package/{esm2015/autocomplete/ptsecurity-mosaic-autocomplete.js → esm2020/autocomplete/ptsecurity-mosaic-autocomplete.mjs} +0 -0
- package/{esm2015/autocomplete/public-api.js → esm2020/autocomplete/public-api.mjs} +0 -0
- package/esm2020/button/button.component.mjs +129 -0
- package/esm2020/button/button.module.mjs +38 -0
- package/{esm2015/button/index.js → esm2020/button/index.mjs} +0 -0
- package/{esm2015/button/ptsecurity-mosaic-button.js → esm2020/button/ptsecurity-mosaic-button.mjs} +0 -0
- package/{esm2015/button/public-api.js → esm2020/button/public-api.mjs} +0 -0
- package/esm2020/button-toggle/button-toggle.component.mjs +362 -0
- package/{esm2015/button-toggle/button-toggle.module.js → esm2020/button-toggle/button-toggle.module.mjs} +5 -5
- package/{esm2015/button-toggle/index.js → esm2020/button-toggle/index.mjs} +0 -0
- package/{esm2015/button-toggle/ptsecurity-mosaic-button-toggle.js → esm2020/button-toggle/ptsecurity-mosaic-button-toggle.mjs} +0 -0
- package/{esm2015/button-toggle/public-api.js → esm2020/button-toggle/public-api.mjs} +0 -0
- package/esm2020/card/card.component.mjs +80 -0
- package/{esm2015/card/card.module.js → esm2020/card/card.module.mjs} +5 -5
- package/{esm2015/card/index.js → esm2020/card/index.mjs} +0 -0
- package/{esm2015/card/ptsecurity-mosaic-card.js → esm2020/card/ptsecurity-mosaic-card.mjs} +0 -0
- package/{esm2015/card/public-api.js → esm2020/card/public-api.mjs} +0 -0
- package/{esm2015/checkbox/checkbox-config.js → esm2020/checkbox/checkbox-config.mjs} +0 -0
- package/{esm2015/checkbox/checkbox-module.js → esm2020/checkbox/checkbox-module.mjs} +5 -5
- package/{esm2015/checkbox/checkbox-required-validator.js → esm2020/checkbox/checkbox-required-validator.mjs} +4 -4
- package/esm2020/checkbox/checkbox.mjs +315 -0
- package/{esm2015/checkbox/index.js → esm2020/checkbox/index.mjs} +0 -0
- package/{esm2015/checkbox/ptsecurity-mosaic-checkbox.js → esm2020/checkbox/ptsecurity-mosaic-checkbox.mjs} +0 -0
- package/{esm2015/checkbox/public-api.js → esm2020/checkbox/public-api.mjs} +0 -0
- package/{esm2015/core/animation/animation.js → esm2020/core/animation/animation.mjs} +0 -0
- package/{esm2015/core/animation/fade-animations.js → esm2020/core/animation/fade-animations.mjs} +0 -0
- package/{esm2015/core/animation/index.js → esm2020/core/animation/index.mjs} +0 -0
- package/{esm2015/core/animation/select-animations.js → esm2020/core/animation/select-animations.mjs} +0 -0
- package/{esm2015/core/common-behaviors/color.js → esm2020/core/common-behaviors/color.mjs} +0 -0
- package/{esm2015/core/common-behaviors/common-module.js → esm2020/core/common-behaviors/common-module.mjs} +5 -5
- package/{esm2015/core/common-behaviors/constructor.js → esm2020/core/common-behaviors/constructor.mjs} +0 -0
- package/{esm2015/core/common-behaviors/disabled.js → esm2020/core/common-behaviors/disabled.mjs} +0 -0
- package/{esm2015/core/common-behaviors/error-state.js → esm2020/core/common-behaviors/error-state.mjs} +0 -0
- package/{esm2015/core/common-behaviors/index.js → esm2020/core/common-behaviors/index.mjs} +0 -0
- package/{esm2015/core/common-behaviors/tabindex.js → esm2020/core/common-behaviors/tabindex.mjs} +0 -0
- package/{esm2015/core/error/error-options.js → esm2020/core/error/error-options.mjs} +7 -7
- package/esm2020/core/formatters/date/formatter.mjs +314 -0
- package/esm2020/core/formatters/date/templates/en-US.mjs +280 -0
- package/esm2020/core/formatters/date/templates/ru-RU.mjs +280 -0
- package/{esm2015/core/formatters/index.js → esm2020/core/formatters/index.mjs} +5 -5
- package/esm2020/core/formatters/number/formatter.mjs +105 -0
- package/{esm2015/core/forms/forms-module.js → esm2020/core/forms/forms-module.mjs} +5 -5
- package/{esm2015/core/forms/forms.directive.js → esm2020/core/forms/forms.directive.mjs} +7 -7
- package/{esm2015/core/forms/index.js → esm2020/core/forms/index.mjs} +0 -0
- package/{esm2015/core/highlight/highlight.pipe.js → esm2020/core/highlight/highlight.pipe.mjs} +4 -4
- package/{esm2015/core/highlight/index.js → esm2020/core/highlight/index.mjs} +5 -5
- package/{esm2015/core/index.js → esm2020/core/index.mjs} +0 -0
- package/{esm2015/core/label/label-options.js → esm2020/core/label/label-options.mjs} +0 -0
- package/{esm2015/core/line/line.js → esm2020/core/line/line.mjs} +8 -8
- package/esm2020/core/option/action.mjs +121 -0
- package/{esm2015/core/option/index.js → esm2020/core/option/index.mjs} +0 -0
- package/esm2020/core/option/optgroup.mjs +31 -0
- package/{esm2015/core/option/option-module.js → esm2020/core/option/option-module.mjs} +5 -5
- package/esm2020/core/option/option.mjs +254 -0
- package/{esm2015/core/overlay/overlay-position-map.js → esm2020/core/overlay/overlay-position-map.mjs} +0 -0
- package/{esm2015/core/pop-up/constants.js → esm2020/core/pop-up/constants.mjs} +0 -0
- package/{esm2015/core/pop-up/index.js → esm2020/core/pop-up/index.mjs} +0 -0
- package/esm2020/core/pop-up/pop-up-trigger.mjs +246 -0
- package/esm2020/core/pop-up/pop-up.mjs +91 -0
- package/{esm2015/core/ptsecurity-mosaic-core.js → esm2020/core/ptsecurity-mosaic-core.mjs} +0 -0
- package/{esm2015/core/public-api.js → esm2020/core/public-api.mjs} +0 -0
- package/{esm2015/core/select/constants.js → esm2020/core/select/constants.mjs} +0 -0
- package/{esm2015/core/select/errors.js → esm2020/core/select/errors.mjs} +0 -0
- package/{esm2015/core/select/events.js → esm2020/core/select/events.mjs} +0 -0
- package/{esm2015/core/select/index.js → esm2020/core/select/index.mjs} +0 -0
- package/{esm2015/core/selection/constants.js → esm2020/core/selection/constants.mjs} +0 -0
- package/{esm2015/core/selection/index.js → esm2020/core/selection/index.mjs} +0 -0
- package/esm2020/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +37 -0
- package/{esm2015/core/selection/pseudo-checkbox/pseudo-checkbox.module.js → esm2020/core/selection/pseudo-checkbox/pseudo-checkbox.module.mjs} +5 -5
- package/{esm2015/core/services/measure-scrollbar.service.js → esm2020/core/services/measure-scrollbar.service.mjs} +4 -4
- package/{esm2015/core/utils/index.js → esm2020/core/utils/index.mjs} +0 -0
- package/{esm2015/core/utils/public-api.js → esm2020/core/utils/public-api.mjs} +0 -0
- package/{esm2015/core/utils/utils.js → esm2020/core/utils/utils.mjs} +0 -0
- package/{esm2015/core/validation/index.js → esm2020/core/validation/index.mjs} +0 -0
- package/{esm2015/core/validation/validation.js → esm2020/core/validation/validation.mjs} +0 -0
- package/esm2020/datepicker/calendar-body.component.mjs +106 -0
- package/esm2020/datepicker/calendar.component.mjs +362 -0
- package/{esm2015/datepicker/datepicker-animations.js → esm2020/datepicker/datepicker-animations.mjs} +0 -0
- package/{esm2015/datepicker/datepicker-errors.js → esm2020/datepicker/datepicker-errors.mjs} +0 -0
- package/esm2020/datepicker/datepicker-input.directive.mjs +900 -0
- package/{esm2015/datepicker/datepicker-intl.js → esm2020/datepicker/datepicker-intl.mjs} +4 -4
- package/{esm2015/datepicker/datepicker-module.js → esm2020/datepicker/datepicker-module.mjs} +5 -5
- package/esm2020/datepicker/datepicker-toggle.component.mjs +86 -0
- package/esm2020/datepicker/datepicker.component.mjs +408 -0
- package/{esm2015/datepicker/index.js → esm2020/datepicker/index.mjs} +0 -0
- package/{esm2015/datepicker/month-view.component.js → esm2020/datepicker/month-view.component.mjs} +5 -11
- package/{esm2015/datepicker/multi-year-view.component.js → esm2020/datepicker/multi-year-view.component.mjs} +5 -11
- package/{esm2015/datepicker/ptsecurity-mosaic-datepicker.js → esm2020/datepicker/ptsecurity-mosaic-datepicker.mjs} +0 -0
- package/{esm2015/datepicker/public-api.js → esm2020/datepicker/public-api.mjs} +0 -0
- package/{esm2015/datepicker/year-view.component.js → esm2020/datepicker/year-view.component.mjs} +5 -11
- package/{esm2015/design-tokens/index.js → esm2020/design-tokens/index.mjs} +0 -0
- package/{esm2015/design-tokens/ptsecurity-mosaic-design-tokens.js → esm2020/design-tokens/ptsecurity-mosaic-design-tokens.mjs} +0 -0
- package/{esm2015/design-tokens/public-api.js → esm2020/design-tokens/public-api.mjs} +0 -0
- package/{esm2015/design-tokens/tokens.js → esm2020/design-tokens/tokens.mjs} +12 -10
- package/{esm2015/divider/divider.component.js → esm2020/divider/divider.component.mjs} +6 -13
- package/{esm2015/divider/divider.module.js → esm2020/divider/divider.module.mjs} +5 -5
- package/{esm2015/divider/index.js → esm2020/divider/index.mjs} +0 -0
- package/{esm2015/divider/ptsecurity-mosaic-divider.js → esm2020/divider/ptsecurity-mosaic-divider.mjs} +0 -0
- package/{esm2015/divider/public-api.js → esm2020/divider/public-api.mjs} +0 -0
- package/{esm2015/dropdown/dropdown-animations.js → esm2020/dropdown/dropdown-animations.mjs} +0 -0
- package/{esm2015/dropdown/dropdown-content.directive.js → esm2020/dropdown/dropdown-content.directive.mjs} +6 -8
- package/{esm2015/dropdown/dropdown-errors.js → esm2020/dropdown/dropdown-errors.mjs} +0 -0
- package/esm2020/dropdown/dropdown-item.component.mjs +139 -0
- package/esm2020/dropdown/dropdown-trigger.directive.mjs +485 -0
- package/esm2020/dropdown/dropdown.component.mjs +292 -0
- package/{esm2015/dropdown/dropdown.module.js → esm2020/dropdown/dropdown.module.mjs} +5 -5
- package/{esm2015/dropdown/dropdown.types.js → esm2020/dropdown/dropdown.types.mjs} +0 -0
- package/{esm2015/dropdown/index.js → esm2020/dropdown/index.mjs} +0 -0
- package/{esm2015/dropdown/ptsecurity-mosaic-dropdown.js → esm2020/dropdown/ptsecurity-mosaic-dropdown.mjs} +0 -0
- package/{esm2015/dropdown/public-api.js → esm2020/dropdown/public-api.mjs} +0 -0
- package/esm2020/form-field/cleaner.mjs +23 -0
- package/{esm2015/form-field/form-field-control.js → esm2020/form-field/form-field-control.mjs} +0 -0
- package/{esm2015/form-field/form-field-errors.js → esm2020/form-field/form-field-errors.mjs} +0 -0
- package/esm2020/form-field/form-field.mjs +205 -0
- package/{esm2015/form-field/form-field.module.js → esm2020/form-field/form-field.module.mjs} +5 -5
- package/{esm2015/form-field/hint.js → esm2020/form-field/hint.mjs} +4 -4
- package/{esm2015/form-field/index.js → esm2020/form-field/index.mjs} +0 -0
- package/{esm2015/form-field/prefix.js → esm2020/form-field/prefix.mjs} +4 -4
- package/{esm2015/form-field/ptsecurity-mosaic-form-field.js → esm2020/form-field/ptsecurity-mosaic-form-field.mjs} +0 -0
- package/{esm2015/form-field/public-api.js → esm2020/form-field/public-api.mjs} +0 -0
- package/{esm2015/form-field/stepper.js → esm2020/form-field/stepper.mjs} +4 -4
- package/{esm2015/form-field/suffix.js → esm2020/form-field/suffix.mjs} +4 -4
- package/esm2020/icon/icon.component.mjs +44 -0
- package/{esm2015/icon/icon.module.js → esm2020/icon/icon.module.mjs} +5 -5
- package/{esm2015/icon/index.js → esm2020/icon/index.mjs} +0 -0
- package/{esm2015/icon/ptsecurity-mosaic-icon.js → esm2020/icon/ptsecurity-mosaic-icon.mjs} +0 -0
- package/{esm2015/icon/public-api.js → esm2020/icon/public-api.mjs} +0 -0
- package/{esm2015/index.js → esm2020/index.mjs} +0 -0
- package/{esm2015/input/index.js → esm2020/input/index.mjs} +0 -0
- package/{esm2015/input/input-errors.js → esm2020/input/input-errors.mjs} +0 -0
- package/esm2020/input/input-number-validators.mjs +92 -0
- package/{esm2015/input/input-number.js → esm2020/input/input-number.mjs} +4 -4
- package/{esm2015/input/input-value-accessor.js → esm2020/input/input-value-accessor.mjs} +0 -0
- package/{esm2015/input/input.js → esm2020/input/input.mjs} +7 -7
- package/{esm2015/input/input.module.js → esm2020/input/input.module.mjs} +5 -5
- package/{esm2015/input/ptsecurity-mosaic-input.js → esm2020/input/ptsecurity-mosaic-input.mjs} +0 -0
- package/{esm2015/input/public-api.js → esm2020/input/public-api.mjs} +0 -0
- package/{esm2015/link/index.js → esm2020/link/index.mjs} +0 -0
- package/esm2020/link/link.component.mjs +107 -0
- package/{esm2015/link/link.module.js → esm2020/link/link.module.mjs} +5 -5
- package/{esm2015/link/ptsecurity-mosaic-link.js → esm2020/link/ptsecurity-mosaic-link.mjs} +0 -0
- package/{esm2015/link/public-api.js → esm2020/link/public-api.mjs} +0 -0
- package/{esm2015/list/index.js → esm2020/list/index.mjs} +0 -0
- package/esm2020/list/list-selection.component.mjs +693 -0
- package/esm2020/list/list.component.mjs +44 -0
- package/{esm2015/list/list.module.js → esm2020/list/list.module.mjs} +5 -5
- package/{esm2015/list/ptsecurity-mosaic-list.js → esm2020/list/ptsecurity-mosaic-list.mjs} +0 -0
- package/{esm2015/list/public-api.js → esm2020/list/public-api.mjs} +0 -0
- package/{esm2015/modal/css-unit.pipe.js → esm2020/modal/css-unit.pipe.mjs} +4 -4
- package/{esm2015/modal/index.js → esm2020/modal/index.mjs} +0 -0
- package/{esm2015/modal/modal-control.service.js → esm2020/modal/modal-control.service.mjs} +4 -4
- package/{esm2015/modal/modal-ref.class.js → esm2020/modal/modal-ref.class.mjs} +0 -0
- package/{esm2015/modal/modal-util.js → esm2020/modal/modal-util.mjs} +0 -0
- package/esm2020/modal/modal.component.mjs +501 -0
- package/{esm2015/modal/modal.directive.js → esm2020/modal/modal.directive.mjs} +13 -13
- package/esm2020/modal/modal.module.mjs +72 -0
- package/esm2020/modal/modal.service.mjs +124 -0
- package/{esm2015/modal/modal.type.js → esm2020/modal/modal.type.mjs} +0 -0
- package/{esm2015/modal/ptsecurity-mosaic-modal.js → esm2020/modal/ptsecurity-mosaic-modal.mjs} +0 -0
- package/{esm2015/modal/public-api.js → esm2020/modal/public-api.mjs} +0 -0
- package/{esm2015/navbar/index.js → esm2020/navbar/index.mjs} +0 -0
- package/esm2020/navbar/navbar-item.component.mjs +577 -0
- package/esm2020/navbar/navbar.component.mjs +237 -0
- package/esm2020/navbar/navbar.module.mjs +92 -0
- package/{esm2015/navbar/ptsecurity-mosaic-navbar.js → esm2020/navbar/ptsecurity-mosaic-navbar.mjs} +0 -0
- package/{esm2015/navbar/public-api.js → esm2020/navbar/public-api.mjs} +0 -0
- package/{esm2015/navbar/vertical-navbar.animation.js → esm2020/navbar/vertical-navbar.animation.mjs} +2 -2
- package/esm2020/navbar/vertical-navbar.component.mjs +114 -0
- package/{esm2015/popover/index.js → esm2020/popover/index.mjs} +0 -0
- package/{esm2015/popover/popover-animations.js → esm2020/popover/popover-animations.mjs} +0 -0
- package/esm2020/popover/popover-confirm.component.mjs +108 -0
- package/esm2020/popover/popover.component.mjs +253 -0
- package/esm2020/popover/popover.module.mjs +24 -0
- package/{esm2015/popover/ptsecurity-mosaic-popover.js → esm2020/popover/ptsecurity-mosaic-popover.mjs} +0 -0
- package/{esm2015/popover/public-api.js → esm2020/popover/public-api.mjs} +2 -1
- package/{esm2015/progress-bar/index.js → esm2020/progress-bar/index.mjs} +0 -0
- package/esm2020/progress-bar/progress-bar.component.mjs +42 -0
- package/{esm2015/progress-bar/progress-bar.module.js → esm2020/progress-bar/progress-bar.module.mjs} +5 -5
- package/{esm2015/progress-bar/ptsecurity-mosaic-progress-bar.js → esm2020/progress-bar/ptsecurity-mosaic-progress-bar.mjs} +0 -0
- package/{esm2015/progress-bar/public-api.js → esm2020/progress-bar/public-api.mjs} +0 -0
- package/{esm2015/progress-spinner/index.js → esm2020/progress-spinner/index.mjs} +0 -0
- package/esm2020/progress-spinner/progress-spinner.component.mjs +46 -0
- package/{esm2015/progress-spinner/progress-spinner.module.js → esm2020/progress-spinner/progress-spinner.module.mjs} +5 -5
- package/{esm2015/progress-spinner/ptsecurity-mosaic-progress-spinner.js → esm2020/progress-spinner/ptsecurity-mosaic-progress-spinner.mjs} +0 -0
- package/{esm2015/progress-spinner/public-api.js → esm2020/progress-spinner/public-api.mjs} +0 -0
- package/{esm2015/ptsecurity-mosaic.js → esm2020/ptsecurity-mosaic.mjs} +0 -0
- package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
- package/{esm2015/radio/index.js → esm2020/radio/index.mjs} +0 -0
- package/{esm2015/radio/ptsecurity-mosaic-radio.js → esm2020/radio/ptsecurity-mosaic-radio.mjs} +0 -0
- package/{esm2015/radio/public-api.js → esm2020/radio/public-api.mjs} +0 -0
- package/esm2020/radio/radio.component.mjs +458 -0
- package/{esm2015/radio/radio.module.js → esm2020/radio/radio.module.mjs} +5 -5
- package/{esm2015/select/index.js → esm2020/select/index.mjs} +0 -0
- package/{esm2015/select/ptsecurity-mosaic-select.js → esm2020/select/ptsecurity-mosaic-select.mjs} +0 -0
- package/{esm2015/select/public-api.js → esm2020/select/public-api.mjs} +0 -0
- package/esm2020/select/select.component.mjs +1110 -0
- package/{esm2015/select/select.module.js → esm2020/select/select.module.mjs} +5 -5
- package/{esm2015/sidebar/index.js → esm2020/sidebar/index.mjs} +0 -0
- package/{esm2015/sidebar/ptsecurity-mosaic-sidebar.js → esm2020/sidebar/ptsecurity-mosaic-sidebar.mjs} +0 -0
- package/{esm2015/sidebar/public-api.js → esm2020/sidebar/public-api.mjs} +0 -0
- package/{esm2015/sidebar/sidebar-animations.js → esm2020/sidebar/sidebar-animations.mjs} +0 -0
- package/esm2020/sidebar/sidebar.component.mjs +146 -0
- package/{esm2015/sidebar/sidebar.module.js → esm2020/sidebar/sidebar.module.mjs} +5 -5
- package/{esm2015/sidepanel/index.js → esm2020/sidepanel/index.mjs} +0 -0
- package/{esm2015/sidepanel/ptsecurity-mosaic-sidepanel.js → esm2020/sidepanel/ptsecurity-mosaic-sidepanel.mjs} +0 -0
- package/{esm2015/sidepanel/public-api.js → esm2020/sidepanel/public-api.mjs} +0 -0
- package/{esm2015/sidepanel/sidepanel-animations.js → esm2020/sidepanel/sidepanel-animations.mjs} +0 -0
- package/{esm2015/sidepanel/sidepanel-config.js → esm2020/sidepanel/sidepanel-config.mjs} +0 -0
- package/esm2020/sidepanel/sidepanel-container.component.mjs +106 -0
- package/esm2020/sidepanel/sidepanel-directives.mjs +159 -0
- package/{esm2015/sidepanel/sidepanel-ref.js → esm2020/sidepanel/sidepanel-ref.mjs} +0 -0
- package/esm2020/sidepanel/sidepanel.module.mjs +74 -0
- package/esm2020/sidepanel/sidepanel.service.mjs +167 -0
- package/{esm2015/splitter/index.js → esm2020/splitter/index.mjs} +0 -0
- package/{esm2015/splitter/ptsecurity-mosaic-splitter.js → esm2020/splitter/ptsecurity-mosaic-splitter.mjs} +0 -0
- package/{esm2015/splitter/public-api.js → esm2020/splitter/public-api.mjs} +0 -0
- package/esm2020/splitter/splitter.component.mjs +480 -0
- package/esm2020/splitter/splitter.module.mjs +40 -0
- package/{esm2015/table/index.js → esm2020/table/index.mjs} +0 -0
- package/{esm2015/table/ptsecurity-mosaic-table.js → esm2020/table/ptsecurity-mosaic-table.mjs} +0 -0
- package/{esm2015/table/public-api.js → esm2020/table/public-api.mjs} +0 -0
- package/{esm2015/table/table.component.js → esm2020/table/table.component.mjs} +4 -4
- package/{esm2015/table/table.module.js → esm2020/table/table.module.mjs} +5 -5
- package/{esm2015/tabs/index.js → esm2020/tabs/index.mjs} +0 -0
- package/esm2020/tabs/paginated-tab-header.mjs +479 -0
- package/{esm2015/tabs/ptsecurity-mosaic-tabs.js → esm2020/tabs/ptsecurity-mosaic-tabs.mjs} +0 -0
- package/{esm2015/tabs/public-api.js → esm2020/tabs/public-api.mjs} +0 -0
- package/esm2020/tabs/tab-body.component.mjs +178 -0
- package/{esm2015/tabs/tab-content.directive.js → esm2020/tabs/tab-content.directive.mjs} +4 -4
- package/esm2020/tabs/tab-group.component.mjs +350 -0
- package/esm2020/tabs/tab-header.component.mjs +67 -0
- package/{esm2015/tabs/tab-label-wrapper.directive.js → esm2020/tabs/tab-label-wrapper.directive.mjs} +4 -4
- package/{esm2015/tabs/tab-label.directive.js → esm2020/tabs/tab-label.directive.mjs} +4 -4
- package/{esm2015/tabs/tab-nav-bar/index.js → esm2020/tabs/tab-nav-bar/index.mjs} +0 -0
- package/esm2020/tabs/tab-nav-bar/tab-nav-bar.mjs +110 -0
- package/{esm2015/tabs/tab.component.js → esm2020/tabs/tab.component.mjs} +4 -4
- package/{esm2015/tabs/tabs-animations.js → esm2020/tabs/tabs-animations.mjs} +0 -0
- package/{esm2015/tabs/tabs.module.js → esm2020/tabs/tabs.module.mjs} +5 -5
- package/{esm2015/tags/index.js → esm2020/tags/index.mjs} +0 -0
- package/{esm2015/tags/ptsecurity-mosaic-tags.js → esm2020/tags/ptsecurity-mosaic-tags.mjs} +0 -0
- package/{esm2015/tags/public-api.js → esm2020/tags/public-api.mjs} +0 -0
- package/{esm2015/tags/tag-default-options.js → esm2020/tags/tag-default-options.mjs} +0 -0
- package/{esm2015/tags/tag-input.js → esm2020/tags/tag-input.mjs} +4 -4
- package/esm2020/tags/tag-list.component.mjs +722 -0
- package/{esm2015/tags/tag-text-control.js → esm2020/tags/tag-text-control.mjs} +0 -0
- package/esm2020/tags/tag.component.mjs +374 -0
- package/{esm2015/tags/tag.module.js → esm2020/tags/tag.module.mjs} +5 -5
- package/{esm2015/textarea/index.js → esm2020/textarea/index.mjs} +0 -0
- package/{esm2015/textarea/ptsecurity-mosaic-textarea.js → esm2020/textarea/ptsecurity-mosaic-textarea.mjs} +0 -0
- package/{esm2015/textarea/public-api.js → esm2020/textarea/public-api.mjs} +0 -0
- package/{esm2015/textarea/textarea.component.js → esm2020/textarea/textarea.component.mjs} +4 -4
- package/{esm2015/textarea/textarea.module.js → esm2020/textarea/textarea.module.mjs} +5 -5
- package/{esm2015/timepicker/index.js → esm2020/timepicker/index.mjs} +0 -0
- package/{esm2015/timepicker/ptsecurity-mosaic-timepicker.js → esm2020/timepicker/ptsecurity-mosaic-timepicker.mjs} +0 -0
- package/{esm2015/timepicker/public-api.js → esm2020/timepicker/public-api.mjs} +0 -0
- package/{esm2015/timepicker/timepicker.constants.js → esm2020/timepicker/timepicker.constants.mjs} +0 -0
- package/esm2020/timepicker/timepicker.directive.mjs +653 -0
- package/{esm2015/timepicker/timepicker.module.js → esm2020/timepicker/timepicker.module.mjs} +5 -5
- package/{esm2015/toggle/index.js → esm2020/toggle/index.mjs} +0 -0
- package/{esm2015/toggle/ptsecurity-mosaic-toggle.js → esm2020/toggle/ptsecurity-mosaic-toggle.mjs} +0 -0
- package/{esm2015/toggle/public-api.js → esm2020/toggle/public-api.mjs} +0 -0
- package/esm2020/toggle/toggle.component.mjs +158 -0
- package/{esm2015/toggle/toggle.module.js → esm2020/toggle/toggle.module.mjs} +5 -5
- package/{esm2015/tooltip/index.js → esm2020/tooltip/index.mjs} +0 -0
- package/{esm2015/tooltip/ptsecurity-mosaic-tooltip.js → esm2020/tooltip/ptsecurity-mosaic-tooltip.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.component.mjs +291 -0
- package/{esm2015/tooltip/tooltip.module.js → esm2020/tooltip/tooltip.module.mjs} +5 -5
- package/{esm2015/tree/control/base-tree-control.js → esm2020/tree/control/base-tree-control.mjs} +0 -0
- package/{esm2015/tree/control/flat-tree-control.js → esm2020/tree/control/flat-tree-control.mjs} +0 -0
- package/{esm2015/tree/control/nested-tree-control.js → esm2020/tree/control/nested-tree-control.mjs} +0 -0
- package/{esm2015/tree/control/tree-control.js → esm2020/tree/control/tree-control.mjs} +0 -0
- package/{esm2015/tree/data-source/flat-data-source.js → esm2020/tree/data-source/flat-data-source.mjs} +0 -0
- package/{esm2015/tree/data-source/nested-data-source.js → esm2020/tree/data-source/nested-data-source.mjs} +0 -0
- package/{esm2015/tree/index.js → esm2020/tree/index.mjs} +0 -0
- package/{esm2015/tree/node.js → esm2020/tree/node.mjs} +4 -4
- package/{esm2015/tree/outlet.js → esm2020/tree/outlet.mjs} +4 -4
- package/esm2020/tree/padding.directive.mjs +110 -0
- package/{esm2015/tree/ptsecurity-mosaic-tree.js → esm2020/tree/ptsecurity-mosaic-tree.mjs} +0 -0
- package/{esm2015/tree/public-api.js → esm2020/tree/public-api.mjs} +0 -0
- package/esm2020/tree/toggle.mjs +80 -0
- package/{esm2015/tree/tree-base.js → esm2020/tree/tree-base.mjs} +7 -7
- package/{esm2015/tree/tree-errors.js → esm2020/tree/tree-errors.mjs} +0 -0
- package/esm2020/tree/tree-option.component.mjs +226 -0
- package/esm2020/tree/tree-selection.component.mjs +530 -0
- package/esm2020/tree/tree.mjs +15 -0
- package/esm2020/tree/tree.module.mjs +53 -0
- package/{esm2015/tree-select/index.js → esm2020/tree-select/index.mjs} +0 -0
- package/{esm2015/tree-select/ptsecurity-mosaic-tree-select.js → esm2020/tree-select/ptsecurity-mosaic-tree-select.mjs} +0 -0
- package/{esm2015/tree-select/public-api.js → esm2020/tree-select/public-api.mjs} +0 -0
- package/esm2020/tree-select/tree-select.component.mjs +889 -0
- package/{esm2015/tree-select/tree-select.module.js → esm2020/tree-select/tree-select.module.mjs} +5 -5
- package/fesm2015/ptsecurity-mosaic-autocomplete.mjs +756 -0
- package/fesm2015/ptsecurity-mosaic-autocomplete.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-button-toggle.mjs +385 -0
- package/fesm2015/ptsecurity-mosaic-button-toggle.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-button.mjs +170 -0
- package/fesm2015/ptsecurity-mosaic-button.mjs.map +1 -0
- package/fesm2015/{ptsecurity-mosaic-card.js → ptsecurity-mosaic-card.mjs} +10 -18
- package/fesm2015/ptsecurity-mosaic-card.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-checkbox.mjs +366 -0
- package/fesm2015/ptsecurity-mosaic-checkbox.mjs.map +1 -0
- package/fesm2015/{ptsecurity-mosaic-core.js → ptsecurity-mosaic-core.mjs} +186 -241
- package/fesm2015/ptsecurity-mosaic-core.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-datepicker.mjs +2700 -0
- package/fesm2015/ptsecurity-mosaic-datepicker.mjs.map +1 -0
- package/fesm2015/{ptsecurity-mosaic-design-tokens.js → ptsecurity-mosaic-design-tokens.mjs} +13 -11
- package/fesm2015/ptsecurity-mosaic-design-tokens.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-divider.mjs +61 -0
- package/fesm2015/ptsecurity-mosaic-divider.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-dropdown.mjs +1106 -0
- package/fesm2015/ptsecurity-mosaic-dropdown.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-form-field.mjs +378 -0
- package/fesm2015/ptsecurity-mosaic-form-field.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-icon.mjs +88 -0
- package/fesm2015/ptsecurity-mosaic-icon.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-input.mjs +609 -0
- package/fesm2015/ptsecurity-mosaic-input.mjs.map +1 -0
- package/fesm2015/{ptsecurity-mosaic-link.js → ptsecurity-mosaic-link.mjs} +8 -8
- package/fesm2015/ptsecurity-mosaic-link.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-list.mjs +796 -0
- package/fesm2015/ptsecurity-mosaic-list.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-modal.mjs +842 -0
- package/fesm2015/ptsecurity-mosaic-modal.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-navbar.mjs +1025 -0
- package/fesm2015/ptsecurity-mosaic-navbar.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-popover.mjs +393 -0
- package/fesm2015/ptsecurity-mosaic-popover.mjs.map +1 -0
- package/fesm2015/{ptsecurity-mosaic-progress-bar.js → ptsecurity-mosaic-progress-bar.mjs} +10 -18
- package/fesm2015/ptsecurity-mosaic-progress-bar.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-progress-spinner.mjs +80 -0
- package/fesm2015/ptsecurity-mosaic-progress-spinner.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-radio.mjs +481 -0
- package/fesm2015/ptsecurity-mosaic-radio.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-select.mjs +1175 -0
- package/fesm2015/ptsecurity-mosaic-select.mjs.map +1 -0
- package/fesm2015/{ptsecurity-mosaic-sidebar.js → ptsecurity-mosaic-sidebar.mjs} +16 -25
- package/fesm2015/ptsecurity-mosaic-sidebar.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-sidepanel.mjs +592 -0
- package/fesm2015/ptsecurity-mosaic-sidepanel.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-splitter.mjs +524 -0
- package/fesm2015/ptsecurity-mosaic-splitter.mjs.map +1 -0
- package/fesm2015/{ptsecurity-mosaic-table.js → ptsecurity-mosaic-table.mjs} +8 -8
- package/fesm2015/ptsecurity-mosaic-table.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-tabs.mjs +1511 -0
- package/fesm2015/ptsecurity-mosaic-tabs.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-tags.mjs +1372 -0
- package/fesm2015/ptsecurity-mosaic-tags.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-textarea.mjs +293 -0
- package/fesm2015/ptsecurity-mosaic-textarea.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-timepicker.mjs +715 -0
- package/fesm2015/ptsecurity-mosaic-timepicker.mjs.map +1 -0
- package/fesm2015/{ptsecurity-mosaic-toggle.js → ptsecurity-mosaic-toggle.mjs} +12 -23
- package/fesm2015/ptsecurity-mosaic-toggle.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-tooltip.mjs +362 -0
- package/fesm2015/ptsecurity-mosaic-tooltip.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-tree-select.mjs +932 -0
- package/fesm2015/ptsecurity-mosaic-tree-select.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-tree.mjs +1707 -0
- package/fesm2015/ptsecurity-mosaic-tree.mjs.map +1 -0
- package/fesm2015/{ptsecurity-mosaic.js → ptsecurity-mosaic.mjs} +1 -1
- package/fesm2015/ptsecurity-mosaic.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-autocomplete.js → fesm2020/ptsecurity-mosaic-autocomplete.mjs} +17 -26
- package/fesm2020/ptsecurity-mosaic-autocomplete.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-button-toggle.js → fesm2020/ptsecurity-mosaic-button-toggle.mjs} +15 -23
- package/fesm2020/ptsecurity-mosaic-button-toggle.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-button.mjs +170 -0
- package/fesm2020/ptsecurity-mosaic-button.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-card.mjs +113 -0
- package/fesm2020/ptsecurity-mosaic-card.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-checkbox.js → fesm2020/ptsecurity-mosaic-checkbox.mjs} +13 -23
- package/fesm2020/ptsecurity-mosaic-checkbox.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-core.mjs +2688 -0
- package/fesm2020/ptsecurity-mosaic-core.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-datepicker.js → fesm2020/ptsecurity-mosaic-datepicker.mjs} +77 -121
- package/fesm2020/ptsecurity-mosaic-datepicker.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-design-tokens.mjs +939 -0
- package/fesm2020/ptsecurity-mosaic-design-tokens.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-divider.mjs +61 -0
- package/fesm2020/ptsecurity-mosaic-divider.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-dropdown.js → fesm2020/ptsecurity-mosaic-dropdown.mjs} +45 -53
- package/fesm2020/ptsecurity-mosaic-dropdown.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-form-field.mjs +377 -0
- package/fesm2020/ptsecurity-mosaic-form-field.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-icon.mjs +86 -0
- package/fesm2020/ptsecurity-mosaic-icon.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-input.js → fesm2020/ptsecurity-mosaic-input.mjs} +41 -27
- package/fesm2020/ptsecurity-mosaic-input.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-link.mjs +136 -0
- package/fesm2020/ptsecurity-mosaic-link.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-list.js → fesm2020/ptsecurity-mosaic-list.mjs} +41 -70
- package/fesm2020/ptsecurity-mosaic-list.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-modal.js → fesm2020/ptsecurity-mosaic-modal.mjs} +63 -59
- package/fesm2020/ptsecurity-mosaic-modal.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-navbar.mjs +1009 -0
- package/fesm2020/ptsecurity-mosaic-navbar.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-popover.mjs +389 -0
- package/fesm2020/ptsecurity-mosaic-popover.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-progress-bar.mjs +76 -0
- package/fesm2020/ptsecurity-mosaic-progress-bar.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-progress-spinner.mjs +80 -0
- package/fesm2020/ptsecurity-mosaic-progress-spinner.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-radio.js → fesm2020/ptsecurity-mosaic-radio.mjs} +13 -22
- package/fesm2020/ptsecurity-mosaic-radio.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-select.js → fesm2020/ptsecurity-mosaic-select.mjs} +23 -35
- package/fesm2020/ptsecurity-mosaic-select.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-sidebar.mjs +202 -0
- package/fesm2020/ptsecurity-mosaic-sidebar.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-sidepanel.js → fesm2020/ptsecurity-mosaic-sidepanel.mjs} +57 -53
- package/fesm2020/ptsecurity-mosaic-sidepanel.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-splitter.mjs +524 -0
- package/fesm2020/ptsecurity-mosaic-splitter.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-table.mjs +50 -0
- package/fesm2020/ptsecurity-mosaic-table.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-tabs.js → fesm2020/ptsecurity-mosaic-tabs.mjs} +65 -102
- package/fesm2020/ptsecurity-mosaic-tabs.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-tags.js → fesm2020/ptsecurity-mosaic-tags.mjs} +29 -47
- package/fesm2020/ptsecurity-mosaic-tags.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-textarea.js → fesm2020/ptsecurity-mosaic-textarea.mjs} +8 -8
- package/fesm2020/ptsecurity-mosaic-textarea.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-timepicker.js → fesm2020/ptsecurity-mosaic-timepicker.mjs} +16 -15
- package/fesm2020/ptsecurity-mosaic-timepicker.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-toggle.mjs +180 -0
- package/fesm2020/ptsecurity-mosaic-toggle.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-tooltip.mjs +354 -0
- package/fesm2020/ptsecurity-mosaic-tooltip.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-tree-select.js → fesm2020/ptsecurity-mosaic-tree-select.mjs} +16 -27
- package/fesm2020/ptsecurity-mosaic-tree-select.mjs.map +1 -0
- package/{fesm2015/ptsecurity-mosaic-tree.js → fesm2020/ptsecurity-mosaic-tree.mjs} +61 -108
- package/fesm2020/ptsecurity-mosaic-tree.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic.mjs +4 -0
- package/fesm2020/ptsecurity-mosaic.mjs.map +1 -0
- package/form-field/README.md +0 -0
- package/form-field/cleaner.d.ts +2 -0
- package/form-field/package.json +5 -5
- package/icon/README.md +0 -0
- package/icon/package.json +5 -5
- package/input/input-number-validators.d.ts +2 -2
- package/input/package.json +5 -5
- package/link/README.md +0 -0
- package/link/package.json +5 -5
- package/list/README.md +0 -0
- package/list/package.json +5 -5
- package/modal/README.md +34 -0
- package/modal/modal.component.d.ts +2 -0
- package/modal/modal.module.d.ts +1 -1
- package/modal/package.json +5 -5
- package/navbar/README.md +41 -0
- package/navbar/navbar-item.component.d.ts +122 -34
- package/navbar/navbar.component.d.ts +37 -9
- package/navbar/navbar.module.d.ts +2 -1
- package/navbar/package.json +5 -5
- package/navbar/vertical-navbar.component.d.ts +15 -26
- package/package.json +299 -14
- package/popover/README.md +32 -0
- package/popover/package.json +5 -5
- package/popover/popover-confirm.component.d.ts +33 -0
- package/popover/popover.component.d.ts +14 -4
- package/popover/popover.module.d.ts +6 -3
- package/popover/public-api.d.ts +1 -0
- package/prebuilt-themes/dark-theme.css +1 -1
- package/prebuilt-themes/default-theme.css +1 -1
- package/prebuilt-visual/default-visual.css +1 -1
- package/progress-bar/README.md +0 -0
- package/progress-bar/package.json +5 -5
- package/progress-spinner/README.md +0 -0
- package/progress-spinner/package.json +5 -5
- package/radio/package.json +5 -5
- package/schematics/README.md +35 -0
- package/schematics/ng-update/data/index.d.ts +1 -0
- package/schematics/ng-update/data/index.js +10 -9
- package/schematics/ng-update/data/index.js.map +1 -1
- package/schematics/ng-update/data/symbol-removal.d.ts +2 -0
- package/schematics/ng-update/data/symbol-removal.js +5 -0
- package/schematics/ng-update/data/symbol-removal.js.map +1 -0
- package/schematics/ng-update/index.js +3 -3
- package/schematics/ng-update/index.js.map +1 -1
- package/schematics/ng-update/update-9.0.0/secondary-entry-points-migration.js +1 -2
- package/schematics/ng-update/update-9.0.0/secondary-entry-points-migration.js.map +1 -1
- package/schematics/ng-update/upgrade-data.js +2 -1
- package/schematics/ng-update/upgrade-data.js.map +1 -1
- package/schematics/tsconfig.lib.json +2 -2
- package/select/README.md +0 -0
- package/select/package.json +5 -5
- package/select/select.component.d.ts +2 -7
- package/sidebar/package.json +5 -5
- package/sidepanel/package.json +5 -5
- package/sidepanel/sidepanel-directives.d.ts +2 -0
- package/sidepanel/sidepanel.module.d.ts +2 -1
- package/splitter/package.json +5 -5
- package/splitter/splitter.component.d.ts +46 -5
- package/splitter/splitter.module.d.ts +1 -1
- package/table/README.md +0 -0
- package/table/package.json +5 -5
- package/tabs/README.md +0 -0
- package/tabs/package.json +5 -5
- package/tags/README.md +0 -0
- package/tags/package.json +5 -5
- package/textarea/README.md +0 -0
- package/textarea/package.json +5 -5
- package/timepicker/README.md +0 -0
- package/timepicker/package.json +5 -5
- package/toggle/package.json +5 -5
- package/tooltip/package.json +5 -5
- package/tooltip/tooltip.component.d.ts +12 -3
- package/tree/package.json +5 -5
- package/tree/padding.directive.d.ts +1 -1
- package/tree/tree-option.component.d.ts +1 -1
- package/tree/tree-selection.component.d.ts +2 -2
- package/tree/tree.module.d.ts +1 -1
- package/tree-select/README.md +0 -0
- package/tree-select/package.json +5 -5
- package/tree-select/tree-select.component.d.ts +2 -7
- package/bundles/ptsecurity-mosaic-autocomplete.umd.js +0 -1162
- package/bundles/ptsecurity-mosaic-autocomplete.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-button-toggle.umd.js +0 -757
- package/bundles/ptsecurity-mosaic-button-toggle.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-button.umd.js +0 -535
- package/bundles/ptsecurity-mosaic-button.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-card.umd.js +0 -481
- package/bundles/ptsecurity-mosaic-card.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-checkbox.umd.js +0 -764
- package/bundles/ptsecurity-mosaic-checkbox.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-core.umd.js +0 -2887
- package/bundles/ptsecurity-mosaic-core.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-datepicker.umd.js +0 -3357
- package/bundles/ptsecurity-mosaic-datepicker.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-design-tokens.umd.js +0 -1872
- package/bundles/ptsecurity-mosaic-design-tokens.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-divider.umd.js +0 -108
- package/bundles/ptsecurity-mosaic-divider.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-dropdown.umd.js +0 -1519
- package/bundles/ptsecurity-mosaic-dropdown.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-form-field.umd.js +0 -789
- package/bundles/ptsecurity-mosaic-form-field.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-icon.umd.js +0 -452
- package/bundles/ptsecurity-mosaic-icon.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-input.umd.js +0 -996
- package/bundles/ptsecurity-mosaic-input.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-link.umd.js +0 -517
- package/bundles/ptsecurity-mosaic-link.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-list.umd.js +0 -1250
- package/bundles/ptsecurity-mosaic-list.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-modal.umd.js +0 -1304
- package/bundles/ptsecurity-mosaic-modal.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-navbar.umd.js +0 -932
- package/bundles/ptsecurity-mosaic-navbar.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-popover.umd.js +0 -655
- package/bundles/ptsecurity-mosaic-popover.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-progress-bar.umd.js +0 -442
- package/bundles/ptsecurity-mosaic-progress-bar.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-progress-spinner.umd.js +0 -450
- package/bundles/ptsecurity-mosaic-progress-spinner.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-radio.umd.js +0 -903
- package/bundles/ptsecurity-mosaic-radio.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-select.umd.js +0 -1608
- package/bundles/ptsecurity-mosaic-select.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-sidebar.umd.js +0 -256
- package/bundles/ptsecurity-mosaic-sidebar.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-sidepanel.umd.js +0 -950
- package/bundles/ptsecurity-mosaic-sidepanel.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-splitter.umd.js +0 -438
- package/bundles/ptsecurity-mosaic-splitter.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-table.umd.js +0 -83
- package/bundles/ptsecurity-mosaic-table.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-tabs.umd.js +0 -2015
- package/bundles/ptsecurity-mosaic-tabs.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-tags.umd.js +0 -1913
- package/bundles/ptsecurity-mosaic-tags.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-textarea.umd.js +0 -666
- package/bundles/ptsecurity-mosaic-textarea.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-timepicker.umd.js +0 -822
- package/bundles/ptsecurity-mosaic-timepicker.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-toggle.umd.js +0 -559
- package/bundles/ptsecurity-mosaic-toggle.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-tooltip.umd.js +0 -728
- package/bundles/ptsecurity-mosaic-tooltip.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-tree-select.umd.js +0 -1370
- package/bundles/ptsecurity-mosaic-tree-select.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic-tree.umd.js +0 -2309
- package/bundles/ptsecurity-mosaic-tree.umd.js.map +0 -1
- package/bundles/ptsecurity-mosaic.umd.js +0 -11
- package/bundles/ptsecurity-mosaic.umd.js.map +0 -1
- package/esm2015/autocomplete/autocomplete.component.js +0 -163
- package/esm2015/button/button.component.js +0 -129
- package/esm2015/button/button.module.js +0 -42
- package/esm2015/button-toggle/button-toggle.component.js +0 -370
- package/esm2015/card/card.component.js +0 -88
- package/esm2015/checkbox/checkbox.js +0 -325
- package/esm2015/core/formatters/date/formatter.js +0 -287
- package/esm2015/core/formatters/date/templates/en-US.js +0 -280
- package/esm2015/core/formatters/date/templates/ru-RU.js +0 -280
- package/esm2015/core/formatters/number/formatter.js +0 -99
- package/esm2015/core/option/action.js +0 -131
- package/esm2015/core/option/optgroup.js +0 -40
- package/esm2015/core/option/option.js +0 -262
- package/esm2015/core/pop-up/pop-up-trigger.js +0 -273
- package/esm2015/core/pop-up/pop-up.js +0 -87
- package/esm2015/core/selection/pseudo-checkbox/pseudo-checkbox.js +0 -45
- package/esm2015/datepicker/calendar-body.component.js +0 -114
- package/esm2015/datepicker/calendar.component.js +0 -377
- package/esm2015/datepicker/datepicker-input.directive.js +0 -885
- package/esm2015/datepicker/datepicker-toggle.component.js +0 -94
- package/esm2015/datepicker/datepicker.component.js +0 -418
- package/esm2015/dropdown/dropdown-item.component.js +0 -142
- package/esm2015/dropdown/dropdown-trigger.directive.js +0 -478
- package/esm2015/dropdown/dropdown.component.js +0 -302
- package/esm2015/form-field/cleaner.js +0 -19
- package/esm2015/form-field/form-field.js +0 -224
- package/esm2015/icon/icon.component.js +0 -51
- package/esm2015/input/input-number-validators.js +0 -78
- package/esm2015/link/link.component.js +0 -108
- package/esm2015/list/list-selection.component.js +0 -708
- package/esm2015/list/list.component.js +0 -58
- package/esm2015/modal/modal.component.js +0 -506
- package/esm2015/modal/modal.module.js +0 -70
- package/esm2015/modal/modal.service.js +0 -117
- package/esm2015/navbar/navbar-item.component.js +0 -209
- package/esm2015/navbar/navbar.component.js +0 -118
- package/esm2015/navbar/navbar.module.js +0 -76
- package/esm2015/navbar/vertical-navbar.component.js +0 -140
- package/esm2015/popover/popover.component.js +0 -219
- package/esm2015/popover/popover.module.js +0 -21
- package/esm2015/progress-bar/progress-bar.component.js +0 -50
- package/esm2015/progress-spinner/progress-spinner.component.js +0 -54
- package/esm2015/radio/radio.component.js +0 -467
- package/esm2015/select/select.component.js +0 -1122
- package/esm2015/sidebar/sidebar.component.js +0 -155
- package/esm2015/sidepanel/sidepanel-container.component.js +0 -113
- package/esm2015/sidepanel/sidepanel-directives.js +0 -155
- package/esm2015/sidepanel/sidepanel.module.js +0 -70
- package/esm2015/sidepanel/sidepanel.service.js +0 -163
- package/esm2015/splitter/splitter.component.js +0 -331
- package/esm2015/splitter/splitter.module.js +0 -38
- package/esm2015/tabs/paginated-tab-header.js +0 -482
- package/esm2015/tabs/tab-body.component.js +0 -186
- package/esm2015/tabs/tab-group.component.js +0 -359
- package/esm2015/tabs/tab-header.component.js +0 -76
- package/esm2015/tabs/tab-nav-bar/tab-nav-bar.js +0 -118
- package/esm2015/tags/tag-list.component.js +0 -732
- package/esm2015/tags/tag.component.js +0 -382
- package/esm2015/timepicker/timepicker.directive.js +0 -652
- package/esm2015/toggle/toggle.component.js +0 -169
- package/esm2015/tooltip/tooltip.component.js +0 -260
- package/esm2015/tree/padding.directive.js +0 -114
- package/esm2015/tree/toggle.js +0 -89
- package/esm2015/tree/tree-option.component.js +0 -238
- package/esm2015/tree/tree-selection.component.js +0 -541
- package/esm2015/tree/tree.js +0 -23
- package/esm2015/tree/tree.module.js +0 -56
- package/esm2015/tree-select/tree-select.component.js +0 -900
- package/fesm2015/ptsecurity-mosaic-autocomplete.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-button-toggle.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-button.js +0 -174
- package/fesm2015/ptsecurity-mosaic-button.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-card.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-checkbox.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-core.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-datepicker.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-design-tokens.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-divider.js +0 -68
- package/fesm2015/ptsecurity-mosaic-divider.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-dropdown.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-form-field.js +0 -393
- package/fesm2015/ptsecurity-mosaic-form-field.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-icon.js +0 -93
- package/fesm2015/ptsecurity-mosaic-icon.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-input.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-link.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-list.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-modal.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-navbar.js +0 -539
- package/fesm2015/ptsecurity-mosaic-navbar.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-popover.js +0 -257
- package/fesm2015/ptsecurity-mosaic-popover.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-progress-bar.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-progress-spinner.js +0 -88
- package/fesm2015/ptsecurity-mosaic-progress-spinner.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-radio.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-select.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-sidebar.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-sidepanel.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-splitter.js +0 -373
- package/fesm2015/ptsecurity-mosaic-splitter.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-table.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-tabs.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-tags.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-textarea.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-timepicker.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-toggle.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-tooltip.js +0 -323
- package/fesm2015/ptsecurity-mosaic-tooltip.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-tree-select.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic-tree.js.map +0 -1
- package/fesm2015/ptsecurity-mosaic.js.map +0 -1
@@ -0,0 +1,2700 @@
|
|
1
|
+
import { A11yModule } from '@angular/cdk/a11y';
|
2
|
+
import * as i3$1 from '@angular/cdk/overlay';
|
3
|
+
import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
|
4
|
+
import * as i8 from '@angular/cdk/portal';
|
5
|
+
import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
|
6
|
+
import * as i1 from '@angular/common';
|
7
|
+
import { DOCUMENT, CommonModule } from '@angular/common';
|
8
|
+
import * as i0 from '@angular/core';
|
9
|
+
import { EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, Optional, Inject, ViewChild, Injectable, forwardRef, Directive, ContentChild, InjectionToken, NgModule } from '@angular/core';
|
10
|
+
import * as i3 from '@ptsecurity/mosaic/button';
|
11
|
+
import { McButtonModule } from '@ptsecurity/mosaic/button';
|
12
|
+
import * as i4 from '@ptsecurity/mosaic/icon';
|
13
|
+
import { McIconModule } from '@ptsecurity/mosaic/icon';
|
14
|
+
import { take } from 'rxjs/operators';
|
15
|
+
import * as i1$1 from '@ptsecurity/cdk/datetime';
|
16
|
+
import { MC_DATE_FORMATS } from '@ptsecurity/cdk/datetime';
|
17
|
+
import { Subject, Subscription, of, merge } from 'rxjs';
|
18
|
+
import { SPACE, ENTER, PAGE_DOWN, PAGE_UP, END, HOME, DOWN_ARROW, UP_ARROW, RIGHT_ARROW, LEFT_ARROW, TAB, ESCAPE, isLetterKey, hasModifierKey, isVerticalMovement, isHorizontalMovement } from '@ptsecurity/cdk/keycodes';
|
19
|
+
import * as i2 from '@angular/cdk/bidi';
|
20
|
+
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
21
|
+
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators } from '@angular/forms';
|
22
|
+
import { validationTooltipShowDelay, validationTooltipHideDelay } from '@ptsecurity/mosaic/core';
|
23
|
+
import { McFormFieldControl } from '@ptsecurity/mosaic/form-field';
|
24
|
+
import { trigger, state, style, transition, animate } from '@angular/animations';
|
25
|
+
|
26
|
+
// tslint:disable:no-magic-numbers
|
27
|
+
/**
|
28
|
+
* An internal class that represents the data corresponding to a single calendar cell.
|
29
|
+
* @docs-private
|
30
|
+
*/
|
31
|
+
class McCalendarCell {
|
32
|
+
constructor(value, displayValue, ariaLabel, enabled, cssClasses) {
|
33
|
+
this.value = value;
|
34
|
+
this.displayValue = displayValue;
|
35
|
+
this.ariaLabel = ariaLabel;
|
36
|
+
this.enabled = enabled;
|
37
|
+
this.cssClasses = cssClasses;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
/**
|
41
|
+
* An internal component used to display calendar data in a table.
|
42
|
+
* @docs-private
|
43
|
+
*/
|
44
|
+
class McCalendarBody {
|
45
|
+
constructor(elementRef, ngZone) {
|
46
|
+
this.elementRef = elementRef;
|
47
|
+
this.ngZone = ngZone;
|
48
|
+
/** The number of columns in the table. */
|
49
|
+
this.numCols = 7;
|
50
|
+
/** The cell number of the active cell in the table. */
|
51
|
+
this.activeCell = 0;
|
52
|
+
/**
|
53
|
+
* The aspect ratio (width / height) to use for the cells in the table. This aspect ratio will be
|
54
|
+
* maintained even as the table resizes.
|
55
|
+
*/
|
56
|
+
this.cellAspectRatio = 1;
|
57
|
+
/** Emits when a new value is selected. */
|
58
|
+
this.selectedValueChange = new EventEmitter();
|
59
|
+
}
|
60
|
+
cellClicked(cell) {
|
61
|
+
if (cell.enabled) {
|
62
|
+
this.selectedValueChange.emit(cell.value);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
ngOnChanges(changes) {
|
66
|
+
const columnChanges = changes.numCols;
|
67
|
+
// tslint:disable-next-line:no-this-assignment
|
68
|
+
const { rows, numCols } = this;
|
69
|
+
if (changes.rows || columnChanges) {
|
70
|
+
this.firstRowOffset = rows && rows.length && rows[0].length ? numCols - rows[0].length : 0;
|
71
|
+
}
|
72
|
+
if (changes.cellAspectRatio || columnChanges || !this.cellPadding) {
|
73
|
+
this.cellPadding = `${this.cellAspectRatio * 50 / numCols}%`;
|
74
|
+
}
|
75
|
+
if (columnChanges || !this.cellWidth) {
|
76
|
+
this.cellWidth = `${100 / numCols}%`;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
isActiveCell(rowIndex, colIndex) {
|
80
|
+
let cellNumber = rowIndex * this.numCols + colIndex;
|
81
|
+
// Account for the fact that the first row may not have as many cells.
|
82
|
+
if (rowIndex) {
|
83
|
+
cellNumber -= this.firstRowOffset;
|
84
|
+
}
|
85
|
+
return cellNumber === this.activeCell;
|
86
|
+
}
|
87
|
+
/** Focuses the active cell after the microtask queue is empty. */
|
88
|
+
focusActiveCell() {
|
89
|
+
this.ngZone.runOutsideAngular(() => {
|
90
|
+
this.ngZone.onStable.asObservable().pipe(take(1)).subscribe(() => {
|
91
|
+
const activeCell = this.elementRef.nativeElement.querySelector('.mc-calendar__body_active');
|
92
|
+
if (activeCell) {
|
93
|
+
activeCell.focus();
|
94
|
+
}
|
95
|
+
});
|
96
|
+
});
|
97
|
+
}
|
98
|
+
}
|
99
|
+
/** @nocollapse */ /** @nocollapse */ McCalendarBody.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McCalendarBody, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
100
|
+
/** @nocollapse */ /** @nocollapse */ McCalendarBody.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: McCalendarBody, selector: "[mc-calendar-body]", inputs: { label: "label", rows: "rows", todayValue: "todayValue", selectedValue: "selectedValue", labelMinRequiredCells: "labelMinRequiredCells", numCols: "numCols", activeCell: "activeCell", cellAspectRatio: "cellAspectRatio" }, outputs: { selectedValueChange: "selectedValueChange" }, host: { attributes: { "role": "grid", "aria-readonly": "true" }, classAttribute: "mc-calendar__body" }, exportAs: ["mcCalendarBody"], usesOnChanges: true, 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\">\n <td class=\"mc-calendar__body-label\" [attr.colspan]=\"numCols\">\n {{ label }}\n </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\">\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 The aspect ratio of the table cells is maintained by setting the top and bottom padding as a\n percentage of the width (a variant of the trick described here:\n https://www.w3schools.com/howto/howto_css_aspect_ratio.asp).\n -->\n <td *ngIf=\"rowIndex === 0 && firstRowOffset\"\n class=\"mc-calendar__body-label\"\n [attr.colspan]=\"firstRowOffset\">\n {{ firstRowOffset >= labelMinRequiredCells ? label : '' }}\n </td>\n <td *ngFor=\"let item of row; let colIndex = index\"\n class=\"mc-calendar__body-cell\"\n [ngClass]=\"item.cssClasses!\"\n [tabindex]=\"isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.mc-calendar__body_disabled]=\"!item.enabled\"\n [class.mc-calendar__body_active]=\"isActiveCell(rowIndex, colIndex)\"\n (click)=\"cellClicked(item)\"\n [style.width]=\"cellWidth\"\n [style.paddingTop]=\"cellPadding\"\n [style.paddingBottom]=\"cellPadding\">\n <div class=\"mc-calendar__body-cell-content\"\n [class.mc-selected]=\"selectedValue === item.value\"\n [class.mc-calendar__body-today]=\"todayValue === item.value\">\n {{ item.displayValue }}\n </div>\n </td>\n</tr>\n", styles: [".mc-calendar__body{min-width:224px;min-width:calc(7 * var(--mc-datepicker-body-size-cell-min-size, 32px))}.mc-calendar__body-label{text-align:left;padding:8px 28px 12px 12px;padding:var(--mc-datepicker-body-size-label-paddings, 8px 28px 12px 12px)}.mc-calendar__body-cell{position:relative;height:0;line-height:0;text-align:center;outline:none;cursor:pointer}.mc-calendar__body_disabled{cursor:default}.mc-calendar__body-cell-content{position:absolute;top:5%;top:var(--mc-datepicker-body-size-cell-margin, 5%);left:5%;left:var(--mc-datepicker-body-size-cell-margin, 5%);padding:8px;padding:var(--mc-datepicker-body-size-cell-padding, 8px);display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;line-height:1;border-width:1px;border-width:var(--mc-datepicker-body-size-cell-border-width, 1px);border-style:solid}.cdk-high-contrast-active .mc-calendar__body-cell-content{border:none}.cdk-high-contrast-active :host .mc-calendar__body-cell-content{border:none}mc-month-view .mc-calendar__body-cell-content{justify-content:flex-end}mc-multi-year-view .mc-calendar__body-cell-content,mc-year-view .mc-calendar__body-cell-content{justify-content:center}.cdk-high-contrast-active .mc-datepicker__popup:not(:empty),.cdk-high-contrast-active .mc-selected{outline:solid 1px}.cdk-high-contrast-active .mc-calendar__body-today{outline:dotted 1px}.cdk-high-contrast-active :host .mc-datepicker__popup:not(:empty),.cdk-high-contrast-active :host .mc-selected{outline:solid 1px}.cdk-high-contrast-active :host .mc-calendar__body-today{outline:dotted 1px}[dir=rtl] .mc-calendar__body-label{text-align:right}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
101
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McCalendarBody, decorators: [{
|
102
|
+
type: Component,
|
103
|
+
args: [{ selector: '[mc-calendar-body]', exportAs: 'mcCalendarBody', host: {
|
104
|
+
class: 'mc-calendar__body',
|
105
|
+
role: 'grid',
|
106
|
+
'aria-readonly': 'true'
|
107
|
+
}, 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\">\n <td class=\"mc-calendar__body-label\" [attr.colspan]=\"numCols\">\n {{ label }}\n </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\">\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 The aspect ratio of the table cells is maintained by setting the top and bottom padding as a\n percentage of the width (a variant of the trick described here:\n https://www.w3schools.com/howto/howto_css_aspect_ratio.asp).\n -->\n <td *ngIf=\"rowIndex === 0 && firstRowOffset\"\n class=\"mc-calendar__body-label\"\n [attr.colspan]=\"firstRowOffset\">\n {{ firstRowOffset >= labelMinRequiredCells ? label : '' }}\n </td>\n <td *ngFor=\"let item of row; let colIndex = index\"\n class=\"mc-calendar__body-cell\"\n [ngClass]=\"item.cssClasses!\"\n [tabindex]=\"isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.mc-calendar__body_disabled]=\"!item.enabled\"\n [class.mc-calendar__body_active]=\"isActiveCell(rowIndex, colIndex)\"\n (click)=\"cellClicked(item)\"\n [style.width]=\"cellWidth\"\n [style.paddingTop]=\"cellPadding\"\n [style.paddingBottom]=\"cellPadding\">\n <div class=\"mc-calendar__body-cell-content\"\n [class.mc-selected]=\"selectedValue === item.value\"\n [class.mc-calendar__body-today]=\"todayValue === item.value\">\n {{ item.displayValue }}\n </div>\n </td>\n</tr>\n", styles: [".mc-calendar__body{min-width:224px;min-width:calc(7 * var(--mc-datepicker-body-size-cell-min-size, 32px))}.mc-calendar__body-label{text-align:left;padding:8px 28px 12px 12px;padding:var(--mc-datepicker-body-size-label-paddings, 8px 28px 12px 12px)}.mc-calendar__body-cell{position:relative;height:0;line-height:0;text-align:center;outline:none;cursor:pointer}.mc-calendar__body_disabled{cursor:default}.mc-calendar__body-cell-content{position:absolute;top:5%;top:var(--mc-datepicker-body-size-cell-margin, 5%);left:5%;left:var(--mc-datepicker-body-size-cell-margin, 5%);padding:8px;padding:var(--mc-datepicker-body-size-cell-padding, 8px);display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;line-height:1;border-width:1px;border-width:var(--mc-datepicker-body-size-cell-border-width, 1px);border-style:solid}.cdk-high-contrast-active .mc-calendar__body-cell-content{border:none}.cdk-high-contrast-active :host .mc-calendar__body-cell-content{border:none}mc-month-view .mc-calendar__body-cell-content{justify-content:flex-end}mc-multi-year-view .mc-calendar__body-cell-content,mc-year-view .mc-calendar__body-cell-content{justify-content:center}.cdk-high-contrast-active .mc-datepicker__popup:not(:empty),.cdk-high-contrast-active .mc-selected{outline:solid 1px}.cdk-high-contrast-active .mc-calendar__body-today{outline:dotted 1px}.cdk-high-contrast-active :host .mc-datepicker__popup:not(:empty),.cdk-high-contrast-active :host .mc-selected{outline:solid 1px}.cdk-high-contrast-active :host .mc-calendar__body-today{outline:dotted 1px}[dir=rtl] .mc-calendar__body-label{text-align:right}\n"] }]
|
108
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { label: [{
|
109
|
+
type: Input
|
110
|
+
}], rows: [{
|
111
|
+
type: Input
|
112
|
+
}], todayValue: [{
|
113
|
+
type: Input
|
114
|
+
}], selectedValue: [{
|
115
|
+
type: Input
|
116
|
+
}], labelMinRequiredCells: [{
|
117
|
+
type: Input
|
118
|
+
}], numCols: [{
|
119
|
+
type: Input
|
120
|
+
}], activeCell: [{
|
121
|
+
type: Input
|
122
|
+
}], cellAspectRatio: [{
|
123
|
+
type: Input
|
124
|
+
}], selectedValueChange: [{
|
125
|
+
type: Output
|
126
|
+
}] } });
|
127
|
+
|
128
|
+
/** @docs-private */
|
129
|
+
function createMissingDateImplError(provider) {
|
130
|
+
return Error(`McDatepicker: No provider found for ${provider}. You must import one of the existing ` +
|
131
|
+
`modules at your application root or provide a custom implementation or use exists ones.`);
|
132
|
+
}
|
133
|
+
|
134
|
+
const DAYS_PER_WEEK = 7;
|
135
|
+
/**
|
136
|
+
* An internal component used to display a single month in the datepicker.
|
137
|
+
* @docs-private
|
138
|
+
*/
|
139
|
+
class McMonthView {
|
140
|
+
constructor(changeDetectorRef, dateFormats, dateAdapter, dir) {
|
141
|
+
this.changeDetectorRef = changeDetectorRef;
|
142
|
+
this.dateFormats = dateFormats;
|
143
|
+
this.dateAdapter = dateAdapter;
|
144
|
+
this.dir = dir;
|
145
|
+
/** Emits when a new date is selected. */
|
146
|
+
this.selectedChange = new EventEmitter();
|
147
|
+
/** Emits when any date is selected. */
|
148
|
+
this.userSelection = new EventEmitter();
|
149
|
+
/** Emits when any date is activated. */
|
150
|
+
this.activeDateChange = new EventEmitter();
|
151
|
+
if (!this.dateAdapter) {
|
152
|
+
throw createMissingDateImplError('DateAdapter');
|
153
|
+
}
|
154
|
+
if (!this.dateFormats) {
|
155
|
+
throw createMissingDateImplError('MC_DATE_FORMATS');
|
156
|
+
}
|
157
|
+
const firstDayOfWeek = this.dateAdapter.getFirstDayOfWeek();
|
158
|
+
const narrowWeekdays = this.dateAdapter.getDayOfWeekNames('short');
|
159
|
+
const longWeekdays = this.dateAdapter.getDayOfWeekNames('long');
|
160
|
+
// Rotate the labels for days of the week based on the configured first day of the week.
|
161
|
+
const weekdays = longWeekdays.map((long, i) => {
|
162
|
+
return { long, narrow: narrowWeekdays[i] };
|
163
|
+
});
|
164
|
+
this.weekdays = weekdays
|
165
|
+
.slice(firstDayOfWeek)
|
166
|
+
.concat(weekdays.slice(0, firstDayOfWeek));
|
167
|
+
this._activeDate = this.dateAdapter.today();
|
168
|
+
}
|
169
|
+
/**
|
170
|
+
* The date to display in this month view (everything other than the month and year is ignored).
|
171
|
+
*/
|
172
|
+
get activeDate() {
|
173
|
+
return this._activeDate;
|
174
|
+
}
|
175
|
+
set activeDate(value) {
|
176
|
+
const oldActiveDate = this._activeDate;
|
177
|
+
const validDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value)) || this.dateAdapter.today();
|
178
|
+
this._activeDate = this.dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
|
179
|
+
if (!this.hasSameMonthAndYear(oldActiveDate, this._activeDate)) {
|
180
|
+
this.init();
|
181
|
+
}
|
182
|
+
}
|
183
|
+
/** The currently selected date. */
|
184
|
+
get selected() {
|
185
|
+
return this._selected;
|
186
|
+
}
|
187
|
+
set selected(value) {
|
188
|
+
this._selected = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
189
|
+
this.selectedDate = this.getDateInCurrentMonth(this._selected);
|
190
|
+
}
|
191
|
+
/** The minimum selectable date. */
|
192
|
+
get minDate() {
|
193
|
+
return this._minDate;
|
194
|
+
}
|
195
|
+
set minDate(value) {
|
196
|
+
this._minDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
197
|
+
}
|
198
|
+
/** The maximum selectable date. */
|
199
|
+
get maxDate() {
|
200
|
+
return this._maxDate;
|
201
|
+
}
|
202
|
+
set maxDate(value) {
|
203
|
+
this._maxDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
204
|
+
}
|
205
|
+
ngAfterContentInit() {
|
206
|
+
this.init();
|
207
|
+
}
|
208
|
+
/** Handles when a new date is selected. */
|
209
|
+
dateSelected(date) {
|
210
|
+
if (this.selectedDate !== date) {
|
211
|
+
const selectedYear = this.dateAdapter.getYear(this.activeDate);
|
212
|
+
const selectedMonth = this.dateAdapter.getMonth(this.activeDate);
|
213
|
+
const selectedDate = this.dateAdapter.createDate(selectedYear, selectedMonth, date);
|
214
|
+
this.selectedChange.emit(selectedDate);
|
215
|
+
}
|
216
|
+
this.userSelection.emit();
|
217
|
+
}
|
218
|
+
/** Handles keydown events on the calendar body when calendar is in month view. */
|
219
|
+
handleCalendarBodyKeydown(event) {
|
220
|
+
// TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
|
221
|
+
// disabled ones from being selected. This may not be ideal, we should look into whether
|
222
|
+
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
|
223
|
+
const oldActiveDate = this._activeDate;
|
224
|
+
const isRtl = this.isRtl();
|
225
|
+
// tslint:disable-next-line:deprecation
|
226
|
+
switch (event.keyCode) {
|
227
|
+
case LEFT_ARROW:
|
228
|
+
this.activeDate = this.dateAdapter.addCalendarDays(this._activeDate, isRtl ? 1 : -1);
|
229
|
+
break;
|
230
|
+
case RIGHT_ARROW:
|
231
|
+
this.activeDate = this.dateAdapter.addCalendarDays(this._activeDate, isRtl ? -1 : 1);
|
232
|
+
break;
|
233
|
+
case UP_ARROW:
|
234
|
+
this.activeDate = this.dateAdapter.addCalendarDays(this._activeDate, -7);
|
235
|
+
break;
|
236
|
+
case DOWN_ARROW:
|
237
|
+
this.activeDate = this.dateAdapter.addCalendarDays(this._activeDate, 7);
|
238
|
+
break;
|
239
|
+
case HOME:
|
240
|
+
this.activeDate = this.dateAdapter.addCalendarDays(this._activeDate, 1 - this.dateAdapter.getDate(this._activeDate));
|
241
|
+
break;
|
242
|
+
case END:
|
243
|
+
this.activeDate = this.dateAdapter.addCalendarDays(this._activeDate, (this.dateAdapter.getNumDaysInMonth(this._activeDate) - this.dateAdapter.getDate(this._activeDate)));
|
244
|
+
break;
|
245
|
+
case PAGE_UP:
|
246
|
+
this.activeDate = event.altKey ?
|
247
|
+
this.dateAdapter.addCalendarYears(this._activeDate, -1) :
|
248
|
+
this.dateAdapter.addCalendarMonths(this._activeDate, -1);
|
249
|
+
break;
|
250
|
+
case PAGE_DOWN:
|
251
|
+
this.activeDate = event.altKey ?
|
252
|
+
this.dateAdapter.addCalendarYears(this._activeDate, 1) :
|
253
|
+
this.dateAdapter.addCalendarMonths(this._activeDate, 1);
|
254
|
+
break;
|
255
|
+
case ENTER:
|
256
|
+
case SPACE:
|
257
|
+
if (!this.dateFilter || this.dateFilter(this._activeDate)) {
|
258
|
+
this.dateSelected(this.dateAdapter.getDate(this._activeDate));
|
259
|
+
this.userSelection.emit();
|
260
|
+
// Prevent unexpected default actions such as form submission.
|
261
|
+
event.preventDefault();
|
262
|
+
}
|
263
|
+
return;
|
264
|
+
default:
|
265
|
+
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
266
|
+
return;
|
267
|
+
}
|
268
|
+
if (this.dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
|
269
|
+
this.activeDateChange.emit(this.activeDate);
|
270
|
+
}
|
271
|
+
this.focusActiveCell();
|
272
|
+
// Prevent unexpected default actions such as form submission.
|
273
|
+
event.preventDefault();
|
274
|
+
}
|
275
|
+
/** Initializes this month view. */
|
276
|
+
init() {
|
277
|
+
this.selectedDate = this.getDateInCurrentMonth(this.selected);
|
278
|
+
this.todayDate = this.getDateInCurrentMonth(this.dateAdapter.today());
|
279
|
+
this.monthLabel = this.dateAdapter.getMonthNames('short')[this.dateAdapter.getMonth(this.activeDate)];
|
280
|
+
this.monthLabel = this.monthLabel[0].toLocaleUpperCase() + this.monthLabel.substr(1);
|
281
|
+
const firstOfMonth = this.dateAdapter.createDate(this.dateAdapter.getYear(this.activeDate), this.dateAdapter.getMonth(this.activeDate));
|
282
|
+
this.firstWeekOffset =
|
283
|
+
(DAYS_PER_WEEK + this.dateAdapter.getDayOfWeek(firstOfMonth) -
|
284
|
+
this.dateAdapter.getFirstDayOfWeek()) % DAYS_PER_WEEK;
|
285
|
+
this.createWeekCells();
|
286
|
+
this.changeDetectorRef.markForCheck();
|
287
|
+
}
|
288
|
+
/** Focuses the active cell after the microtask queue is empty. */
|
289
|
+
focusActiveCell() {
|
290
|
+
this.mcCalendarBody.focusActiveCell();
|
291
|
+
}
|
292
|
+
/** Creates McCalendarCells for the dates in this month. */
|
293
|
+
createWeekCells() {
|
294
|
+
const daysInMonth = this.dateAdapter.getNumDaysInMonth(this.activeDate);
|
295
|
+
const dateNames = this.dateAdapter.getDateNames();
|
296
|
+
this.weeks = [[]];
|
297
|
+
for (let i = 0, cell = this.firstWeekOffset; i < daysInMonth; i++, cell++) {
|
298
|
+
if (cell === DAYS_PER_WEEK) {
|
299
|
+
this.weeks.push([]);
|
300
|
+
cell = 0;
|
301
|
+
}
|
302
|
+
const date = this.dateAdapter.createDate(this.dateAdapter.getYear(this.activeDate), this.dateAdapter.getMonth(this.activeDate), i + 1);
|
303
|
+
const enabled = this.shouldEnableDate(date);
|
304
|
+
const ariaLabel = this.dateAdapter.format(date, this.dateFormats.dateA11yLabel);
|
305
|
+
const cellClasses = this.dateClass ? this.dateClass(date) : undefined;
|
306
|
+
this.weeks[this.weeks.length - 1]
|
307
|
+
.push(new McCalendarCell(i + 1, dateNames[i], ariaLabel, enabled, cellClasses));
|
308
|
+
}
|
309
|
+
}
|
310
|
+
/** Date filter for the month */
|
311
|
+
shouldEnableDate(date) {
|
312
|
+
return !!date &&
|
313
|
+
(!this.dateFilter || this.dateFilter(date)) &&
|
314
|
+
(!this.minDate || this.dateAdapter.compareDate(date, this.minDate) >= 0) &&
|
315
|
+
(!this.maxDate || this.dateAdapter.compareDate(date, this.maxDate) <= 0);
|
316
|
+
}
|
317
|
+
/**
|
318
|
+
* Gets the date in this month that the given Date falls on.
|
319
|
+
* Returns null if the given Date is in another month.
|
320
|
+
*/
|
321
|
+
getDateInCurrentMonth(date) {
|
322
|
+
return date && this.hasSameMonthAndYear(date, this.activeDate) ?
|
323
|
+
this.dateAdapter.getDate(date) : null;
|
324
|
+
}
|
325
|
+
/** Checks whether the 2 dates are non-null and fall within the same month of the same year. */
|
326
|
+
hasSameMonthAndYear(d1, d2) {
|
327
|
+
return !!(d1 && d2 && this.dateAdapter.getMonth(d1) === this.dateAdapter.getMonth(d2) &&
|
328
|
+
this.dateAdapter.getYear(d1) === this.dateAdapter.getYear(d2));
|
329
|
+
}
|
330
|
+
/**
|
331
|
+
* @param obj The object to check.
|
332
|
+
* @returns The given object if it is both a date instance and valid, otherwise null.
|
333
|
+
*/
|
334
|
+
getValidDateOrNull(obj) {
|
335
|
+
return (this.dateAdapter.isDateInstance(obj) && this.dateAdapter.isValid(obj)) ? obj : null;
|
336
|
+
}
|
337
|
+
/** Determines whether the user has the RTL layout direction. */
|
338
|
+
isRtl() {
|
339
|
+
return this.dir && this.dir.value === 'rtl';
|
340
|
+
}
|
341
|
+
}
|
342
|
+
/** @nocollapse */ /** @nocollapse */ McMonthView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McMonthView, deps: [{ token: i0.ChangeDetectorRef }, { token: MC_DATE_FORMATS, optional: true }, { token: i1$1.DateAdapter, optional: true }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
343
|
+
/** @nocollapse */ /** @nocollapse */ McMonthView.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: McMonthView, selector: "mc-month-view", inputs: { activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate", dateFilter: "dateFilter", dateClass: "dateClass" }, outputs: { selectedChange: "selectedChange", userSelection: "userSelection", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "mcCalendarBody", first: true, predicate: McCalendarBody, descendants: true }], exportAs: ["mcMonthView"], ngImport: i0, template: "<table class=\"mc-calendar__table\">\n <thead class=\"mc-calendar__table-header\">\n <tr>\n <th *ngFor=\"let day of weekdays\" [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\n </tr>\n <tr>\n <th class=\"mc-calendar__table-header-divider\" colspan=\"7\"></th>\n </tr>\n </thead>\n <tbody mc-calendar-body\n [label]=\"monthLabel\"\n [rows]=\"weeks\"\n [todayValue]=\"todayDate!\"\n [selectedValue]=\"selectedDate!\"\n [labelMinRequiredCells]=\"3\"\n [activeCell]=\"dateAdapter.getDate(activeDate) - 1\"\n (selectedValueChange)=\"dateSelected($event)\"\n (keydown)=\"handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n", components: [{ type: McCalendarBody, selector: "[mc-calendar-body]", inputs: ["label", "rows", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "activeCell", "cellAspectRatio"], outputs: ["selectedValueChange"], exportAs: ["mcCalendarBody"] }], directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
344
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McMonthView, decorators: [{
|
345
|
+
type: Component,
|
346
|
+
args: [{ selector: 'mc-month-view', exportAs: 'mcMonthView', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<table class=\"mc-calendar__table\">\n <thead class=\"mc-calendar__table-header\">\n <tr>\n <th *ngFor=\"let day of weekdays\" [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\n </tr>\n <tr>\n <th class=\"mc-calendar__table-header-divider\" colspan=\"7\"></th>\n </tr>\n </thead>\n <tbody mc-calendar-body\n [label]=\"monthLabel\"\n [rows]=\"weeks\"\n [todayValue]=\"todayDate!\"\n [selectedValue]=\"selectedDate!\"\n [labelMinRequiredCells]=\"3\"\n [activeCell]=\"dateAdapter.getDate(activeDate) - 1\"\n (selectedValueChange)=\"dateSelected($event)\"\n (keydown)=\"handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n" }]
|
347
|
+
}], ctorParameters: function () {
|
348
|
+
return [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
349
|
+
type: Optional
|
350
|
+
}, {
|
351
|
+
type: Inject,
|
352
|
+
args: [MC_DATE_FORMATS]
|
353
|
+
}] }, { type: i1$1.DateAdapter, decorators: [{
|
354
|
+
type: Optional
|
355
|
+
}] }, { type: i2.Directionality, decorators: [{
|
356
|
+
type: Optional
|
357
|
+
}] }];
|
358
|
+
}, propDecorators: { activeDate: [{
|
359
|
+
type: Input
|
360
|
+
}], selected: [{
|
361
|
+
type: Input
|
362
|
+
}], minDate: [{
|
363
|
+
type: Input
|
364
|
+
}], maxDate: [{
|
365
|
+
type: Input
|
366
|
+
}], dateFilter: [{
|
367
|
+
type: Input
|
368
|
+
}], dateClass: [{
|
369
|
+
type: Input
|
370
|
+
}], selectedChange: [{
|
371
|
+
type: Output
|
372
|
+
}], userSelection: [{
|
373
|
+
type: Output
|
374
|
+
}], activeDateChange: [{
|
375
|
+
type: Output
|
376
|
+
}], mcCalendarBody: [{
|
377
|
+
type: ViewChild,
|
378
|
+
args: [McCalendarBody, { static: false }]
|
379
|
+
}] } });
|
380
|
+
|
381
|
+
const yearsPerPage = 24;
|
382
|
+
const yearsPerRow = 4;
|
383
|
+
/**
|
384
|
+
* An internal component used to display a year selector in the datepicker.
|
385
|
+
* @docs-private
|
386
|
+
*/
|
387
|
+
class McMultiYearView {
|
388
|
+
constructor(changeDetectorRef, dateAdapter, dir) {
|
389
|
+
this.changeDetectorRef = changeDetectorRef;
|
390
|
+
this.dateAdapter = dateAdapter;
|
391
|
+
this.dir = dir;
|
392
|
+
/** Emits when a new year is selected. */
|
393
|
+
this.selectedChange = new EventEmitter();
|
394
|
+
/** Emits the selected year. This doesn't imply a change on the selected date */
|
395
|
+
this.yearSelected = new EventEmitter();
|
396
|
+
/** Emits when any date is activated. */
|
397
|
+
this.activeDateChange = new EventEmitter();
|
398
|
+
if (!this.dateAdapter) {
|
399
|
+
throw createMissingDateImplError('DateAdapter');
|
400
|
+
}
|
401
|
+
this._activeDate = this.dateAdapter.today();
|
402
|
+
}
|
403
|
+
/** The date to display in this multi-year view (everything other than the year is ignored). */
|
404
|
+
get activeDate() {
|
405
|
+
return this._activeDate;
|
406
|
+
}
|
407
|
+
set activeDate(value) {
|
408
|
+
const oldActiveDate = this._activeDate;
|
409
|
+
const validDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value)) || this.dateAdapter.today();
|
410
|
+
this._activeDate = this.dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
|
411
|
+
if (Math.floor(this.dateAdapter.getYear(oldActiveDate) / yearsPerPage) !==
|
412
|
+
Math.floor(this.dateAdapter.getYear(this._activeDate) / yearsPerPage)) {
|
413
|
+
this.init();
|
414
|
+
}
|
415
|
+
}
|
416
|
+
/** The currently selected date. */
|
417
|
+
get selected() {
|
418
|
+
return this._selected;
|
419
|
+
}
|
420
|
+
set selected(value) {
|
421
|
+
this._selected = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
422
|
+
this.selectedYear = this._selected && this.dateAdapter.getYear(this._selected);
|
423
|
+
}
|
424
|
+
/** The minimum selectable date. */
|
425
|
+
get minDate() {
|
426
|
+
return this._minDate;
|
427
|
+
}
|
428
|
+
set minDate(value) {
|
429
|
+
this._minDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
430
|
+
}
|
431
|
+
/** The maximum selectable date. */
|
432
|
+
get maxDate() {
|
433
|
+
return this._maxDate;
|
434
|
+
}
|
435
|
+
set maxDate(value) {
|
436
|
+
this._maxDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
437
|
+
}
|
438
|
+
ngAfterContentInit() {
|
439
|
+
this.init();
|
440
|
+
}
|
441
|
+
/** Initializes this multi-year view. */
|
442
|
+
init() {
|
443
|
+
this.todayYear = this.dateAdapter.getYear(this.dateAdapter.today());
|
444
|
+
const activeYear = this.dateAdapter.getYear(this._activeDate);
|
445
|
+
const activeOffset = activeYear % yearsPerPage;
|
446
|
+
this.years = [];
|
447
|
+
for (let i = 0, row = []; i < yearsPerPage; i++) {
|
448
|
+
row.push(activeYear - activeOffset + i);
|
449
|
+
if (row.length === yearsPerRow) {
|
450
|
+
this.years.push(row.map((year) => this.createCellForYear(year)));
|
451
|
+
row = [];
|
452
|
+
}
|
453
|
+
}
|
454
|
+
this.changeDetectorRef.markForCheck();
|
455
|
+
}
|
456
|
+
/** Handles when a new year is selected. */
|
457
|
+
onYearSelected(year) {
|
458
|
+
this.yearSelected.emit(this.dateAdapter.createDate(year));
|
459
|
+
const month = this.dateAdapter.getMonth(this.activeDate);
|
460
|
+
const daysInMonth = this.dateAdapter.getNumDaysInMonth(this.dateAdapter.createDate(year, month));
|
461
|
+
this.selectedChange.emit(this.dateAdapter.createDate(year, month, Math.min(this.dateAdapter.getDate(this.activeDate), daysInMonth)));
|
462
|
+
}
|
463
|
+
/** Handles keydown events on the calendar body when calendar is in multi-year view. */
|
464
|
+
handleCalendarBodyKeydown(event) {
|
465
|
+
// TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
|
466
|
+
// disabled ones from being selected. This may not be ideal, we should look into whether
|
467
|
+
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
|
468
|
+
const oldActiveDate = this._activeDate;
|
469
|
+
const isRtl = this.isRtl();
|
470
|
+
// tslint:disable-next-line:deprecation
|
471
|
+
switch (event.keyCode) {
|
472
|
+
case LEFT_ARROW:
|
473
|
+
this.activeDate = this.dateAdapter.addCalendarYears(this._activeDate, isRtl ? 1 : -1);
|
474
|
+
break;
|
475
|
+
case RIGHT_ARROW:
|
476
|
+
this.activeDate = this.dateAdapter.addCalendarYears(this._activeDate, isRtl ? -1 : 1);
|
477
|
+
break;
|
478
|
+
case UP_ARROW:
|
479
|
+
this.activeDate = this.dateAdapter.addCalendarYears(this._activeDate, -yearsPerRow);
|
480
|
+
break;
|
481
|
+
case DOWN_ARROW:
|
482
|
+
this.activeDate = this.dateAdapter.addCalendarYears(this._activeDate, yearsPerRow);
|
483
|
+
break;
|
484
|
+
case HOME:
|
485
|
+
this.activeDate = this.dateAdapter.addCalendarYears(this._activeDate, -this.dateAdapter.getYear(this._activeDate) % yearsPerPage);
|
486
|
+
break;
|
487
|
+
case END:
|
488
|
+
this.activeDate = this.dateAdapter.addCalendarYears(this._activeDate, yearsPerPage - this.dateAdapter.getYear(this._activeDate) % yearsPerPage - 1);
|
489
|
+
break;
|
490
|
+
case PAGE_UP:
|
491
|
+
this.activeDate =
|
492
|
+
this.dateAdapter.addCalendarYears(this._activeDate, event.altKey ? -yearsPerPage * 10 : -yearsPerPage);
|
493
|
+
break;
|
494
|
+
case PAGE_DOWN:
|
495
|
+
this.activeDate =
|
496
|
+
this.dateAdapter.addCalendarYears(this._activeDate, event.altKey ? yearsPerPage * 10 : yearsPerPage);
|
497
|
+
break;
|
498
|
+
case ENTER:
|
499
|
+
case SPACE:
|
500
|
+
this.onYearSelected(this.dateAdapter.getYear(this._activeDate));
|
501
|
+
break;
|
502
|
+
default:
|
503
|
+
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
504
|
+
return;
|
505
|
+
}
|
506
|
+
if (this.dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
|
507
|
+
this.activeDateChange.emit(this.activeDate);
|
508
|
+
}
|
509
|
+
this.focusActiveCell();
|
510
|
+
// Prevent unexpected default actions such as form submission.
|
511
|
+
event.preventDefault();
|
512
|
+
}
|
513
|
+
getActiveCell() {
|
514
|
+
return this.dateAdapter.getYear(this.activeDate) % yearsPerPage;
|
515
|
+
}
|
516
|
+
/** Focuses the active cell after the microtask queue is empty. */
|
517
|
+
focusActiveCell() {
|
518
|
+
this.mcCalendarBody.focusActiveCell();
|
519
|
+
}
|
520
|
+
/** Creates an McCalendarCell for the given year. */
|
521
|
+
createCellForYear(year) {
|
522
|
+
const yearName = this.dateAdapter.getYearName(this.dateAdapter.createDate(year));
|
523
|
+
return new McCalendarCell(year, yearName, yearName, this.shouldEnableYear(year));
|
524
|
+
}
|
525
|
+
/** Whether the given year is enabled. */
|
526
|
+
shouldEnableYear(year) {
|
527
|
+
// disable if the year is greater than maxDate lower than minDate
|
528
|
+
if (year === undefined || year === null ||
|
529
|
+
(this.maxDate && year > this.dateAdapter.getYear(this.maxDate)) ||
|
530
|
+
(this.minDate && year < this.dateAdapter.getYear(this.minDate))) {
|
531
|
+
return false;
|
532
|
+
}
|
533
|
+
// enable if it reaches here and there's no filter defined
|
534
|
+
if (!this.dateFilter) {
|
535
|
+
return true;
|
536
|
+
}
|
537
|
+
const firstOfYear = this.dateAdapter.createDate(year);
|
538
|
+
// If any date in the year is enabled count the year as enabled.
|
539
|
+
for (let date = firstOfYear; this.dateAdapter.getYear(date) === year; date = this.dateAdapter.addCalendarDays(date, 1)) {
|
540
|
+
if (this.dateFilter(date)) {
|
541
|
+
return true;
|
542
|
+
}
|
543
|
+
}
|
544
|
+
return false;
|
545
|
+
}
|
546
|
+
/**
|
547
|
+
* @param obj The object to check.
|
548
|
+
* @returns The given object if it is both a date instance and valid, otherwise null.
|
549
|
+
*/
|
550
|
+
getValidDateOrNull(obj) {
|
551
|
+
return (this.dateAdapter.isDateInstance(obj) && this.dateAdapter.isValid(obj)) ? obj : null;
|
552
|
+
}
|
553
|
+
/** Determines whether the user has the RTL layout direction. */
|
554
|
+
isRtl() {
|
555
|
+
return this.dir && this.dir.value === 'rtl';
|
556
|
+
}
|
557
|
+
}
|
558
|
+
/** @nocollapse */ /** @nocollapse */ McMultiYearView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McMultiYearView, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$1.DateAdapter, optional: true }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
559
|
+
/** @nocollapse */ /** @nocollapse */ McMultiYearView.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: McMultiYearView, selector: "mc-multi-year-view", inputs: { activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate", dateFilter: "dateFilter" }, outputs: { selectedChange: "selectedChange", yearSelected: "yearSelected", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "mcCalendarBody", first: true, predicate: McCalendarBody, descendants: true }], exportAs: ["mcMultiYearView"], ngImport: i0, template: "<table class=\"mc-calendar__table\">\n <thead class=\"mc-calendar__table-header\">\n <tr>\n <th class=\"mc-calendar__table-header-divider\" colspan=\"4\"></th>\n </tr>\n </thead>\n <tbody mc-calendar-body\n [rows]=\"years\"\n [todayValue]=\"todayYear\"\n [selectedValue]=\"selectedYear!\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"getActiveCell()\"\n (selectedValueChange)=\"onYearSelected($event)\"\n (keydown)=\"handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n", components: [{ type: McCalendarBody, selector: "[mc-calendar-body]", inputs: ["label", "rows", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "activeCell", "cellAspectRatio"], outputs: ["selectedValueChange"], exportAs: ["mcCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
560
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McMultiYearView, decorators: [{
|
561
|
+
type: Component,
|
562
|
+
args: [{ selector: 'mc-multi-year-view', exportAs: 'mcMultiYearView', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<table class=\"mc-calendar__table\">\n <thead class=\"mc-calendar__table-header\">\n <tr>\n <th class=\"mc-calendar__table-header-divider\" colspan=\"4\"></th>\n </tr>\n </thead>\n <tbody mc-calendar-body\n [rows]=\"years\"\n [todayValue]=\"todayYear\"\n [selectedValue]=\"selectedYear!\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"getActiveCell()\"\n (selectedValueChange)=\"onYearSelected($event)\"\n (keydown)=\"handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n" }]
|
563
|
+
}], ctorParameters: function () {
|
564
|
+
return [{ type: i0.ChangeDetectorRef }, { type: i1$1.DateAdapter, decorators: [{
|
565
|
+
type: Optional
|
566
|
+
}] }, { type: i2.Directionality, decorators: [{
|
567
|
+
type: Optional
|
568
|
+
}] }];
|
569
|
+
}, propDecorators: { activeDate: [{
|
570
|
+
type: Input
|
571
|
+
}], selected: [{
|
572
|
+
type: Input
|
573
|
+
}], minDate: [{
|
574
|
+
type: Input
|
575
|
+
}], maxDate: [{
|
576
|
+
type: Input
|
577
|
+
}], dateFilter: [{
|
578
|
+
type: Input
|
579
|
+
}], selectedChange: [{
|
580
|
+
type: Output
|
581
|
+
}], yearSelected: [{
|
582
|
+
type: Output
|
583
|
+
}], activeDateChange: [{
|
584
|
+
type: Output
|
585
|
+
}], mcCalendarBody: [{
|
586
|
+
type: ViewChild,
|
587
|
+
args: [McCalendarBody, { static: false }]
|
588
|
+
}] } });
|
589
|
+
|
590
|
+
/**
|
591
|
+
* An internal component used to display a single year in the datepicker.
|
592
|
+
* @docs-private
|
593
|
+
*/
|
594
|
+
class McYearView {
|
595
|
+
constructor(changeDetectorRef, dateFormats, dateAdapter, dir) {
|
596
|
+
this.changeDetectorRef = changeDetectorRef;
|
597
|
+
this.dateFormats = dateFormats;
|
598
|
+
this.dateAdapter = dateAdapter;
|
599
|
+
this.dir = dir;
|
600
|
+
/** Emits when a new month is selected. */
|
601
|
+
this.selectedChange = new EventEmitter();
|
602
|
+
/** Emits the selected month. This doesn't imply a change on the selected date */
|
603
|
+
this.monthSelected = new EventEmitter();
|
604
|
+
/** Emits when any date is activated. */
|
605
|
+
this.activeDateChange = new EventEmitter();
|
606
|
+
if (!this.dateAdapter) {
|
607
|
+
throw createMissingDateImplError('DateAdapter');
|
608
|
+
}
|
609
|
+
if (!this.dateFormats) {
|
610
|
+
throw createMissingDateImplError('MC_DATE_FORMATS');
|
611
|
+
}
|
612
|
+
this._activeDate = this.dateAdapter.today();
|
613
|
+
}
|
614
|
+
/** The date to display in this year view (everything other than the year is ignored). */
|
615
|
+
get activeDate() {
|
616
|
+
return this._activeDate;
|
617
|
+
}
|
618
|
+
set activeDate(value) {
|
619
|
+
const oldActiveDate = this._activeDate;
|
620
|
+
const validDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value)) || this.dateAdapter.today();
|
621
|
+
this._activeDate = this.dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
|
622
|
+
if (this.dateAdapter.getYear(oldActiveDate) !== this.dateAdapter.getYear(this._activeDate)) {
|
623
|
+
this.init();
|
624
|
+
}
|
625
|
+
}
|
626
|
+
/** The currently selected date. */
|
627
|
+
get selected() {
|
628
|
+
return this._selected;
|
629
|
+
}
|
630
|
+
set selected(value) {
|
631
|
+
this._selected = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
632
|
+
this.selectedMonth = this.getMonthInCurrentYear(this._selected);
|
633
|
+
}
|
634
|
+
/** The minimum selectable date. */
|
635
|
+
get minDate() {
|
636
|
+
return this._minDate;
|
637
|
+
}
|
638
|
+
set minDate(value) {
|
639
|
+
this._minDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
640
|
+
}
|
641
|
+
/** The maximum selectable date. */
|
642
|
+
get maxDate() {
|
643
|
+
return this._maxDate;
|
644
|
+
}
|
645
|
+
set maxDate(value) {
|
646
|
+
this._maxDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
647
|
+
}
|
648
|
+
ngAfterContentInit() {
|
649
|
+
this.init();
|
650
|
+
}
|
651
|
+
/** Handles when a new month is selected. */
|
652
|
+
onMonthSelected(month) {
|
653
|
+
const year = this.dateAdapter.getYear(this.activeDate);
|
654
|
+
const normalizedDate = this.dateAdapter.createDate(year, month);
|
655
|
+
this.monthSelected.emit(normalizedDate);
|
656
|
+
const daysInMonth = this.dateAdapter.getNumDaysInMonth(normalizedDate);
|
657
|
+
this.selectedChange.emit(this.dateAdapter.createDate(year, month, Math.min(this.dateAdapter.getDate(this.activeDate), daysInMonth)));
|
658
|
+
}
|
659
|
+
/** Handles keydown events on the calendar body when calendar is in year view. */
|
660
|
+
handleCalendarBodyKeydown(event) {
|
661
|
+
// TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
|
662
|
+
// disabled ones from being selected. This may not be ideal, we should look into whether
|
663
|
+
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
|
664
|
+
const oldActiveDate = this._activeDate;
|
665
|
+
const isRtl = this.isRtl();
|
666
|
+
const VERTICAL_SHIFT = 4;
|
667
|
+
const PAGE_SHIFT = 10;
|
668
|
+
const MAX_MONTH_INDEX = 11;
|
669
|
+
// tslint:disable-next-line:deprecation
|
670
|
+
switch (event.keyCode) {
|
671
|
+
case LEFT_ARROW:
|
672
|
+
this.activeDate = this.dateAdapter.addCalendarMonths(this._activeDate, isRtl ? 1 : -1);
|
673
|
+
break;
|
674
|
+
case RIGHT_ARROW:
|
675
|
+
this.activeDate = this.dateAdapter.addCalendarMonths(this._activeDate, isRtl ? -1 : 1);
|
676
|
+
break;
|
677
|
+
case UP_ARROW:
|
678
|
+
this.activeDate = this.dateAdapter.addCalendarMonths(this._activeDate, -VERTICAL_SHIFT);
|
679
|
+
break;
|
680
|
+
case DOWN_ARROW:
|
681
|
+
this.activeDate = this.dateAdapter.addCalendarMonths(this._activeDate, VERTICAL_SHIFT);
|
682
|
+
break;
|
683
|
+
case HOME:
|
684
|
+
this.activeDate = this.dateAdapter.addCalendarMonths(this._activeDate, -this.dateAdapter.getMonth(this._activeDate));
|
685
|
+
break;
|
686
|
+
case END:
|
687
|
+
this.activeDate = this.dateAdapter.addCalendarMonths(this._activeDate, MAX_MONTH_INDEX - this.dateAdapter.getMonth(this._activeDate));
|
688
|
+
break;
|
689
|
+
case PAGE_UP:
|
690
|
+
this.activeDate =
|
691
|
+
this.dateAdapter.addCalendarYears(this._activeDate, event.altKey ? -PAGE_SHIFT : -1);
|
692
|
+
break;
|
693
|
+
case PAGE_DOWN:
|
694
|
+
this.activeDate =
|
695
|
+
this.dateAdapter.addCalendarYears(this._activeDate, event.altKey ? PAGE_SHIFT : 1);
|
696
|
+
break;
|
697
|
+
case ENTER:
|
698
|
+
case SPACE:
|
699
|
+
this.onMonthSelected(this.dateAdapter.getMonth(this._activeDate));
|
700
|
+
break;
|
701
|
+
default:
|
702
|
+
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
703
|
+
return;
|
704
|
+
}
|
705
|
+
if (this.dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
|
706
|
+
this.activeDateChange.emit(this.activeDate);
|
707
|
+
}
|
708
|
+
this.focusActiveCell();
|
709
|
+
// Prevent unexpected default actions such as form submission.
|
710
|
+
event.preventDefault();
|
711
|
+
}
|
712
|
+
/** Initializes this year view. */
|
713
|
+
init() {
|
714
|
+
this.selectedMonth = this.getMonthInCurrentYear(this.selected);
|
715
|
+
this.todayMonth = this.getMonthInCurrentYear(this.dateAdapter.today());
|
716
|
+
this.yearLabel = this.dateAdapter.getYearName(this.activeDate);
|
717
|
+
const monthNames = this.dateAdapter.getMonthNames('short');
|
718
|
+
// First row of months only contains 5 elements so we can fit the year label on the same row.
|
719
|
+
// tslint:disable-next-line:no-magic-numbers
|
720
|
+
this.months = [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]
|
721
|
+
.map((row) => row.map((month) => this.createCellForMonth(month, monthNames[month])));
|
722
|
+
this.changeDetectorRef.markForCheck();
|
723
|
+
}
|
724
|
+
/** Focuses the active cell after the microtask queue is empty. */
|
725
|
+
focusActiveCell() {
|
726
|
+
this.mcCalendarBody.focusActiveCell();
|
727
|
+
}
|
728
|
+
/**
|
729
|
+
* Gets the month in this year that the given Date falls on.
|
730
|
+
* Returns null if the given Date is in another year.
|
731
|
+
*/
|
732
|
+
getMonthInCurrentYear(date) {
|
733
|
+
return date && this.dateAdapter.getYear(date) === this.dateAdapter.getYear(this.activeDate) ?
|
734
|
+
this.dateAdapter.getMonth(date) : null;
|
735
|
+
}
|
736
|
+
/** Creates an McCalendarCell for the given month. */
|
737
|
+
createCellForMonth(month, monthName) {
|
738
|
+
const ariaLabel = this.dateAdapter.format(this.dateAdapter.createDate(this.dateAdapter.getYear(this.activeDate), month), this.dateFormats.monthYearA11yLabel);
|
739
|
+
const newMonthName = monthName[0].toLocaleUpperCase() + monthName.substr(1);
|
740
|
+
return new McCalendarCell(month, newMonthName, ariaLabel, this.shouldEnableMonth(month));
|
741
|
+
}
|
742
|
+
/** Whether the given month is enabled. */
|
743
|
+
shouldEnableMonth(month) {
|
744
|
+
const activeYear = this.dateAdapter.getYear(this.activeDate);
|
745
|
+
if (month === undefined || month === null ||
|
746
|
+
this.isYearAndMonthAfterMaxDate(activeYear, month) ||
|
747
|
+
this.isYearAndMonthBeforeMinDate(activeYear, month)) {
|
748
|
+
return false;
|
749
|
+
}
|
750
|
+
if (!this.dateFilter) {
|
751
|
+
return true;
|
752
|
+
}
|
753
|
+
const firstOfMonth = this.dateAdapter.createDate(activeYear, month);
|
754
|
+
// If any date in the month is enabled count the month as enabled.
|
755
|
+
for (let date = firstOfMonth; this.dateAdapter.getMonth(date) === month; date = this.dateAdapter.addCalendarDays(date, 1)) {
|
756
|
+
if (this.dateFilter(date)) {
|
757
|
+
return true;
|
758
|
+
}
|
759
|
+
}
|
760
|
+
return false;
|
761
|
+
}
|
762
|
+
/**
|
763
|
+
* Tests whether the combination month/year is after this.maxDate, considering
|
764
|
+
* just the month and year of this.maxDate
|
765
|
+
*/
|
766
|
+
isYearAndMonthAfterMaxDate(year, month) {
|
767
|
+
if (this.maxDate) {
|
768
|
+
const maxYear = this.dateAdapter.getYear(this.maxDate);
|
769
|
+
const maxMonth = this.dateAdapter.getMonth(this.maxDate);
|
770
|
+
return year > maxYear || (year === maxYear && month > maxMonth);
|
771
|
+
}
|
772
|
+
return false;
|
773
|
+
}
|
774
|
+
/**
|
775
|
+
* Tests whether the combination month/year is before this.minDate, considering
|
776
|
+
* just the month and year of this.minDate
|
777
|
+
*/
|
778
|
+
isYearAndMonthBeforeMinDate(year, month) {
|
779
|
+
if (this.minDate) {
|
780
|
+
const minYear = this.dateAdapter.getYear(this.minDate);
|
781
|
+
const minMonth = this.dateAdapter.getMonth(this.minDate);
|
782
|
+
return year < minYear || (year === minYear && month < minMonth);
|
783
|
+
}
|
784
|
+
return false;
|
785
|
+
}
|
786
|
+
/**
|
787
|
+
* @param obj The object to check.
|
788
|
+
* @returns The given object if it is both a date instance and valid, otherwise null.
|
789
|
+
*/
|
790
|
+
getValidDateOrNull(obj) {
|
791
|
+
return (this.dateAdapter.isDateInstance(obj) && this.dateAdapter.isValid(obj)) ? obj : null;
|
792
|
+
}
|
793
|
+
/** Determines whether the user has the RTL layout direction. */
|
794
|
+
isRtl() {
|
795
|
+
return this.dir && this.dir.value === 'rtl';
|
796
|
+
}
|
797
|
+
}
|
798
|
+
/** @nocollapse */ /** @nocollapse */ McYearView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McYearView, deps: [{ token: i0.ChangeDetectorRef }, { token: MC_DATE_FORMATS, optional: true }, { token: i1$1.DateAdapter, optional: true }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
799
|
+
/** @nocollapse */ /** @nocollapse */ McYearView.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: McYearView, selector: "mc-year-view", inputs: { activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate", dateFilter: "dateFilter" }, outputs: { selectedChange: "selectedChange", monthSelected: "monthSelected", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "mcCalendarBody", first: true, predicate: McCalendarBody, descendants: true }], exportAs: ["mcYearView"], ngImport: i0, template: "<table class=\"mc-calendar__table\">\n <thead class=\"mc-calendar__table-header\">\n <tr>\n <th class=\"mc-calendar__table-header-divider\" colspan=\"4\"></th>\n </tr>\n </thead>\n <tbody mc-calendar-body\n [label]=\"yearLabel\"\n [rows]=\"months\"\n [todayValue]=\"todayMonth!\"\n [selectedValue]=\"selectedMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"dateAdapter.getMonth(activeDate)\"\n (selectedValueChange)=\"onMonthSelected($event)\"\n (keydown)=\"handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n", components: [{ type: McCalendarBody, selector: "[mc-calendar-body]", inputs: ["label", "rows", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "activeCell", "cellAspectRatio"], outputs: ["selectedValueChange"], exportAs: ["mcCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
800
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McYearView, decorators: [{
|
801
|
+
type: Component,
|
802
|
+
args: [{ selector: 'mc-year-view', exportAs: 'mcYearView', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<table class=\"mc-calendar__table\">\n <thead class=\"mc-calendar__table-header\">\n <tr>\n <th class=\"mc-calendar__table-header-divider\" colspan=\"4\"></th>\n </tr>\n </thead>\n <tbody mc-calendar-body\n [label]=\"yearLabel\"\n [rows]=\"months\"\n [todayValue]=\"todayMonth!\"\n [selectedValue]=\"selectedMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"dateAdapter.getMonth(activeDate)\"\n (selectedValueChange)=\"onMonthSelected($event)\"\n (keydown)=\"handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n" }]
|
803
|
+
}], ctorParameters: function () {
|
804
|
+
return [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
805
|
+
type: Optional
|
806
|
+
}, {
|
807
|
+
type: Inject,
|
808
|
+
args: [MC_DATE_FORMATS]
|
809
|
+
}] }, { type: i1$1.DateAdapter, decorators: [{
|
810
|
+
type: Optional
|
811
|
+
}] }, { type: i2.Directionality, decorators: [{
|
812
|
+
type: Optional
|
813
|
+
}] }];
|
814
|
+
}, propDecorators: { activeDate: [{
|
815
|
+
type: Input
|
816
|
+
}], selected: [{
|
817
|
+
type: Input
|
818
|
+
}], minDate: [{
|
819
|
+
type: Input
|
820
|
+
}], maxDate: [{
|
821
|
+
type: Input
|
822
|
+
}], dateFilter: [{
|
823
|
+
type: Input
|
824
|
+
}], selectedChange: [{
|
825
|
+
type: Output
|
826
|
+
}], monthSelected: [{
|
827
|
+
type: Output
|
828
|
+
}], activeDateChange: [{
|
829
|
+
type: Output
|
830
|
+
}], mcCalendarBody: [{
|
831
|
+
type: ViewChild,
|
832
|
+
args: [McCalendarBody, { static: false }]
|
833
|
+
}] } });
|
834
|
+
|
835
|
+
/** Datepicker data that requires internationalization. */
|
836
|
+
class McDatepickerIntl {
|
837
|
+
constructor() {
|
838
|
+
/**
|
839
|
+
* Stream that emits whenever the labels here are changed. Use this to notify
|
840
|
+
* components if the labels have changed after initialization.
|
841
|
+
*/
|
842
|
+
this.changes = new Subject();
|
843
|
+
/** A label for the calendar popup (used by screen readers). */
|
844
|
+
this.calendarLabel = 'Calendar';
|
845
|
+
/** A label for the button used to open the calendar popup (used by screen readers). */
|
846
|
+
this.openCalendarLabel = 'Open calendar';
|
847
|
+
/** A label for the previous month button (used by screen readers). */
|
848
|
+
this.prevMonthLabel = 'Previous month';
|
849
|
+
/** A label for the next month button (used by screen readers). */
|
850
|
+
this.nextMonthLabel = 'Next month';
|
851
|
+
/** A label for the previous year button (used by screen readers). */
|
852
|
+
this.prevYearLabel = 'Previous year';
|
853
|
+
/** A label for the next year button (used by screen readers). */
|
854
|
+
this.nextYearLabel = 'Next year';
|
855
|
+
/** A label for the previous multi-year button (used by screen readers). */
|
856
|
+
this.prevMultiYearLabel = 'Previous 20 years';
|
857
|
+
/** A label for the next multi-year button (used by screen readers). */
|
858
|
+
this.nextMultiYearLabel = 'Next 20 years';
|
859
|
+
/** A label for the 'switch to month view' button (used by screen readers). */
|
860
|
+
this.switchToMonthViewLabel = 'Choose date';
|
861
|
+
/** A label for the 'switch to year view' button (used by screen readers). */
|
862
|
+
this.switchToMultiYearViewLabel = 'Choose month and year';
|
863
|
+
}
|
864
|
+
}
|
865
|
+
/** @nocollapse */ /** @nocollapse */ McDatepickerIntl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerIntl, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
866
|
+
/** @nocollapse */ /** @nocollapse */ McDatepickerIntl.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerIntl, providedIn: 'root' });
|
867
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerIntl, decorators: [{
|
868
|
+
type: Injectable,
|
869
|
+
args: [{ providedIn: 'root' }]
|
870
|
+
}] });
|
871
|
+
|
872
|
+
/**
|
873
|
+
* Possible views for the calendar.
|
874
|
+
* @docs-private
|
875
|
+
*/
|
876
|
+
var McCalendarView;
|
877
|
+
(function (McCalendarView) {
|
878
|
+
McCalendarView["Month"] = "month";
|
879
|
+
McCalendarView["Year"] = "year";
|
880
|
+
McCalendarView["MultiYear"] = "multi-year";
|
881
|
+
})(McCalendarView || (McCalendarView = {}));
|
882
|
+
/** Default header for McCalendar */
|
883
|
+
class McCalendarHeader {
|
884
|
+
constructor(intl, calendar, dateAdapter, dateFormats, changeDetectorRef) {
|
885
|
+
this.intl = intl;
|
886
|
+
this.calendar = calendar;
|
887
|
+
this.dateAdapter = dateAdapter;
|
888
|
+
this.dateFormats = dateFormats;
|
889
|
+
this.calendar.stateChanges.subscribe(() => changeDetectorRef.markForCheck());
|
890
|
+
}
|
891
|
+
/** The label for the current calendar view. */
|
892
|
+
get periodButtonText() {
|
893
|
+
if (this.calendar.currentView === McCalendarView.Month) {
|
894
|
+
const label = this.dateAdapter.format(this.calendar.activeDate, this.dateFormats.monthYearLabel);
|
895
|
+
return (label[0].toLocaleUpperCase() + label.substr(1)).replace('.', '');
|
896
|
+
}
|
897
|
+
if (this.calendar.currentView === McCalendarView.Year) {
|
898
|
+
return this.dateAdapter.getYearName(this.calendar.activeDate);
|
899
|
+
}
|
900
|
+
const activeYear = this.dateAdapter.getYear(this.calendar.activeDate);
|
901
|
+
const firstYearInView = this.dateAdapter.getYearName(
|
902
|
+
// tslint:disable-next-line:no-magic-numbers
|
903
|
+
this.dateAdapter.createDate(activeYear - activeYear % 24));
|
904
|
+
const lastYearInView = this.dateAdapter.getYearName(
|
905
|
+
// tslint:disable-next-line:no-magic-numbers
|
906
|
+
this.dateAdapter.createDate(activeYear + yearsPerPage - 1 - activeYear % 24));
|
907
|
+
return `${firstYearInView} \u2013 ${lastYearInView}`;
|
908
|
+
}
|
909
|
+
get periodButtonLabel() {
|
910
|
+
return this.calendar.currentView === McCalendarView.Month ?
|
911
|
+
this.intl.switchToMultiYearViewLabel : this.intl.switchToMonthViewLabel;
|
912
|
+
}
|
913
|
+
/** The label for the previous button. */
|
914
|
+
get prevButtonLabel() {
|
915
|
+
return {
|
916
|
+
[McCalendarView.Month]: this.intl.prevMonthLabel,
|
917
|
+
[McCalendarView.Year]: this.intl.prevYearLabel,
|
918
|
+
[McCalendarView.MultiYear]: this.intl.prevMultiYearLabel
|
919
|
+
}[this.calendar.currentView];
|
920
|
+
}
|
921
|
+
/** The label for the next button. */
|
922
|
+
get nextButtonLabel() {
|
923
|
+
return {
|
924
|
+
[McCalendarView.Month]: this.intl.nextMonthLabel,
|
925
|
+
[McCalendarView.Year]: this.intl.nextYearLabel,
|
926
|
+
[McCalendarView.MultiYear]: this.intl.nextMultiYearLabel
|
927
|
+
}[this.calendar.currentView];
|
928
|
+
}
|
929
|
+
/** Handles user clicks on the period label. */
|
930
|
+
currentPeriodClicked() {
|
931
|
+
if ([McCalendarView.Month, McCalendarView.MultiYear].includes(this.calendar.currentView)) {
|
932
|
+
this.calendar.currentView = McCalendarView.Year;
|
933
|
+
}
|
934
|
+
else if (this.calendar.currentView === McCalendarView.Year) {
|
935
|
+
this.calendar.currentView = McCalendarView.Month;
|
936
|
+
}
|
937
|
+
}
|
938
|
+
/** Handles user clicks on the previous button. */
|
939
|
+
previousClicked() {
|
940
|
+
if (this.calendar.currentView === McCalendarView.Month) {
|
941
|
+
this.calendar.activeDate = this.dateAdapter.addCalendarMonths(this.calendar.activeDate, -1);
|
942
|
+
}
|
943
|
+
else {
|
944
|
+
this.calendar.activeDate = this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView === McCalendarView.Year ? -1 : -yearsPerPage);
|
945
|
+
}
|
946
|
+
}
|
947
|
+
/** Handles user clicks on the next button. */
|
948
|
+
nextClicked() {
|
949
|
+
if (this.calendar.currentView === McCalendarView.Month) {
|
950
|
+
this.calendar.activeDate = this.dateAdapter.addCalendarMonths(this.calendar.activeDate, 1);
|
951
|
+
}
|
952
|
+
else {
|
953
|
+
this.calendar.activeDate = this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView === McCalendarView.Year ? 1 : yearsPerPage);
|
954
|
+
}
|
955
|
+
}
|
956
|
+
/** Whether the previous period button is enabled. */
|
957
|
+
previousEnabled() {
|
958
|
+
if (!this.calendar.minDate) {
|
959
|
+
return true;
|
960
|
+
}
|
961
|
+
return !this.calendar.minDate || !this.isSameView(this.calendar.activeDate, this.calendar.minDate);
|
962
|
+
}
|
963
|
+
/** Whether the next period button is enabled. */
|
964
|
+
nextEnabled() {
|
965
|
+
return !this.calendar.maxDate || !this.isSameView(this.calendar.activeDate, this.calendar.maxDate);
|
966
|
+
}
|
967
|
+
/** Whether the two dates represent the same view in the current view mode (month or year). */
|
968
|
+
isSameView(firstDate, secondDate) {
|
969
|
+
const firstYear = this.dateAdapter.getYear(firstDate);
|
970
|
+
const secondYear = this.dateAdapter.getYear(secondDate);
|
971
|
+
const firstMonth = this.dateAdapter.getMonth(firstDate);
|
972
|
+
const secondMonth = this.dateAdapter.getMonth(secondDate);
|
973
|
+
if (this.calendar.currentView === McCalendarView.Month) {
|
974
|
+
return firstYear === secondYear && firstMonth === secondMonth;
|
975
|
+
}
|
976
|
+
if (this.calendar.currentView === McCalendarView.Year) {
|
977
|
+
return firstYear === secondYear;
|
978
|
+
}
|
979
|
+
// Otherwise we are in 'multi-year' view.
|
980
|
+
return Math.floor(firstYear / yearsPerPage) === Math.floor(secondYear / yearsPerPage);
|
981
|
+
}
|
982
|
+
}
|
983
|
+
/** @nocollapse */ /** @nocollapse */ McCalendarHeader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McCalendarHeader, deps: [{ token: McDatepickerIntl }, { token: forwardRef(() => McCalendar) }, { token: i1$1.DateAdapter, optional: true }, { token: MC_DATE_FORMATS, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
984
|
+
/** @nocollapse */ /** @nocollapse */ McCalendarHeader.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: McCalendarHeader, selector: "mc-calendar-header", host: { classAttribute: "mc-calendar-header" }, exportAs: ["mcCalendarHeader"], ngImport: i0, template: "<button mc-button\n [tabindex]=\"'-1'\"\n class=\"mc-button_transparent mc-calendar__period-button\"\n (click)=\"currentPeriodClicked()\">\n {{ periodButtonText }}\n\n <i class=\"mc mc-icon\"\n [class.mc-angle-up-M_16]=\"calendar.currentView !== 'month'\"\n [class.mc-angle-down-M_16]=\"calendar.currentView === 'month'\">\n </i>\n</button>\n\n<div class=\"mc-calendar-spacer\"></div>\n\n<button mc-button\n [tabindex]=\"'-1'\"\n class=\"mc-button_transparent mc-calendar__previous-button\"\n [disabled]=\"!previousEnabled()\"\n (click)=\"previousClicked()\">\n\n <i mc-icon=\"mc-angle-left-L_16\"></i>\n</button>\n\n<button mc-button\n [tabindex]=\"'-1'\"\n class=\"mc-button_transparent mc-calendar__next-button\"\n [disabled]=\"!nextEnabled()\"\n (click)=\"nextClicked()\">\n\n <i mc-icon=\"mc-angle-right-L_16\"></i>\n</button>\n", components: [{ type: i3.McButton, selector: "[mc-button]", inputs: ["color", "tabIndex", "disabled"] }, { type: i4.McIcon, selector: "[mc-icon]", inputs: ["color"] }], directives: [{ type: i3.McButtonCssStyler, selector: "[mc-button]" }, { type: i4.McIconCSSStyler, selector: "[mc-icon]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
985
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McCalendarHeader, decorators: [{
|
986
|
+
type: Component,
|
987
|
+
args: [{ selector: 'mc-calendar-header', exportAs: 'mcCalendarHeader', host: {
|
988
|
+
class: 'mc-calendar-header'
|
989
|
+
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<button mc-button\n [tabindex]=\"'-1'\"\n class=\"mc-button_transparent mc-calendar__period-button\"\n (click)=\"currentPeriodClicked()\">\n {{ periodButtonText }}\n\n <i class=\"mc mc-icon\"\n [class.mc-angle-up-M_16]=\"calendar.currentView !== 'month'\"\n [class.mc-angle-down-M_16]=\"calendar.currentView === 'month'\">\n </i>\n</button>\n\n<div class=\"mc-calendar-spacer\"></div>\n\n<button mc-button\n [tabindex]=\"'-1'\"\n class=\"mc-button_transparent mc-calendar__previous-button\"\n [disabled]=\"!previousEnabled()\"\n (click)=\"previousClicked()\">\n\n <i mc-icon=\"mc-angle-left-L_16\"></i>\n</button>\n\n<button mc-button\n [tabindex]=\"'-1'\"\n class=\"mc-button_transparent mc-calendar__next-button\"\n [disabled]=\"!nextEnabled()\"\n (click)=\"nextClicked()\">\n\n <i mc-icon=\"mc-angle-right-L_16\"></i>\n</button>\n" }]
|
990
|
+
}], ctorParameters: function () {
|
991
|
+
return [{ type: McDatepickerIntl }, { type: McCalendar, decorators: [{
|
992
|
+
type: Inject,
|
993
|
+
args: [forwardRef(() => McCalendar)]
|
994
|
+
}] }, { type: i1$1.DateAdapter, decorators: [{
|
995
|
+
type: Optional
|
996
|
+
}] }, { type: undefined, decorators: [{
|
997
|
+
type: Optional
|
998
|
+
}, {
|
999
|
+
type: Inject,
|
1000
|
+
args: [MC_DATE_FORMATS]
|
1001
|
+
}] }, { type: i0.ChangeDetectorRef }];
|
1002
|
+
} });
|
1003
|
+
/**
|
1004
|
+
* A calendar that is used as part of the datepicker.
|
1005
|
+
* @docs-private
|
1006
|
+
*/
|
1007
|
+
class McCalendar {
|
1008
|
+
constructor(intl, dateAdapter, dateFormats, changeDetectorRef) {
|
1009
|
+
this.dateAdapter = dateAdapter;
|
1010
|
+
this.dateFormats = dateFormats;
|
1011
|
+
this.changeDetectorRef = changeDetectorRef;
|
1012
|
+
/** Whether the calendar should be started in month or year view. */
|
1013
|
+
this.startView = McCalendarView.Month;
|
1014
|
+
/** Emits when the currently selected date changes. */
|
1015
|
+
this.selectedChange = new EventEmitter();
|
1016
|
+
/**
|
1017
|
+
* Emits the year chosen in multiyear view.
|
1018
|
+
* This doesn't imply a change on the selected date.
|
1019
|
+
*/
|
1020
|
+
this.yearSelected = new EventEmitter();
|
1021
|
+
/**
|
1022
|
+
* Emits the month chosen in year view.
|
1023
|
+
* This doesn't imply a change on the selected date.
|
1024
|
+
*/
|
1025
|
+
this.monthSelected = new EventEmitter();
|
1026
|
+
/** Emits when any date is selected. */
|
1027
|
+
this.userSelection = new EventEmitter();
|
1028
|
+
/**
|
1029
|
+
* Emits whenever there is a state change that the header may need to respond to.
|
1030
|
+
*/
|
1031
|
+
this.stateChanges = new Subject();
|
1032
|
+
/**
|
1033
|
+
* Used for scheduling that focus should be moved to the active cell on the next tick.
|
1034
|
+
* We need to schedule it, rather than do it immediately, because we have to wait
|
1035
|
+
* for Angular to re-evaluate the view children.
|
1036
|
+
*/
|
1037
|
+
this.moveFocusOnNextTick = false;
|
1038
|
+
if (!this.dateAdapter) {
|
1039
|
+
throw createMissingDateImplError('DateAdapter');
|
1040
|
+
}
|
1041
|
+
if (!this.dateFormats) {
|
1042
|
+
throw createMissingDateImplError('MC_DATE_FORMATS');
|
1043
|
+
}
|
1044
|
+
this.intlChanges = intl.changes.subscribe(() => {
|
1045
|
+
changeDetectorRef.markForCheck();
|
1046
|
+
this.stateChanges.next();
|
1047
|
+
});
|
1048
|
+
}
|
1049
|
+
/** A date representing the period (month or year) to start the calendar in. */
|
1050
|
+
get startAt() {
|
1051
|
+
return this._startAt;
|
1052
|
+
}
|
1053
|
+
set startAt(value) {
|
1054
|
+
this._startAt = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
1055
|
+
}
|
1056
|
+
/** The currently selected date. */
|
1057
|
+
get selected() {
|
1058
|
+
return this._selected;
|
1059
|
+
}
|
1060
|
+
set selected(value) {
|
1061
|
+
this._selected = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
1062
|
+
}
|
1063
|
+
/** The minimum selectable date. */
|
1064
|
+
get minDate() {
|
1065
|
+
return this._minDate;
|
1066
|
+
}
|
1067
|
+
set minDate(value) {
|
1068
|
+
this._minDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
1069
|
+
}
|
1070
|
+
/** The maximum selectable date. */
|
1071
|
+
get maxDate() {
|
1072
|
+
return this._maxDate;
|
1073
|
+
}
|
1074
|
+
set maxDate(value) {
|
1075
|
+
this._maxDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
1076
|
+
}
|
1077
|
+
/**
|
1078
|
+
* The current active date. This determines which time period is shown and which date is
|
1079
|
+
* highlighted when using keyboard navigation.
|
1080
|
+
*/
|
1081
|
+
get activeDate() {
|
1082
|
+
return this.clampedActiveDate;
|
1083
|
+
}
|
1084
|
+
set activeDate(value) {
|
1085
|
+
this.clampedActiveDate = this.dateAdapter.clampDate(value, this.minDate, this.maxDate);
|
1086
|
+
this.stateChanges.next();
|
1087
|
+
}
|
1088
|
+
/** Whether the calendar is in month view. */
|
1089
|
+
get currentView() {
|
1090
|
+
return this._currentView;
|
1091
|
+
}
|
1092
|
+
set currentView(value) {
|
1093
|
+
this._currentView = value;
|
1094
|
+
this.moveFocusOnNextTick = true;
|
1095
|
+
}
|
1096
|
+
ngAfterContentInit() {
|
1097
|
+
this.calendarHeaderPortal = new ComponentPortal(this.headerComponent || McCalendarHeader);
|
1098
|
+
this.activeDate = this.startAt || this.dateAdapter.today();
|
1099
|
+
// Assign to the private property since we don't want to move focus on init.
|
1100
|
+
this._currentView = this.startView;
|
1101
|
+
}
|
1102
|
+
ngAfterViewChecked() {
|
1103
|
+
if (this.moveFocusOnNextTick) {
|
1104
|
+
this.moveFocusOnNextTick = false;
|
1105
|
+
this.focusActiveCell();
|
1106
|
+
}
|
1107
|
+
}
|
1108
|
+
ngOnDestroy() {
|
1109
|
+
this.intlChanges.unsubscribe();
|
1110
|
+
this.stateChanges.complete();
|
1111
|
+
}
|
1112
|
+
ngOnChanges(changes) {
|
1113
|
+
const change = changes.minDate || changes.maxDate || changes.dateFilter;
|
1114
|
+
if (change && !change.firstChange) {
|
1115
|
+
const view = this.getCurrentViewComponent();
|
1116
|
+
if (view) {
|
1117
|
+
// We need to `detectChanges` manually here, because the `minDate`, `maxDate` etc. are
|
1118
|
+
// passed down to the view via data bindings which won't be up-to-date when we call `init`.
|
1119
|
+
this.changeDetectorRef.detectChanges();
|
1120
|
+
view.init();
|
1121
|
+
}
|
1122
|
+
}
|
1123
|
+
this.stateChanges.next();
|
1124
|
+
}
|
1125
|
+
focusActiveCell() {
|
1126
|
+
this.getCurrentViewComponent().focusActiveCell();
|
1127
|
+
}
|
1128
|
+
/** Updates today's date after an update of the active date */
|
1129
|
+
updateTodaysDate() {
|
1130
|
+
const view = this.currentView === McCalendarView.Month ? this.monthView :
|
1131
|
+
(this.currentView === McCalendarView.Year ? this.yearView : this.multiYearView);
|
1132
|
+
view.ngAfterContentInit();
|
1133
|
+
}
|
1134
|
+
/** Handles date selection in the month view. */
|
1135
|
+
dateSelected(date) {
|
1136
|
+
if (!this.dateAdapter.sameDate(date, this.selected)) {
|
1137
|
+
this.selectedChange.emit(date);
|
1138
|
+
}
|
1139
|
+
}
|
1140
|
+
/** Handles year selection in the multiyear view. */
|
1141
|
+
yearSelectedInMultiYearView(normalizedYear) {
|
1142
|
+
this.yearSelected.emit(normalizedYear);
|
1143
|
+
}
|
1144
|
+
/** Handles month selection in the year view. */
|
1145
|
+
monthSelectedInYearView(normalizedMonth) {
|
1146
|
+
this.monthSelected.emit(normalizedMonth);
|
1147
|
+
}
|
1148
|
+
userSelected() {
|
1149
|
+
this.userSelection.emit();
|
1150
|
+
}
|
1151
|
+
/** Handles year/month selection in the multi-year/year views. */
|
1152
|
+
goToDateInView(date, view) {
|
1153
|
+
this.activeDate = date;
|
1154
|
+
this.currentView = view;
|
1155
|
+
}
|
1156
|
+
/**
|
1157
|
+
* @param obj The object to check.
|
1158
|
+
* @returns The given object if it is both a date instance and valid, otherwise null.
|
1159
|
+
*/
|
1160
|
+
getValidDateOrNull(obj) {
|
1161
|
+
return (this.dateAdapter.isDateInstance(obj) && this.dateAdapter.isValid(obj)) ? obj : null;
|
1162
|
+
}
|
1163
|
+
/** Returns the component instance that corresponds to the current calendar view. */
|
1164
|
+
getCurrentViewComponent() {
|
1165
|
+
return this.monthView || this.yearView || this.multiYearView;
|
1166
|
+
}
|
1167
|
+
}
|
1168
|
+
/** @nocollapse */ /** @nocollapse */ McCalendar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McCalendar, deps: [{ token: McDatepickerIntl }, { token: i1$1.DateAdapter, optional: true }, { token: MC_DATE_FORMATS, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
1169
|
+
/** @nocollapse */ /** @nocollapse */ McCalendar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: McCalendar, selector: "mc-calendar", inputs: { startAt: "startAt", selected: "selected", minDate: "minDate", maxDate: "maxDate", headerComponent: "headerComponent", startView: "startView", dateFilter: "dateFilter", dateClass: "dateClass" }, outputs: { selectedChange: "selectedChange", yearSelected: "yearSelected", monthSelected: "monthSelected", userSelection: "userSelection" }, host: { classAttribute: "mc-calendar" }, viewQueries: [{ propertyName: "monthView", first: true, predicate: McMonthView, descendants: true }, { propertyName: "yearView", first: true, predicate: McYearView, descendants: true }, { propertyName: "multiYearView", first: true, predicate: McMultiYearView, descendants: true }], exportAs: ["mcCalendar"], usesOnChanges: true, ngImport: i0, template: "<ng-template [cdkPortalOutlet]=\"calendarHeaderPortal\"></ng-template>\n\n<div class=\"mc-calendar__content\" [ngSwitch]=\"currentView\">\n <mc-month-view\n *ngSwitchCase=\"'month'\"\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [dateClass]=\"dateClass\"\n (selectedChange)=\"dateSelected($event!)\"\n (userSelection)=\"userSelected()\">\n </mc-month-view>\n\n <mc-year-view\n *ngSwitchCase=\"'year'\"\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n (monthSelected)=\"monthSelectedInYearView($event)\"\n (selectedChange)=\"goToDateInView($event, 'multi-year')\">\n </mc-year-view>\n\n <mc-multi-year-view\n *ngSwitchCase=\"'multi-year'\"\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n (yearSelected)=\"yearSelectedInMultiYearView($event)\"\n (selectedChange)=\"goToDateInView($event, 'month')\">\n </mc-multi-year-view>\n</div>\n", styles: [".mc-calendar{display:block}.mc-calendar-header{display:flex;padding:16px 8px 12px;padding:var(--mc-datepicker-calendar-size-padding-top, 16px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-blocks, 12px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px)}.mc-calendar__content{padding:0 8px 8px;padding:0 var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px);outline:none}.mc-calendar-spacer{flex:1 1 auto}.mc-calendar__period-button{min-width:0}.mc-calendar__period-button .mc-icon{vertical-align:baseline}.mc-calendar__previous-button:after{border-left-width:2px;border-left-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(2px) rotate(-45deg);transform:var(--mc-datepicker-calendar-size-icon-prev-icon-transform, translateX(2px) rotate(-45deg))}.mc-calendar__next-button:after{border-right-width:2px;border-right-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(-2px) rotate(45deg);transform:var(--mc-datepicker-calendar-size-icon-nex-icon-transform, translateX(-2px) rotate(45deg))}.mc-calendar__table{border-spacing:0;border-collapse:collapse;width:100%}.mc-calendar__table-header th{text-align:center;height:30px}.mc-calendar__table-header th.mc-calendar__table-header-divider{position:relative;height:10px;height:calc(var(--mc-datepicker-calendar-size-padding-blocks, 12px) - 2px)}.mc-calendar__table-header th.mc-calendar__table-header-divider:after{content:\"\";position:absolute;top:0;left:-8px;left:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));right:-8px;right:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));height:1px;height:var(--mc-datepicker-calendar-size-divider-width, 1px)}\n"], components: [{ type: McMonthView, selector: "mc-month-view", inputs: ["activeDate", "selected", "minDate", "maxDate", "dateFilter", "dateClass"], outputs: ["selectedChange", "userSelection", "activeDateChange"], exportAs: ["mcMonthView"] }, { type: McYearView, selector: "mc-year-view", inputs: ["activeDate", "selected", "minDate", "maxDate", "dateFilter"], outputs: ["selectedChange", "monthSelected", "activeDateChange"], exportAs: ["mcYearView"] }, { type: McMultiYearView, selector: "mc-multi-year-view", inputs: ["activeDate", "selected", "minDate", "maxDate", "dateFilter"], outputs: ["selectedChange", "yearSelected", "activeDateChange"], exportAs: ["mcMultiYearView"] }], directives: [{ type: i8.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
1170
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McCalendar, decorators: [{
|
1171
|
+
type: Component,
|
1172
|
+
args: [{ selector: 'mc-calendar', exportAs: 'mcCalendar', host: {
|
1173
|
+
class: 'mc-calendar'
|
1174
|
+
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template [cdkPortalOutlet]=\"calendarHeaderPortal\"></ng-template>\n\n<div class=\"mc-calendar__content\" [ngSwitch]=\"currentView\">\n <mc-month-view\n *ngSwitchCase=\"'month'\"\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [dateClass]=\"dateClass\"\n (selectedChange)=\"dateSelected($event!)\"\n (userSelection)=\"userSelected()\">\n </mc-month-view>\n\n <mc-year-view\n *ngSwitchCase=\"'year'\"\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n (monthSelected)=\"monthSelectedInYearView($event)\"\n (selectedChange)=\"goToDateInView($event, 'multi-year')\">\n </mc-year-view>\n\n <mc-multi-year-view\n *ngSwitchCase=\"'multi-year'\"\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n (yearSelected)=\"yearSelectedInMultiYearView($event)\"\n (selectedChange)=\"goToDateInView($event, 'month')\">\n </mc-multi-year-view>\n</div>\n", styles: [".mc-calendar{display:block}.mc-calendar-header{display:flex;padding:16px 8px 12px;padding:var(--mc-datepicker-calendar-size-padding-top, 16px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-blocks, 12px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px)}.mc-calendar__content{padding:0 8px 8px;padding:0 var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px);outline:none}.mc-calendar-spacer{flex:1 1 auto}.mc-calendar__period-button{min-width:0}.mc-calendar__period-button .mc-icon{vertical-align:baseline}.mc-calendar__previous-button:after{border-left-width:2px;border-left-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(2px) rotate(-45deg);transform:var(--mc-datepicker-calendar-size-icon-prev-icon-transform, translateX(2px) rotate(-45deg))}.mc-calendar__next-button:after{border-right-width:2px;border-right-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(-2px) rotate(45deg);transform:var(--mc-datepicker-calendar-size-icon-nex-icon-transform, translateX(-2px) rotate(45deg))}.mc-calendar__table{border-spacing:0;border-collapse:collapse;width:100%}.mc-calendar__table-header th{text-align:center;height:30px}.mc-calendar__table-header th.mc-calendar__table-header-divider{position:relative;height:10px;height:calc(var(--mc-datepicker-calendar-size-padding-blocks, 12px) - 2px)}.mc-calendar__table-header th.mc-calendar__table-header-divider:after{content:\"\";position:absolute;top:0;left:-8px;left:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));right:-8px;right:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));height:1px;height:var(--mc-datepicker-calendar-size-divider-width, 1px)}\n"] }]
|
1175
|
+
}], ctorParameters: function () {
|
1176
|
+
return [{ type: McDatepickerIntl }, { type: i1$1.DateAdapter, decorators: [{
|
1177
|
+
type: Optional
|
1178
|
+
}] }, { type: undefined, decorators: [{
|
1179
|
+
type: Optional
|
1180
|
+
}, {
|
1181
|
+
type: Inject,
|
1182
|
+
args: [MC_DATE_FORMATS]
|
1183
|
+
}] }, { type: i0.ChangeDetectorRef }];
|
1184
|
+
}, propDecorators: { startAt: [{
|
1185
|
+
type: Input
|
1186
|
+
}], selected: [{
|
1187
|
+
type: Input
|
1188
|
+
}], minDate: [{
|
1189
|
+
type: Input
|
1190
|
+
}], maxDate: [{
|
1191
|
+
type: Input
|
1192
|
+
}], headerComponent: [{
|
1193
|
+
type: Input
|
1194
|
+
}], startView: [{
|
1195
|
+
type: Input
|
1196
|
+
}], dateFilter: [{
|
1197
|
+
type: Input
|
1198
|
+
}], dateClass: [{
|
1199
|
+
type: Input
|
1200
|
+
}], selectedChange: [{
|
1201
|
+
type: Output
|
1202
|
+
}], yearSelected: [{
|
1203
|
+
type: Output
|
1204
|
+
}], monthSelected: [{
|
1205
|
+
type: Output
|
1206
|
+
}], userSelection: [{
|
1207
|
+
type: Output
|
1208
|
+
}], monthView: [{
|
1209
|
+
type: ViewChild,
|
1210
|
+
args: [McMonthView, { static: false }]
|
1211
|
+
}], yearView: [{
|
1212
|
+
type: ViewChild,
|
1213
|
+
args: [McYearView, { static: false }]
|
1214
|
+
}], multiYearView: [{
|
1215
|
+
type: ViewChild,
|
1216
|
+
args: [McMultiYearView, { static: false }]
|
1217
|
+
}] } });
|
1218
|
+
|
1219
|
+
// @ts-nocheck
|
1220
|
+
// tslint:disable:naming-convention
|
1221
|
+
var DateParts;
|
1222
|
+
(function (DateParts) {
|
1223
|
+
DateParts["year"] = "y";
|
1224
|
+
DateParts["month"] = "m";
|
1225
|
+
DateParts["day"] = "d";
|
1226
|
+
})(DateParts || (DateParts = {}));
|
1227
|
+
const MAX_YEAR = 9999;
|
1228
|
+
const YEAR_LENGTH = 4;
|
1229
|
+
class DateDigit {
|
1230
|
+
constructor(value, start, length) {
|
1231
|
+
this.value = value;
|
1232
|
+
this.start = start;
|
1233
|
+
this.length = length;
|
1234
|
+
this.maxDays = 31;
|
1235
|
+
this.maxMonth = 12;
|
1236
|
+
if (value === DateParts.day) {
|
1237
|
+
this.parse = this.parseDay;
|
1238
|
+
}
|
1239
|
+
else if (value === DateParts.month) {
|
1240
|
+
this.parse = this.parseMonth;
|
1241
|
+
}
|
1242
|
+
else if (value === DateParts.year) {
|
1243
|
+
this.parse = this.parseYear;
|
1244
|
+
}
|
1245
|
+
}
|
1246
|
+
get end() {
|
1247
|
+
return this.start + this.length;
|
1248
|
+
}
|
1249
|
+
get isDay() {
|
1250
|
+
return this.value === DateParts.day;
|
1251
|
+
}
|
1252
|
+
get isMonth() {
|
1253
|
+
return this.value === DateParts.month;
|
1254
|
+
}
|
1255
|
+
get isYear() {
|
1256
|
+
return this.value === DateParts.year;
|
1257
|
+
}
|
1258
|
+
get fullName() {
|
1259
|
+
if (this.isDay) {
|
1260
|
+
return 'date';
|
1261
|
+
}
|
1262
|
+
if (this.isMonth) {
|
1263
|
+
return 'month';
|
1264
|
+
}
|
1265
|
+
if (this.isYear) {
|
1266
|
+
return 'year';
|
1267
|
+
}
|
1268
|
+
}
|
1269
|
+
parseDay(value) {
|
1270
|
+
const parsedValue = parseInt(value);
|
1271
|
+
if (parsedValue === 0) {
|
1272
|
+
return 1;
|
1273
|
+
}
|
1274
|
+
if (parsedValue > this.maxDays) {
|
1275
|
+
return this.maxDays;
|
1276
|
+
}
|
1277
|
+
return parsedValue;
|
1278
|
+
}
|
1279
|
+
parseMonth(value) {
|
1280
|
+
const parsedValue = parseInt(value);
|
1281
|
+
if (parsedValue === 0) {
|
1282
|
+
return 1;
|
1283
|
+
}
|
1284
|
+
if (parsedValue > this.maxMonth) {
|
1285
|
+
return this.maxMonth;
|
1286
|
+
}
|
1287
|
+
return parsedValue;
|
1288
|
+
}
|
1289
|
+
parseYear(value) {
|
1290
|
+
const parsedValue = parseInt(value);
|
1291
|
+
if (parsedValue === 0) {
|
1292
|
+
return 1;
|
1293
|
+
}
|
1294
|
+
if (parsedValue > MAX_YEAR) {
|
1295
|
+
return parseInt(value.substring(0, YEAR_LENGTH));
|
1296
|
+
}
|
1297
|
+
return parsedValue;
|
1298
|
+
}
|
1299
|
+
}
|
1300
|
+
/** @docs-private */
|
1301
|
+
const MC_DATEPICKER_VALUE_ACCESSOR = {
|
1302
|
+
provide: NG_VALUE_ACCESSOR,
|
1303
|
+
useExisting: forwardRef(() => McDatepickerInput),
|
1304
|
+
multi: true
|
1305
|
+
};
|
1306
|
+
/** @docs-private */
|
1307
|
+
const MC_DATEPICKER_VALIDATORS = {
|
1308
|
+
provide: NG_VALIDATORS,
|
1309
|
+
useExisting: forwardRef(() => McDatepickerInput),
|
1310
|
+
multi: true
|
1311
|
+
};
|
1312
|
+
/**
|
1313
|
+
* An event used for datepicker input and change events. We don't always have access to a native
|
1314
|
+
* input or change event because the event may have been triggered by the user clicking on the
|
1315
|
+
* calendar popup. For consistency, we always use McDatepickerInputEvent instead.
|
1316
|
+
*/
|
1317
|
+
class McDatepickerInputEvent {
|
1318
|
+
constructor(
|
1319
|
+
/** Reference to the datepicker input component that emitted the event. */
|
1320
|
+
target,
|
1321
|
+
/** Reference to the native input element associated with the datepicker input. */
|
1322
|
+
targetElement) {
|
1323
|
+
this.target = target;
|
1324
|
+
this.targetElement = targetElement;
|
1325
|
+
this.value = this.target.value;
|
1326
|
+
}
|
1327
|
+
}
|
1328
|
+
let uniqueComponentIdSuffix = 0;
|
1329
|
+
/** Directive used to connect an input to a McDatepicker. */
|
1330
|
+
class McDatepickerInput {
|
1331
|
+
constructor(elementRef, renderer, dateAdapter, dateFormats) {
|
1332
|
+
this.elementRef = elementRef;
|
1333
|
+
this.renderer = renderer;
|
1334
|
+
this.dateAdapter = dateAdapter;
|
1335
|
+
this.dateFormats = dateFormats;
|
1336
|
+
this.stateChanges = new Subject();
|
1337
|
+
this.controlType = 'datepicker';
|
1338
|
+
this.focused = false;
|
1339
|
+
/** Emits when the value changes (either due to user input or programmatic change). */
|
1340
|
+
this.valueChange = new EventEmitter();
|
1341
|
+
/** Emits when the disabled state has changed */
|
1342
|
+
this.disabledChange = new EventEmitter();
|
1343
|
+
this._disabled = false;
|
1344
|
+
this.incorrectInput = new EventEmitter();
|
1345
|
+
/** Emits when a `change` event is fired on this `<input>`. */
|
1346
|
+
this.dateChange = new EventEmitter();
|
1347
|
+
/** Emits when an `input` event is fired on this `<input>`. */
|
1348
|
+
this.dateInput = new EventEmitter();
|
1349
|
+
this.uid = `mc-datepicker-${uniqueComponentIdSuffix++}`;
|
1350
|
+
this.datepickerSubscription = Subscription.EMPTY;
|
1351
|
+
this.localeSubscription = Subscription.EMPTY;
|
1352
|
+
/** Whether the last value set on the input was valid. */
|
1353
|
+
this.lastValueValid = false;
|
1354
|
+
this.onTouched = () => { };
|
1355
|
+
this.onInput = () => {
|
1356
|
+
this.correctCursorPosition();
|
1357
|
+
const formattedValue = this.replaceSymbols(this.viewValue);
|
1358
|
+
const newTimeObj = this.getDateFromString(formattedValue);
|
1359
|
+
this.lastValueValid = !!newTimeObj;
|
1360
|
+
if (!newTimeObj) {
|
1361
|
+
if (!this.viewValue) {
|
1362
|
+
this._value = null;
|
1363
|
+
this.cvaOnChange(null);
|
1364
|
+
}
|
1365
|
+
this.control.updateValueAndValidity({ emitEvent: false });
|
1366
|
+
return;
|
1367
|
+
}
|
1368
|
+
this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateFormats.dateInput), true);
|
1369
|
+
this.selectNextDigitByCursor(this.selectionStart);
|
1370
|
+
this.updateValue(newTimeObj);
|
1371
|
+
};
|
1372
|
+
this.parseOnBlur = () => {
|
1373
|
+
if (!this.viewValue) {
|
1374
|
+
return null;
|
1375
|
+
}
|
1376
|
+
const date = this.getDefaultValue();
|
1377
|
+
const viewDigits = this.viewValue
|
1378
|
+
.split(this.separator)
|
1379
|
+
.map((value) => value)
|
1380
|
+
.filter((value) => value);
|
1381
|
+
const [firsViewDigit, secondViewDigit, thirdViewDigit] = viewDigits;
|
1382
|
+
// tslint:disable-next-line:no-magic-numbers
|
1383
|
+
if (viewDigits.length !== 3) {
|
1384
|
+
this.lastValueValid = false;
|
1385
|
+
this._value = null;
|
1386
|
+
return setTimeout(() => this.control.updateValueAndValidity());
|
1387
|
+
}
|
1388
|
+
date[this.firstDigit.fullName] = this.firstDigit.parse(firsViewDigit);
|
1389
|
+
date[this.secondDigit.fullName] = this.secondDigit.parse(secondViewDigit);
|
1390
|
+
date[this.thirdDigit.fullName] = this.thirdDigit.parse(thirdViewDigit);
|
1391
|
+
const [digitWithYear, viewDigitWithYear] = [this.firstDigit, this.secondDigit, this.thirdDigit]
|
1392
|
+
.reduce((acc, digit, index) => digit.value === DateParts.year ? [digit, viewDigits[index]] : acc, []);
|
1393
|
+
// tslint:disable-next-line:no-magic-numbers
|
1394
|
+
if (viewDigitWithYear.length < 3) {
|
1395
|
+
// tslint:disable-next-line:no-magic-numbers
|
1396
|
+
date.year += date.year < 30 ? 2000 : 1900;
|
1397
|
+
}
|
1398
|
+
else if (viewDigitWithYear.length < digitWithYear.length) {
|
1399
|
+
this.lastValueValid = false;
|
1400
|
+
this._value = null;
|
1401
|
+
return setTimeout(() => this.control.updateValueAndValidity());
|
1402
|
+
}
|
1403
|
+
if (Object.values(date).some(isNaN)) {
|
1404
|
+
return;
|
1405
|
+
}
|
1406
|
+
const newTimeObj = this.getValidDateOrNull(this.dateAdapter.createDateTime(date.year, date.month - 1, date.date, date.hours, date.minutes, date.seconds, date.milliseconds));
|
1407
|
+
if (!newTimeObj) {
|
1408
|
+
this.lastValueValid = false;
|
1409
|
+
this._value = null;
|
1410
|
+
this.cvaOnChange(null);
|
1411
|
+
return setTimeout(() => this.control.updateValueAndValidity());
|
1412
|
+
}
|
1413
|
+
this.lastValueValid = !!newTimeObj;
|
1414
|
+
this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateFormats.dateInput), true);
|
1415
|
+
this.updateValue(newTimeObj);
|
1416
|
+
};
|
1417
|
+
this.updateLocaleParams = () => {
|
1418
|
+
this.setFormat(this.dateFormats.dateInput);
|
1419
|
+
this.value = this.value;
|
1420
|
+
};
|
1421
|
+
this.cvaOnChange = () => { };
|
1422
|
+
this.validatorOnChange = () => { };
|
1423
|
+
/** The form control validator for whether the input parses. */
|
1424
|
+
this.parseValidator = () => {
|
1425
|
+
return this.focused ||
|
1426
|
+
this.empty ||
|
1427
|
+
this.lastValueValid ? null : { mcDatepickerParse: { text: this.elementRef.nativeElement.value } };
|
1428
|
+
};
|
1429
|
+
/** The form control validator for the min date. */
|
1430
|
+
this.minValidator = (control) => {
|
1431
|
+
const controlValue = this.getValidDateOrNull(this.dateAdapter.deserialize(control.value));
|
1432
|
+
return (!this.min || !controlValue ||
|
1433
|
+
this.dateAdapter.compareDate(this.min, controlValue) <= 0) ?
|
1434
|
+
null : { mcDatepickerMin: { min: this.min, actual: controlValue } };
|
1435
|
+
};
|
1436
|
+
/** The form control validator for the max date. */
|
1437
|
+
this.maxValidator = (control) => {
|
1438
|
+
const controlValue = this.getValidDateOrNull(this.dateAdapter.deserialize(control.value));
|
1439
|
+
return (!this.max || !controlValue ||
|
1440
|
+
this.dateAdapter.compareDate(this.max, controlValue) >= 0) ?
|
1441
|
+
null : { mcDatepickerMax: { max: this.max, actual: controlValue } };
|
1442
|
+
};
|
1443
|
+
/** The form control validator for the date filter. */
|
1444
|
+
this.filterValidator = (control) => {
|
1445
|
+
const controlValue = this.getValidDateOrNull(this.dateAdapter.deserialize(control.value));
|
1446
|
+
return !this.dateFilter || !controlValue || this.dateFilter(controlValue) ?
|
1447
|
+
null : { mcDatepickerFilter: true };
|
1448
|
+
};
|
1449
|
+
this.validator = Validators.compose([
|
1450
|
+
this.parseValidator,
|
1451
|
+
this.minValidator,
|
1452
|
+
this.maxValidator,
|
1453
|
+
this.filterValidator
|
1454
|
+
]);
|
1455
|
+
if (!this.dateAdapter) {
|
1456
|
+
throw createMissingDateImplError('DateAdapter');
|
1457
|
+
}
|
1458
|
+
if (!this.dateFormats) {
|
1459
|
+
throw createMissingDateImplError('MC_DATE_FORMATS');
|
1460
|
+
}
|
1461
|
+
this.setFormat(dateFormats.dateInput);
|
1462
|
+
this.localeSubscription = dateAdapter.localeChanges
|
1463
|
+
.subscribe(this.updateLocaleParams);
|
1464
|
+
}
|
1465
|
+
get required() {
|
1466
|
+
return this._required;
|
1467
|
+
}
|
1468
|
+
set required(value) {
|
1469
|
+
this._required = coerceBooleanProperty(value);
|
1470
|
+
}
|
1471
|
+
/** The datepicker that this input is associated with. */
|
1472
|
+
set mcDatepicker(value) {
|
1473
|
+
if (!value) {
|
1474
|
+
return;
|
1475
|
+
}
|
1476
|
+
this.datepicker = value;
|
1477
|
+
this.datepicker.registerInput(this);
|
1478
|
+
this.datepickerSubscription.unsubscribe();
|
1479
|
+
this.datepickerSubscription = this.datepicker.selectedChanged
|
1480
|
+
.subscribe((selected) => {
|
1481
|
+
this.value = selected;
|
1482
|
+
this.cvaOnChange(selected);
|
1483
|
+
this.onTouched();
|
1484
|
+
this.dateChange.emit(new McDatepickerInputEvent(this, this.elementRef.nativeElement));
|
1485
|
+
});
|
1486
|
+
}
|
1487
|
+
/** Function that can be used to filter out dates within the datepicker. */
|
1488
|
+
set mcDatepickerFilter(value) {
|
1489
|
+
this.dateFilter = value;
|
1490
|
+
this.validatorOnChange();
|
1491
|
+
}
|
1492
|
+
/** The value of the input. */
|
1493
|
+
get value() {
|
1494
|
+
return this._value;
|
1495
|
+
}
|
1496
|
+
set value(value) {
|
1497
|
+
let newValue = this.dateAdapter.deserialize(value);
|
1498
|
+
this.lastValueValid = !newValue || this.dateAdapter.isValid(newValue);
|
1499
|
+
newValue = this.getValidDateOrNull(newValue);
|
1500
|
+
const oldDate = this.value;
|
1501
|
+
this._value = newValue;
|
1502
|
+
this.formatValue(newValue);
|
1503
|
+
if (!this.dateAdapter.sameDate(oldDate, newValue)) {
|
1504
|
+
this.valueChange.emit(newValue);
|
1505
|
+
}
|
1506
|
+
}
|
1507
|
+
/** The minimum valid date. */
|
1508
|
+
get min() {
|
1509
|
+
return this._min;
|
1510
|
+
}
|
1511
|
+
set min(value) {
|
1512
|
+
this._min = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
1513
|
+
this.validatorOnChange();
|
1514
|
+
}
|
1515
|
+
/** The maximum valid date. */
|
1516
|
+
get max() {
|
1517
|
+
return this._max;
|
1518
|
+
}
|
1519
|
+
set max(value) {
|
1520
|
+
this._max = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
1521
|
+
this.validatorOnChange();
|
1522
|
+
}
|
1523
|
+
/** Whether the datepicker-input is disabled. */
|
1524
|
+
get disabled() {
|
1525
|
+
return this._disabled;
|
1526
|
+
}
|
1527
|
+
set disabled(value) {
|
1528
|
+
const newValue = coerceBooleanProperty(value);
|
1529
|
+
const element = this.elementRef.nativeElement;
|
1530
|
+
if (this._disabled !== newValue) {
|
1531
|
+
this._disabled = newValue;
|
1532
|
+
this.disabledChange.emit(newValue);
|
1533
|
+
}
|
1534
|
+
// We need to null check the `blur` method, because it's undefined during SSR.
|
1535
|
+
if (newValue && element.blur) {
|
1536
|
+
// Normally, native input elements automatically blur if they turn disabled. This behavior
|
1537
|
+
// is problematic, because it would mean that it triggers another change detection cycle,
|
1538
|
+
// which then causes a changed after checked error if the input element was focused before.
|
1539
|
+
element.blur();
|
1540
|
+
}
|
1541
|
+
}
|
1542
|
+
get id() {
|
1543
|
+
return this._id;
|
1544
|
+
}
|
1545
|
+
set id(value) {
|
1546
|
+
this._id = value || this.uid;
|
1547
|
+
}
|
1548
|
+
set mcValidationTooltip(tooltip) {
|
1549
|
+
if (!tooltip) {
|
1550
|
+
return;
|
1551
|
+
}
|
1552
|
+
tooltip.enterDelay = validationTooltipShowDelay;
|
1553
|
+
tooltip.trigger = 'manual';
|
1554
|
+
tooltip.initListeners();
|
1555
|
+
this.incorrectInput.subscribe(() => {
|
1556
|
+
if (tooltip.isOpen) {
|
1557
|
+
return;
|
1558
|
+
}
|
1559
|
+
tooltip.show();
|
1560
|
+
setTimeout(() => tooltip.hide(), validationTooltipHideDelay);
|
1561
|
+
});
|
1562
|
+
}
|
1563
|
+
get empty() {
|
1564
|
+
return !this.viewValue && !this.isBadInput();
|
1565
|
+
}
|
1566
|
+
get viewValue() {
|
1567
|
+
return this.elementRef.nativeElement.value;
|
1568
|
+
}
|
1569
|
+
get ngControl() {
|
1570
|
+
return this.control;
|
1571
|
+
}
|
1572
|
+
get isReadOnly() {
|
1573
|
+
return this.elementRef.nativeElement.readOnly;
|
1574
|
+
}
|
1575
|
+
get selectionStart() {
|
1576
|
+
return this.elementRef.nativeElement.selectionStart;
|
1577
|
+
}
|
1578
|
+
set selectionStart(value) {
|
1579
|
+
this.elementRef.nativeElement.selectionStart = value;
|
1580
|
+
}
|
1581
|
+
get selectionEnd() {
|
1582
|
+
return this.elementRef.nativeElement.selectionEnd;
|
1583
|
+
}
|
1584
|
+
set selectionEnd(value) {
|
1585
|
+
this.elementRef.nativeElement.selectionEnd = value;
|
1586
|
+
}
|
1587
|
+
onContainerClick() {
|
1588
|
+
this.focus();
|
1589
|
+
}
|
1590
|
+
focus() {
|
1591
|
+
this.elementRef.nativeElement.focus();
|
1592
|
+
}
|
1593
|
+
focusChanged(isFocused) {
|
1594
|
+
if (isFocused !== this.focused) {
|
1595
|
+
this.focused = isFocused;
|
1596
|
+
this.onTouched();
|
1597
|
+
this.stateChanges.next();
|
1598
|
+
}
|
1599
|
+
}
|
1600
|
+
ngOnDestroy() {
|
1601
|
+
this.datepickerSubscription.unsubscribe();
|
1602
|
+
this.localeSubscription.unsubscribe();
|
1603
|
+
this.valueChange.complete();
|
1604
|
+
this.disabledChange.complete();
|
1605
|
+
}
|
1606
|
+
/** @docs-private */
|
1607
|
+
registerOnValidatorChange(fn) {
|
1608
|
+
this.validatorOnChange = fn;
|
1609
|
+
}
|
1610
|
+
/** @docs-private */
|
1611
|
+
validate(control) {
|
1612
|
+
this.setControl(control);
|
1613
|
+
return this.validator ? this.validator(control) : null;
|
1614
|
+
}
|
1615
|
+
// Implemented as part of ControlValueAccessor.
|
1616
|
+
writeValue(value) {
|
1617
|
+
this.value = value;
|
1618
|
+
}
|
1619
|
+
// Implemented as part of ControlValueAccessor.
|
1620
|
+
registerOnChange(fn) {
|
1621
|
+
this.cvaOnChange = fn;
|
1622
|
+
}
|
1623
|
+
// Implemented as part of ControlValueAccessor.
|
1624
|
+
registerOnTouched(fn) {
|
1625
|
+
this.onTouched = fn;
|
1626
|
+
}
|
1627
|
+
// Implemented as part of ControlValueAccessor.
|
1628
|
+
setDisabledState(isDisabled) {
|
1629
|
+
this.disabled = isDisabled;
|
1630
|
+
}
|
1631
|
+
onKeyDown(event) {
|
1632
|
+
var _a;
|
1633
|
+
if (this.isReadOnly) {
|
1634
|
+
return;
|
1635
|
+
}
|
1636
|
+
// tslint:disable-next-line: deprecation
|
1637
|
+
const keyCode = event.keyCode;
|
1638
|
+
if (this.isLetterKey(event)) {
|
1639
|
+
event.preventDefault();
|
1640
|
+
this.incorrectInput.emit();
|
1641
|
+
}
|
1642
|
+
else if (this.isKeyForOpen(event)) {
|
1643
|
+
event.preventDefault();
|
1644
|
+
(_a = this.datepicker) === null || _a === void 0 ? void 0 : _a.open();
|
1645
|
+
}
|
1646
|
+
else if (this.isKeyForClose(event)) {
|
1647
|
+
event.preventDefault();
|
1648
|
+
this.datepicker.close();
|
1649
|
+
}
|
1650
|
+
else if (keyCode === TAB) {
|
1651
|
+
this.datepicker.close(false);
|
1652
|
+
}
|
1653
|
+
else if (this.isKeyForByPass(event)) {
|
1654
|
+
return;
|
1655
|
+
}
|
1656
|
+
else if (keyCode === SPACE) {
|
1657
|
+
this.spaceKeyHandler(event);
|
1658
|
+
}
|
1659
|
+
else if ([UP_ARROW, DOWN_ARROW].includes(keyCode)) {
|
1660
|
+
event.preventDefault();
|
1661
|
+
this.verticalArrowKeyHandler(keyCode);
|
1662
|
+
}
|
1663
|
+
else if ([LEFT_ARROW, RIGHT_ARROW, HOME, PAGE_UP, END, PAGE_DOWN].includes(keyCode)) {
|
1664
|
+
event.preventDefault();
|
1665
|
+
this.changeCaretPosition(keyCode);
|
1666
|
+
}
|
1667
|
+
else if (/^\D$/.test(event.key)) {
|
1668
|
+
event.preventDefault();
|
1669
|
+
const newValue = this.getNewValue(event.key, this.selectionStart);
|
1670
|
+
const formattedValue = this.replaceSymbols(newValue);
|
1671
|
+
if (newValue !== formattedValue) {
|
1672
|
+
this.setViewValue(formattedValue, true);
|
1673
|
+
setTimeout(this.onInput);
|
1674
|
+
}
|
1675
|
+
else {
|
1676
|
+
this.incorrectInput.emit();
|
1677
|
+
}
|
1678
|
+
}
|
1679
|
+
else {
|
1680
|
+
setTimeout(this.onInput);
|
1681
|
+
}
|
1682
|
+
}
|
1683
|
+
onChange() {
|
1684
|
+
this.dateChange.emit(new McDatepickerInputEvent(this, this.elementRef.nativeElement));
|
1685
|
+
}
|
1686
|
+
/** Handles blur events on the input. */
|
1687
|
+
onBlur() {
|
1688
|
+
// Reformat the input only if we have a valid value.
|
1689
|
+
this.parseOnBlur();
|
1690
|
+
this.focusChanged(false);
|
1691
|
+
}
|
1692
|
+
onPaste($event) {
|
1693
|
+
var _a, _b, _c;
|
1694
|
+
$event.preventDefault();
|
1695
|
+
let rawValue = $event.clipboardData.getData('text');
|
1696
|
+
if (rawValue.match(/^\d\D/)) {
|
1697
|
+
rawValue = `0${rawValue}`;
|
1698
|
+
}
|
1699
|
+
rawValue.replace(/[^A-Za-z0-9]+/g, this.separator);
|
1700
|
+
if (/[a-z]/gi.test(rawValue)) {
|
1701
|
+
this.incorrectInput.emit();
|
1702
|
+
}
|
1703
|
+
const match = rawValue.match(/^(?<first>\d+)\W(?<second>\d+)\W(?<third>\d+)$/);
|
1704
|
+
if (!((_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.first) || !((_b = match === null || match === void 0 ? void 0 : match.groups) === null || _b === void 0 ? void 0 : _b.second) || !((_c = match === null || match === void 0 ? void 0 : match.groups) === null || _c === void 0 ? void 0 : _c.third)) {
|
1705
|
+
this.setViewValue(rawValue);
|
1706
|
+
return rawValue;
|
1707
|
+
}
|
1708
|
+
const value = [match.groups.first, match.groups.second, match.groups.third].join(this.separator);
|
1709
|
+
const newTimeObj = this.getDateFromString(value);
|
1710
|
+
if (!newTimeObj) {
|
1711
|
+
this.setViewValue(value);
|
1712
|
+
return value;
|
1713
|
+
}
|
1714
|
+
this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateFormats.dateInput));
|
1715
|
+
this.updateValue(newTimeObj);
|
1716
|
+
}
|
1717
|
+
toISO8601(value) {
|
1718
|
+
return this.dateAdapter.toIso8601(value);
|
1719
|
+
}
|
1720
|
+
setFormat(format) {
|
1721
|
+
this.separator = format.match(/[aA-zZ]+(?<separator>\W|\D)[aA-zZ]+/).groups.separator;
|
1722
|
+
this.separatorPositions = format
|
1723
|
+
.split('')
|
1724
|
+
.reduce((acc, item, index) => this.separator === item ? [...acc, index + 1] : acc, []);
|
1725
|
+
this.getDigitPositions(format);
|
1726
|
+
}
|
1727
|
+
updateValue(newValue) {
|
1728
|
+
if (!this.dateAdapter.sameDate(newValue, this.value)) {
|
1729
|
+
this._value = newValue;
|
1730
|
+
this.cvaOnChange(newValue);
|
1731
|
+
this.valueChange.emit(newValue);
|
1732
|
+
this.dateInput.emit(new McDatepickerInputEvent(this, this.elementRef.nativeElement));
|
1733
|
+
}
|
1734
|
+
this.control.updateValueAndValidity({ emitEvent: false });
|
1735
|
+
}
|
1736
|
+
isKeyForClose(event) {
|
1737
|
+
// tslint:disable-next-line: deprecation
|
1738
|
+
return (event.altKey && event.keyCode === UP_ARROW) || event.keyCode === ESCAPE;
|
1739
|
+
}
|
1740
|
+
isKeyForOpen(event) {
|
1741
|
+
// tslint:disable-next-line: deprecation
|
1742
|
+
return event.altKey && event.keyCode === DOWN_ARROW;
|
1743
|
+
}
|
1744
|
+
isLetterKey(event) {
|
1745
|
+
return isLetterKey(event) && !event.ctrlKey && !event.metaKey;
|
1746
|
+
}
|
1747
|
+
isKeyForByPass(event) {
|
1748
|
+
// tslint:disable-next-line: deprecation
|
1749
|
+
return (hasModifierKey(event) && (isVerticalMovement(event.keyCode) || isHorizontalMovement(event.keyCode))) ||
|
1750
|
+
event.ctrlKey ||
|
1751
|
+
event.metaKey;
|
1752
|
+
}
|
1753
|
+
spaceKeyHandler(event) {
|
1754
|
+
event.preventDefault();
|
1755
|
+
if (this.selectionStart === this.selectionEnd) {
|
1756
|
+
const value = this.getNewValue(event.key, this.selectionStart);
|
1757
|
+
this.setViewValue(value);
|
1758
|
+
setTimeout(this.onInput);
|
1759
|
+
}
|
1760
|
+
else if (this.selectionStart !== this.selectionEnd) {
|
1761
|
+
this.selectNextDigit(this.selectionStart, true);
|
1762
|
+
}
|
1763
|
+
}
|
1764
|
+
getNewValue(key, position) {
|
1765
|
+
return [this.viewValue.slice(0, position), key, this.viewValue.slice(position)].join('');
|
1766
|
+
}
|
1767
|
+
setViewValue(value, savePosition = false) {
|
1768
|
+
if (savePosition) {
|
1769
|
+
const selectionStart = this.selectionStart;
|
1770
|
+
const selectionEnd = this.selectionEnd;
|
1771
|
+
this.renderer.setProperty(this.elementRef.nativeElement, 'value', value);
|
1772
|
+
this.selectionStart = selectionStart;
|
1773
|
+
this.selectionEnd = selectionEnd;
|
1774
|
+
}
|
1775
|
+
else {
|
1776
|
+
this.renderer.setProperty(this.elementRef.nativeElement, 'value', value);
|
1777
|
+
}
|
1778
|
+
}
|
1779
|
+
replaceSymbols(value) {
|
1780
|
+
return value
|
1781
|
+
.split(this.separator)
|
1782
|
+
.map((part) => part.replace(/^([0-9]+)\W$/, '0$1'))
|
1783
|
+
.join(this.separator);
|
1784
|
+
}
|
1785
|
+
getDateFromString(timeString) {
|
1786
|
+
if (!timeString || timeString.length < this.firstDigit.length) {
|
1787
|
+
return null;
|
1788
|
+
}
|
1789
|
+
const date = this.getDefaultValue();
|
1790
|
+
const viewDigits = timeString
|
1791
|
+
.split(this.separator)
|
1792
|
+
.map((value) => value);
|
1793
|
+
const [firsViewDigit, secondViewDigit, thirdViewDigit] = viewDigits;
|
1794
|
+
if (viewDigits.length === 1) {
|
1795
|
+
if (firsViewDigit.length < this.firstDigit.length) {
|
1796
|
+
return null;
|
1797
|
+
}
|
1798
|
+
date[this.firstDigit.fullName] = this.firstDigit.parse(firsViewDigit);
|
1799
|
+
date.month = 1;
|
1800
|
+
// tslint:disable-next-line:no-magic-numbers
|
1801
|
+
}
|
1802
|
+
else if (viewDigits.length === 2) {
|
1803
|
+
if (firsViewDigit.length < this.firstDigit.length || secondViewDigit.length < this.secondDigit.length) {
|
1804
|
+
return null;
|
1805
|
+
}
|
1806
|
+
date[this.firstDigit.fullName] = this.firstDigit.parse(firsViewDigit);
|
1807
|
+
date[this.secondDigit.fullName] = this.secondDigit.parse(secondViewDigit);
|
1808
|
+
// tslint:disable-next-line:no-magic-numbers
|
1809
|
+
}
|
1810
|
+
else if (viewDigits.length === 3) {
|
1811
|
+
if (firsViewDigit.length < this.firstDigit.length ||
|
1812
|
+
secondViewDigit.length < this.secondDigit.length ||
|
1813
|
+
thirdViewDigit.length < this.thirdDigit.length) {
|
1814
|
+
return null;
|
1815
|
+
}
|
1816
|
+
date[this.firstDigit.fullName] = this.firstDigit.parse(firsViewDigit);
|
1817
|
+
date[this.secondDigit.fullName] = this.secondDigit.parse(secondViewDigit);
|
1818
|
+
date[this.thirdDigit.fullName] = this.thirdDigit.parse(thirdViewDigit);
|
1819
|
+
}
|
1820
|
+
else {
|
1821
|
+
return null;
|
1822
|
+
}
|
1823
|
+
return this.getValidDateOrNull(this.dateAdapter.createDateTime(date.year, date.month - 1, date.date, date.hours, date.minutes, date.seconds, date.milliseconds));
|
1824
|
+
}
|
1825
|
+
getDefaultValue() {
|
1826
|
+
const defaultValue = this.value || this.dateAdapter.today();
|
1827
|
+
return {
|
1828
|
+
year: this.dateAdapter.getYear(defaultValue),
|
1829
|
+
month: this.dateAdapter.getMonth(defaultValue),
|
1830
|
+
date: this.dateAdapter.getDate(defaultValue),
|
1831
|
+
hours: this.dateAdapter.getHours(defaultValue),
|
1832
|
+
minutes: this.dateAdapter.getMinutes(defaultValue),
|
1833
|
+
seconds: this.dateAdapter.getSeconds(defaultValue),
|
1834
|
+
milliseconds: this.dateAdapter.getMilliseconds(defaultValue)
|
1835
|
+
};
|
1836
|
+
}
|
1837
|
+
getTimeStringFromDate(value, timeFormat) {
|
1838
|
+
if (!value || !this.dateAdapter.isValid(value)) {
|
1839
|
+
return '';
|
1840
|
+
}
|
1841
|
+
return this.dateAdapter.format(value, timeFormat);
|
1842
|
+
}
|
1843
|
+
getDateEditMetrics(cursorPosition) {
|
1844
|
+
for (const digit of [this.firstDigit, this.secondDigit, this.thirdDigit]) {
|
1845
|
+
if (cursorPosition >= digit.start && cursorPosition <= digit.end) {
|
1846
|
+
return [digit.value, digit.start, digit.end];
|
1847
|
+
}
|
1848
|
+
}
|
1849
|
+
return [this.thirdDigit.value, this.thirdDigit.start, this.thirdDigit.end];
|
1850
|
+
}
|
1851
|
+
incrementDate(dateVal, whatToIncrement) {
|
1852
|
+
let year = this.dateAdapter.getYear(dateVal);
|
1853
|
+
let month = this.dateAdapter.getMonth(dateVal);
|
1854
|
+
let day = this.dateAdapter.getDate(dateVal);
|
1855
|
+
switch (whatToIncrement) {
|
1856
|
+
case DateParts.day:
|
1857
|
+
day++;
|
1858
|
+
if (day > this.dateAdapter.getNumDaysInMonth(dateVal)) {
|
1859
|
+
day = 1;
|
1860
|
+
}
|
1861
|
+
break;
|
1862
|
+
case DateParts.month:
|
1863
|
+
month++;
|
1864
|
+
// tslint:disable-next-line:no-magic-numbers
|
1865
|
+
if (month > 11) {
|
1866
|
+
month = 0;
|
1867
|
+
}
|
1868
|
+
const lastDay = this.getLastDayFor(year, month);
|
1869
|
+
if (day > lastDay) {
|
1870
|
+
day = lastDay;
|
1871
|
+
}
|
1872
|
+
break;
|
1873
|
+
case DateParts.year:
|
1874
|
+
year++;
|
1875
|
+
if (year > MAX_YEAR) {
|
1876
|
+
year = 1;
|
1877
|
+
}
|
1878
|
+
break;
|
1879
|
+
default:
|
1880
|
+
}
|
1881
|
+
return this.createDate(year, month, day);
|
1882
|
+
}
|
1883
|
+
getLastDayFor(year, month) {
|
1884
|
+
return this.dateAdapter.getNumDaysInMonth(this.createDate(year, month, 1));
|
1885
|
+
}
|
1886
|
+
decrementDate(dateVal, whatToDecrement) {
|
1887
|
+
let year = this.dateAdapter.getYear(dateVal);
|
1888
|
+
let month = this.dateAdapter.getMonth(dateVal);
|
1889
|
+
let day = this.dateAdapter.getDate(dateVal);
|
1890
|
+
switch (whatToDecrement) {
|
1891
|
+
case DateParts.day:
|
1892
|
+
day--;
|
1893
|
+
if (day < 1) {
|
1894
|
+
day = this.dateAdapter.getNumDaysInMonth(dateVal);
|
1895
|
+
}
|
1896
|
+
break;
|
1897
|
+
case DateParts.month:
|
1898
|
+
month--;
|
1899
|
+
if (month < 0) {
|
1900
|
+
// tslint:disable-next-line:no-magic-numbers
|
1901
|
+
month = 11;
|
1902
|
+
}
|
1903
|
+
const lastDay = this.getLastDayFor(year, month);
|
1904
|
+
if (day > lastDay) {
|
1905
|
+
day = lastDay;
|
1906
|
+
}
|
1907
|
+
break;
|
1908
|
+
case DateParts.year:
|
1909
|
+
year--;
|
1910
|
+
if (year < 1) {
|
1911
|
+
year = MAX_YEAR;
|
1912
|
+
}
|
1913
|
+
break;
|
1914
|
+
default:
|
1915
|
+
}
|
1916
|
+
return this.createDate(year, month, day);
|
1917
|
+
}
|
1918
|
+
verticalArrowKeyHandler(keyCode) {
|
1919
|
+
if (!this.value) {
|
1920
|
+
return;
|
1921
|
+
}
|
1922
|
+
let changedTime;
|
1923
|
+
const [modifiedTimePart, selectionStart, selectionEnd] = this.getDateEditMetrics(this.selectionStart);
|
1924
|
+
if (keyCode === UP_ARROW) {
|
1925
|
+
changedTime = this.incrementDate(this.value, modifiedTimePart);
|
1926
|
+
}
|
1927
|
+
if (keyCode === DOWN_ARROW) {
|
1928
|
+
changedTime = this.decrementDate(this.value, modifiedTimePart);
|
1929
|
+
}
|
1930
|
+
this.value = changedTime;
|
1931
|
+
this.selectionStart = selectionStart;
|
1932
|
+
this.selectionEnd = selectionEnd;
|
1933
|
+
this.cvaOnChange(changedTime);
|
1934
|
+
this.onChange();
|
1935
|
+
this.stateChanges.next();
|
1936
|
+
}
|
1937
|
+
changeCaretPosition(keyCode) {
|
1938
|
+
if (!this.value) {
|
1939
|
+
return;
|
1940
|
+
}
|
1941
|
+
let cursorPos = this.selectionStart;
|
1942
|
+
if ([HOME, PAGE_UP].includes(keyCode)) {
|
1943
|
+
cursorPos = 0;
|
1944
|
+
}
|
1945
|
+
else if ([END, PAGE_DOWN].includes(keyCode)) {
|
1946
|
+
cursorPos = this.viewValue.length;
|
1947
|
+
}
|
1948
|
+
else if (keyCode === LEFT_ARROW) {
|
1949
|
+
cursorPos = cursorPos === 0 ? this.viewValue.length : cursorPos - 1;
|
1950
|
+
}
|
1951
|
+
else if (keyCode === RIGHT_ARROW) {
|
1952
|
+
const nextSeparatorPos = this.viewValue.indexOf(this.separator, cursorPos);
|
1953
|
+
cursorPos = nextSeparatorPos ? nextSeparatorPos + 1 : 0;
|
1954
|
+
}
|
1955
|
+
this.selectDigitByCursor(cursorPos);
|
1956
|
+
}
|
1957
|
+
selectDigitByCursor(cursorPos) {
|
1958
|
+
setTimeout(() => {
|
1959
|
+
const [, selectionStart, selectionEnd] = this.getDateEditMetrics(cursorPos);
|
1960
|
+
this.selectionStart = selectionStart;
|
1961
|
+
this.selectionEnd = selectionEnd;
|
1962
|
+
});
|
1963
|
+
}
|
1964
|
+
selectNextDigitByCursor(cursorPos) {
|
1965
|
+
setTimeout(() => {
|
1966
|
+
const [, , endPositionOfCurrentDigit] = this.getDateEditMetrics(cursorPos);
|
1967
|
+
const [, selectionStart, selectionEnd] = this.getDateEditMetrics(endPositionOfCurrentDigit + 1);
|
1968
|
+
this.selectionStart = selectionStart;
|
1969
|
+
this.selectionEnd = selectionEnd;
|
1970
|
+
});
|
1971
|
+
}
|
1972
|
+
selectNextDigit(cursorPos, cycle = false) {
|
1973
|
+
setTimeout(() => {
|
1974
|
+
const lastValue = cycle ? 0 : cursorPos;
|
1975
|
+
const nextSeparatorPos = this.viewValue.indexOf(this.separator, cursorPos);
|
1976
|
+
const newCursorPos = nextSeparatorPos > 0 ? nextSeparatorPos + 1 : lastValue;
|
1977
|
+
const [, selectionStart, selectionEnd] = this.getDateEditMetrics(newCursorPos);
|
1978
|
+
this.selectionStart = selectionStart;
|
1979
|
+
this.selectionEnd = selectionEnd;
|
1980
|
+
});
|
1981
|
+
}
|
1982
|
+
/** Checks whether the input is invalid based on the native validation. */
|
1983
|
+
isBadInput() {
|
1984
|
+
const validity = this.elementRef.nativeElement.validity;
|
1985
|
+
return validity && validity.badInput;
|
1986
|
+
}
|
1987
|
+
/** Formats a value and sets it on the input element. */
|
1988
|
+
formatValue(value) {
|
1989
|
+
const formattedValue = value ? this.dateAdapter.format(value, this.dateFormats.dateInput) : '';
|
1990
|
+
this.setViewValue(formattedValue);
|
1991
|
+
}
|
1992
|
+
/**
|
1993
|
+
* @param obj The object to check.
|
1994
|
+
* @returns The given object if it is both a date instance and valid, otherwise null.
|
1995
|
+
*/
|
1996
|
+
getValidDateOrNull(obj) {
|
1997
|
+
return (this.dateAdapter.isDateInstance(obj) && this.dateAdapter.isValid(obj)) ? obj : null;
|
1998
|
+
}
|
1999
|
+
setControl(control) {
|
2000
|
+
if (!this.control) {
|
2001
|
+
this.control = control;
|
2002
|
+
}
|
2003
|
+
}
|
2004
|
+
getDigitPositions(format) {
|
2005
|
+
const formatInLowerCase = format.toLowerCase();
|
2006
|
+
formatInLowerCase
|
2007
|
+
.split('')
|
2008
|
+
.reduce(({ prev, length, start }, value, index, arr) => {
|
2009
|
+
if (value === this.separator || (arr.length - 1) === index) {
|
2010
|
+
if (!this.firstDigit) {
|
2011
|
+
this.firstDigit = new DateDigit(prev, start, length);
|
2012
|
+
}
|
2013
|
+
else if (!this.secondDigit) {
|
2014
|
+
this.secondDigit = new DateDigit(prev, start, length);
|
2015
|
+
}
|
2016
|
+
else if (!this.thirdDigit) {
|
2017
|
+
this.thirdDigit = new DateDigit(prev, start, arr.length - start);
|
2018
|
+
}
|
2019
|
+
// tslint:disable:no-parameter-reassignment
|
2020
|
+
length = 0;
|
2021
|
+
start = index + 1;
|
2022
|
+
}
|
2023
|
+
else {
|
2024
|
+
length++;
|
2025
|
+
}
|
2026
|
+
return { prev: value, length, start };
|
2027
|
+
}, { length: 0, start: 0 });
|
2028
|
+
if (!this.firstDigit || !this.secondDigit || !this.thirdDigit) {
|
2029
|
+
Error(`Can' t use this format: ${format}`);
|
2030
|
+
}
|
2031
|
+
}
|
2032
|
+
createDate(year, month, day) {
|
2033
|
+
return this.dateAdapter.createDateTime(year, month, day, this.dateAdapter.getHours(this.value), this.dateAdapter.getMinutes(this.value), this.dateAdapter.getSeconds(this.value), this.dateAdapter.getMilliseconds(this.value));
|
2034
|
+
}
|
2035
|
+
correctCursorPosition() {
|
2036
|
+
if (this.selectionStart && this.separatorPositions.includes(this.selectionStart)) {
|
2037
|
+
this.selectionStart = this.selectionStart - 1;
|
2038
|
+
}
|
2039
|
+
}
|
2040
|
+
}
|
2041
|
+
/** @nocollapse */ /** @nocollapse */ McDatepickerInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerInput, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1$1.DateAdapter, optional: true }, { token: MC_DATE_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
2042
|
+
/** @nocollapse */ /** @nocollapse */ McDatepickerInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: McDatepickerInput, selector: "input[mcDatepicker]", inputs: { placeholder: "placeholder", required: "required", mcDatepicker: "mcDatepicker", mcDatepickerFilter: "mcDatepickerFilter", value: "value", min: "min", max: "max", disabled: "disabled", id: "id", mcValidationTooltip: "mcValidationTooltip" }, outputs: { incorrectInput: "incorrectInput", dateChange: "dateChange", dateInput: "dateInput" }, host: { listeners: { "paste": "onPaste($event)", "change": "onChange()", "focus": "focusChanged(true)", "blur": "onBlur()", "keydown": "onKeyDown($event)" }, properties: { "attr.placeholder": "placeholder", "attr.required": "required", "attr.disabled": "disabled || null", "attr.min": "min ? toISO8601(min) : null", "attr.max": "max ? toISO8601(max) : null", "attr.autocomplete": "\"off\"" }, classAttribute: "mc-input mc-datepicker" }, providers: [
|
2043
|
+
MC_DATEPICKER_VALUE_ACCESSOR,
|
2044
|
+
MC_DATEPICKER_VALIDATORS,
|
2045
|
+
{ provide: McFormFieldControl, useExisting: McDatepickerInput }
|
2046
|
+
], exportAs: ["mcDatepickerInput"], ngImport: i0 });
|
2047
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerInput, decorators: [{
|
2048
|
+
type: Directive,
|
2049
|
+
args: [{
|
2050
|
+
selector: 'input[mcDatepicker]',
|
2051
|
+
exportAs: 'mcDatepickerInput',
|
2052
|
+
providers: [
|
2053
|
+
MC_DATEPICKER_VALUE_ACCESSOR,
|
2054
|
+
MC_DATEPICKER_VALIDATORS,
|
2055
|
+
{ provide: McFormFieldControl, useExisting: McDatepickerInput }
|
2056
|
+
],
|
2057
|
+
host: {
|
2058
|
+
class: 'mc-input mc-datepicker',
|
2059
|
+
'[attr.placeholder]': 'placeholder',
|
2060
|
+
'[attr.required]': 'required',
|
2061
|
+
'[attr.disabled]': 'disabled || null',
|
2062
|
+
'[attr.min]': 'min ? toISO8601(min) : null',
|
2063
|
+
'[attr.max]': 'max ? toISO8601(max) : null',
|
2064
|
+
'[attr.autocomplete]': '"off"',
|
2065
|
+
'(paste)': 'onPaste($event)',
|
2066
|
+
'(change)': 'onChange()',
|
2067
|
+
'(focus)': 'focusChanged(true)',
|
2068
|
+
'(blur)': 'onBlur()',
|
2069
|
+
'(keydown)': 'onKeyDown($event)'
|
2070
|
+
}
|
2071
|
+
}]
|
2072
|
+
}], ctorParameters: function () {
|
2073
|
+
return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1$1.DateAdapter, decorators: [{
|
2074
|
+
type: Optional
|
2075
|
+
}] }, { type: undefined, decorators: [{
|
2076
|
+
type: Optional
|
2077
|
+
}, {
|
2078
|
+
type: Inject,
|
2079
|
+
args: [MC_DATE_FORMATS]
|
2080
|
+
}] }];
|
2081
|
+
}, propDecorators: { placeholder: [{
|
2082
|
+
type: Input
|
2083
|
+
}], required: [{
|
2084
|
+
type: Input
|
2085
|
+
}], mcDatepicker: [{
|
2086
|
+
type: Input
|
2087
|
+
}], mcDatepickerFilter: [{
|
2088
|
+
type: Input
|
2089
|
+
}], value: [{
|
2090
|
+
type: Input
|
2091
|
+
}], min: [{
|
2092
|
+
type: Input
|
2093
|
+
}], max: [{
|
2094
|
+
type: Input
|
2095
|
+
}], disabled: [{
|
2096
|
+
type: Input
|
2097
|
+
}], id: [{
|
2098
|
+
type: Input
|
2099
|
+
}], mcValidationTooltip: [{
|
2100
|
+
type: Input
|
2101
|
+
}], incorrectInput: [{
|
2102
|
+
type: Output
|
2103
|
+
}], dateChange: [{
|
2104
|
+
type: Output
|
2105
|
+
}], dateInput: [{
|
2106
|
+
type: Output
|
2107
|
+
}] } });
|
2108
|
+
|
2109
|
+
/** Can be used to override the icon of a `mcDatepickerToggle`. */
|
2110
|
+
class McDatepickerToggleIcon {
|
2111
|
+
}
|
2112
|
+
/** @nocollapse */ /** @nocollapse */ McDatepickerToggleIcon.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerToggleIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
2113
|
+
/** @nocollapse */ /** @nocollapse */ McDatepickerToggleIcon.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: McDatepickerToggleIcon, selector: "[mcDatepickerToggleIcon]", ngImport: i0 });
|
2114
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerToggleIcon, decorators: [{
|
2115
|
+
type: Directive,
|
2116
|
+
args: [{
|
2117
|
+
selector: '[mcDatepickerToggleIcon]'
|
2118
|
+
}]
|
2119
|
+
}] });
|
2120
|
+
class McDatepickerToggle {
|
2121
|
+
constructor(intl, changeDetectorRef) {
|
2122
|
+
this.intl = intl;
|
2123
|
+
this.changeDetectorRef = changeDetectorRef;
|
2124
|
+
this.stateChanges = Subscription.EMPTY;
|
2125
|
+
}
|
2126
|
+
/** Whether the toggle button is disabled. */
|
2127
|
+
get disabled() {
|
2128
|
+
return this._disabled === undefined ? this.datepicker.disabled : this._disabled;
|
2129
|
+
}
|
2130
|
+
set disabled(value) {
|
2131
|
+
this._disabled = coerceBooleanProperty(value);
|
2132
|
+
}
|
2133
|
+
ngOnChanges(changes) {
|
2134
|
+
if (changes.datepicker) {
|
2135
|
+
this.watchStateChanges();
|
2136
|
+
}
|
2137
|
+
}
|
2138
|
+
ngOnDestroy() {
|
2139
|
+
this.stateChanges.unsubscribe();
|
2140
|
+
}
|
2141
|
+
ngAfterContentInit() {
|
2142
|
+
this.watchStateChanges();
|
2143
|
+
}
|
2144
|
+
open(event) {
|
2145
|
+
if (this.datepicker && !this.disabled) {
|
2146
|
+
this.datepicker.open();
|
2147
|
+
event.stopPropagation();
|
2148
|
+
}
|
2149
|
+
}
|
2150
|
+
watchStateChanges() {
|
2151
|
+
const datepickerDisabled = this.datepicker ? this.datepicker.disabledChange : of();
|
2152
|
+
const inputDisabled = this.datepicker && this.datepicker.datepickerInput ?
|
2153
|
+
this.datepicker.datepickerInput.disabledChange : of();
|
2154
|
+
const datepickerToggled = this.datepicker ?
|
2155
|
+
merge(this.datepicker.openedStream, this.datepicker.closedStream) :
|
2156
|
+
of();
|
2157
|
+
this.stateChanges.unsubscribe();
|
2158
|
+
this.stateChanges = merge(this.intl.changes, datepickerDisabled, inputDisabled, datepickerToggled).subscribe(() => this.changeDetectorRef.markForCheck());
|
2159
|
+
}
|
2160
|
+
}
|
2161
|
+
/** @nocollapse */ /** @nocollapse */ McDatepickerToggle.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerToggle, deps: [{ token: McDatepickerIntl }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
2162
|
+
/** @nocollapse */ /** @nocollapse */ McDatepickerToggle.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: McDatepickerToggle, selector: "mc-datepicker-toggle", inputs: { disabled: "disabled", datepicker: ["for", "datepicker"], tabIndex: "tabIndex" }, host: { properties: { "class.mc-active": "datepicker && datepicker.opened" }, classAttribute: "mc-datepicker-toggle" }, queries: [{ propertyName: "customIcon", first: true, predicate: McDatepickerToggleIcon, descendants: true }], viewQueries: [{ propertyName: "button", first: true, predicate: ["button"], descendants: true }], exportAs: ["mcDatepickerToggle"], usesOnChanges: true, ngImport: i0, template: "<!--todo need simplify this-->\n<button\n #button\n mc-button\n type=\"button\"\n class=\"mc-datepicker-toggle__button\"\n aria-haspopup=\"true\"\n [attr.aria-label]=\"intl.openCalendarLabel\"\n [tabIndex]=\"tabIndex\"\n [disabled]=\"disabled\"\n (click)=\"open($event)\">\n\n <i *ngIf=\"!customIcon\" mc-icon=\"mc-calendar_16\" class=\"mc-datepicker-toggle__default-icon\"></i>\n\n <ng-content select=\"[mcDatepickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mc-datepicker-toggle:focus{outline:0}.mc-datepicker-toggle__button.mc-icon-button{width:30px;width:var(--mc-datepicker-toggle-size-width, 30px);height:30px;height:var(--mc-datepicker-toggle-size-height, 30px);margin-left:2px}.mc-form-field-appearance-legacy .mc-form-field-prefix .mc-datepicker-toggle__default-icon,.mc-form-field-appearance-legacy .mc-form-field-suffix .mc-datepicker-toggle__default-icon{width:1em}.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-prefix .mc-datepicker-toggle__default-icon,.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-suffix .mc-datepicker-toggle__default-icon{display:block;width:1.5em;height:1.5em}.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-prefix .mc-icon-button .mc-datepicker-toggle__default-icon,.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-suffix .mc-icon-button .mc-datepicker-toggle__default-icon{margin:auto}\n"], components: [{ type: i3.McButton, selector: "[mc-button]", inputs: ["color", "tabIndex", "disabled"] }, { type: i4.McIcon, selector: "[mc-icon]", inputs: ["color"] }], directives: [{ type: i3.McButtonCssStyler, selector: "[mc-button]" }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.McIconCSSStyler, selector: "[mc-icon]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
2163
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerToggle, decorators: [{
|
2164
|
+
type: Component,
|
2165
|
+
args: [{ selector: 'mc-datepicker-toggle', host: {
|
2166
|
+
class: 'mc-datepicker-toggle',
|
2167
|
+
'[class.mc-active]': 'datepicker && datepicker.opened'
|
2168
|
+
}, exportAs: 'mcDatepickerToggle', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!--todo need simplify this-->\n<button\n #button\n mc-button\n type=\"button\"\n class=\"mc-datepicker-toggle__button\"\n aria-haspopup=\"true\"\n [attr.aria-label]=\"intl.openCalendarLabel\"\n [tabIndex]=\"tabIndex\"\n [disabled]=\"disabled\"\n (click)=\"open($event)\">\n\n <i *ngIf=\"!customIcon\" mc-icon=\"mc-calendar_16\" class=\"mc-datepicker-toggle__default-icon\"></i>\n\n <ng-content select=\"[mcDatepickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mc-datepicker-toggle:focus{outline:0}.mc-datepicker-toggle__button.mc-icon-button{width:30px;width:var(--mc-datepicker-toggle-size-width, 30px);height:30px;height:var(--mc-datepicker-toggle-size-height, 30px);margin-left:2px}.mc-form-field-appearance-legacy .mc-form-field-prefix .mc-datepicker-toggle__default-icon,.mc-form-field-appearance-legacy .mc-form-field-suffix .mc-datepicker-toggle__default-icon{width:1em}.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-prefix .mc-datepicker-toggle__default-icon,.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-suffix .mc-datepicker-toggle__default-icon{display:block;width:1.5em;height:1.5em}.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-prefix .mc-icon-button .mc-datepicker-toggle__default-icon,.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-suffix .mc-icon-button .mc-datepicker-toggle__default-icon{margin:auto}\n"] }]
|
2169
|
+
}], ctorParameters: function () { return [{ type: McDatepickerIntl }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { disabled: [{
|
2170
|
+
type: Input
|
2171
|
+
}], datepicker: [{
|
2172
|
+
type: Input,
|
2173
|
+
args: ['for']
|
2174
|
+
}], tabIndex: [{
|
2175
|
+
type: Input
|
2176
|
+
}], customIcon: [{
|
2177
|
+
type: ContentChild,
|
2178
|
+
args: [McDatepickerToggleIcon, { static: false }]
|
2179
|
+
}], button: [{
|
2180
|
+
type: ViewChild,
|
2181
|
+
args: ['button', { static: false }]
|
2182
|
+
}] } });
|
2183
|
+
|
2184
|
+
/**
|
2185
|
+
* Animations used by the mosaic datepicker.
|
2186
|
+
* @docs-private
|
2187
|
+
*/
|
2188
|
+
const mcDatepickerAnimations = {
|
2189
|
+
/** Transforms the height of the datepicker's calendar. */
|
2190
|
+
transformPanel: trigger('transformPanel', [
|
2191
|
+
state('void', style({
|
2192
|
+
opacity: 0,
|
2193
|
+
transform: 'scale(1, 0.8)'
|
2194
|
+
})),
|
2195
|
+
transition('void => enter', animate('120ms cubic-bezier(0, 0, 0.2, 1)', style({
|
2196
|
+
opacity: 1,
|
2197
|
+
transform: 'scale(1, 1)'
|
2198
|
+
}))),
|
2199
|
+
transition('* => void', animate('100ms linear', style({ opacity: 0 })))
|
2200
|
+
]),
|
2201
|
+
/** Fades in the content of the calendar. */
|
2202
|
+
fadeInCalendar: trigger('fadeInCalendar', [
|
2203
|
+
state('void', style({ opacity: 0 })),
|
2204
|
+
state('enter', style({ opacity: 1 })),
|
2205
|
+
// need to keep it until #12440 gets in, otherwise the exit animation will look glitchy.
|
2206
|
+
transition('void => *', animate('120ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)'))
|
2207
|
+
])
|
2208
|
+
};
|
2209
|
+
// todo should be put into polyfils
|
2210
|
+
// https://github.com/angular/angular/issues/24769
|
2211
|
+
if (!Element.prototype.matches) {
|
2212
|
+
Element.prototype.matches = Element.prototype.msMatchesSelector;
|
2213
|
+
}
|
2214
|
+
|
2215
|
+
/** Used to generate a unique ID for each datepicker instance. */
|
2216
|
+
let datepickerUid = 0;
|
2217
|
+
/** Injection token that determines the scroll handling while the calendar is open. */
|
2218
|
+
const MC_DATEPICKER_SCROLL_STRATEGY = new InjectionToken('mc-datepicker-scroll-strategy');
|
2219
|
+
/** @docs-private */
|
2220
|
+
// tslint:disable-next-line:naming-convention
|
2221
|
+
function MC_DATEPICKER_SCROLL_STRATEGY_FACTORY(overlay) {
|
2222
|
+
return () => overlay.scrollStrategies.reposition();
|
2223
|
+
}
|
2224
|
+
/** @docs-private */
|
2225
|
+
const MC_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
|
2226
|
+
provide: MC_DATEPICKER_SCROLL_STRATEGY,
|
2227
|
+
deps: [Overlay],
|
2228
|
+
useFactory: MC_DATEPICKER_SCROLL_STRATEGY_FACTORY
|
2229
|
+
};
|
2230
|
+
/**
|
2231
|
+
* Component used as the content for the datepicker dialog and popup. We use this instead of using
|
2232
|
+
* McCalendar directly as the content so we can control the initial focus. This also gives us a
|
2233
|
+
* place to put additional features of the popup that are not part of the calendar itself in the
|
2234
|
+
* future. (e.g. confirmation buttons).
|
2235
|
+
* @docs-private
|
2236
|
+
*/
|
2237
|
+
class McDatepickerContent {
|
2238
|
+
constructor(changeDetectorRef) {
|
2239
|
+
this.changeDetectorRef = changeDetectorRef;
|
2240
|
+
/** Emits when an animation has finished. */
|
2241
|
+
this.animationDone = new Subject();
|
2242
|
+
this.subscriptions = new Subscription();
|
2243
|
+
}
|
2244
|
+
ngAfterViewInit() {
|
2245
|
+
this.subscriptions.add(this.datepicker.stateChanges.subscribe(() => {
|
2246
|
+
this.changeDetectorRef.markForCheck();
|
2247
|
+
}));
|
2248
|
+
}
|
2249
|
+
ngOnDestroy() {
|
2250
|
+
this.subscriptions.unsubscribe();
|
2251
|
+
this.animationDone.complete();
|
2252
|
+
}
|
2253
|
+
startExitAnimation() {
|
2254
|
+
this.animationState = 'void';
|
2255
|
+
this.changeDetectorRef.markForCheck();
|
2256
|
+
}
|
2257
|
+
}
|
2258
|
+
/** @nocollapse */ /** @nocollapse */ McDatepickerContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerContent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
2259
|
+
/** @nocollapse */ /** @nocollapse */ McDatepickerContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: McDatepickerContent, selector: "mc-datepicker__content", host: { listeners: { "@transformPanel.done": "animationDone.next()" }, properties: { "@transformPanel": "animationState" }, classAttribute: "mc-datepicker__content" }, viewQueries: [{ propertyName: "calendar", first: true, predicate: McCalendar, descendants: true }], exportAs: ["mcDatepickerContent"], ngImport: i0, template: "<mc-calendar [id]=\"datepicker.id\"\n [ngClass]=\"datepicker.panelClass\"\n [startAt]=\"datepicker.startAt\"\n [startView]=\"datepicker.startView\"\n [minDate]=\"datepicker.minDate\"\n [maxDate]=\"datepicker.maxDate\"\n [dateFilter]=\"datepicker.dateFilter\"\n [headerComponent]=\"datepicker.calendarHeaderComponent\"\n [selected]=\"datepicker.selected\"\n [dateClass]=\"datepicker.dateClass\"\n [@fadeInCalendar]=\"'enter'\"\n (selectedChange)=\"datepicker.select($event)\"\n (yearSelected)=\"datepicker.selectYear($event)\"\n (monthSelected)=\"datepicker.selectMonth($event)\"\n (userSelection)=\"datepicker.close()\">\n</mc-calendar>\n", styles: [".mc-calendar{display:block}.mc-calendar-header{display:flex;padding:16px 8px 12px;padding:var(--mc-datepicker-calendar-size-padding-top, 16px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-blocks, 12px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px)}.mc-calendar__content{padding:0 8px 8px;padding:0 var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px);outline:none}.mc-calendar-spacer{flex:1 1 auto}.mc-calendar__period-button{min-width:0}.mc-calendar__period-button .mc-icon{vertical-align:baseline}.mc-calendar__previous-button:after{border-left-width:2px;border-left-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(2px) rotate(-45deg);transform:var(--mc-datepicker-calendar-size-icon-prev-icon-transform, translateX(2px) rotate(-45deg))}.mc-calendar__next-button:after{border-right-width:2px;border-right-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(-2px) rotate(45deg);transform:var(--mc-datepicker-calendar-size-icon-nex-icon-transform, translateX(-2px) rotate(45deg))}.mc-calendar__table{border-spacing:0;border-collapse:collapse;width:100%}.mc-calendar__table-header th{text-align:center;height:30px}.mc-calendar__table-header th.mc-calendar__table-header-divider{position:relative;height:10px;height:calc(var(--mc-datepicker-calendar-size-padding-blocks, 12px) - 2px)}.mc-calendar__table-header th.mc-calendar__table-header-divider:after{content:\"\";position:absolute;top:0;left:-8px;left:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));right:-8px;right:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));height:1px;height:var(--mc-datepicker-calendar-size-divider-width, 1px)}.mc-datepicker__content{display:block;border-width:1px;border-style:solid}.mc-datepicker__content .mc-calendar{width:296px;height:348px}.mc-datepicker__content .mc-calendar__next-button[disabled],.mc-datepicker__content .mc-calendar__previous-button[disabled]{border:0}\n"], components: [{ type: McCalendar, selector: "mc-calendar", inputs: ["startAt", "selected", "minDate", "maxDate", "headerComponent", "startView", "dateFilter", "dateClass"], outputs: ["selectedChange", "yearSelected", "monthSelected", "userSelection"], exportAs: ["mcCalendar"] }], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], animations: [
|
2260
|
+
mcDatepickerAnimations.transformPanel,
|
2261
|
+
mcDatepickerAnimations.fadeInCalendar
|
2262
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
2263
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerContent, decorators: [{
|
2264
|
+
type: Component,
|
2265
|
+
args: [{ selector: 'mc-datepicker__content', exportAs: 'mcDatepickerContent', host: {
|
2266
|
+
class: 'mc-datepicker__content',
|
2267
|
+
'[@transformPanel]': 'animationState',
|
2268
|
+
'(@transformPanel.done)': 'animationDone.next()'
|
2269
|
+
}, animations: [
|
2270
|
+
mcDatepickerAnimations.transformPanel,
|
2271
|
+
mcDatepickerAnimations.fadeInCalendar
|
2272
|
+
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<mc-calendar [id]=\"datepicker.id\"\n [ngClass]=\"datepicker.panelClass\"\n [startAt]=\"datepicker.startAt\"\n [startView]=\"datepicker.startView\"\n [minDate]=\"datepicker.minDate\"\n [maxDate]=\"datepicker.maxDate\"\n [dateFilter]=\"datepicker.dateFilter\"\n [headerComponent]=\"datepicker.calendarHeaderComponent\"\n [selected]=\"datepicker.selected\"\n [dateClass]=\"datepicker.dateClass\"\n [@fadeInCalendar]=\"'enter'\"\n (selectedChange)=\"datepicker.select($event)\"\n (yearSelected)=\"datepicker.selectYear($event)\"\n (monthSelected)=\"datepicker.selectMonth($event)\"\n (userSelection)=\"datepicker.close()\">\n</mc-calendar>\n", styles: [".mc-calendar{display:block}.mc-calendar-header{display:flex;padding:16px 8px 12px;padding:var(--mc-datepicker-calendar-size-padding-top, 16px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-blocks, 12px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px)}.mc-calendar__content{padding:0 8px 8px;padding:0 var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px);outline:none}.mc-calendar-spacer{flex:1 1 auto}.mc-calendar__period-button{min-width:0}.mc-calendar__period-button .mc-icon{vertical-align:baseline}.mc-calendar__previous-button:after{border-left-width:2px;border-left-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(2px) rotate(-45deg);transform:var(--mc-datepicker-calendar-size-icon-prev-icon-transform, translateX(2px) rotate(-45deg))}.mc-calendar__next-button:after{border-right-width:2px;border-right-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(-2px) rotate(45deg);transform:var(--mc-datepicker-calendar-size-icon-nex-icon-transform, translateX(-2px) rotate(45deg))}.mc-calendar__table{border-spacing:0;border-collapse:collapse;width:100%}.mc-calendar__table-header th{text-align:center;height:30px}.mc-calendar__table-header th.mc-calendar__table-header-divider{position:relative;height:10px;height:calc(var(--mc-datepicker-calendar-size-padding-blocks, 12px) - 2px)}.mc-calendar__table-header th.mc-calendar__table-header-divider:after{content:\"\";position:absolute;top:0;left:-8px;left:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));right:-8px;right:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));height:1px;height:var(--mc-datepicker-calendar-size-divider-width, 1px)}.mc-datepicker__content{display:block;border-width:1px;border-style:solid}.mc-datepicker__content .mc-calendar{width:296px;height:348px}.mc-datepicker__content .mc-calendar__next-button[disabled],.mc-datepicker__content .mc-calendar__previous-button[disabled]{border:0}\n"] }]
|
2273
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { calendar: [{
|
2274
|
+
type: ViewChild,
|
2275
|
+
args: [McCalendar]
|
2276
|
+
}] } });
|
2277
|
+
// TODO: We use a component instead of a directive here so the user can use implicit
|
2278
|
+
// template reference variables (e.g. #d vs #d="mcDatepicker"). We can change this to a directive
|
2279
|
+
// if angular adds support for `exportAs: '$implicit'` on directives.
|
2280
|
+
/** Component responsible for managing the datepicker popup/dialog. */
|
2281
|
+
class McDatepicker {
|
2282
|
+
constructor(overlay, ngZone, viewContainerRef, scrollStrategy, dateAdapter, dir, document) {
|
2283
|
+
this.overlay = overlay;
|
2284
|
+
this.ngZone = ngZone;
|
2285
|
+
this.viewContainerRef = viewContainerRef;
|
2286
|
+
this.dateAdapter = dateAdapter;
|
2287
|
+
this.dir = dir;
|
2288
|
+
this.document = document;
|
2289
|
+
this._hasBackdrop = false;
|
2290
|
+
this._opened = false;
|
2291
|
+
/** The view that the calendar should start in. */
|
2292
|
+
this.startView = McCalendarView.Month;
|
2293
|
+
/**
|
2294
|
+
* Emits selected year in multiyear view.
|
2295
|
+
* This doesn't imply a change on the selected date.
|
2296
|
+
*/
|
2297
|
+
this.yearSelected = new EventEmitter();
|
2298
|
+
/**
|
2299
|
+
* Emits selected month in year view.
|
2300
|
+
* This doesn't imply a change on the selected date.
|
2301
|
+
*/
|
2302
|
+
this.monthSelected = new EventEmitter();
|
2303
|
+
this.backdropClass = 'cdk-overlay-transparent-backdrop';
|
2304
|
+
/** Emits when the datepicker has been opened. */
|
2305
|
+
this.openedStream = new EventEmitter();
|
2306
|
+
/** Emits when the datepicker has been closed. */
|
2307
|
+
this.closedStream = new EventEmitter();
|
2308
|
+
/** The id for the datepicker calendar. */
|
2309
|
+
this.id = `mc-datepicker-${datepickerUid++}`;
|
2310
|
+
this.stateChanges = new Subject();
|
2311
|
+
/** Emits when the datepicker is disabled. */
|
2312
|
+
this.disabledChange = new Subject();
|
2313
|
+
/** Emits new selected date when selected date changes. */
|
2314
|
+
this.selectedChanged = new Subject();
|
2315
|
+
this.validSelected = null;
|
2316
|
+
/** The element that was focused before the datepicker was opened. */
|
2317
|
+
this.focusedElementBeforeOpen = null;
|
2318
|
+
/** Subscription to value changes in the associated input element. */
|
2319
|
+
this.inputSubscription = Subscription.EMPTY;
|
2320
|
+
this.closeSubscription = Subscription.EMPTY;
|
2321
|
+
if (!this.dateAdapter) {
|
2322
|
+
throw createMissingDateImplError('DateAdapter');
|
2323
|
+
}
|
2324
|
+
this.scrollStrategy = scrollStrategy;
|
2325
|
+
}
|
2326
|
+
get hasBackdrop() {
|
2327
|
+
return this._hasBackdrop;
|
2328
|
+
}
|
2329
|
+
set hasBackdrop(value) {
|
2330
|
+
this._hasBackdrop = coerceBooleanProperty(value);
|
2331
|
+
}
|
2332
|
+
/** The date to open the calendar to initially. */
|
2333
|
+
get startAt() {
|
2334
|
+
// If an explicit startAt is set we start there, otherwise we start at whatever the currently
|
2335
|
+
// selected value is.
|
2336
|
+
return this._startAt || (this.datepickerInput ? this.datepickerInput.value : null);
|
2337
|
+
}
|
2338
|
+
set startAt(value) {
|
2339
|
+
this._startAt = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
|
2340
|
+
}
|
2341
|
+
/** Whether the datepicker pop-up should be disabled. */
|
2342
|
+
get disabled() {
|
2343
|
+
return this._disabled === undefined && this.datepickerInput ? this.datepickerInput.disabled : this._disabled;
|
2344
|
+
}
|
2345
|
+
set disabled(value) {
|
2346
|
+
const newValue = coerceBooleanProperty(value);
|
2347
|
+
if (newValue !== this._disabled) {
|
2348
|
+
this._disabled = newValue;
|
2349
|
+
this.disabledChange.next(newValue);
|
2350
|
+
}
|
2351
|
+
}
|
2352
|
+
/** Whether the calendar is open. */
|
2353
|
+
get opened() {
|
2354
|
+
return this._opened;
|
2355
|
+
}
|
2356
|
+
set opened(value) {
|
2357
|
+
coerceBooleanProperty(value) ? this.open() : this.close();
|
2358
|
+
}
|
2359
|
+
/** The currently selected date. */
|
2360
|
+
get selected() {
|
2361
|
+
return this.validSelected;
|
2362
|
+
}
|
2363
|
+
set selected(value) {
|
2364
|
+
this.validSelected = value;
|
2365
|
+
}
|
2366
|
+
/** The minimum selectable date. */
|
2367
|
+
get minDate() {
|
2368
|
+
return this.datepickerInput && this.datepickerInput.min;
|
2369
|
+
}
|
2370
|
+
/** The maximum selectable date. */
|
2371
|
+
get maxDate() {
|
2372
|
+
return this.datepickerInput && this.datepickerInput.max;
|
2373
|
+
}
|
2374
|
+
get dateFilter() {
|
2375
|
+
return this.datepickerInput && this.datepickerInput.dateFilter;
|
2376
|
+
}
|
2377
|
+
get value() {
|
2378
|
+
return this.selected;
|
2379
|
+
}
|
2380
|
+
ngOnDestroy() {
|
2381
|
+
this.close();
|
2382
|
+
this.inputSubscription.unsubscribe();
|
2383
|
+
this.closeSubscription.unsubscribe();
|
2384
|
+
this.disabledChange.complete();
|
2385
|
+
this.destroyOverlay();
|
2386
|
+
}
|
2387
|
+
/** Selects the given date */
|
2388
|
+
select(date) {
|
2389
|
+
const oldValue = this.selected;
|
2390
|
+
this.selected = date;
|
2391
|
+
if (!this.dateAdapter.sameDate(oldValue, this.selected)) {
|
2392
|
+
this.selectedChanged.next(date);
|
2393
|
+
}
|
2394
|
+
}
|
2395
|
+
/** Emits the selected year in multiyear view */
|
2396
|
+
selectYear(normalizedYear) {
|
2397
|
+
this.yearSelected.emit(normalizedYear);
|
2398
|
+
}
|
2399
|
+
/** Emits selected month in year view */
|
2400
|
+
selectMonth(normalizedMonth) {
|
2401
|
+
this.monthSelected.emit(normalizedMonth);
|
2402
|
+
}
|
2403
|
+
/**
|
2404
|
+
* Register an input with this datepicker.
|
2405
|
+
* @param input The datepicker input to register with this datepicker.
|
2406
|
+
*/
|
2407
|
+
registerInput(input) {
|
2408
|
+
if (this.datepickerInput) {
|
2409
|
+
throw Error('A McDatepicker can only be associated with a single input.');
|
2410
|
+
}
|
2411
|
+
this.datepickerInput = input;
|
2412
|
+
this.inputSubscription = this.datepickerInput.valueChange
|
2413
|
+
.subscribe((value) => {
|
2414
|
+
var _a;
|
2415
|
+
this.selected = value;
|
2416
|
+
if (this.popupComponentRef) {
|
2417
|
+
(_a = this.popupComponentRef.instance.calendar.monthView) === null || _a === void 0 ? void 0 : _a.init();
|
2418
|
+
this.popupComponentRef.instance.calendar.activeDate = value;
|
2419
|
+
}
|
2420
|
+
});
|
2421
|
+
}
|
2422
|
+
/** Open the calendar. */
|
2423
|
+
open() {
|
2424
|
+
if (this._opened || this.disabled) {
|
2425
|
+
return;
|
2426
|
+
}
|
2427
|
+
if (!this.datepickerInput) {
|
2428
|
+
throw Error('Attempted to open an McDatepicker with no associated input.');
|
2429
|
+
}
|
2430
|
+
if (this.document) {
|
2431
|
+
this.focusedElementBeforeOpen = this.document.activeElement;
|
2432
|
+
}
|
2433
|
+
this.openAsPopup();
|
2434
|
+
this._opened = true;
|
2435
|
+
this.openedStream.emit();
|
2436
|
+
}
|
2437
|
+
/** Close the calendar. */
|
2438
|
+
close(restoreFocus = true) {
|
2439
|
+
if (!this._opened) {
|
2440
|
+
return;
|
2441
|
+
}
|
2442
|
+
if (this.popupComponentRef) {
|
2443
|
+
const instance = this.popupComponentRef.instance;
|
2444
|
+
instance.startExitAnimation();
|
2445
|
+
instance.animationDone
|
2446
|
+
.pipe(take(1))
|
2447
|
+
.subscribe(() => this.destroyOverlay());
|
2448
|
+
}
|
2449
|
+
if (restoreFocus) {
|
2450
|
+
this.focusedElementBeforeOpen.focus();
|
2451
|
+
}
|
2452
|
+
this._opened = false;
|
2453
|
+
this.closedStream.emit();
|
2454
|
+
this.focusedElementBeforeOpen = null;
|
2455
|
+
}
|
2456
|
+
toggle() {
|
2457
|
+
if (this.datepickerInput.isReadOnly) {
|
2458
|
+
return;
|
2459
|
+
}
|
2460
|
+
this._opened ? this.close() : this.open();
|
2461
|
+
}
|
2462
|
+
/** Destroys the current overlay. */
|
2463
|
+
destroyOverlay() {
|
2464
|
+
if (this.popupRef) {
|
2465
|
+
this.popupRef.dispose();
|
2466
|
+
this.popupRef = this.popupComponentRef = null;
|
2467
|
+
}
|
2468
|
+
}
|
2469
|
+
/** Open the calendar as a popup. */
|
2470
|
+
openAsPopup() {
|
2471
|
+
if (!this.calendarPortal) {
|
2472
|
+
this.calendarPortal = new ComponentPortal(McDatepickerContent, this.viewContainerRef);
|
2473
|
+
}
|
2474
|
+
if (!this.popupRef) {
|
2475
|
+
this.createPopup();
|
2476
|
+
}
|
2477
|
+
if (!this.popupRef.hasAttached()) {
|
2478
|
+
this.popupComponentRef = this.popupRef.attach(this.calendarPortal);
|
2479
|
+
this.popupComponentRef.instance.datepicker = this;
|
2480
|
+
// Update the position once the calendar has rendered.
|
2481
|
+
this.ngZone.onStable.asObservable()
|
2482
|
+
.pipe(take(1))
|
2483
|
+
.subscribe(() => this.popupRef.updatePosition());
|
2484
|
+
}
|
2485
|
+
}
|
2486
|
+
/** Create the popup. */
|
2487
|
+
createPopup() {
|
2488
|
+
const overlayConfig = new OverlayConfig({
|
2489
|
+
positionStrategy: this.createPopupPositionStrategy(),
|
2490
|
+
hasBackdrop: this.hasBackdrop,
|
2491
|
+
backdropClass: this.backdropClass,
|
2492
|
+
direction: this.dir,
|
2493
|
+
scrollStrategy: this.scrollStrategy(),
|
2494
|
+
panelClass: 'mc-datepicker__popup'
|
2495
|
+
});
|
2496
|
+
this.popupRef = this.overlay.create(overlayConfig);
|
2497
|
+
this.closeSubscription = this.closingActions()
|
2498
|
+
.subscribe(() => this.close(this.restoreFocus()));
|
2499
|
+
}
|
2500
|
+
restoreFocus() {
|
2501
|
+
return this.document.activeElement === this.document.body;
|
2502
|
+
}
|
2503
|
+
closingActions() {
|
2504
|
+
return merge(this.popupRef.backdropClick(), this.popupRef.outsidePointerEvents(), this.popupRef.detachments());
|
2505
|
+
}
|
2506
|
+
/** Create the popup PositionStrategy. */
|
2507
|
+
createPopupPositionStrategy() {
|
2508
|
+
return this.overlay.position()
|
2509
|
+
.flexibleConnectedTo(this.datepickerInput.elementRef)
|
2510
|
+
.withTransformOriginOn('.mc-datepicker__content')
|
2511
|
+
.withFlexibleDimensions(false)
|
2512
|
+
.withViewportMargin(8)
|
2513
|
+
.withLockedPosition()
|
2514
|
+
.withPositions([
|
2515
|
+
{
|
2516
|
+
originX: 'start',
|
2517
|
+
originY: 'bottom',
|
2518
|
+
overlayX: 'start',
|
2519
|
+
overlayY: 'top'
|
2520
|
+
},
|
2521
|
+
{
|
2522
|
+
originX: 'start',
|
2523
|
+
originY: 'top',
|
2524
|
+
overlayX: 'start',
|
2525
|
+
overlayY: 'bottom'
|
2526
|
+
},
|
2527
|
+
{
|
2528
|
+
originX: 'end',
|
2529
|
+
originY: 'bottom',
|
2530
|
+
overlayX: 'end',
|
2531
|
+
overlayY: 'top'
|
2532
|
+
},
|
2533
|
+
{
|
2534
|
+
originX: 'end',
|
2535
|
+
originY: 'top',
|
2536
|
+
overlayX: 'end',
|
2537
|
+
overlayY: 'bottom'
|
2538
|
+
}
|
2539
|
+
]);
|
2540
|
+
}
|
2541
|
+
/**
|
2542
|
+
* @param obj The object to check.
|
2543
|
+
* @returns The given object if it is both a date instance and valid, otherwise null.
|
2544
|
+
*/
|
2545
|
+
getValidDateOrNull(obj) {
|
2546
|
+
return (this.dateAdapter.isDateInstance(obj) && this.dateAdapter.isValid(obj)) ? obj : null;
|
2547
|
+
}
|
2548
|
+
}
|
2549
|
+
/** @nocollapse */ /** @nocollapse */ McDatepicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepicker, deps: [{ token: i3$1.Overlay }, { token: i0.NgZone }, { token: i0.ViewContainerRef }, { token: MC_DATEPICKER_SCROLL_STRATEGY }, { token: i1$1.DateAdapter, optional: true }, { token: i2.Directionality, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
2550
|
+
/** @nocollapse */ /** @nocollapse */ McDatepicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: McDatepicker, selector: "mc-datepicker", inputs: { hasBackdrop: "hasBackdrop", startAt: "startAt", disabled: "disabled", opened: "opened", calendarHeaderComponent: "calendarHeaderComponent", startView: "startView", panelClass: "panelClass", dateClass: "dateClass", backdropClass: "backdropClass" }, outputs: { yearSelected: "yearSelected", monthSelected: "monthSelected", openedStream: "opened", closedStream: "closed" }, providers: [{ provide: McFormFieldControl, useExisting: McDatepicker }], exportAs: ["mcDatepicker"], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
2551
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepicker, decorators: [{
|
2552
|
+
type: Component,
|
2553
|
+
args: [{
|
2554
|
+
selector: 'mc-datepicker',
|
2555
|
+
template: '',
|
2556
|
+
exportAs: 'mcDatepicker',
|
2557
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
2558
|
+
encapsulation: ViewEncapsulation.None,
|
2559
|
+
providers: [{ provide: McFormFieldControl, useExisting: McDatepicker }]
|
2560
|
+
}]
|
2561
|
+
}], ctorParameters: function () {
|
2562
|
+
return [{ type: i3$1.Overlay }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
|
2563
|
+
type: Inject,
|
2564
|
+
args: [MC_DATEPICKER_SCROLL_STRATEGY]
|
2565
|
+
}] }, { type: i1$1.DateAdapter, decorators: [{
|
2566
|
+
type: Optional
|
2567
|
+
}] }, { type: i2.Directionality, decorators: [{
|
2568
|
+
type: Optional
|
2569
|
+
}] }, { type: undefined, decorators: [{
|
2570
|
+
type: Optional
|
2571
|
+
}, {
|
2572
|
+
type: Inject,
|
2573
|
+
args: [DOCUMENT]
|
2574
|
+
}] }];
|
2575
|
+
}, propDecorators: { hasBackdrop: [{
|
2576
|
+
type: Input
|
2577
|
+
}], startAt: [{
|
2578
|
+
type: Input
|
2579
|
+
}], disabled: [{
|
2580
|
+
type: Input
|
2581
|
+
}], opened: [{
|
2582
|
+
type: Input
|
2583
|
+
}], calendarHeaderComponent: [{
|
2584
|
+
type: Input
|
2585
|
+
}], startView: [{
|
2586
|
+
type: Input
|
2587
|
+
}], yearSelected: [{
|
2588
|
+
type: Output
|
2589
|
+
}], monthSelected: [{
|
2590
|
+
type: Output
|
2591
|
+
}], panelClass: [{
|
2592
|
+
type: Input
|
2593
|
+
}], dateClass: [{
|
2594
|
+
type: Input
|
2595
|
+
}], backdropClass: [{
|
2596
|
+
type: Input
|
2597
|
+
}], openedStream: [{
|
2598
|
+
type: Output,
|
2599
|
+
args: ['opened']
|
2600
|
+
}], closedStream: [{
|
2601
|
+
type: Output,
|
2602
|
+
args: ['closed']
|
2603
|
+
}] } });
|
2604
|
+
|
2605
|
+
class McDatepickerModule {
|
2606
|
+
}
|
2607
|
+
/** @nocollapse */ /** @nocollapse */ McDatepickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
2608
|
+
/** @nocollapse */ /** @nocollapse */ McDatepickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerModule, declarations: [McCalendar,
|
2609
|
+
McCalendarBody,
|
2610
|
+
McDatepicker,
|
2611
|
+
McDatepickerContent,
|
2612
|
+
McDatepickerInput,
|
2613
|
+
McDatepickerToggle,
|
2614
|
+
McDatepickerToggleIcon,
|
2615
|
+
McMonthView,
|
2616
|
+
McYearView,
|
2617
|
+
McMultiYearView,
|
2618
|
+
McCalendarHeader], imports: [CommonModule,
|
2619
|
+
McButtonModule,
|
2620
|
+
OverlayModule,
|
2621
|
+
A11yModule,
|
2622
|
+
PortalModule,
|
2623
|
+
McIconModule], exports: [McCalendar,
|
2624
|
+
McCalendarBody,
|
2625
|
+
McDatepicker,
|
2626
|
+
McDatepickerContent,
|
2627
|
+
McDatepickerInput,
|
2628
|
+
McDatepickerToggle,
|
2629
|
+
McDatepickerToggleIcon,
|
2630
|
+
McMonthView,
|
2631
|
+
McYearView,
|
2632
|
+
McMultiYearView,
|
2633
|
+
McCalendarHeader,
|
2634
|
+
McButtonModule] });
|
2635
|
+
/** @nocollapse */ /** @nocollapse */ McDatepickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerModule, providers: [
|
2636
|
+
McDatepickerIntl,
|
2637
|
+
MC_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER
|
2638
|
+
], imports: [[
|
2639
|
+
CommonModule,
|
2640
|
+
McButtonModule,
|
2641
|
+
OverlayModule,
|
2642
|
+
A11yModule,
|
2643
|
+
PortalModule,
|
2644
|
+
McIconModule
|
2645
|
+
], McButtonModule] });
|
2646
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: McDatepickerModule, decorators: [{
|
2647
|
+
type: NgModule,
|
2648
|
+
args: [{
|
2649
|
+
imports: [
|
2650
|
+
CommonModule,
|
2651
|
+
McButtonModule,
|
2652
|
+
OverlayModule,
|
2653
|
+
A11yModule,
|
2654
|
+
PortalModule,
|
2655
|
+
McIconModule
|
2656
|
+
],
|
2657
|
+
exports: [
|
2658
|
+
McCalendar,
|
2659
|
+
McCalendarBody,
|
2660
|
+
McDatepicker,
|
2661
|
+
McDatepickerContent,
|
2662
|
+
McDatepickerInput,
|
2663
|
+
McDatepickerToggle,
|
2664
|
+
McDatepickerToggleIcon,
|
2665
|
+
McMonthView,
|
2666
|
+
McYearView,
|
2667
|
+
McMultiYearView,
|
2668
|
+
McCalendarHeader,
|
2669
|
+
McButtonModule
|
2670
|
+
],
|
2671
|
+
declarations: [
|
2672
|
+
McCalendar,
|
2673
|
+
McCalendarBody,
|
2674
|
+
McDatepicker,
|
2675
|
+
McDatepickerContent,
|
2676
|
+
McDatepickerInput,
|
2677
|
+
McDatepickerToggle,
|
2678
|
+
McDatepickerToggleIcon,
|
2679
|
+
McMonthView,
|
2680
|
+
McYearView,
|
2681
|
+
McMultiYearView,
|
2682
|
+
McCalendarHeader
|
2683
|
+
],
|
2684
|
+
providers: [
|
2685
|
+
McDatepickerIntl,
|
2686
|
+
MC_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER
|
2687
|
+
],
|
2688
|
+
entryComponents: [
|
2689
|
+
McDatepickerContent,
|
2690
|
+
McCalendarHeader
|
2691
|
+
]
|
2692
|
+
}]
|
2693
|
+
}] });
|
2694
|
+
|
2695
|
+
/**
|
2696
|
+
* Generated bundle index. Do not edit.
|
2697
|
+
*/
|
2698
|
+
|
2699
|
+
export { MAX_YEAR, MC_DATEPICKER_SCROLL_STRATEGY, MC_DATEPICKER_SCROLL_STRATEGY_FACTORY, MC_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER, MC_DATEPICKER_VALIDATORS, MC_DATEPICKER_VALUE_ACCESSOR, McCalendar, McCalendarBody, McCalendarCell, McCalendarHeader, McCalendarView, McDatepicker, McDatepickerContent, McDatepickerInput, McDatepickerInputEvent, McDatepickerIntl, McDatepickerModule, McDatepickerToggle, McDatepickerToggleIcon, McMonthView, McMultiYearView, McYearView, mcDatepickerAnimations, yearsPerPage, yearsPerRow };
|
2700
|
+
//# sourceMappingURL=ptsecurity-mosaic-datepicker.mjs.map
|