@tylertech/forge 2.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/LICENSE +202 -0
- package/README.md +124 -0
- package/dist/busy-indicator/forge-busy-indicator.css +6 -0
- package/dist/button/forge-button.css +6 -0
- package/dist/dialog/forge-dialog-utils.css +6 -0
- package/dist/dialog/forge-dialog.css +6 -0
- package/dist/expansion-panel/forge-expansion-panel.css +6 -0
- package/dist/floating-action-button/forge-floating-action-button.css +6 -0
- package/dist/floating-label/forge-floating-label.css +6 -0
- package/dist/forge-core.css +6 -0
- package/dist/forge-dark.css +6 -0
- package/dist/forge.css +6 -0
- package/dist/form-field/forge-form-field.css +6 -0
- package/dist/icon-button/forge-icon-button.css +6 -0
- package/dist/popup/forge-popup.css +6 -0
- package/dist/quantity-field/forge-quantity-field.css +6 -0
- package/dist/ripple/forge-ripple.css +6 -0
- package/dist/scaffold/forge-scaffold.css +6 -0
- package/dist/table/forge-table.css +6 -0
- package/dist/theme/forge-theme.css +6 -0
- package/dist/tooltip/forge-tooltip.css +6 -0
- package/dist/typography/forge-form.css +6 -0
- package/dist/typography/forge-typography.css +6 -0
- package/dist/utils/forge-flex.css +6 -0
- package/dist/utils/forge-grid.css +6 -0
- package/dist/utils/forge-utils.css +6 -0
- package/esm/accordion/accordion-adapter.d.ts +48 -0
- package/esm/accordion/accordion-adapter.js +63 -0
- package/esm/accordion/accordion-constants.d.ts +11 -0
- package/esm/accordion/accordion-constants.js +14 -0
- package/esm/accordion/accordion-foundation.d.ts +27 -0
- package/esm/accordion/accordion-foundation.js +61 -0
- package/esm/accordion/accordion.d.ts +30 -0
- package/esm/accordion/accordion.js +52 -0
- package/esm/accordion/index.d.ts +10 -0
- package/esm/accordion/index.js +14 -0
- package/esm/app-bar/app-bar-adapter.d.ts +43 -0
- package/esm/app-bar/app-bar-adapter.js +60 -0
- package/esm/app-bar/app-bar-constants.d.ts +33 -0
- package/esm/app-bar/app-bar-constants.js +37 -0
- package/esm/app-bar/app-bar-foundation.d.ts +35 -0
- package/esm/app-bar/app-bar-foundation.js +70 -0
- package/esm/app-bar/app-bar.d.ts +34 -0
- package/esm/app-bar/app-bar.js +71 -0
- package/esm/app-bar/help-button/app-bar-help-button-adapter.d.ts +18 -0
- package/esm/app-bar/help-button/app-bar-help-button-adapter.js +19 -0
- package/esm/app-bar/help-button/app-bar-help-button-constants.d.ts +8 -0
- package/esm/app-bar/help-button/app-bar-help-button-constants.js +10 -0
- package/esm/app-bar/help-button/app-bar-help-button-foundation.d.ts +21 -0
- package/esm/app-bar/help-button/app-bar-help-button-foundation.js +29 -0
- package/esm/app-bar/help-button/app-bar-help-button.d.ts +23 -0
- package/esm/app-bar/help-button/app-bar-help-button.js +48 -0
- package/esm/app-bar/help-button/index.d.ts +10 -0
- package/esm/app-bar/help-button/index.js +14 -0
- package/esm/app-bar/index.d.ts +16 -0
- package/esm/app-bar/index.js +20 -0
- package/esm/app-bar/menu-button/app-bar-menu-button-constants.d.ts +8 -0
- package/esm/app-bar/menu-button/app-bar-menu-button-constants.js +10 -0
- package/esm/app-bar/menu-button/app-bar-menu-button.d.ts +17 -0
- package/esm/app-bar/menu-button/app-bar-menu-button.js +34 -0
- package/esm/app-bar/menu-button/index.d.ts +8 -0
- package/esm/app-bar/menu-button/index.js +12 -0
- package/esm/app-bar/notification-button/app-bar-notification-button-adapter.d.ts +23 -0
- package/esm/app-bar/notification-button/app-bar-notification-button-adapter.js +28 -0
- package/esm/app-bar/notification-button/app-bar-notification-button-constants.d.ts +14 -0
- package/esm/app-bar/notification-button/app-bar-notification-button-constants.js +17 -0
- package/esm/app-bar/notification-button/app-bar-notification-button-foundation.d.ts +32 -0
- package/esm/app-bar/notification-button/app-bar-notification-button-foundation.js +79 -0
- package/esm/app-bar/notification-button/app-bar-notification-button.d.ts +29 -0
- package/esm/app-bar/notification-button/app-bar-notification-button.js +78 -0
- package/esm/app-bar/notification-button/index.d.ts +10 -0
- package/esm/app-bar/notification-button/index.js +14 -0
- package/esm/app-bar/profile-button/app-bar-profile-button-adapter.d.ts +34 -0
- package/esm/app-bar/profile-button/app-bar-profile-button-adapter.js +72 -0
- package/esm/app-bar/profile-button/app-bar-profile-button-constants.d.ts +31 -0
- package/esm/app-bar/profile-button/app-bar-profile-button-constants.js +25 -0
- package/esm/app-bar/profile-button/app-bar-profile-button-foundation.d.ts +66 -0
- package/esm/app-bar/profile-button/app-bar-profile-button-foundation.js +199 -0
- package/esm/app-bar/profile-button/app-bar-profile-button.d.ts +42 -0
- package/esm/app-bar/profile-button/app-bar-profile-button.js +112 -0
- package/esm/app-bar/profile-button/index.d.ts +10 -0
- package/esm/app-bar/profile-button/index.js +14 -0
- package/esm/app-bar/search/app-bar-search-adapter.d.ts +59 -0
- package/esm/app-bar/search/app-bar-search-adapter.js +73 -0
- package/esm/app-bar/search/app-bar-search-constants.d.ts +38 -0
- package/esm/app-bar/search/app-bar-search-constants.js +42 -0
- package/esm/app-bar/search/app-bar-search-foundation.d.ts +62 -0
- package/esm/app-bar/search/app-bar-search-foundation.js +126 -0
- package/esm/app-bar/search/app-bar-search.d.ts +52 -0
- package/esm/app-bar/search/app-bar-search.js +101 -0
- package/esm/app-bar/search/index.d.ts +10 -0
- package/esm/app-bar/search/index.js +14 -0
- package/esm/autocomplete/autocomplete-adapter.d.ts +90 -0
- package/esm/autocomplete/autocomplete-adapter.js +222 -0
- package/esm/autocomplete/autocomplete-component-delegate.d.ts +34 -0
- package/esm/autocomplete/autocomplete-component-delegate.js +76 -0
- package/esm/autocomplete/autocomplete-constants.d.ts +68 -0
- package/esm/autocomplete/autocomplete-constants.js +49 -0
- package/esm/autocomplete/autocomplete-foundation.d.ts +175 -0
- package/esm/autocomplete/autocomplete-foundation.js +857 -0
- package/esm/autocomplete/autocomplete-utils.d.ts +22 -0
- package/esm/autocomplete/autocomplete-utils.js +36 -0
- package/esm/autocomplete/autocomplete.d.ts +85 -0
- package/esm/autocomplete/autocomplete.js +162 -0
- package/esm/autocomplete/index.d.ts +12 -0
- package/esm/autocomplete/index.js +16 -0
- package/esm/avatar/avatar-adapter.d.ts +42 -0
- package/esm/avatar/avatar-adapter.js +63 -0
- package/esm/avatar/avatar-component-delegate.d.ts +16 -0
- package/esm/avatar/avatar-component-delegate.js +15 -0
- package/esm/avatar/avatar-constants.d.ts +25 -0
- package/esm/avatar/avatar-constants.js +32 -0
- package/esm/avatar/avatar-foundation.d.ts +47 -0
- package/esm/avatar/avatar-foundation.js +119 -0
- package/esm/avatar/avatar.d.ts +36 -0
- package/esm/avatar/avatar.js +71 -0
- package/esm/avatar/index.d.ts +11 -0
- package/esm/avatar/index.js +15 -0
- package/esm/backdrop/backdrop-adapter.d.ts +36 -0
- package/esm/backdrop/backdrop-adapter.js +40 -0
- package/esm/backdrop/backdrop-constants.d.ts +26 -0
- package/esm/backdrop/backdrop-constants.js +31 -0
- package/esm/backdrop/backdrop-foundation.d.ts +38 -0
- package/esm/backdrop/backdrop-foundation.js +82 -0
- package/esm/backdrop/backdrop.d.ts +51 -0
- package/esm/backdrop/backdrop.js +85 -0
- package/esm/backdrop/index.d.ts +10 -0
- package/esm/backdrop/index.js +14 -0
- package/esm/badge/badge-adapter.d.ts +17 -0
- package/esm/badge/badge-adapter.js +20 -0
- package/esm/badge/badge-component-delegate.d.ts +16 -0
- package/esm/badge/badge-component-delegate.js +15 -0
- package/esm/badge/badge-constants.d.ts +21 -0
- package/esm/badge/badge-constants.js +26 -0
- package/esm/badge/badge-foundation.d.ts +24 -0
- package/esm/badge/badge-foundation.js +55 -0
- package/esm/badge/badge.d.ts +26 -0
- package/esm/badge/badge.js +51 -0
- package/esm/badge/index.d.ts +11 -0
- package/esm/badge/index.js +15 -0
- package/esm/banner/banner-adapter.d.ts +30 -0
- package/esm/banner/banner-adapter.js +44 -0
- package/esm/banner/banner-constants.d.ts +34 -0
- package/esm/banner/banner-constants.js +41 -0
- package/esm/banner/banner-foundation.d.ts +31 -0
- package/esm/banner/banner-foundation.js +73 -0
- package/esm/banner/banner.d.ts +35 -0
- package/esm/banner/banner.js +67 -0
- package/esm/banner/index.d.ts +10 -0
- package/esm/banner/index.js +14 -0
- package/esm/bottom-sheet/bottom-sheet-adapter.d.ts +70 -0
- package/esm/bottom-sheet/bottom-sheet-adapter.js +129 -0
- package/esm/bottom-sheet/bottom-sheet-constants.d.ts +49 -0
- package/esm/bottom-sheet/bottom-sheet-constants.js +47 -0
- package/esm/bottom-sheet/bottom-sheet-foundation.d.ts +79 -0
- package/esm/bottom-sheet/bottom-sheet-foundation.js +327 -0
- package/esm/bottom-sheet/bottom-sheet.d.ts +58 -0
- package/esm/bottom-sheet/bottom-sheet.js +85 -0
- package/esm/bottom-sheet/index.d.ts +10 -0
- package/esm/bottom-sheet/index.js +14 -0
- package/esm/busy-indicator/busy-indicator-adapter.d.ts +159 -0
- package/esm/busy-indicator/busy-indicator-adapter.js +201 -0
- package/esm/busy-indicator/busy-indicator-constants.d.ts +49 -0
- package/esm/busy-indicator/busy-indicator-constants.js +58 -0
- package/esm/busy-indicator/busy-indicator-foundation.d.ts +97 -0
- package/esm/busy-indicator/busy-indicator-foundation.js +268 -0
- package/esm/busy-indicator/busy-indicator.d.ts +73 -0
- package/esm/busy-indicator/busy-indicator.js +111 -0
- package/esm/busy-indicator/index.d.ts +10 -0
- package/esm/busy-indicator/index.js +14 -0
- package/esm/button/button-component-delegate.d.ts +24 -0
- package/esm/button/button-component-delegate.js +39 -0
- package/esm/button/button-constants.d.ts +28 -0
- package/esm/button/button-constants.js +33 -0
- package/esm/button/button.d.ts +43 -0
- package/esm/button/button.js +160 -0
- package/esm/button/index.d.ts +9 -0
- package/esm/button/index.js +13 -0
- package/esm/button-toggle/button-toggle/button-toggle-adapter.d.ts +30 -0
- package/esm/button-toggle/button-toggle/button-toggle-adapter.js +62 -0
- package/esm/button-toggle/button-toggle/button-toggle-constants.d.ts +33 -0
- package/esm/button-toggle/button-toggle/button-toggle-constants.js +35 -0
- package/esm/button-toggle/button-toggle/button-toggle-foundation.d.ts +37 -0
- package/esm/button-toggle/button-toggle/button-toggle-foundation.js +74 -0
- package/esm/button-toggle/button-toggle/button-toggle.d.ts +37 -0
- package/esm/button-toggle/button-toggle/button-toggle.js +76 -0
- package/esm/button-toggle/button-toggle/index.d.ts +10 -0
- package/esm/button-toggle/button-toggle/index.js +14 -0
- package/esm/button-toggle/button-toggle-group/button-toggle-group-adapter.d.ts +44 -0
- package/esm/button-toggle/button-toggle-group/button-toggle-group-adapter.js +125 -0
- package/esm/button-toggle/button-toggle-group/button-toggle-group-constants.d.ts +35 -0
- package/esm/button-toggle/button-toggle-group/button-toggle-group-constants.js +33 -0
- package/esm/button-toggle/button-toggle-group/button-toggle-group-foundation.d.ts +57 -0
- package/esm/button-toggle/button-toggle-group/button-toggle-group-foundation.js +198 -0
- package/esm/button-toggle/button-toggle-group/button-toggle-group.d.ts +38 -0
- package/esm/button-toggle/button-toggle-group/button-toggle-group.js +94 -0
- package/esm/button-toggle/button-toggle-group/index.d.ts +10 -0
- package/esm/button-toggle/button-toggle-group/index.js +14 -0
- package/esm/button-toggle/index.d.ts +7 -0
- package/esm/button-toggle/index.js +7 -0
- package/esm/calendar/calendar-adapter.d.ts +160 -0
- package/esm/calendar/calendar-adapter.js +425 -0
- package/esm/calendar/calendar-component-delegate.d.ts +21 -0
- package/esm/calendar/calendar-component-delegate.js +27 -0
- package/esm/calendar/calendar-constants.d.ts +261 -0
- package/esm/calendar/calendar-constants.js +170 -0
- package/esm/calendar/calendar-dom-utils.d.ts +46 -0
- package/esm/calendar/calendar-dom-utils.js +301 -0
- package/esm/calendar/calendar-dropdown/calendar-dropdown-constants.d.ts +15 -0
- package/esm/calendar/calendar-dropdown/calendar-dropdown-constants.js +11 -0
- package/esm/calendar/calendar-dropdown/calendar-dropdown.d.ts +41 -0
- package/esm/calendar/calendar-dropdown/calendar-dropdown.js +106 -0
- package/esm/calendar/calendar-dropdown/index.d.ts +7 -0
- package/esm/calendar/calendar-dropdown/index.js +7 -0
- package/esm/calendar/calendar-foundation.d.ts +547 -0
- package/esm/calendar/calendar-foundation.js +2218 -0
- package/esm/calendar/calendar-locale-utils.d.ts +20 -0
- package/esm/calendar/calendar-locale-utils.js +133 -0
- package/esm/calendar/calendar-menu/calendar-menu-adapter.d.ts +43 -0
- package/esm/calendar/calendar-menu/calendar-menu-adapter.js +156 -0
- package/esm/calendar/calendar-menu/calendar-menu-constants.d.ts +74 -0
- package/esm/calendar/calendar-menu/calendar-menu-constants.js +76 -0
- package/esm/calendar/calendar-menu/calendar-menu-foundation.d.ts +66 -0
- package/esm/calendar/calendar-menu/calendar-menu-foundation.js +229 -0
- package/esm/calendar/calendar-menu/calendar-menu-utils.d.ts +12 -0
- package/esm/calendar/calendar-menu/calendar-menu-utils.js +85 -0
- package/esm/calendar/calendar-menu/calendar-menu.d.ts +48 -0
- package/esm/calendar/calendar-menu/calendar-menu.js +86 -0
- package/esm/calendar/calendar-menu/index.d.ts +11 -0
- package/esm/calendar/calendar-menu/index.js +15 -0
- package/esm/calendar/calendar-utils.d.ts +64 -0
- package/esm/calendar/calendar-utils.js +309 -0
- package/esm/calendar/calendar.d.ts +96 -0
- package/esm/calendar/calendar.js +282 -0
- package/esm/calendar/core/calendar-base.d.ts +34 -0
- package/esm/calendar/core/calendar-base.js +6 -0
- package/esm/calendar/core/date-range.d.ts +15 -0
- package/esm/calendar/core/date-range.js +16 -0
- package/esm/calendar/core/index.d.ts +7 -0
- package/esm/calendar/core/index.js +7 -0
- package/esm/calendar/index.d.ts +17 -0
- package/esm/calendar/index.js +21 -0
- package/esm/card/card-constants.d.ts +17 -0
- package/esm/card/card-constants.js +22 -0
- package/esm/card/card.d.ts +27 -0
- package/esm/card/card.js +58 -0
- package/esm/card/index.d.ts +8 -0
- package/esm/card/index.js +12 -0
- package/esm/checkbox/checkbox-adapter.d.ts +71 -0
- package/esm/checkbox/checkbox-adapter.js +216 -0
- package/esm/checkbox/checkbox-component-delegate.d.ts +37 -0
- package/esm/checkbox/checkbox-component-delegate.js +92 -0
- package/esm/checkbox/checkbox-constants.d.ts +72 -0
- package/esm/checkbox/checkbox-constants.js +67 -0
- package/esm/checkbox/checkbox-foundation.d.ts +35 -0
- package/esm/checkbox/checkbox-foundation.js +175 -0
- package/esm/checkbox/checkbox.d.ts +28 -0
- package/esm/checkbox/checkbox.js +69 -0
- package/esm/checkbox/index.d.ts +11 -0
- package/esm/checkbox/index.js +15 -0
- package/esm/chip-field/chip-field-adapter.d.ts +32 -0
- package/esm/chip-field/chip-field-adapter.js +51 -0
- package/esm/chip-field/chip-field-component-delegate.d.ts +45 -0
- package/esm/chip-field/chip-field-component-delegate.js +125 -0
- package/esm/chip-field/chip-field-constants.d.ts +31 -0
- package/esm/chip-field/chip-field-constants.js +36 -0
- package/esm/chip-field/chip-field-foundation.d.ts +30 -0
- package/esm/chip-field/chip-field-foundation.js +151 -0
- package/esm/chip-field/chip-field.d.ts +21 -0
- package/esm/chip-field/chip-field.js +28 -0
- package/esm/chip-field/index.d.ts +11 -0
- package/esm/chip-field/index.js +15 -0
- package/esm/chips/chip/chip-adapter.d.ts +51 -0
- package/esm/chips/chip/chip-adapter.js +115 -0
- package/esm/chips/chip/chip-constants.d.ts +53 -0
- package/esm/chips/chip/chip-constants.js +47 -0
- package/esm/chips/chip/chip-foundation.d.ts +69 -0
- package/esm/chips/chip/chip-foundation.js +264 -0
- package/esm/chips/chip/chip.d.ts +50 -0
- package/esm/chips/chip/chip.js +98 -0
- package/esm/chips/chip/index.d.ts +10 -0
- package/esm/chips/chip/index.js +14 -0
- package/esm/chips/chip-set/chip-set-adapter.d.ts +23 -0
- package/esm/chips/chip-set/chip-set-adapter.js +33 -0
- package/esm/chips/chip-set/chip-set-constants.d.ts +21 -0
- package/esm/chips/chip-set/chip-set-constants.js +26 -0
- package/esm/chips/chip-set/chip-set-foundation.d.ts +35 -0
- package/esm/chips/chip-set/chip-set-foundation.js +74 -0
- package/esm/chips/chip-set/chip-set.d.ts +29 -0
- package/esm/chips/chip-set/chip-set.js +67 -0
- package/esm/chips/chip-set/index.d.ts +10 -0
- package/esm/chips/chip-set/index.js +14 -0
- package/esm/chips/index.d.ts +7 -0
- package/esm/chips/index.js +7 -0
- package/esm/circular-progress/circular-progress-adapter.d.ts +28 -0
- package/esm/circular-progress/circular-progress-adapter.js +42 -0
- package/esm/circular-progress/circular-progress-constants.d.ts +17 -0
- package/esm/circular-progress/circular-progress-constants.js +21 -0
- package/esm/circular-progress/circular-progress-foundation.d.ts +32 -0
- package/esm/circular-progress/circular-progress-foundation.js +66 -0
- package/esm/circular-progress/circular-progress.d.ts +27 -0
- package/esm/circular-progress/circular-progress.js +65 -0
- package/esm/circular-progress/index.d.ts +10 -0
- package/esm/circular-progress/index.js +14 -0
- package/esm/color-picker/color-picker-adapter.d.ts +78 -0
- package/esm/color-picker/color-picker-adapter.js +175 -0
- package/esm/color-picker/color-picker-constants.d.ts +79 -0
- package/esm/color-picker/color-picker-constants.js +65 -0
- package/esm/color-picker/color-picker-foundation.d.ts +67 -0
- package/esm/color-picker/color-picker-foundation.js +235 -0
- package/esm/color-picker/color-picker-gradient-slider.d.ts +30 -0
- package/esm/color-picker/color-picker-gradient-slider.js +135 -0
- package/esm/color-picker/color-picker-slider.d.ts +38 -0
- package/esm/color-picker/color-picker-slider.js +118 -0
- package/esm/color-picker/color-picker-utils.d.ts +40 -0
- package/esm/color-picker/color-picker-utils.js +197 -0
- package/esm/color-picker/color-picker.d.ts +43 -0
- package/esm/color-picker/color-picker.js +80 -0
- package/esm/color-picker/index.d.ts +10 -0
- package/esm/color-picker/index.js +14 -0
- package/esm/constants.d.ts +9 -0
- package/esm/constants.js +9 -0
- package/esm/core/base/base-adapter.d.ts +42 -0
- package/esm/core/base/base-adapter.js +56 -0
- package/esm/core/base/base-component.d.ts +11 -0
- package/esm/core/base/base-component.js +8 -0
- package/esm/core/base/index.d.ts +7 -0
- package/esm/core/base/index.js +7 -0
- package/esm/core/delegates/base-component-delegate.d.ts +40 -0
- package/esm/core/delegates/base-component-delegate.js +84 -0
- package/esm/core/delegates/form-field-component-delegate.d.ts +24 -0
- package/esm/core/delegates/form-field-component-delegate.js +11 -0
- package/esm/core/delegates/index.d.ts +7 -0
- package/esm/core/delegates/index.js +7 -0
- package/esm/core/index.d.ts +9 -0
- package/esm/core/index.js +9 -0
- package/esm/core/mask/date-input-mask.d.ts +35 -0
- package/esm/core/mask/date-input-mask.js +155 -0
- package/esm/core/mask/index.d.ts +7 -0
- package/esm/core/mask/index.js +7 -0
- package/esm/core/mask/time-input-mask.d.ts +38 -0
- package/esm/core/mask/time-input-mask.js +163 -0
- package/esm/core/utils/date-utils.d.ts +42 -0
- package/esm/core/utils/date-utils.js +133 -0
- package/esm/core/utils/index.d.ts +9 -0
- package/esm/core/utils/index.js +9 -0
- package/esm/core/utils/svg-utils.d.ts +14 -0
- package/esm/core/utils/svg-utils.js +62 -0
- package/esm/core/utils/time-utils.d.ts +21 -0
- package/esm/core/utils/time-utils.js +111 -0
- package/esm/core/utils/utils.d.ts +11 -0
- package/esm/core/utils/utils.js +26 -0
- package/esm/date-picker/base/base-date-picker-adapter.d.ts +98 -0
- package/esm/date-picker/base/base-date-picker-adapter.js +157 -0
- package/esm/date-picker/base/base-date-picker-constants.d.ts +52 -0
- package/esm/date-picker/base/base-date-picker-constants.js +33 -0
- package/esm/date-picker/base/base-date-picker-foundation.d.ts +152 -0
- package/esm/date-picker/base/base-date-picker-foundation.js +608 -0
- package/esm/date-picker/base/base-date-picker-utils.d.ts +6 -0
- package/esm/date-picker/base/base-date-picker-utils.js +21 -0
- package/esm/date-picker/base/base-date-picker.d.ts +82 -0
- package/esm/date-picker/base/base-date-picker.js +135 -0
- package/esm/date-picker/date-picker-adapter.d.ts +39 -0
- package/esm/date-picker/date-picker-adapter.js +121 -0
- package/esm/date-picker/date-picker-component-delegate.d.ts +34 -0
- package/esm/date-picker/date-picker-component-delegate.js +73 -0
- package/esm/date-picker/date-picker-constants.d.ts +20 -0
- package/esm/date-picker/date-picker-constants.js +25 -0
- package/esm/date-picker/date-picker-foundation.d.ts +34 -0
- package/esm/date-picker/date-picker-foundation.js +155 -0
- package/esm/date-picker/date-picker.d.ts +26 -0
- package/esm/date-picker/date-picker.js +54 -0
- package/esm/date-picker/index.d.ts +11 -0
- package/esm/date-picker/index.js +15 -0
- package/esm/date-range-picker/date-range-picker-adapter.d.ts +65 -0
- package/esm/date-range-picker/date-range-picker-adapter.js +190 -0
- package/esm/date-range-picker/date-range-picker-component-delegate.d.ts +41 -0
- package/esm/date-range-picker/date-range-picker-component-delegate.js +86 -0
- package/esm/date-range-picker/date-range-picker-constants.d.ts +34 -0
- package/esm/date-range-picker/date-range-picker-constants.js +38 -0
- package/esm/date-range-picker/date-range-picker-foundation.d.ts +60 -0
- package/esm/date-range-picker/date-range-picker-foundation.js +342 -0
- package/esm/date-range-picker/date-range-picker.d.ts +33 -0
- package/esm/date-range-picker/date-range-picker.js +64 -0
- package/esm/date-range-picker/index.d.ts +11 -0
- package/esm/date-range-picker/index.js +15 -0
- package/esm/dialog/dialog-adapter.d.ts +75 -0
- package/esm/dialog/dialog-adapter.js +164 -0
- package/esm/dialog/dialog-constants.d.ts +65 -0
- package/esm/dialog/dialog-constants.js +59 -0
- package/esm/dialog/dialog-foundation.d.ts +102 -0
- package/esm/dialog/dialog-foundation.js +451 -0
- package/esm/dialog/dialog.d.ts +71 -0
- package/esm/dialog/dialog.js +120 -0
- package/esm/dialog/index.d.ts +10 -0
- package/esm/dialog/index.js +14 -0
- package/esm/divider/divider-constants.d.ts +11 -0
- package/esm/divider/divider-constants.js +14 -0
- package/esm/divider/divider.d.ts +19 -0
- package/esm/divider/divider.js +26 -0
- package/esm/divider/index.d.ts +8 -0
- package/esm/divider/index.js +12 -0
- package/esm/drawer/base/base-drawer-adapter.d.ts +24 -0
- package/esm/drawer/base/base-drawer-adapter.js +48 -0
- package/esm/drawer/base/base-drawer-constants.d.ts +27 -0
- package/esm/drawer/base/base-drawer-constants.js +30 -0
- package/esm/drawer/base/base-drawer-foundation.d.ts +32 -0
- package/esm/drawer/base/base-drawer-foundation.js +89 -0
- package/esm/drawer/base/base-drawer.d.ts +30 -0
- package/esm/drawer/base/base-drawer.js +42 -0
- package/esm/drawer/base/index.d.ts +9 -0
- package/esm/drawer/base/index.js +9 -0
- package/esm/drawer/drawer/drawer-constants.d.ts +8 -0
- package/esm/drawer/drawer/drawer-constants.js +10 -0
- package/esm/drawer/drawer/drawer.d.ts +21 -0
- package/esm/drawer/drawer/drawer.js +24 -0
- package/esm/drawer/drawer/index.d.ts +8 -0
- package/esm/drawer/drawer/index.js +12 -0
- package/esm/drawer/index.d.ts +9 -0
- package/esm/drawer/index.js +9 -0
- package/esm/drawer/mini-drawer/index.d.ts +8 -0
- package/esm/drawer/mini-drawer/index.js +12 -0
- package/esm/drawer/mini-drawer/mini-drawer-constants.d.ts +11 -0
- package/esm/drawer/mini-drawer/mini-drawer-constants.js +14 -0
- package/esm/drawer/mini-drawer/mini-drawer.d.ts +17 -0
- package/esm/drawer/mini-drawer/mini-drawer.js +24 -0
- package/esm/drawer/modal-drawer/index.d.ts +10 -0
- package/esm/drawer/modal-drawer/index.js +14 -0
- package/esm/drawer/modal-drawer/modal-drawer-adapter.d.ts +20 -0
- package/esm/drawer/modal-drawer/modal-drawer-adapter.js +30 -0
- package/esm/drawer/modal-drawer/modal-drawer-constants.d.ts +15 -0
- package/esm/drawer/modal-drawer/modal-drawer-constants.js +19 -0
- package/esm/drawer/modal-drawer/modal-drawer-foundation.d.ts +22 -0
- package/esm/drawer/modal-drawer/modal-drawer-foundation.js +52 -0
- package/esm/drawer/modal-drawer/modal-drawer.d.ts +21 -0
- package/esm/drawer/modal-drawer/modal-drawer.js +28 -0
- package/esm/expansion-panel/expansion-panel-adapter.d.ts +33 -0
- package/esm/expansion-panel/expansion-panel-adapter.js +182 -0
- package/esm/expansion-panel/expansion-panel-constants.d.ts +38 -0
- package/esm/expansion-panel/expansion-panel-constants.js +47 -0
- package/esm/expansion-panel/expansion-panel-foundation.d.ts +59 -0
- package/esm/expansion-panel/expansion-panel-foundation.js +151 -0
- package/esm/expansion-panel/expansion-panel.d.ts +60 -0
- package/esm/expansion-panel/expansion-panel.js +81 -0
- package/esm/expansion-panel/index.d.ts +10 -0
- package/esm/expansion-panel/index.js +14 -0
- package/esm/field/field-adapter.d.ts +101 -0
- package/esm/field/field-adapter.js +184 -0
- package/esm/field/field-constants.d.ts +36 -0
- package/esm/field/field-constants.js +36 -0
- package/esm/field/field-foundation.d.ts +65 -0
- package/esm/field/field-foundation.js +328 -0
- package/esm/field/field.d.ts +40 -0
- package/esm/field/field.js +78 -0
- package/esm/file-picker/file-picker-adapter.d.ts +81 -0
- package/esm/file-picker/file-picker-adapter.js +134 -0
- package/esm/file-picker/file-picker-component-delegate.d.ts +23 -0
- package/esm/file-picker/file-picker-component-delegate.js +49 -0
- package/esm/file-picker/file-picker-constants.d.ts +41 -0
- package/esm/file-picker/file-picker-constants.js +44 -0
- package/esm/file-picker/file-picker-foundation.d.ts +66 -0
- package/esm/file-picker/file-picker-foundation.js +226 -0
- package/esm/file-picker/file-picker.d.ts +45 -0
- package/esm/file-picker/file-picker.js +88 -0
- package/esm/file-picker/index.d.ts +11 -0
- package/esm/file-picker/index.js +15 -0
- package/esm/floating-action-button/floating-action-button-component-delegate.d.ts +22 -0
- package/esm/floating-action-button/floating-action-button-component-delegate.js +36 -0
- package/esm/floating-action-button/floating-action-button-constants.d.ts +27 -0
- package/esm/floating-action-button/floating-action-button-constants.js +32 -0
- package/esm/floating-action-button/floating-action-button.d.ts +40 -0
- package/esm/floating-action-button/floating-action-button.js +126 -0
- package/esm/floating-action-button/index.d.ts +9 -0
- package/esm/floating-action-button/index.js +13 -0
- package/esm/floating-label/floating-label-adapter.d.ts +23 -0
- package/esm/floating-label/floating-label-adapter.js +32 -0
- package/esm/floating-label/floating-label-constants.d.ts +13 -0
- package/esm/floating-label/floating-label-constants.js +14 -0
- package/esm/floating-label/floating-label-foundation.d.ts +17 -0
- package/esm/floating-label/floating-label-foundation.js +71 -0
- package/esm/floating-label/floating-label.d.ts +27 -0
- package/esm/floating-label/floating-label.js +34 -0
- package/esm/floating-label/index.d.ts +9 -0
- package/esm/floating-label/index.js +9 -0
- package/esm/icon/icon-adapter.d.ts +23 -0
- package/esm/icon/icon-adapter.js +43 -0
- package/esm/icon/icon-component-delegate.d.ts +15 -0
- package/esm/icon/icon-component-delegate.js +15 -0
- package/esm/icon/icon-constants.d.ts +27 -0
- package/esm/icon/icon-constants.js +31 -0
- package/esm/icon/icon-foundation.d.ts +58 -0
- package/esm/icon/icon-foundation.js +187 -0
- package/esm/icon/icon-registry.d.ts +53 -0
- package/esm/icon/icon-registry.js +94 -0
- package/esm/icon/icon-utils.d.ts +12 -0
- package/esm/icon/icon-utils.js +66 -0
- package/esm/icon/icon.d.ts +46 -0
- package/esm/icon/icon.js +89 -0
- package/esm/icon/index.d.ts +13 -0
- package/esm/icon/index.js +23 -0
- package/esm/icon-button/icon-button-component-delegate.d.ts +31 -0
- package/esm/icon-button/icon-button-component-delegate.js +68 -0
- package/esm/icon-button/icon-button-constants.d.ts +30 -0
- package/esm/icon-button/icon-button-constants.js +43 -0
- package/esm/icon-button/icon-button.d.ts +57 -0
- package/esm/icon-button/icon-button.js +219 -0
- package/esm/icon-button/index.d.ts +9 -0
- package/esm/icon-button/index.js +13 -0
- package/esm/index.d.ts +70 -0
- package/esm/index.js +212 -0
- package/esm/inline-message/index.d.ts +8 -0
- package/esm/inline-message/index.js +12 -0
- package/esm/inline-message/inline-message-constants.d.ts +11 -0
- package/esm/inline-message/inline-message-constants.js +14 -0
- package/esm/inline-message/inline-message.d.ts +16 -0
- package/esm/inline-message/inline-message.js +23 -0
- package/esm/keyboard-shortcut/index.d.ts +11 -0
- package/esm/keyboard-shortcut/index.js +15 -0
- package/esm/keyboard-shortcut/keyboard-shortcut-adapter.d.ts +44 -0
- package/esm/keyboard-shortcut/keyboard-shortcut-adapter.js +79 -0
- package/esm/keyboard-shortcut/keyboard-shortcut-constants.d.ts +29 -0
- package/esm/keyboard-shortcut/keyboard-shortcut-constants.js +44 -0
- package/esm/keyboard-shortcut/keyboard-shortcut-foundation.d.ts +63 -0
- package/esm/keyboard-shortcut/keyboard-shortcut-foundation.js +165 -0
- package/esm/keyboard-shortcut/keyboard-shortcut-utils.d.ts +16 -0
- package/esm/keyboard-shortcut/keyboard-shortcut-utils.js +61 -0
- package/esm/keyboard-shortcut/keyboard-shortcut.d.ts +45 -0
- package/esm/keyboard-shortcut/keyboard-shortcut.js +93 -0
- package/esm/label-value/index.d.ts +11 -0
- package/esm/label-value/index.js +15 -0
- package/esm/label-value/label-value-adapter.d.ts +24 -0
- package/esm/label-value/label-value-adapter.js +47 -0
- package/esm/label-value/label-value-component-delegate.d.ts +29 -0
- package/esm/label-value/label-value-component-delegate.js +54 -0
- package/esm/label-value/label-value-constants.d.ts +27 -0
- package/esm/label-value/label-value-constants.js +30 -0
- package/esm/label-value/label-value-foundation.d.ts +33 -0
- package/esm/label-value/label-value-foundation.js +80 -0
- package/esm/label-value/label-value.d.ts +34 -0
- package/esm/label-value/label-value.js +65 -0
- package/esm/linear-progress/index.d.ts +8 -0
- package/esm/linear-progress/index.js +12 -0
- package/esm/linear-progress/linear-progress-constants.d.ts +18 -0
- package/esm/linear-progress/linear-progress-constants.js +22 -0
- package/esm/linear-progress/linear-progress.d.ts +44 -0
- package/esm/linear-progress/linear-progress.js +143 -0
- package/esm/list/index.d.ts +7 -0
- package/esm/list/index.js +7 -0
- package/esm/list/list/index.d.ts +10 -0
- package/esm/list/list/index.js +14 -0
- package/esm/list/list/list-adapter.d.ts +61 -0
- package/esm/list/list/list-adapter.js +99 -0
- package/esm/list/list/list-constants.d.ts +18 -0
- package/esm/list/list/list-constants.js +22 -0
- package/esm/list/list/list-foundation.d.ts +48 -0
- package/esm/list/list/list-foundation.js +142 -0
- package/esm/list/list/list.d.ts +38 -0
- package/esm/list/list/list.js +77 -0
- package/esm/list/list-item/index.d.ts +10 -0
- package/esm/list/list-item/index.js +14 -0
- package/esm/list/list-item/list-item-adapter.d.ts +101 -0
- package/esm/list/list-item/list-item-adapter.js +175 -0
- package/esm/list/list-item/list-item-constants.d.ts +57 -0
- package/esm/list/list-item/list-item-constants.js +59 -0
- package/esm/list/list-item/list-item-foundation.d.ts +102 -0
- package/esm/list/list-item/list-item-foundation.js +305 -0
- package/esm/list/list-item/list-item.d.ts +72 -0
- package/esm/list/list-item/list-item.js +168 -0
- package/esm/list-dropdown/cascading-list-dropdown-aware-foundation.d.ts +43 -0
- package/esm/list-dropdown/cascading-list-dropdown-aware-foundation.js +62 -0
- package/esm/list-dropdown/index.d.ts +10 -0
- package/esm/list-dropdown/index.js +10 -0
- package/esm/list-dropdown/list-dropdown-adapter.d.ts +64 -0
- package/esm/list-dropdown/list-dropdown-adapter.js +282 -0
- package/esm/list-dropdown/list-dropdown-aware-foundation.d.ts +40 -0
- package/esm/list-dropdown/list-dropdown-aware-foundation.js +62 -0
- package/esm/list-dropdown/list-dropdown-aware.d.ts +34 -0
- package/esm/list-dropdown/list-dropdown-aware.js +54 -0
- package/esm/list-dropdown/list-dropdown-constants.d.ts +101 -0
- package/esm/list-dropdown/list-dropdown-constants.js +39 -0
- package/esm/list-dropdown/list-dropdown-foundation.d.ts +64 -0
- package/esm/list-dropdown/list-dropdown-foundation.js +224 -0
- package/esm/list-dropdown/list-dropdown-utils.d.ts +35 -0
- package/esm/list-dropdown/list-dropdown-utils.js +347 -0
- package/esm/list-dropdown/list-dropdown.d.ts +63 -0
- package/esm/list-dropdown/list-dropdown.js +86 -0
- package/esm/menu/index.d.ts +10 -0
- package/esm/menu/index.js +14 -0
- package/esm/menu/menu-adapter.d.ts +67 -0
- package/esm/menu/menu-adapter.js +202 -0
- package/esm/menu/menu-constants.d.ts +59 -0
- package/esm/menu/menu-constants.js +48 -0
- package/esm/menu/menu-foundation.d.ts +101 -0
- package/esm/menu/menu-foundation.js +514 -0
- package/esm/menu/menu.d.ts +71 -0
- package/esm/menu/menu.js +136 -0
- package/esm/open-icon/index.d.ts +10 -0
- package/esm/open-icon/index.js +14 -0
- package/esm/open-icon/open-icon-adapter.d.ts +18 -0
- package/esm/open-icon/open-icon-adapter.js +27 -0
- package/esm/open-icon/open-icon-constants.d.ts +20 -0
- package/esm/open-icon/open-icon-constants.js +25 -0
- package/esm/open-icon/open-icon-foundation.d.ts +22 -0
- package/esm/open-icon/open-icon-foundation.js +35 -0
- package/esm/open-icon/open-icon.d.ts +29 -0
- package/esm/open-icon/open-icon.js +55 -0
- package/esm/page-state/index.d.ts +8 -0
- package/esm/page-state/index.js +12 -0
- package/esm/page-state/page-state-constants.d.ts +8 -0
- package/esm/page-state/page-state-constants.js +10 -0
- package/esm/page-state/page-state.d.ts +16 -0
- package/esm/page-state/page-state.js +23 -0
- package/esm/paginator/index.d.ts +10 -0
- package/esm/paginator/index.js +14 -0
- package/esm/paginator/paginator-adapter.d.ts +96 -0
- package/esm/paginator/paginator-adapter.js +149 -0
- package/esm/paginator/paginator-constants.d.ts +74 -0
- package/esm/paginator/paginator-constants.js +75 -0
- package/esm/paginator/paginator-foundation.d.ts +132 -0
- package/esm/paginator/paginator-foundation.js +402 -0
- package/esm/paginator/paginator.d.ts +59 -0
- package/esm/paginator/paginator.js +135 -0
- package/esm/popup/index.d.ts +10 -0
- package/esm/popup/index.js +14 -0
- package/esm/popup/popup-adapter.d.ts +43 -0
- package/esm/popup/popup-adapter.js +136 -0
- package/esm/popup/popup-constants.d.ts +54 -0
- package/esm/popup/popup-constants.js +52 -0
- package/esm/popup/popup-foundation.d.ts +68 -0
- package/esm/popup/popup-foundation.js +249 -0
- package/esm/popup/popup.d.ts +49 -0
- package/esm/popup/popup.js +94 -0
- package/esm/product-icon/index.d.ts +10 -0
- package/esm/product-icon/index.js +14 -0
- package/esm/product-icon/product-icon-adapter.d.ts +27 -0
- package/esm/product-icon/product-icon-adapter.js +50 -0
- package/esm/product-icon/product-icon-constants.d.ts +38 -0
- package/esm/product-icon/product-icon-constants.js +46 -0
- package/esm/product-icon/product-icon-foundation.d.ts +40 -0
- package/esm/product-icon/product-icon-foundation.js +116 -0
- package/esm/product-icon/product-icon.d.ts +32 -0
- package/esm/product-icon/product-icon.js +65 -0
- package/esm/profile-card/index.d.ts +10 -0
- package/esm/profile-card/index.js +14 -0
- package/esm/profile-card/profile-card-adapter.d.ts +46 -0
- package/esm/profile-card/profile-card-adapter.js +81 -0
- package/esm/profile-card/profile-card-constants.d.ts +33 -0
- package/esm/profile-card/profile-card-constants.js +39 -0
- package/esm/profile-card/profile-card-foundation.d.ts +48 -0
- package/esm/profile-card/profile-card-foundation.js +108 -0
- package/esm/profile-card/profile-card.d.ts +38 -0
- package/esm/profile-card/profile-card.js +94 -0
- package/esm/quantity-field/index.d.ts +11 -0
- package/esm/quantity-field/index.js +15 -0
- package/esm/quantity-field/quantity-field-adapter.d.ts +77 -0
- package/esm/quantity-field/quantity-field-adapter.js +225 -0
- package/esm/quantity-field/quantity-field-component-delegate.d.ts +44 -0
- package/esm/quantity-field/quantity-field-component-delegate.js +129 -0
- package/esm/quantity-field/quantity-field-constants.d.ts +35 -0
- package/esm/quantity-field/quantity-field-constants.js +41 -0
- package/esm/quantity-field/quantity-field-foundation.d.ts +36 -0
- package/esm/quantity-field/quantity-field-foundation.js +100 -0
- package/esm/quantity-field/quantity-field.d.ts +29 -0
- package/esm/quantity-field/quantity-field.js +89 -0
- package/esm/radio/index.d.ts +8 -0
- package/esm/radio/index.js +12 -0
- package/esm/radio/radio-adapter.d.ts +70 -0
- package/esm/radio/radio-adapter.js +250 -0
- package/esm/radio/radio-constants.d.ts +30 -0
- package/esm/radio/radio-constants.js +36 -0
- package/esm/radio/radio-foundation.d.ts +31 -0
- package/esm/radio/radio-foundation.js +80 -0
- package/esm/radio/radio.d.ts +31 -0
- package/esm/radio/radio.js +73 -0
- package/esm/ripple/forge-ripple.d.ts +11 -0
- package/esm/ripple/forge-ripple.js +10 -0
- package/esm/ripple/index.d.ts +11 -0
- package/esm/ripple/index.js +15 -0
- package/esm/ripple/ripple-adapter.d.ts +23 -0
- package/esm/ripple/ripple-adapter.js +47 -0
- package/esm/ripple/ripple-constants.d.ts +15 -0
- package/esm/ripple/ripple-constants.js +19 -0
- package/esm/ripple/ripple-foundation.d.ts +30 -0
- package/esm/ripple/ripple-foundation.js +48 -0
- package/esm/ripple/ripple.d.ts +31 -0
- package/esm/ripple/ripple.js +59 -0
- package/esm/scaffold/index.d.ts +8 -0
- package/esm/scaffold/index.js +12 -0
- package/esm/scaffold/scaffold-constants.d.ts +8 -0
- package/esm/scaffold/scaffold-constants.js +10 -0
- package/esm/scaffold/scaffold.d.ts +19 -0
- package/esm/scaffold/scaffold.js +26 -0
- package/esm/select/core/base-select-adapter.d.ts +68 -0
- package/esm/select/core/base-select-adapter.js +167 -0
- package/esm/select/core/base-select-constants.d.ts +28 -0
- package/esm/select/core/base-select-constants.js +22 -0
- package/esm/select/core/base-select-foundation.d.ts +137 -0
- package/esm/select/core/base-select-foundation.js +609 -0
- package/esm/select/core/base-select.d.ts +51 -0
- package/esm/select/core/base-select.js +67 -0
- package/esm/select/core/index.d.ts +10 -0
- package/esm/select/core/index.js +10 -0
- package/esm/select/core/select-utils.d.ts +18 -0
- package/esm/select/core/select-utils.js +27 -0
- package/esm/select/index.d.ts +20 -0
- package/esm/select/index.js +11 -0
- package/esm/select/option/index.d.ts +10 -0
- package/esm/select/option/index.js +14 -0
- package/esm/select/option/option-adapter.d.ts +17 -0
- package/esm/select/option/option-adapter.js +14 -0
- package/esm/select/option/option-constants.d.ts +21 -0
- package/esm/select/option/option-constants.js +24 -0
- package/esm/select/option/option-foundation.d.ts +67 -0
- package/esm/select/option/option-foundation.js +149 -0
- package/esm/select/option/option.d.ts +51 -0
- package/esm/select/option/option.js +122 -0
- package/esm/select/option-group/index.d.ts +8 -0
- package/esm/select/option-group/index.js +12 -0
- package/esm/select/option-group/option-group-constants.d.ts +11 -0
- package/esm/select/option-group/option-group-constants.js +14 -0
- package/esm/select/option-group/option-group.d.ts +26 -0
- package/esm/select/option-group/option-group.js +45 -0
- package/esm/select/select/index.d.ts +10 -0
- package/esm/select/select/index.js +14 -0
- package/esm/select/select/select-adapter.d.ts +85 -0
- package/esm/select/select/select-adapter.js +159 -0
- package/esm/select/select/select-constants.d.ts +37 -0
- package/esm/select/select/select-constants.js +42 -0
- package/esm/select/select/select-foundation.d.ts +96 -0
- package/esm/select/select/select-foundation.js +338 -0
- package/esm/select/select/select.d.ts +54 -0
- package/esm/select/select/select.js +129 -0
- package/esm/select/select-component-delegate.d.ts +30 -0
- package/esm/select/select-component-delegate.js +62 -0
- package/esm/select/select-dropdown/index.d.ts +10 -0
- package/esm/select/select-dropdown/index.js +14 -0
- package/esm/select/select-dropdown/select-dropdown-adapter.d.ts +36 -0
- package/esm/select/select-dropdown/select-dropdown-adapter.js +123 -0
- package/esm/select/select-dropdown/select-dropdown-constants.d.ts +16 -0
- package/esm/select/select-dropdown/select-dropdown-constants.js +21 -0
- package/esm/select/select-dropdown/select-dropdown-foundation.d.ts +35 -0
- package/esm/select/select-dropdown/select-dropdown-foundation.js +88 -0
- package/esm/select/select-dropdown/select-dropdown.d.ts +31 -0
- package/esm/select/select-dropdown/select-dropdown.js +83 -0
- package/esm/skeleton/index.d.ts +8 -0
- package/esm/skeleton/index.js +12 -0
- package/esm/skeleton/skeleton-constants.d.ts +8 -0
- package/esm/skeleton/skeleton-constants.js +10 -0
- package/esm/skeleton/skeleton.d.ts +16 -0
- package/esm/skeleton/skeleton.js +23 -0
- package/esm/slider/index.d.ts +9 -0
- package/esm/slider/index.js +13 -0
- package/esm/slider/slider-component-delegate.d.ts +27 -0
- package/esm/slider/slider-component-delegate.js +42 -0
- package/esm/slider/slider-constants.d.ts +41 -0
- package/esm/slider/slider-constants.js +38 -0
- package/esm/slider/slider.d.ts +92 -0
- package/esm/slider/slider.js +298 -0
- package/esm/stepper/core/stepper-utils.d.ts +51 -0
- package/esm/stepper/core/stepper-utils.js +139 -0
- package/esm/stepper/index.d.ts +7 -0
- package/esm/stepper/index.js +7 -0
- package/esm/stepper/step/index.d.ts +10 -0
- package/esm/stepper/step/index.js +14 -0
- package/esm/stepper/step/step-adapter.d.ts +76 -0
- package/esm/stepper/step/step-adapter.js +161 -0
- package/esm/stepper/step/step-constants.d.ts +76 -0
- package/esm/stepper/step/step-constants.js +82 -0
- package/esm/stepper/step/step-foundation.d.ts +78 -0
- package/esm/stepper/step/step-foundation.js +248 -0
- package/esm/stepper/step/step.d.ts +49 -0
- package/esm/stepper/step/step.js +127 -0
- package/esm/stepper/stepper/index.d.ts +10 -0
- package/esm/stepper/stepper/index.js +14 -0
- package/esm/stepper/stepper/stepper-adapter.d.ts +67 -0
- package/esm/stepper/stepper/stepper-adapter.js +148 -0
- package/esm/stepper/stepper/stepper-constants.d.ts +77 -0
- package/esm/stepper/stepper/stepper-constants.js +79 -0
- package/esm/stepper/stepper/stepper-foundation.d.ts +76 -0
- package/esm/stepper/stepper/stepper-foundation.js +292 -0
- package/esm/stepper/stepper/stepper.d.ts +44 -0
- package/esm/stepper/stepper/stepper.js +95 -0
- package/esm/switch/index.d.ts +9 -0
- package/esm/switch/index.js +13 -0
- package/esm/switch/switch-component-delegate.d.ts +32 -0
- package/esm/switch/switch-component-delegate.js +70 -0
- package/esm/switch/switch-constants.d.ts +26 -0
- package/esm/switch/switch-constants.js +31 -0
- package/esm/switch/switch.d.ts +53 -0
- package/esm/switch/switch.js +155 -0
- package/esm/table/index.d.ts +12 -0
- package/esm/table/index.js +16 -0
- package/esm/table/multi-sort-manager.d.ts +18 -0
- package/esm/table/multi-sort-manager.js +67 -0
- package/esm/table/table-adapter.d.ts +80 -0
- package/esm/table/table-adapter.js +120 -0
- package/esm/table/table-constants.d.ts +104 -0
- package/esm/table/table-constants.js +115 -0
- package/esm/table/table-foundation.d.ts +271 -0
- package/esm/table/table-foundation.js +918 -0
- package/esm/table/table-row.d.ts +13 -0
- package/esm/table/table-row.js +14 -0
- package/esm/table/table-utils.d.ts +389 -0
- package/esm/table/table-utils.js +1415 -0
- package/esm/table/table.d.ts +182 -0
- package/esm/table/table.js +290 -0
- package/esm/table/types.d.ts +157 -0
- package/esm/table/types.js +26 -0
- package/esm/tabs/index.d.ts +7 -0
- package/esm/tabs/index.js +7 -0
- package/esm/tabs/tab/index.d.ts +10 -0
- package/esm/tabs/tab/index.js +14 -0
- package/esm/tabs/tab/tab-adapter.d.ts +54 -0
- package/esm/tabs/tab/tab-adapter.js +103 -0
- package/esm/tabs/tab/tab-constants.d.ts +32 -0
- package/esm/tabs/tab/tab-constants.js +32 -0
- package/esm/tabs/tab/tab-foundation.d.ts +43 -0
- package/esm/tabs/tab/tab-foundation.js +98 -0
- package/esm/tabs/tab/tab.d.ts +42 -0
- package/esm/tabs/tab/tab.js +79 -0
- package/esm/tabs/tab-bar/index.d.ts +10 -0
- package/esm/tabs/tab-bar/index.js +14 -0
- package/esm/tabs/tab-bar/tab-bar-adapter.d.ts +98 -0
- package/esm/tabs/tab-bar/tab-bar-adapter.js +223 -0
- package/esm/tabs/tab-bar/tab-bar-constants.d.ts +64 -0
- package/esm/tabs/tab-bar/tab-bar-constants.js +79 -0
- package/esm/tabs/tab-bar/tab-bar-foundation.d.ts +96 -0
- package/esm/tabs/tab-bar/tab-bar-foundation.js +385 -0
- package/esm/tabs/tab-bar/tab-bar.d.ts +64 -0
- package/esm/tabs/tab-bar/tab-bar.js +123 -0
- package/esm/text-field/index.d.ts +11 -0
- package/esm/text-field/index.js +15 -0
- package/esm/text-field/text-field-adapter.d.ts +34 -0
- package/esm/text-field/text-field-adapter.js +109 -0
- package/esm/text-field/text-field-component-delegate.d.ts +45 -0
- package/esm/text-field/text-field-component-delegate.js +125 -0
- package/esm/text-field/text-field-constants.d.ts +21 -0
- package/esm/text-field/text-field-constants.js +25 -0
- package/esm/text-field/text-field-foundation.d.ts +14 -0
- package/esm/text-field/text-field-foundation.js +16 -0
- package/esm/text-field/text-field.d.ts +17 -0
- package/esm/text-field/text-field.js +26 -0
- package/esm/theme/color-constants.d.ts +313 -0
- package/esm/theme/color-constants.js +363 -0
- package/esm/theme/index.d.ts +7 -0
- package/esm/theme/index.js +7 -0
- package/esm/theme/theme-utils.d.ts +9 -0
- package/esm/theme/theme-utils.js +68 -0
- package/esm/time-picker/index.d.ts +12 -0
- package/esm/time-picker/index.js +16 -0
- package/esm/time-picker/time-picker-adapter.d.ts +80 -0
- package/esm/time-picker/time-picker-adapter.js +208 -0
- package/esm/time-picker/time-picker-component-delegate.d.ts +33 -0
- package/esm/time-picker/time-picker-component-delegate.js +68 -0
- package/esm/time-picker/time-picker-constants.d.ts +59 -0
- package/esm/time-picker/time-picker-constants.js +48 -0
- package/esm/time-picker/time-picker-foundation.d.ts +146 -0
- package/esm/time-picker/time-picker-foundation.js +814 -0
- package/esm/time-picker/time-picker-utils.d.ts +25 -0
- package/esm/time-picker/time-picker-utils.js +122 -0
- package/esm/time-picker/time-picker.d.ts +76 -0
- package/esm/time-picker/time-picker.js +198 -0
- package/esm/toast/index.d.ts +10 -0
- package/esm/toast/index.js +14 -0
- package/esm/toast/toast-adapter.d.ts +83 -0
- package/esm/toast/toast-adapter.js +146 -0
- package/esm/toast/toast-constants.d.ts +58 -0
- package/esm/toast/toast-constants.js +63 -0
- package/esm/toast/toast-foundation.d.ts +67 -0
- package/esm/toast/toast-foundation.js +150 -0
- package/esm/toast/toast.d.ts +49 -0
- package/esm/toast/toast.js +93 -0
- package/esm/toolbar/index.d.ts +8 -0
- package/esm/toolbar/index.js +12 -0
- package/esm/toolbar/toolbar-constants.d.ts +25 -0
- package/esm/toolbar/toolbar-constants.js +30 -0
- package/esm/toolbar/toolbar.d.ts +26 -0
- package/esm/toolbar/toolbar.js +58 -0
- package/esm/tooltip/index.d.ts +11 -0
- package/esm/tooltip/index.js +15 -0
- package/esm/tooltip/tooltip-adapter.d.ts +74 -0
- package/esm/tooltip/tooltip-adapter.js +127 -0
- package/esm/tooltip/tooltip-constants.d.ts +35 -0
- package/esm/tooltip/tooltip-constants.js +41 -0
- package/esm/tooltip/tooltip-foundation.d.ts +104 -0
- package/esm/tooltip/tooltip-foundation.js +251 -0
- package/esm/tooltip/tooltip-utils.d.ts +13 -0
- package/esm/tooltip/tooltip-utils.js +53 -0
- package/esm/tooltip/tooltip.d.ts +47 -0
- package/esm/tooltip/tooltip.js +80 -0
- package/esm/utils/color-utils.d.ts +14 -0
- package/esm/utils/color-utils.js +35 -0
- package/esm/utils/index.d.ts +6 -0
- package/esm/utils/index.js +6 -0
- package/esm/view-switcher/index.d.ts +11 -0
- package/esm/view-switcher/index.js +15 -0
- package/esm/view-switcher/view/index.d.ts +8 -0
- package/esm/view-switcher/view/index.js +12 -0
- package/esm/view-switcher/view/view-constants.d.ts +8 -0
- package/esm/view-switcher/view/view-constants.js +10 -0
- package/esm/view-switcher/view/view.d.ts +16 -0
- package/esm/view-switcher/view/view.js +23 -0
- package/esm/view-switcher/view-switcher-adapter.d.ts +93 -0
- package/esm/view-switcher/view-switcher-adapter.js +281 -0
- package/esm/view-switcher/view-switcher-constants.d.ts +38 -0
- package/esm/view-switcher/view-switcher-constants.js +43 -0
- package/esm/view-switcher/view-switcher-foundation.d.ts +38 -0
- package/esm/view-switcher/view-switcher-foundation.js +122 -0
- package/esm/view-switcher/view-switcher.d.ts +40 -0
- package/esm/view-switcher/view-switcher.js +73 -0
- package/package.json +22 -0
- package/styles/app-bar/_mixins.scss +242 -0
- package/styles/app-bar/_variables.scss +34 -0
- package/styles/app-bar/app-bar.scss +22 -0
- package/styles/app-bar/search/_mixins.scss +238 -0
- package/styles/app-bar/search/_variables.scss +18 -0
- package/styles/app-bar/search/app-bar-search.scss +16 -0
- package/styles/autocomplete/autocomplete.scss +12 -0
- package/styles/avatar/_mixins.scss +46 -0
- package/styles/avatar/_variables.scss +16 -0
- package/styles/avatar/avatar.scss +16 -0
- package/styles/backdrop/_mixins.scss +31 -0
- package/styles/backdrop/_variables.scss +12 -0
- package/styles/backdrop/backdrop.scss +32 -0
- package/styles/badge/_mixins.scss +121 -0
- package/styles/badge/_variables.scss +87 -0
- package/styles/badge/badge.scss +40 -0
- package/styles/banner/_mixins.scss +219 -0
- package/styles/banner/_variables.scss +88 -0
- package/styles/banner/banner.scss +24 -0
- package/styles/bottom-sheet/_mixins.scss +98 -0
- package/styles/bottom-sheet/_variables.scss +7 -0
- package/styles/bottom-sheet/bottom-sheet.scss +21 -0
- package/styles/busy-indicator/_mixins.scss +184 -0
- package/styles/busy-indicator/_variables.scss +9 -0
- package/styles/busy-indicator/busy-indicator.scss +23 -0
- package/styles/busy-indicator/forge-busy-indicator.scss +8 -0
- package/styles/button/_button-base.scss +183 -0
- package/styles/button/_button-filled-theme.scss +60 -0
- package/styles/button/_button-filled.scss +71 -0
- package/styles/button/_button-outlined-theme.scss +175 -0
- package/styles/button/_button-outlined.scss +76 -0
- package/styles/button/_button-protected-theme.scss +60 -0
- package/styles/button/_button-protected.scss +88 -0
- package/styles/button/_button-ripple.scss +69 -0
- package/styles/button/_button-shared-theme.scss +447 -0
- package/styles/button/_button-text-theme.scss +60 -0
- package/styles/button/_button-text.scss +57 -0
- package/styles/button/_button.mixins.scss +148 -0
- package/styles/button/_mixins.scss +183 -0
- package/styles/button/forge-button.scss +9 -0
- package/styles/button-toggle/button-toggle/_mixins.scss +98 -0
- package/styles/button-toggle/button-toggle/button-toggle.scss +35 -0
- package/styles/button-toggle/button-toggle-group/_mixins.scss +79 -0
- package/styles/button-toggle/button-toggle-group/button-toggle-group.scss +16 -0
- package/styles/calendar/_mixins.scss +440 -0
- package/styles/calendar/_variables.scss +79 -0
- package/styles/calendar/calendar-menu/_mixins.scss +419 -0
- package/styles/calendar/calendar-menu/_variables.scss +10 -0
- package/styles/calendar/calendar-menu/calendar-menu.scss +22 -0
- package/styles/calendar/calendar.scss +26 -0
- package/styles/card/_mixins.scss +45 -0
- package/styles/card/_variables.scss +9 -0
- package/styles/card/card.scss +16 -0
- package/styles/checkbox/_checkbox-custom-properties.scss +11 -0
- package/styles/checkbox/_checkbox-theme.scss +577 -0
- package/styles/checkbox/_checkbox.mixins.scss +595 -0
- package/styles/checkbox/checkbox.scss +19 -0
- package/styles/chip-field/_base.scss +298 -0
- package/styles/chip-field/_core.scss +25 -0
- package/styles/chip-field/_mixins.scss +26 -0
- package/styles/chip-field/_selector.scss +229 -0
- package/styles/chip-field/_variables.scss +76 -0
- package/styles/chip-field/chip-field.scss +16 -0
- package/styles/chips/chip/_mixins.scss +277 -0
- package/styles/chips/chip/_variables.scss +7 -0
- package/styles/chips/chip/chip.scss +22 -0
- package/styles/chips/chip-set/_mixins.scss +40 -0
- package/styles/chips/chip-set/_variables.scss +6 -0
- package/styles/chips/chip-set/chip-set.scss +16 -0
- package/styles/circular-progress/_keyframes.scss +185 -0
- package/styles/circular-progress/_mixins.scss +320 -0
- package/styles/circular-progress/_variables.scss +50 -0
- package/styles/circular-progress/circular-progress.scss +9 -0
- package/styles/color-picker/_mixins.scss +231 -0
- package/styles/color-picker/_variables.scss +6 -0
- package/styles/color-picker/color-picker.scss +21 -0
- package/styles/date-picker/date-picker.scss +12 -0
- package/styles/date-range-picker/date-range-picker.scss +12 -0
- package/styles/dialog/_mixins.scss +199 -0
- package/styles/dialog/_variables.scss +22 -0
- package/styles/dialog/dialog.scss +16 -0
- package/styles/dialog/forge-dialog-utils.scss +31 -0
- package/styles/dialog/forge-dialog.scss +8 -0
- package/styles/divider/_mixins.scss +47 -0
- package/styles/divider/_variables.scss +7 -0
- package/styles/divider/divider.scss +31 -0
- package/styles/drawer/base/_mixins.scss +137 -0
- package/styles/drawer/base/_variables.scss +11 -0
- package/styles/drawer/drawer/_mixins.scss +10 -0
- package/styles/drawer/drawer/_variables.scss +12 -0
- package/styles/drawer/drawer/drawer.scss +25 -0
- package/styles/drawer/mini-drawer/_mixins.scss +66 -0
- package/styles/drawer/mini-drawer/_variables.scss +7 -0
- package/styles/drawer/mini-drawer/mini-drawer.scss +40 -0
- package/styles/drawer/modal-drawer/_mixins.scss +69 -0
- package/styles/drawer/modal-drawer/modal-drawer.scss +8 -0
- package/styles/expansion-panel/_mixins.scss +87 -0
- package/styles/expansion-panel/expansion-panel.scss +16 -0
- package/styles/expansion-panel/forge-expansion-panel.scss +16 -0
- package/styles/field/_base.scss +622 -0
- package/styles/field/_core.scss +61 -0
- package/styles/field/_selector.scss +560 -0
- package/styles/field/_utils.scss +48 -0
- package/styles/field/_variables.scss +126 -0
- package/styles/file-picker/_mixins.scss +153 -0
- package/styles/file-picker/_variables.scss +8 -0
- package/styles/file-picker/file-picker.scss +16 -0
- package/styles/floating-action-button/_extended-fab-theme.scss +238 -0
- package/styles/floating-action-button/_fab-custom-properties.scss +29 -0
- package/styles/floating-action-button/_fab-theme.scss +541 -0
- package/styles/floating-action-button/_fab.mixins.scss +351 -0
- package/styles/floating-action-button/forge-floating-action-button.scss +16 -0
- package/styles/floating-label/_mixins.scss +291 -0
- package/styles/floating-label/_variables.scss +15 -0
- package/styles/floating-label/forge-floating-label.scss +8 -0
- package/styles/forge-core.scss +14 -0
- package/styles/forge-dark.scss +10 -0
- package/styles/forge.scss +26 -0
- package/styles/form-field/_mixins.scss +71 -0
- package/styles/form-field/forge-form-field.scss +8 -0
- package/styles/icon/_mixins.scss +37 -0
- package/styles/icon/_variables.scss +10 -0
- package/styles/icon/icon.scss +26 -0
- package/styles/icon-button/_mixins.scss +345 -0
- package/styles/icon-button/_variables.scss +42 -0
- package/styles/icon-button/forge-icon-button.scss +8 -0
- package/styles/inline-message/_mixins.scss +82 -0
- package/styles/inline-message/_variables.scss +67 -0
- package/styles/inline-message/inline-message.scss +18 -0
- package/styles/label-value/_base.scss +252 -0
- package/styles/label-value/_core.scss +15 -0
- package/styles/label-value/_mixins.scss +15 -0
- package/styles/label-value/_selector.scss +167 -0
- package/styles/label-value/_variables.scss +37 -0
- package/styles/label-value/label-value.scss +17 -0
- package/styles/linear-progress/_mixins.scss +11 -0
- package/styles/linear-progress/_variables.scss +15 -0
- package/styles/linear-progress/linear-progress.scss +40 -0
- package/styles/list/list/_mixins.scss +45 -0
- package/styles/list/list/list.scss +16 -0
- package/styles/list/list-item/_mixins.scss +392 -0
- package/styles/list/list-item/_variables.scss +25 -0
- package/styles/list/list-item/list-item.scss +30 -0
- package/styles/menu/menu.scss +12 -0
- package/styles/open-icon/_mixins.scss +39 -0
- package/styles/open-icon/_variables.scss +8 -0
- package/styles/open-icon/open-icon.scss +16 -0
- package/styles/page-state/_mixins.scss +123 -0
- package/styles/page-state/_variables.scss +9 -0
- package/styles/page-state/page-state.scss +17 -0
- package/styles/paginator/_mixins.scss +136 -0
- package/styles/paginator/_variables.scss +6 -0
- package/styles/paginator/paginator.scss +21 -0
- package/styles/popup/_mixins.scss +86 -0
- package/styles/popup/_variables.scss +7 -0
- package/styles/popup/forge-popup.scss +8 -0
- package/styles/popup/popup.scss +16 -0
- package/styles/product-icon/_mixins.scss +49 -0
- package/styles/product-icon/_variables.scss +7 -0
- package/styles/product-icon/product-icon.scss +16 -0
- package/styles/profile-card/_mixins.scss +83 -0
- package/styles/profile-card/profile-card.scss +22 -0
- package/styles/quantity-field/_mixins.scss +116 -0
- package/styles/quantity-field/forge-quantity-field.scss +18 -0
- package/styles/quantity-field/quantity-field.scss +16 -0
- package/styles/radio/_mixins.scss +309 -0
- package/styles/radio/_radio-theme.scss +314 -0
- package/styles/radio/radio.scss +19 -0
- package/styles/ripple/forge-ripple.scss +17 -0
- package/styles/scaffold/_mixins.scss +194 -0
- package/styles/scaffold/forge-scaffold.scss +43 -0
- package/styles/scaffold/scaffold.scss +21 -0
- package/styles/select/select/_base.scss +84 -0
- package/styles/select/select/_core.scss +23 -0
- package/styles/select/select/_mixins.scss +25 -0
- package/styles/select/select/_selector.scss +88 -0
- package/styles/select/select/_variables.scss +16 -0
- package/styles/select/select/select.scss +17 -0
- package/styles/select/select-dropdown/select-dropdown.scss +8 -0
- package/styles/skeleton/_mixins.scss +132 -0
- package/styles/skeleton/_variables.scss +45 -0
- package/styles/skeleton/skeleton.scss +18 -0
- package/styles/slider/slider.scss +33 -0
- package/styles/stepper/step/_mixins.scss +416 -0
- package/styles/stepper/step/_variables.scss +21 -0
- package/styles/stepper/step/step.scss +164 -0
- package/styles/stepper/stepper/_mixins.scss +113 -0
- package/styles/stepper/stepper/stepper.scss +22 -0
- package/styles/switch/_switch-mixins.scss +301 -0
- package/styles/switch/_switch-theme.scss +701 -0
- package/styles/switch/switch.scss +80 -0
- package/styles/table/_mixins.scss +527 -0
- package/styles/table/_variables.scss +57 -0
- package/styles/table/forge-table.scss +12 -0
- package/styles/tabs/tab/_mixins.scss +165 -0
- package/styles/tabs/tab/_variables.scss +9 -0
- package/styles/tabs/tab/tab.scss +30 -0
- package/styles/tabs/tab-bar/_mixins.scss +78 -0
- package/styles/tabs/tab-bar/tab-bar.scss +19 -0
- package/styles/text-field/_base.scss +76 -0
- package/styles/text-field/_core.scss +19 -0
- package/styles/text-field/_mixins.scss +28 -0
- package/styles/text-field/_selector.scss +57 -0
- package/styles/text-field/_variables.scss +20 -0
- package/styles/text-field/text-field.scss +17 -0
- package/styles/theme/_custom-properties.scss +311 -0
- package/styles/theme/_icon-mixins.scss +62 -0
- package/styles/theme/_index.scss +7 -0
- package/styles/theme/_keys.scss +477 -0
- package/styles/theme/_theme-dark.scss +47 -0
- package/styles/theme/_theme-utils.scss +23 -0
- package/styles/theme/_theme-values.scss +244 -0
- package/styles/theme/_theme.scss +353 -0
- package/styles/theme/forge-material-icons.scss +19 -0
- package/styles/theme/forge-theme.scss +9 -0
- package/styles/time-picker/time-picker.scss +12 -0
- package/styles/toast/_mixins.scss +242 -0
- package/styles/toast/_variables.scss +52 -0
- package/styles/toast/toast.scss +18 -0
- package/styles/toolbar/_mixins.scss +79 -0
- package/styles/toolbar/_variables.scss +10 -0
- package/styles/toolbar/toolbar.scss +28 -0
- package/styles/tooltip/_mixins.scss +98 -0
- package/styles/tooltip/_variables.scss +18 -0
- package/styles/tooltip/forge-tooltip.scss +12 -0
- package/styles/typography/_index.scss +7 -0
- package/styles/typography/_mixins.scss +93 -0
- package/styles/typography/_variables.scss +100 -0
- package/styles/typography/forge-form.scss +67 -0
- package/styles/typography/forge-typography.scss +9 -0
- package/styles/utils/_functions-grid.scss +8 -0
- package/styles/utils/_mixins-animation.scss +37 -0
- package/styles/utils/_mixins-core.scss +18 -0
- package/styles/utils/_mixins-flex.scss +53 -0
- package/styles/utils/_mixins-grid.scss +29 -0
- package/styles/utils/_mixins-media.scss +38 -0
- package/styles/utils/_mixins.scss +45 -0
- package/styles/utils/_variables-flex.scss +30 -0
- package/styles/utils/_variables-grid.scss +9 -0
- package/styles/utils/_variables-media.scss +11 -0
- package/styles/utils/forge-flex.scss +30 -0
- package/styles/utils/forge-grid.scss +54 -0
- package/styles/utils/forge-utils.scss +45 -0
- package/styles/view-switcher/_mixins.scss +49 -0
- package/styles/view-switcher/_variables.scss +6 -0
- package/styles/view-switcher/view/view.scss +12 -0
- package/styles/view-switcher/view-switcher.scss +32 -0
|
@@ -0,0 +1,2218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Tyler Technologies, Inc.
|
|
4
|
+
* License: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { isArray, isDefined, isValidDate } from '@tylertech/forge-core';
|
|
7
|
+
import { CALENDAR_CONSTANTS, CalendarMonthFocus, DayOfWeek } from './calendar-constants';
|
|
8
|
+
import { isDisabled, isSelected, getAllYearOptions, getDateRangeFromDates, getDatesFromDateRange, getDatesInRange, getEventDescriptions, getEventsOnDate, getFirstDateOfWeek, getIndexOfDate, getLastDateOfWeek, getMinAndMaxDates, getMonthDates, getMonthOptions, getMultipleFromRange, getSortedDaysOfWeek, getYearOptions, isInMonth, isToday, parseYearRange, sortDates, coerceDateFromValue, shouldHandleEvent } from './calendar-utils';
|
|
9
|
+
import { getFirstDayOfWeekForLocale, getLocalizedMonth, getLocalizedYear, getWeekendDaysForLocale, isRtlLocale } from './calendar-locale-utils';
|
|
10
|
+
import { eventIncludesDate } from './calendar-dom-utils';
|
|
11
|
+
import { DateRange } from './core/date-range';
|
|
12
|
+
import { getLastDateOfMonth, getMonthLength, isSameDate } from '../core/utils/date-utils';
|
|
13
|
+
export class CalendarFoundation {
|
|
14
|
+
constructor(_adapter) {
|
|
15
|
+
this._adapter = _adapter;
|
|
16
|
+
// Dates
|
|
17
|
+
this._dates = [];
|
|
18
|
+
this._month = new Date().getMonth();
|
|
19
|
+
this._year = new Date().getFullYear();
|
|
20
|
+
this._showToday = true;
|
|
21
|
+
this._showOtherMonths = false;
|
|
22
|
+
this._fixedHeight = false;
|
|
23
|
+
this._events = [];
|
|
24
|
+
// Selection
|
|
25
|
+
this._value = [];
|
|
26
|
+
this._mode = 'single';
|
|
27
|
+
this._readonly = false;
|
|
28
|
+
this._selectionFollowsMonth = false;
|
|
29
|
+
this._rangeSelectionState = 'none';
|
|
30
|
+
this._allowSingleDateRange = true;
|
|
31
|
+
// Disabled dates
|
|
32
|
+
this._min = null;
|
|
33
|
+
this._max = null;
|
|
34
|
+
this._minAttribute = null;
|
|
35
|
+
this._maxAttribute = null;
|
|
36
|
+
this._disabledDates = [];
|
|
37
|
+
this._disabledDaysOfWeek = [];
|
|
38
|
+
this._constrainToEnabled = true;
|
|
39
|
+
// Header and footer
|
|
40
|
+
this._showHeader = true;
|
|
41
|
+
this._clearButton = false;
|
|
42
|
+
this._todayButton = false;
|
|
43
|
+
// Menu
|
|
44
|
+
this._view = 'date';
|
|
45
|
+
this._menuAnimation = 'scale';
|
|
46
|
+
this._menuYear = null;
|
|
47
|
+
this._listYears = true;
|
|
48
|
+
this._menuIncludedYear = new Date().getFullYear();
|
|
49
|
+
this._menuYearsInView = null;
|
|
50
|
+
this._yearRange = `-${CALENDAR_CONSTANTS.numbers.DEFAULT_MIN_YEAR_OFFSET}:+${CALENDAR_CONSTANTS.numbers.DEFAULT_MAX_YEAR_OFFSET}`;
|
|
51
|
+
this._weekendDays = null;
|
|
52
|
+
this._localeFirstDayOfWeek = DayOfWeek.Sunday;
|
|
53
|
+
this._localeWeekendDays = [];
|
|
54
|
+
this._rtl = false;
|
|
55
|
+
// Core
|
|
56
|
+
this._preventFocus = false;
|
|
57
|
+
this._isInitialized = false;
|
|
58
|
+
this._clearButtonListener = () => this._onClearClicked();
|
|
59
|
+
this._dateClickListener = evt => this._onDateClick(evt);
|
|
60
|
+
this._keydownListener = evt => this._onKeydown(evt);
|
|
61
|
+
this._hoverListener = evt => this._onHover(evt);
|
|
62
|
+
this._menuFocusChangeListener = evt => this._onMenuFocusChange(evt);
|
|
63
|
+
this._menuListener = evt => this._onMenuSelect(evt);
|
|
64
|
+
this._monthButtonListener = () => this._onMonthButtonClicked();
|
|
65
|
+
this._nextButtonListener = () => this._onNextButtonClicked();
|
|
66
|
+
this._preventFocusListener = evt => evt.preventDefault();
|
|
67
|
+
this._previousButtonListener = () => this._onPreviousButtonClicked();
|
|
68
|
+
this._todayButtonListener = () => this._onTodayClicked();
|
|
69
|
+
this._yearButtonListener = () => this._onYearButtonClicked();
|
|
70
|
+
}
|
|
71
|
+
initialize() {
|
|
72
|
+
this._adapter.registerMenuListener(this._menuListener);
|
|
73
|
+
this._adapter.registerMenuFocusChangeEventListener(this._menuFocusChangeListener);
|
|
74
|
+
this._adapter.registerKeydownListener(this._keydownListener);
|
|
75
|
+
this._applyMin();
|
|
76
|
+
this._applyMax();
|
|
77
|
+
this._applyFixedHeight();
|
|
78
|
+
this._applyReadOnly();
|
|
79
|
+
this._applyShowToday();
|
|
80
|
+
this._applyPreventFocus();
|
|
81
|
+
this._applyShowHeader();
|
|
82
|
+
this._applyMonth();
|
|
83
|
+
this._applyYear();
|
|
84
|
+
this._applyListYears();
|
|
85
|
+
this._applyMenuAnimation();
|
|
86
|
+
this._applyLocale();
|
|
87
|
+
this._applyClearButton();
|
|
88
|
+
this._applyTodayButton();
|
|
89
|
+
this._applyFirstDayOfWeek();
|
|
90
|
+
this._applyShowOtherMonths();
|
|
91
|
+
this._createDateView();
|
|
92
|
+
this._applyConstrainToEnabled();
|
|
93
|
+
this._applyAllowSingleDateRange();
|
|
94
|
+
this._applyMode();
|
|
95
|
+
this._applyYearRange();
|
|
96
|
+
this._applySelectionFollowsMonth();
|
|
97
|
+
this._isInitialized = true;
|
|
98
|
+
}
|
|
99
|
+
disconnect() {
|
|
100
|
+
this._isInitialized = false;
|
|
101
|
+
}
|
|
102
|
+
_onMonthButtonClicked() {
|
|
103
|
+
this._toggleMonthMenu();
|
|
104
|
+
}
|
|
105
|
+
_toggleMonthMenu(setFocus = false) {
|
|
106
|
+
if (this._view !== 'month') {
|
|
107
|
+
this._openMonthMenu(setFocus);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this._closeMenu(false, setFocus);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
_onYearButtonClicked() {
|
|
114
|
+
this._toggleYearMenu();
|
|
115
|
+
}
|
|
116
|
+
_toggleYearMenu(setFocus = false) {
|
|
117
|
+
if (this._view !== 'year') {
|
|
118
|
+
this._openYearMenu(setFocus);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this._closeMenu(false, setFocus);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
_onMenuFocusChange(evt) {
|
|
125
|
+
this._emitFocusChangeEvent(evt.detail);
|
|
126
|
+
}
|
|
127
|
+
_onMenuSelect(evt) {
|
|
128
|
+
switch (this._view) {
|
|
129
|
+
case 'month':
|
|
130
|
+
this._onMonthSelected(evt.detail);
|
|
131
|
+
break;
|
|
132
|
+
case 'year':
|
|
133
|
+
this._onYearSelected(evt.detail);
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
_onNextButtonClicked() {
|
|
138
|
+
if (this._view === 'date') {
|
|
139
|
+
this._goToNextMonth();
|
|
140
|
+
this._setFocusInMonth(CalendarMonthFocus.First, false);
|
|
141
|
+
}
|
|
142
|
+
else if (this._view === 'month') {
|
|
143
|
+
this._goToNextYear();
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
this._goToNextSetOfYears();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
_onPreviousButtonClicked() {
|
|
150
|
+
if (this._view === 'date') {
|
|
151
|
+
this._goToPreviousMonth();
|
|
152
|
+
this._setFocusInMonth(CalendarMonthFocus.Last, false);
|
|
153
|
+
}
|
|
154
|
+
else if (this._view === 'month') {
|
|
155
|
+
this._goToPreviousYear();
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
this._goToPreviousSetOfYears();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
_onHover(evt) {
|
|
162
|
+
if (this._mode === 'range') {
|
|
163
|
+
const element = eventIncludesDate(evt, false);
|
|
164
|
+
if (!element) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const date = new Date(Date.parse(element.getAttribute(CALENDAR_CONSTANTS.attributes.DATA_DATE)));
|
|
168
|
+
if (isInMonth(date, this._month, this._year)) {
|
|
169
|
+
this._setRangePreview(date);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
_onDateClick(evt) {
|
|
174
|
+
const element = eventIncludesDate(evt, false);
|
|
175
|
+
if (!element) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const dateString = element.getAttribute(CALENDAR_CONSTANTS.attributes.DATA_DATE);
|
|
179
|
+
if (!dateString) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const date = new Date(dateString);
|
|
183
|
+
if (isInMonth(date, this._month, this._year)) {
|
|
184
|
+
// Move the tab index to this date
|
|
185
|
+
this._focusedDate = date;
|
|
186
|
+
this._beforeDateSelected(date);
|
|
187
|
+
}
|
|
188
|
+
this._resumeTabindexOnDate(false);
|
|
189
|
+
}
|
|
190
|
+
_onKeydown(evt) {
|
|
191
|
+
switch (evt.key) {
|
|
192
|
+
case 'ArrowLeft':
|
|
193
|
+
case 'ArrowRight':
|
|
194
|
+
case 'ArrowUp':
|
|
195
|
+
case 'ArrowDown':
|
|
196
|
+
this._handleArrowKey(evt);
|
|
197
|
+
break;
|
|
198
|
+
case 'Home':
|
|
199
|
+
case 'End':
|
|
200
|
+
case 'PageUp':
|
|
201
|
+
case 'PageDown':
|
|
202
|
+
this._handleNavigationKey(evt);
|
|
203
|
+
break;
|
|
204
|
+
case ' ':
|
|
205
|
+
case 'Enter':
|
|
206
|
+
this._handleEnterOrSpaceKey(evt);
|
|
207
|
+
break;
|
|
208
|
+
case 'm':
|
|
209
|
+
case 'M':
|
|
210
|
+
evt.preventDefault();
|
|
211
|
+
this._toggleMonthMenu(true);
|
|
212
|
+
break;
|
|
213
|
+
case 'y':
|
|
214
|
+
case 'Y':
|
|
215
|
+
evt.preventDefault();
|
|
216
|
+
this._toggleYearMenu(true);
|
|
217
|
+
break;
|
|
218
|
+
case 't':
|
|
219
|
+
case 'T':
|
|
220
|
+
case 'n':
|
|
221
|
+
case 'N':
|
|
222
|
+
evt.preventDefault();
|
|
223
|
+
this.today();
|
|
224
|
+
break;
|
|
225
|
+
case 'Delete':
|
|
226
|
+
case 'Backspace':
|
|
227
|
+
evt.preventDefault();
|
|
228
|
+
this._deselectAllDates();
|
|
229
|
+
break;
|
|
230
|
+
case 'Escape':
|
|
231
|
+
if (this._view !== 'date') {
|
|
232
|
+
evt.preventDefault();
|
|
233
|
+
this._closeMenu(false, true);
|
|
234
|
+
}
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Runs locale specific logic to handle focus on an arrow key event.
|
|
240
|
+
* @param evt A keyboard event containing an arrow key
|
|
241
|
+
*/
|
|
242
|
+
_handleArrowKey(evt) {
|
|
243
|
+
if (!shouldHandleEvent(evt, this._view, this._preventFocus)) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
evt.preventDefault();
|
|
247
|
+
let direction;
|
|
248
|
+
switch (evt.key) {
|
|
249
|
+
case 'ArrowLeft':
|
|
250
|
+
direction = this._rtl ? 'next' : 'previous';
|
|
251
|
+
break;
|
|
252
|
+
case 'ArrowRight':
|
|
253
|
+
direction = this._rtl ? 'previous' : 'next';
|
|
254
|
+
break;
|
|
255
|
+
case 'ArrowUp':
|
|
256
|
+
direction = 'up';
|
|
257
|
+
break;
|
|
258
|
+
case 'ArrowDown':
|
|
259
|
+
direction = 'down';
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
switch (direction) {
|
|
263
|
+
case 'previous':
|
|
264
|
+
if (this._view === 'date') {
|
|
265
|
+
this._moveFocusToPreviousDate(true);
|
|
266
|
+
}
|
|
267
|
+
else if (!this._adapter.moveMenuFocusBackward() && this._canGoBackward()) {
|
|
268
|
+
if (this._view === 'month') {
|
|
269
|
+
this._goToPreviousYear(true);
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
this._goToPreviousSetOfYears(true);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
break;
|
|
276
|
+
case 'next':
|
|
277
|
+
if (this._view === 'date') {
|
|
278
|
+
this._moveFocusToNextDate(true);
|
|
279
|
+
}
|
|
280
|
+
else if (!this._adapter.moveMenuFocusForward() && this._canGoForward()) {
|
|
281
|
+
if (this._view === 'month') {
|
|
282
|
+
this._goToNextYear(true);
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
this._goToNextSetOfYears(true);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
break;
|
|
289
|
+
case 'up':
|
|
290
|
+
if (this._view === 'date') {
|
|
291
|
+
this._moveFocusToPreviousWeek(true);
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
this._adapter.moveMenuFocusUp();
|
|
295
|
+
}
|
|
296
|
+
break;
|
|
297
|
+
case 'down':
|
|
298
|
+
if (this._view === 'date') {
|
|
299
|
+
this._moveFocusToNextWeek(true);
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
this._adapter.moveMenuFocusDown();
|
|
303
|
+
}
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
if (this._mode === 'range') {
|
|
307
|
+
this._setRangePreview(this._focusedDate);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
/** Moves between months and years if allowed.
|
|
311
|
+
* @param evt A keyboard evt containing the page up, page down, home, or end key
|
|
312
|
+
*/
|
|
313
|
+
_handleNavigationKey(evt) {
|
|
314
|
+
evt.preventDefault();
|
|
315
|
+
switch (evt.key) {
|
|
316
|
+
case 'Home':
|
|
317
|
+
if (this._view !== 'date') {
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
if (evt.shiftKey) {
|
|
321
|
+
this._moveFocusToFirstOfMonth(true);
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
this._moveFocusToFirstOfWeek(true);
|
|
325
|
+
}
|
|
326
|
+
break;
|
|
327
|
+
case 'End':
|
|
328
|
+
if (this._view !== 'date') {
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
if (evt.shiftKey) {
|
|
332
|
+
this._moveFocusToLastOfMonth(true);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
this._moveFocusToLastOfWeek(true);
|
|
336
|
+
}
|
|
337
|
+
break;
|
|
338
|
+
case 'PageUp':
|
|
339
|
+
if (this._view === 'date') {
|
|
340
|
+
if (evt.shiftKey) {
|
|
341
|
+
this._moveFocusToPreviousYear(true);
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
this._moveFocusToPreviousMonth(true);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
else if (this._view === 'month' && !evt.shiftKey && this._canGoBackward()) {
|
|
348
|
+
this._goToPreviousYear(true);
|
|
349
|
+
}
|
|
350
|
+
else if (this._view === 'year' && !evt.shiftKey && this._canGoBackward()) {
|
|
351
|
+
this._goToPreviousSetOfYears(true);
|
|
352
|
+
}
|
|
353
|
+
break;
|
|
354
|
+
case 'PageDown':
|
|
355
|
+
if (this._view === 'date') {
|
|
356
|
+
if (evt.shiftKey) {
|
|
357
|
+
this._moveFocusToNextYear(true);
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
this._moveFocusToNextMonth(true);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
else if (this._view === 'month' && !evt.shiftKey && this._canGoForward()) {
|
|
364
|
+
this._goToNextYear(true);
|
|
365
|
+
}
|
|
366
|
+
else if (this._view === 'year' && !evt.shiftKey && this._canGoForward()) {
|
|
367
|
+
this._goToNextSetOfYears(true);
|
|
368
|
+
}
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Selects or deselects the focused date or menu option if allowed.
|
|
374
|
+
* @param evt A keyboard event containing the enter or space key
|
|
375
|
+
*/
|
|
376
|
+
_handleEnterOrSpaceKey(evt) {
|
|
377
|
+
if (!shouldHandleEvent(evt, this._view, this._preventFocus)) {
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
evt.preventDefault();
|
|
381
|
+
switch (this._view) {
|
|
382
|
+
case 'date':
|
|
383
|
+
if (this._readonly) {
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
this._setSelectOnFocusedDate();
|
|
387
|
+
break;
|
|
388
|
+
case 'month':
|
|
389
|
+
case 'year':
|
|
390
|
+
this._adapter.selectFocusedMenuItem();
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
_onMonthSelected(month) {
|
|
395
|
+
const yearChanged = this._year !== this._menuYear;
|
|
396
|
+
if (yearChanged && this._menuYear !== null) {
|
|
397
|
+
this._year = this._menuYear;
|
|
398
|
+
this._setYear();
|
|
399
|
+
}
|
|
400
|
+
this._month = month;
|
|
401
|
+
this._setMonth(true);
|
|
402
|
+
this._trySetValueMonthAndYear(this._month, this._year, 'month');
|
|
403
|
+
this._closeMenu(true);
|
|
404
|
+
}
|
|
405
|
+
_onYearSelected(year) {
|
|
406
|
+
this._year = year;
|
|
407
|
+
this._setYear(true);
|
|
408
|
+
this._trySetValueMonthAndYear(this._month, this._year, 'year');
|
|
409
|
+
this._closeMenu(true);
|
|
410
|
+
}
|
|
411
|
+
_onClearClicked() {
|
|
412
|
+
this.clear();
|
|
413
|
+
}
|
|
414
|
+
_onTodayClicked() {
|
|
415
|
+
this.today();
|
|
416
|
+
}
|
|
417
|
+
/** Attempts to the month and year of the value in single mode, then emits a selection event */
|
|
418
|
+
_trySetValueMonthAndYear(month, year, type = 'date') {
|
|
419
|
+
var _a;
|
|
420
|
+
if (!this.selectionFollowsMonth || this._mode !== 'single' || !((_a = this._value) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
const newDate = new Date(this._value[0]);
|
|
424
|
+
const lastDay = getMonthLength(month, year);
|
|
425
|
+
newDate.setDate(Math.min(newDate.getDate(), lastDay));
|
|
426
|
+
newDate.setFullYear(year);
|
|
427
|
+
newDate.setMonth(month);
|
|
428
|
+
if (isDisabled(newDate, this._getDisabledDateParams())) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
this._beforeDateSelected(newDate, type);
|
|
432
|
+
}
|
|
433
|
+
/** Sets initial date tabindex and focus to today or the first enabled date in view */
|
|
434
|
+
_setInitialDateFocus(setFocus = false) {
|
|
435
|
+
const today = new Date();
|
|
436
|
+
if (isInMonth(today, this._month, this._year) && !isDisabled(today, this._getDisabledDateParams(false))) {
|
|
437
|
+
this._setFocusedDate(today, setFocus);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
const firstDay = new Date(this._year, this._month, 1);
|
|
441
|
+
this._setFocusedDate(this._getNextEnabledDate(firstDay, 1, false, true, true), setFocus);
|
|
442
|
+
}
|
|
443
|
+
/** Attempts to move the tabindex to the most recently focused date, returning whether the date was found in view */
|
|
444
|
+
_resumeTabindexOnDate(setFocus) {
|
|
445
|
+
if (isInMonth(this._focusedDate, this._month, this._year)) {
|
|
446
|
+
this._adapter.setActiveDate(this._focusedDate, setFocus, this._preventFocus);
|
|
447
|
+
this._emitFocusChangeEvent(this._focusedDate);
|
|
448
|
+
return true;
|
|
449
|
+
}
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
/** Moves the tabindex to the next date */
|
|
453
|
+
_moveFocusToNextDate(setFocus) {
|
|
454
|
+
this._setFocusedDate(this._getNextEnabledDate(this._focusedDate), setFocus);
|
|
455
|
+
}
|
|
456
|
+
/** Moves the tabindex to the previous date */
|
|
457
|
+
_moveFocusToPreviousDate(setFocus) {
|
|
458
|
+
this._setFocusedDate(this._getPreviousEnabledDate(this._focusedDate), setFocus);
|
|
459
|
+
}
|
|
460
|
+
/** Moves the tabindex to the next week */
|
|
461
|
+
_moveFocusToNextWeek(setFocus) {
|
|
462
|
+
this._setFocusedDate(this._getNextEnabledDate(this._focusedDate, 7, true), setFocus);
|
|
463
|
+
}
|
|
464
|
+
/** Moves the tabindex to the previous week */
|
|
465
|
+
_moveFocusToPreviousWeek(setFocus) {
|
|
466
|
+
this._setFocusedDate(this._getPreviousEnabledDate(this._focusedDate, 7, true), setFocus);
|
|
467
|
+
}
|
|
468
|
+
/** Moves the tabindex to the first selectable date of the week containing the current tabindex */
|
|
469
|
+
_moveFocusToFirstOfWeek(setFocus) {
|
|
470
|
+
this._setFocusedDate(this._getFirstEnabledDayOfWeek(this._focusedDate, true), setFocus);
|
|
471
|
+
}
|
|
472
|
+
/** Moves the tabindex to the last selectable date of the week containing the current tabindex */
|
|
473
|
+
_moveFocusToLastOfWeek(setFocus) {
|
|
474
|
+
this._setFocusedDate(this._getLastEnabledDayOfWeek(this._focusedDate, true), setFocus);
|
|
475
|
+
}
|
|
476
|
+
/** Moves the tabindex to the first date of the month */
|
|
477
|
+
_moveFocusToFirstOfMonth(setFocus) {
|
|
478
|
+
const firstOfMonth = new Date(this._year, this._month, 1);
|
|
479
|
+
this._setFocusedDate(this._getNextEnabledDate(firstOfMonth, 1, false, true), setFocus);
|
|
480
|
+
}
|
|
481
|
+
/** Moves the tabindex to the last date of the month */
|
|
482
|
+
_moveFocusToLastOfMonth(setFocus) {
|
|
483
|
+
const lastOfMonth = new Date(this._year, this._month + 1, 0);
|
|
484
|
+
this._setFocusedDate(this._getPreviousEnabledDate(lastOfMonth, 1, false, true), setFocus);
|
|
485
|
+
}
|
|
486
|
+
/** Moves the tabindex to the same day and week of the next month */
|
|
487
|
+
_moveFocusToNextMonth(setFocus) {
|
|
488
|
+
const index = getIndexOfDate(this._focusedDate, this._dates);
|
|
489
|
+
const destinationMonth = (this._month + 1) % 12;
|
|
490
|
+
const destinationYear = destinationMonth === 0 ? this._year + 1 : this._year;
|
|
491
|
+
this._setFocusedDate(this._getDateAtIndexInMonth(index, destinationMonth, destinationYear), setFocus);
|
|
492
|
+
}
|
|
493
|
+
/** Moves the tabindex to the same day and week of the previous month */
|
|
494
|
+
_moveFocusToPreviousMonth(setFocus) {
|
|
495
|
+
const index = getIndexOfDate(this._focusedDate, this._dates);
|
|
496
|
+
const destinationMonth = this._month === 0 ? 11 : this._month - 1;
|
|
497
|
+
const destinationYear = destinationMonth === 11 ? this._year - 1 : this._year;
|
|
498
|
+
this._setFocusedDate(this._getDateAtIndexInMonth(index, destinationMonth, destinationYear), setFocus);
|
|
499
|
+
}
|
|
500
|
+
/** Moves the tabindex to the same day, week, and month of the next year */
|
|
501
|
+
_moveFocusToNextYear(setFocus) {
|
|
502
|
+
const index = getIndexOfDate(this._focusedDate, this._dates);
|
|
503
|
+
this._setFocusedDate(this._getDateAtIndexInMonth(index, this._month, this._year + 1), setFocus);
|
|
504
|
+
}
|
|
505
|
+
/** Moves the tabindex to the same day, week, and month of the previous year */
|
|
506
|
+
_moveFocusToPreviousYear(setFocus) {
|
|
507
|
+
const index = getIndexOfDate(this._focusedDate, this._dates);
|
|
508
|
+
this._setFocusedDate(this._getDateAtIndexInMonth(index, this._month, this._year - 1), setFocus);
|
|
509
|
+
}
|
|
510
|
+
/** Sets the focusable date when a new month comes into view */
|
|
511
|
+
_setFocusInMonth(focus, setFocus) {
|
|
512
|
+
switch (focus) {
|
|
513
|
+
case CalendarMonthFocus.First:
|
|
514
|
+
this._moveFocusToFirstOfMonth(setFocus);
|
|
515
|
+
break;
|
|
516
|
+
case CalendarMonthFocus.Last:
|
|
517
|
+
this._moveFocusToLastOfMonth(setFocus);
|
|
518
|
+
break;
|
|
519
|
+
default:
|
|
520
|
+
this._resumeTabindexOnDate(setFocus);
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
/** Selects or deselects the focused date */
|
|
525
|
+
_setSelectOnFocusedDate() {
|
|
526
|
+
if (isInMonth(this._focusedDate, this._month, this._year) && !isDisabled(this._focusedDate, this._getDisabledDateParams(false))) {
|
|
527
|
+
this._beforeDateSelected(this._focusedDate);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
/** Emits a focus change event */
|
|
531
|
+
_emitFocusChangeEvent(value) {
|
|
532
|
+
const eventData = {
|
|
533
|
+
type: this._view,
|
|
534
|
+
value
|
|
535
|
+
};
|
|
536
|
+
switch (this._view) {
|
|
537
|
+
case 'date':
|
|
538
|
+
eventData.selected = isSelected(value, this._value);
|
|
539
|
+
eventData.text = value.toLocaleDateString(this.locale, { month: 'long', day: '2-digit', year: 'numeric' });
|
|
540
|
+
break;
|
|
541
|
+
case 'month':
|
|
542
|
+
eventData.selected = this._month === value;
|
|
543
|
+
eventData.text = getLocalizedMonth(value, 'long');
|
|
544
|
+
break;
|
|
545
|
+
case 'year':
|
|
546
|
+
eventData.selected = this._year === value;
|
|
547
|
+
eventData.text = getLocalizedYear(value, 'numeric');
|
|
548
|
+
break;
|
|
549
|
+
}
|
|
550
|
+
this._adapter.emitHostEvent(CALENDAR_CONSTANTS.events.FOCUS_CHANGE, eventData);
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Finds the previous enabled date.
|
|
554
|
+
* @param start The date to search backward from
|
|
555
|
+
* @param step A number of dates to skip at each step, defaults to 1
|
|
556
|
+
* @param stepOnce Whether to use the step amount once and then continue sequentially, defaults to false
|
|
557
|
+
* @param includeStart Whether to first check and potentially return the start date, defaults to false
|
|
558
|
+
* @returns The previous enabled date or null if none found
|
|
559
|
+
*/
|
|
560
|
+
_getPreviousEnabledDate(start, step = 1, stepOnce = false, includeStart = false, inMonth = false) {
|
|
561
|
+
const disabledParams = this._getDisabledDateParams();
|
|
562
|
+
const current = new Date(start);
|
|
563
|
+
if (includeStart && !isDisabled(current, disabledParams)) {
|
|
564
|
+
return current;
|
|
565
|
+
}
|
|
566
|
+
const month = start.getMonth();
|
|
567
|
+
let outsideBounds = false;
|
|
568
|
+
do {
|
|
569
|
+
current.setDate(current.getDate() - step);
|
|
570
|
+
if (stepOnce) {
|
|
571
|
+
step = 1;
|
|
572
|
+
}
|
|
573
|
+
if ((inMonth && current.getMonth() !== month) || (this._min && current < this._min)) {
|
|
574
|
+
outsideBounds = true;
|
|
575
|
+
}
|
|
576
|
+
} while (!outsideBounds && isDisabled(current, disabledParams));
|
|
577
|
+
return outsideBounds ? null : current;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Finds the previous enabled date.
|
|
581
|
+
* @param start The date to search forward from
|
|
582
|
+
* @param step A number of dates to skip at each step, defaults to 1
|
|
583
|
+
* @param stepOnce Whether to use the step amount once and then continue sequentially, defaults to false
|
|
584
|
+
* @param includeStart Whether to first check and potentially return the start date, defaults to false
|
|
585
|
+
* @returns The next enabled date or null if none found
|
|
586
|
+
*/
|
|
587
|
+
_getNextEnabledDate(start, step = 1, stepOnce = false, includeStart = false, inMonth = false) {
|
|
588
|
+
const disabledParams = this._getDisabledDateParams();
|
|
589
|
+
const current = new Date(start);
|
|
590
|
+
if (includeStart && !isDisabled(current, disabledParams)) {
|
|
591
|
+
return current;
|
|
592
|
+
}
|
|
593
|
+
const month = start.getMonth();
|
|
594
|
+
let outsideBounds = false;
|
|
595
|
+
do {
|
|
596
|
+
current.setDate(current.getDate() + step);
|
|
597
|
+
if (stepOnce) {
|
|
598
|
+
step = 1;
|
|
599
|
+
}
|
|
600
|
+
if ((inMonth && current.getMonth() !== month) || (this._max && current > this._max)) {
|
|
601
|
+
outsideBounds = true;
|
|
602
|
+
}
|
|
603
|
+
} while (!outsideBounds && isDisabled(current, disabledParams));
|
|
604
|
+
return outsideBounds ? null : current;
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Finds the closest enabled date.
|
|
608
|
+
* @param start The date to begin searching from
|
|
609
|
+
* @param includeStart Whether to first check and potentially return the start date, defaults to false
|
|
610
|
+
* @returns The closest enabled date or null if none found
|
|
611
|
+
*/
|
|
612
|
+
_getClosestEnabledDate(start, inMonth = false, includeStart = false) {
|
|
613
|
+
if (this._min && start < this._min) {
|
|
614
|
+
return this._getFirstEnabledDate();
|
|
615
|
+
}
|
|
616
|
+
else if (this._max && start > this._max) {
|
|
617
|
+
return this._getLastEnabledDate();
|
|
618
|
+
}
|
|
619
|
+
const disabledParams = this._getDisabledDateParams();
|
|
620
|
+
if (includeStart && !isDisabled(start, disabledParams)) {
|
|
621
|
+
return new Date(start);
|
|
622
|
+
}
|
|
623
|
+
const startDate = start.getDate();
|
|
624
|
+
let current;
|
|
625
|
+
let overMax = false;
|
|
626
|
+
let underMin = false;
|
|
627
|
+
let index = 1;
|
|
628
|
+
while (!overMax || !underMin) {
|
|
629
|
+
if (!overMax) {
|
|
630
|
+
current = new Date(start);
|
|
631
|
+
current.setDate(startDate + index);
|
|
632
|
+
overMax = !isInMonth(current, start.getMonth(), start.getFullYear());
|
|
633
|
+
if (!overMax && !isDisabled(current, disabledParams)) {
|
|
634
|
+
return current;
|
|
635
|
+
}
|
|
636
|
+
else if (this._max && current > this._max) {
|
|
637
|
+
overMax = true;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
if (!underMin) {
|
|
641
|
+
current = new Date(start);
|
|
642
|
+
current.setDate(startDate - index);
|
|
643
|
+
underMin = !isInMonth(current, start.getMonth(), start.getFullYear());
|
|
644
|
+
if (!underMin && !isDisabled(current, disabledParams)) {
|
|
645
|
+
return current;
|
|
646
|
+
}
|
|
647
|
+
else if (this._min && current < this._min) {
|
|
648
|
+
underMin = true;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
index += 1;
|
|
652
|
+
}
|
|
653
|
+
return null;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Finds the first enabled date of a week.
|
|
657
|
+
* @param date A date that falls in the requested week
|
|
658
|
+
* @returns The first enabled date of the week or null if none found
|
|
659
|
+
*/
|
|
660
|
+
_getFirstEnabledDayOfWeek(date, inMonth = true) {
|
|
661
|
+
const current = getFirstDateOfWeek(date);
|
|
662
|
+
const disabledParams = this._getDisabledDateParams(inMonth ? current.getMonth() !== date.getMonth() || current.getFullYear() !== date.getFullYear() : undefined);
|
|
663
|
+
let index = 0;
|
|
664
|
+
while (index < 7 && isDisabled(current, disabledParams)) {
|
|
665
|
+
current.setDate(current.getDate() + 1);
|
|
666
|
+
disabledParams.otherMonth = inMonth ? current.getMonth() !== date.getMonth() || current.getFullYear() !== date.getFullYear() : undefined;
|
|
667
|
+
index += 1;
|
|
668
|
+
}
|
|
669
|
+
return index < 7 ? current : null;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Finds the last enabled date of a week.
|
|
673
|
+
* @param date A date that falls in the requested week
|
|
674
|
+
* @returns The last enabled date of the week or null if none found
|
|
675
|
+
*/
|
|
676
|
+
_getLastEnabledDayOfWeek(date, inMonth = true) {
|
|
677
|
+
const current = getLastDateOfWeek(date);
|
|
678
|
+
const disabledParams = this._getDisabledDateParams(inMonth ? current.getMonth() !== date.getMonth() || current.getFullYear() !== date.getFullYear() : undefined);
|
|
679
|
+
let index = 0;
|
|
680
|
+
while (index < 7 && isDisabled(current, disabledParams)) {
|
|
681
|
+
current.setDate(current.getDate() - 1);
|
|
682
|
+
disabledParams.otherMonth = inMonth ? current.getMonth() !== date.getMonth() || current.getFullYear() !== date.getFullYear() : undefined;
|
|
683
|
+
index += 1;
|
|
684
|
+
}
|
|
685
|
+
return index < 7 ? current : null;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Finds an enabled date with the same index in another month, skipping forward or back one week if that date falls in an adjacent month.
|
|
689
|
+
* @param index The index to look up
|
|
690
|
+
* @param month The month to look up
|
|
691
|
+
* @param year The year of the month
|
|
692
|
+
* @returns An enabled date with the same index plus or minus a week, the nearest enabled date, or null if no enabled date was found
|
|
693
|
+
*/
|
|
694
|
+
_getDateAtIndexInMonth(index, month, year) {
|
|
695
|
+
var _a;
|
|
696
|
+
const monthDates = getMonthDates(month, year, (_a = this._firstDayOfWeek) !== null && _a !== void 0 ? _a : this._localeFirstDayOfWeek);
|
|
697
|
+
// If outside the min or max date pick the first or last enabled date
|
|
698
|
+
if (this._min && monthDates[index] < this._min) {
|
|
699
|
+
return this._getFirstEnabledDate();
|
|
700
|
+
}
|
|
701
|
+
else if (this._max && monthDates[index] > this._max) {
|
|
702
|
+
return this._getLastEnabledDate();
|
|
703
|
+
}
|
|
704
|
+
// If the index is in another month go forward or back a week based on which half of the month the index is nearest
|
|
705
|
+
if (isInMonth(monthDates[index], month, year)) {
|
|
706
|
+
return this._getClosestEnabledDate(monthDates[index], true);
|
|
707
|
+
}
|
|
708
|
+
return index < 20 ? this._getNextEnabledDate(monthDates[index], 7, true) : this._getPreviousEnabledDate(monthDates[index], 7, true);
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Finds the first enabled date.
|
|
712
|
+
* @returns This first enabled date or null if a min date isn't set
|
|
713
|
+
*/
|
|
714
|
+
_getFirstEnabledDate() {
|
|
715
|
+
if (!this._min) {
|
|
716
|
+
return null;
|
|
717
|
+
}
|
|
718
|
+
return this._getNextEnabledDate(this._min, 1, false, true);
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Finds the last enabled date.
|
|
722
|
+
* @returns This last enabled date or null if a max date isn't set
|
|
723
|
+
*/
|
|
724
|
+
_getLastEnabledDate() {
|
|
725
|
+
if (!this._max) {
|
|
726
|
+
return null;
|
|
727
|
+
}
|
|
728
|
+
return this._getPreviousEnabledDate(this._max, 1, false, true);
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Moves the month in view to a date, sets focus on the date, and emits a focus change event.
|
|
732
|
+
* @param date The date to focus or null if focus should not move
|
|
733
|
+
* @param setFocus Whether to truly focus the date element versus just setting its tabindex
|
|
734
|
+
* @returns Void
|
|
735
|
+
*/
|
|
736
|
+
_setFocusedDate(date, setFocus) {
|
|
737
|
+
if (!date) {
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
const monthChanged = this._month !== date.getMonth();
|
|
741
|
+
const yearChanged = this._year !== date.getFullYear();
|
|
742
|
+
if (monthChanged || yearChanged) {
|
|
743
|
+
if (monthChanged) {
|
|
744
|
+
this._month = date.getMonth();
|
|
745
|
+
this._setMonth();
|
|
746
|
+
}
|
|
747
|
+
if (yearChanged) {
|
|
748
|
+
this._year = date.getFullYear();
|
|
749
|
+
this._setYear();
|
|
750
|
+
}
|
|
751
|
+
this._resetDateGrid();
|
|
752
|
+
}
|
|
753
|
+
this._focusedDate = date;
|
|
754
|
+
this._adapter.setActiveDate(this._focusedDate, setFocus, this._preventFocus);
|
|
755
|
+
this._emitFocusChangeEvent(this._focusedDate);
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Gets disabled date params.
|
|
759
|
+
* @param otherMonth Whether the date is outside the month in view - only set if needed
|
|
760
|
+
* @returns An ICalendarDisabledDateParams object
|
|
761
|
+
*/
|
|
762
|
+
_getDisabledDateParams(otherMonth) {
|
|
763
|
+
return {
|
|
764
|
+
builder: this._disabledDateBuilder,
|
|
765
|
+
disabledDates: this._disabledDates,
|
|
766
|
+
disabledDaysOfWeek: this._disabledDaysOfWeek,
|
|
767
|
+
maxDate: this._max,
|
|
768
|
+
minDate: this._min,
|
|
769
|
+
otherMonth
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Builds dates for the period in view, sets them to the DOM, and enables focus on one of them.
|
|
774
|
+
*/
|
|
775
|
+
_createDateView() {
|
|
776
|
+
this._resetDateGrid();
|
|
777
|
+
if (!this._focusedDate || !this._resumeTabindexOnDate(false)) {
|
|
778
|
+
this._setInitialDateFocus();
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Initiates month navigation and opens the month menu on the year in view.
|
|
783
|
+
*/
|
|
784
|
+
_openMonthMenu(setFocus = false) {
|
|
785
|
+
this._view = 'month';
|
|
786
|
+
if (this._menuYear === null) {
|
|
787
|
+
this._menuYear = this._year;
|
|
788
|
+
}
|
|
789
|
+
if (this._showHeader) {
|
|
790
|
+
this._setNavButtonLabels();
|
|
791
|
+
this._adapter.setMonthButtonPressed(true);
|
|
792
|
+
this._adapter.setYearButtonPressed(false);
|
|
793
|
+
}
|
|
794
|
+
this._adapter.openMenuAsGrid(this._getMonthsForMenu(), setFocus);
|
|
795
|
+
this._adapter.setDateViewHidden(true);
|
|
796
|
+
this._setNavigationButtonStates();
|
|
797
|
+
this._adapter.emitHostEvent(CALENDAR_CONSTANTS.events.VIEW_CHANGE, this._view);
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Initiates year navigation and opens the year menu.
|
|
801
|
+
*/
|
|
802
|
+
_openYearMenu(setFocus = false) {
|
|
803
|
+
var _a;
|
|
804
|
+
this._view = 'year';
|
|
805
|
+
this._menuIncludedYear = (_a = this._menuYear) !== null && _a !== void 0 ? _a : this._year;
|
|
806
|
+
if (this._showHeader) {
|
|
807
|
+
this._setNavButtonLabels();
|
|
808
|
+
this._adapter.setMonthButtonPressed(false);
|
|
809
|
+
this._adapter.setYearButtonPressed(true);
|
|
810
|
+
}
|
|
811
|
+
if (this._listYears) {
|
|
812
|
+
this._adapter.openMenuAsList(this._getYearsForMenu(), setFocus);
|
|
813
|
+
}
|
|
814
|
+
else {
|
|
815
|
+
this._adapter.openMenuAsGrid(this._getYearsForMenu(), setFocus);
|
|
816
|
+
}
|
|
817
|
+
this._adapter.setDateViewHidden(true);
|
|
818
|
+
this._setNavigationButtonStates();
|
|
819
|
+
this._adapter.emitHostEvent(CALENDAR_CONSTANTS.events.VIEW_CHANGE, this._view);
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Gets the months to display in the menu.
|
|
823
|
+
* @returns An array of ICalendarMenuOptions containing months
|
|
824
|
+
*/
|
|
825
|
+
_getMonthsForMenu() {
|
|
826
|
+
var _a;
|
|
827
|
+
const config = {
|
|
828
|
+
locale: this._locale,
|
|
829
|
+
max: this._max,
|
|
830
|
+
min: this._min,
|
|
831
|
+
selectedMonth: this._year === this._menuYear ? this._month : -1,
|
|
832
|
+
selectedYear: (_a = this._menuYear) !== null && _a !== void 0 ? _a : this._year
|
|
833
|
+
};
|
|
834
|
+
return getMonthOptions(config);
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Gets the years to display in the menu, either a slice of visible years or all possible years.
|
|
838
|
+
* @returns An array of ICalendarMenuOptions containing years
|
|
839
|
+
*/
|
|
840
|
+
_getYearsForMenu() {
|
|
841
|
+
const min = this._min ? this._min.getFullYear() : this._minYear;
|
|
842
|
+
const max = this._max ? this._max.getFullYear() : this._maxYear;
|
|
843
|
+
const config = {
|
|
844
|
+
locale: this._locale,
|
|
845
|
+
max,
|
|
846
|
+
min,
|
|
847
|
+
selectedYear: this._year,
|
|
848
|
+
yearInView: this._menuIncludedYear
|
|
849
|
+
};
|
|
850
|
+
const options = this._listYears ? getAllYearOptions(config) : getYearOptions(config);
|
|
851
|
+
this._menuYearsInView = { min: options[0].value, max: options[options.length - 1].value };
|
|
852
|
+
return options;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Closes the menu and reapplies labels and focus for the date view.
|
|
856
|
+
* @param valueSelected Whether the user made a selection that requires the date view to be rebuilt
|
|
857
|
+
*/
|
|
858
|
+
_closeMenu(valueSelected, setFocus = false) {
|
|
859
|
+
this._view = 'date';
|
|
860
|
+
this._menuYear = null;
|
|
861
|
+
this._adapter.closeMenu();
|
|
862
|
+
this._adapter.setDateViewHidden(false);
|
|
863
|
+
this._adapter.setYear(this._year, this._locale);
|
|
864
|
+
if (valueSelected) {
|
|
865
|
+
this._resetDateGrid();
|
|
866
|
+
}
|
|
867
|
+
if (this._showHeader) {
|
|
868
|
+
this._setNavButtonLabels();
|
|
869
|
+
this._setNavigationButtonStates();
|
|
870
|
+
this._adapter.setMonthButtonPressed(false);
|
|
871
|
+
this._adapter.setYearButtonPressed(false);
|
|
872
|
+
}
|
|
873
|
+
if (!this._resumeTabindexOnDate(setFocus)) {
|
|
874
|
+
this._setInitialDateFocus(setFocus);
|
|
875
|
+
}
|
|
876
|
+
this._adapter.emitHostEvent(CALENDAR_CONSTANTS.events.VIEW_CHANGE, this._view);
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Sets the labels on the previous and next buttons appropriate for the view.
|
|
880
|
+
*/
|
|
881
|
+
_setNavButtonLabels() {
|
|
882
|
+
switch (this._view) {
|
|
883
|
+
case 'date':
|
|
884
|
+
this._adapter.setPreviousButtonLabel('Previous month');
|
|
885
|
+
this._adapter.setNextButtonLabel('Next month');
|
|
886
|
+
break;
|
|
887
|
+
case 'month':
|
|
888
|
+
this._adapter.setPreviousButtonLabel('Previous year');
|
|
889
|
+
this._adapter.setNextButtonLabel('Next year');
|
|
890
|
+
break;
|
|
891
|
+
case 'year':
|
|
892
|
+
this._adapter.setPreviousButtonLabel('Previous years');
|
|
893
|
+
this._adapter.setNextButtonLabel('Next years');
|
|
894
|
+
break;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* Rebuilds all dates and resets the date grid.
|
|
899
|
+
* */
|
|
900
|
+
_resetDateGrid() {
|
|
901
|
+
var _a;
|
|
902
|
+
this._dates = getMonthDates(this._month, this._year, (_a = this._firstDayOfWeek) !== null && _a !== void 0 ? _a : this._localeFirstDayOfWeek);
|
|
903
|
+
const dateConfigs = this._dates.map(d => this._getDateConfig(d));
|
|
904
|
+
this._adapter.setDates(dateConfigs, { builder: this._dateBuilder, locale: this._locale, showOtherMonths: this._showOtherMonths });
|
|
905
|
+
this._setNavigationButtonStates();
|
|
906
|
+
this._applyWeekendDays();
|
|
907
|
+
this._applyEvents();
|
|
908
|
+
if (this._mode === 'range') {
|
|
909
|
+
this._adapter.setRangeStart(this._value[0]);
|
|
910
|
+
this._setRangePreview();
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Creates a date config object from the given date.
|
|
915
|
+
* @param date The date
|
|
916
|
+
* @returns A date config
|
|
917
|
+
*/
|
|
918
|
+
_getDateConfig(date) {
|
|
919
|
+
const thisMonth = isInMonth(date, this._month, this._year);
|
|
920
|
+
const config = {
|
|
921
|
+
date: new Date(date),
|
|
922
|
+
selected: isSelected(date, this._value),
|
|
923
|
+
today: isToday(date),
|
|
924
|
+
thisMonth,
|
|
925
|
+
disabled: isDisabled(date, this._getDisabledDateParams(!thisMonth))
|
|
926
|
+
};
|
|
927
|
+
return config;
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* Creates a calendar date object from the given date.
|
|
931
|
+
* @param date The date
|
|
932
|
+
* @returns A calendar date object
|
|
933
|
+
*/
|
|
934
|
+
_getCalendarDate(date) {
|
|
935
|
+
return {
|
|
936
|
+
date: new Date(date),
|
|
937
|
+
selected: isSelected(date, this._value),
|
|
938
|
+
events: getEventsOnDate(date, this._events, this._eventBuilder)
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Sets events to display on a date in the DOM, including overflow and tooltips.
|
|
943
|
+
* @param date The date to set events on
|
|
944
|
+
*/
|
|
945
|
+
_setEventsOnDate(date) {
|
|
946
|
+
var _a;
|
|
947
|
+
if (!this._showOtherMonths && !isInMonth(date, this._month, this._year)) {
|
|
948
|
+
this._adapter.setEventWrapperOnDate(date, false);
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
const events = getEventsOnDate(date, this._events, this._eventBuilder);
|
|
952
|
+
this._adapter.setEventWrapperOnDate(date, !!events.length);
|
|
953
|
+
events.forEach((e, i) => {
|
|
954
|
+
if (i > 2) {
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
this._adapter.setEvent(e, i === 2 && events.length > 3);
|
|
958
|
+
});
|
|
959
|
+
let description = events.length ? getEventDescriptions(events) : '';
|
|
960
|
+
if (this._tooltipBuilder) {
|
|
961
|
+
description = (_a = this._tooltipBuilder(this._getCalendarDate(date), description)) !== null && _a !== void 0 ? _a : '';
|
|
962
|
+
}
|
|
963
|
+
this._adapter.setDateTooltip(date, description);
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Provides a hook to intercept date selection events.
|
|
967
|
+
* @param date The date that was selected
|
|
968
|
+
* */
|
|
969
|
+
_beforeDateSelected(date, type = 'date') {
|
|
970
|
+
if (this._dateSelectCallback) {
|
|
971
|
+
Promise.resolve(this._dateSelectCallback(this._getCalendarDate(date))).then(res => {
|
|
972
|
+
if (res) {
|
|
973
|
+
this._onDateSelected(date, undefined, type);
|
|
974
|
+
}
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
else {
|
|
978
|
+
this._onDateSelected(date, undefined, type);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* Runs mode dependent logic to manage selected dates and emit selection events.
|
|
983
|
+
* @param date The date that was selected
|
|
984
|
+
* @param force Whether the date should be selected or deselected, regardless of its prior state (optional)
|
|
985
|
+
* */
|
|
986
|
+
_onDateSelected(date, force, type = 'date') {
|
|
987
|
+
if (this._mode === 'range' && this._emitRangeSelectionEvent(date)) {
|
|
988
|
+
this._applyRangeSelection(date);
|
|
989
|
+
this._rangeSelectionStore = undefined;
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
const selected = isSelected(date, this._value);
|
|
993
|
+
const event = {
|
|
994
|
+
date: new Date(date),
|
|
995
|
+
selected,
|
|
996
|
+
type
|
|
997
|
+
};
|
|
998
|
+
const isAllowed = this._adapter.emitHostEvent(CALENDAR_CONSTANTS.events.DATE_SELECT, event, true, true);
|
|
999
|
+
if (!isAllowed) {
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
this._rangeSelectionStore = undefined;
|
|
1003
|
+
if (this._mode === 'single') {
|
|
1004
|
+
if ((selected && !force) || force === false) {
|
|
1005
|
+
this._deselectDate(date);
|
|
1006
|
+
}
|
|
1007
|
+
else if (force === undefined || force === true) {
|
|
1008
|
+
if (this._value.length) {
|
|
1009
|
+
this._deselectDate(this._value[0]);
|
|
1010
|
+
}
|
|
1011
|
+
this._selectDate(date);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
else {
|
|
1015
|
+
if ((selected && !force) || force === false) {
|
|
1016
|
+
this._deselectDate(date);
|
|
1017
|
+
}
|
|
1018
|
+
else if (force === undefined || force === true) {
|
|
1019
|
+
this._selectDate(date);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
sortDates(this._value);
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Emits a date select event with range data.
|
|
1026
|
+
* @param date The selected date.
|
|
1027
|
+
* @returns True if the event was not cancelled.
|
|
1028
|
+
*/
|
|
1029
|
+
_emitRangeSelectionEvent(date) {
|
|
1030
|
+
const event = {
|
|
1031
|
+
date: new Date(date),
|
|
1032
|
+
selected: isSelected(date, this._value),
|
|
1033
|
+
type: 'date'
|
|
1034
|
+
};
|
|
1035
|
+
// Build the event without affecting the calendar's state
|
|
1036
|
+
switch (this._rangeSelectionState) {
|
|
1037
|
+
case 'none':
|
|
1038
|
+
case 'to':
|
|
1039
|
+
event.range = getDateRangeFromDates([date]);
|
|
1040
|
+
event.rangeSelectionState = 'from';
|
|
1041
|
+
break;
|
|
1042
|
+
case 'from':
|
|
1043
|
+
if (isSameDate(date, this._value[0])) {
|
|
1044
|
+
if (this._allowSingleDateRange) {
|
|
1045
|
+
event.range = getDateRangeFromDates([this._value[0], date]);
|
|
1046
|
+
event.rangeSelectionState = 'to';
|
|
1047
|
+
}
|
|
1048
|
+
else {
|
|
1049
|
+
event.range = getDateRangeFromDates([]);
|
|
1050
|
+
event.rangeSelectionState = 'none';
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
else if (date < this._value[0]) {
|
|
1054
|
+
event.range = getDateRangeFromDates([date]);
|
|
1055
|
+
event.rangeSelectionState = 'from';
|
|
1056
|
+
}
|
|
1057
|
+
else {
|
|
1058
|
+
event.range = getDateRangeFromDates([this._value[0], date]);
|
|
1059
|
+
event.rangeSelectionState = 'to';
|
|
1060
|
+
}
|
|
1061
|
+
break;
|
|
1062
|
+
}
|
|
1063
|
+
return this._adapter.emitHostEvent(CALENDAR_CONSTANTS.events.DATE_SELECT, event, true, true);
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Manages the current selection state and value from a selection when in range mode.
|
|
1067
|
+
* @param date The selected date
|
|
1068
|
+
* */
|
|
1069
|
+
_applyRangeSelection(date) {
|
|
1070
|
+
switch (this._rangeSelectionState) {
|
|
1071
|
+
case 'none':
|
|
1072
|
+
case 'to':
|
|
1073
|
+
this._deselectAllDates();
|
|
1074
|
+
this._selectDate(date);
|
|
1075
|
+
this._adapter.setRange(null);
|
|
1076
|
+
this._adapter.setRangeStart(date);
|
|
1077
|
+
this._rangeSelectionState = 'from';
|
|
1078
|
+
break;
|
|
1079
|
+
case 'from':
|
|
1080
|
+
if (isSameDate(date, this._value[0])) {
|
|
1081
|
+
if (this._allowSingleDateRange) {
|
|
1082
|
+
this._value.push(date);
|
|
1083
|
+
this._rangeSelectionState = 'to';
|
|
1084
|
+
}
|
|
1085
|
+
else {
|
|
1086
|
+
this._deselectDate(date);
|
|
1087
|
+
this._rangeSelectionState = 'none';
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
else if (date < this._value[0]) {
|
|
1091
|
+
this._deselectDate(this._value[0]);
|
|
1092
|
+
this._selectDate(date);
|
|
1093
|
+
this._adapter.setRangeStart(date);
|
|
1094
|
+
}
|
|
1095
|
+
else {
|
|
1096
|
+
this._selectDate(date);
|
|
1097
|
+
this._setRangePreview(date);
|
|
1098
|
+
this._rangeSelectionState = 'to';
|
|
1099
|
+
}
|
|
1100
|
+
break;
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Sets the properties to display range selections.
|
|
1105
|
+
* @param toDate The date that the range preview should end on if an end date isn't already selected (optional)
|
|
1106
|
+
* */
|
|
1107
|
+
_setRangePreview(toDate) {
|
|
1108
|
+
switch (this._rangeSelectionState) {
|
|
1109
|
+
case 'from':
|
|
1110
|
+
if (!toDate) {
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1113
|
+
if (toDate < this._value[0]) {
|
|
1114
|
+
this._adapter.setRange(null);
|
|
1115
|
+
}
|
|
1116
|
+
else {
|
|
1117
|
+
this._adapter.setRange(getDatesInRange(this._dates, this._value[0], toDate));
|
|
1118
|
+
this._adapter.setRangeEnd(toDate);
|
|
1119
|
+
}
|
|
1120
|
+
break;
|
|
1121
|
+
case 'to':
|
|
1122
|
+
this._adapter.setRange(getDatesInRange(this._dates, this._value[0], this._value[1]));
|
|
1123
|
+
this._adapter.setRangeEnd(this._value[1]);
|
|
1124
|
+
break;
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* Removes the range preview.
|
|
1129
|
+
*/
|
|
1130
|
+
_clearRangePreview() {
|
|
1131
|
+
this._adapter.setRange(null);
|
|
1132
|
+
this._adapter.setRangeStart(null);
|
|
1133
|
+
this._adapter.setRangeEnd(null);
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* Adds a date to the value array and sets it selected in the adapter.
|
|
1137
|
+
* @param date The date to select
|
|
1138
|
+
* */
|
|
1139
|
+
_selectDate(date) {
|
|
1140
|
+
this._value.push(date);
|
|
1141
|
+
this._focusedDate = date;
|
|
1142
|
+
this._adapter.setDateSelected(date, true);
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Removes a date from the value array and sets it deselected in the adapter.
|
|
1146
|
+
* @param date The date to deselect
|
|
1147
|
+
* */
|
|
1148
|
+
_deselectDate(date) {
|
|
1149
|
+
const index = this._value.findIndex(d => isSameDate(d, date));
|
|
1150
|
+
if (index > -1) {
|
|
1151
|
+
this._value.splice(index, 1);
|
|
1152
|
+
}
|
|
1153
|
+
this._adapter.setDateSelected(date, false);
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* Clears the value array and sets all dates deselected in the adapter.
|
|
1157
|
+
* */
|
|
1158
|
+
_deselectAllDates() {
|
|
1159
|
+
this._value.forEach(d => this._adapter.setDateSelected(d, false));
|
|
1160
|
+
this._clearRangePreview();
|
|
1161
|
+
this._value = [];
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Moves to and sets tabindex on the given date.
|
|
1165
|
+
* @param date The destination date
|
|
1166
|
+
* @param setFocus Whether focus should be set on the date
|
|
1167
|
+
* */
|
|
1168
|
+
_goToDate(date, setFocus) {
|
|
1169
|
+
const year = date.getFullYear();
|
|
1170
|
+
const month = date.getMonth();
|
|
1171
|
+
this._focusedDate = date;
|
|
1172
|
+
if (this._year !== year || this._month !== month) {
|
|
1173
|
+
this._month = month;
|
|
1174
|
+
this._setMonth();
|
|
1175
|
+
this._year = year;
|
|
1176
|
+
this._setYear();
|
|
1177
|
+
if (this._view !== 'date') {
|
|
1178
|
+
this._closeMenu(false, setFocus);
|
|
1179
|
+
}
|
|
1180
|
+
else {
|
|
1181
|
+
this._resetDateGrid();
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
else if (this._view !== 'date') {
|
|
1185
|
+
this._closeMenu(false, setFocus);
|
|
1186
|
+
}
|
|
1187
|
+
this._adapter.setActiveDate(date, setFocus, this._preventFocus);
|
|
1188
|
+
this._emitFocusChangeEvent(this._focusedDate);
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Moves forward one month and rebuilds the calendar dates to match.
|
|
1192
|
+
* */
|
|
1193
|
+
_goToNextMonth() {
|
|
1194
|
+
if (this._month < 11) {
|
|
1195
|
+
this._month += 1;
|
|
1196
|
+
}
|
|
1197
|
+
else {
|
|
1198
|
+
this._month = 0;
|
|
1199
|
+
this._year += 1;
|
|
1200
|
+
this._setYear();
|
|
1201
|
+
}
|
|
1202
|
+
this._setMonth();
|
|
1203
|
+
this._resetDateGrid();
|
|
1204
|
+
}
|
|
1205
|
+
/**
|
|
1206
|
+
* Moves backward one month and rebuilds the calendar dates to match.
|
|
1207
|
+
* */
|
|
1208
|
+
_goToPreviousMonth() {
|
|
1209
|
+
if (this._month > 0) {
|
|
1210
|
+
this._month -= 1;
|
|
1211
|
+
}
|
|
1212
|
+
else {
|
|
1213
|
+
this._month = 11;
|
|
1214
|
+
this._year -= 1;
|
|
1215
|
+
this._setYear();
|
|
1216
|
+
}
|
|
1217
|
+
this._setMonth();
|
|
1218
|
+
this._resetDateGrid();
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Moves forward one year.
|
|
1222
|
+
* */
|
|
1223
|
+
_goToNextYear(setFocus = false) {
|
|
1224
|
+
if (this._view === 'month') {
|
|
1225
|
+
if (this._menuYear) {
|
|
1226
|
+
this._menuYear += 1;
|
|
1227
|
+
this._setMenuYear();
|
|
1228
|
+
}
|
|
1229
|
+
this._adapter.animateIntoSelectionMenu(this._getMonthsForMenu(), this._rtl ? 'left' : 'right', setFocus);
|
|
1230
|
+
}
|
|
1231
|
+
else {
|
|
1232
|
+
this._year += 1;
|
|
1233
|
+
this._setYear();
|
|
1234
|
+
this._resetDateGrid();
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
/**
|
|
1238
|
+
* Moves backward one year.
|
|
1239
|
+
* */
|
|
1240
|
+
_goToPreviousYear(setFocus = false) {
|
|
1241
|
+
if (this._view === 'month') {
|
|
1242
|
+
if (this._menuYear) {
|
|
1243
|
+
this._menuYear -= 1;
|
|
1244
|
+
this._setMenuYear();
|
|
1245
|
+
}
|
|
1246
|
+
this._adapter.animateIntoSelectionMenu(this._getMonthsForMenu(), this._rtl ? 'right' : 'left', setFocus);
|
|
1247
|
+
}
|
|
1248
|
+
else {
|
|
1249
|
+
this._year -= 1;
|
|
1250
|
+
this._setYear();
|
|
1251
|
+
this._resetDateGrid();
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Moves to the next set of selectable years in grid view.
|
|
1256
|
+
* */
|
|
1257
|
+
_goToNextSetOfYears(setFocus = false) {
|
|
1258
|
+
this._menuIncludedYear += CALENDAR_CONSTANTS.numbers.YEARS_IN_VIEW;
|
|
1259
|
+
this._adapter.animateIntoSelectionMenu(this._getYearsForMenu(), this._rtl ? 'left' : 'right', setFocus);
|
|
1260
|
+
this._setNavigationButtonStates();
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Move to the previous set of selectable years in grid view.
|
|
1264
|
+
* */
|
|
1265
|
+
_goToPreviousSetOfYears(setFocus = false) {
|
|
1266
|
+
this._menuIncludedYear -= CALENDAR_CONSTANTS.numbers.YEARS_IN_VIEW;
|
|
1267
|
+
this._adapter.animateIntoSelectionMenu(this._getYearsForMenu(), this._rtl ? 'right' : 'left', setFocus);
|
|
1268
|
+
this._setNavigationButtonStates();
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* Checks whether the minimum navigable date occurs before the current period.
|
|
1272
|
+
* @param forceConstrain Whether to ignore the ability to view dates before the min
|
|
1273
|
+
* @returns Whether periods before the one in view are navigable
|
|
1274
|
+
*/
|
|
1275
|
+
_canGoBackward(forceConstrain) {
|
|
1276
|
+
var _a;
|
|
1277
|
+
if (!forceConstrain && !this._constrainToEnabled) {
|
|
1278
|
+
return true;
|
|
1279
|
+
}
|
|
1280
|
+
switch (this._view) {
|
|
1281
|
+
case 'date':
|
|
1282
|
+
return !this._min || this._min < new Date(this._year, this._month, 1);
|
|
1283
|
+
case 'month':
|
|
1284
|
+
const minDateYear = (_a = this._min) === null || _a === void 0 ? void 0 : _a.getFullYear();
|
|
1285
|
+
return this._menuYear !== null && (minDateYear === undefined || minDateYear < this._menuYear);
|
|
1286
|
+
case 'year':
|
|
1287
|
+
return !!this._menuYearsInView && this._minYear < this._menuYearsInView.min;
|
|
1288
|
+
default:
|
|
1289
|
+
return false;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* Checks whether the maximum navigable date occurs after the current period.
|
|
1294
|
+
* @param forceConstrain Whether to ignore the ability to view dates after the max
|
|
1295
|
+
* @returns Whether periods after the one in view are navigable
|
|
1296
|
+
*/
|
|
1297
|
+
_canGoForward(forceConstrain) {
|
|
1298
|
+
var _a;
|
|
1299
|
+
if (!forceConstrain && !this._constrainToEnabled) {
|
|
1300
|
+
return true;
|
|
1301
|
+
}
|
|
1302
|
+
switch (this._view) {
|
|
1303
|
+
case 'date':
|
|
1304
|
+
return !this._max || this._max > getLastDateOfMonth(this._month, this._year);
|
|
1305
|
+
case 'month':
|
|
1306
|
+
const maxDateYear = (_a = this._max) === null || _a === void 0 ? void 0 : _a.getFullYear();
|
|
1307
|
+
return this._menuYear !== null && (maxDateYear === undefined || maxDateYear > this._menuYear);
|
|
1308
|
+
case 'year':
|
|
1309
|
+
return !!this._menuYearsInView && this._maxYear > this._menuYearsInView.max;
|
|
1310
|
+
default:
|
|
1311
|
+
return false;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* Enables or disabled navigation buttons based on whether they would lead outside the range of enabled dates.
|
|
1316
|
+
*/
|
|
1317
|
+
_setNavigationButtonStates() {
|
|
1318
|
+
if (!this._showHeader) {
|
|
1319
|
+
return;
|
|
1320
|
+
}
|
|
1321
|
+
if (!this._constrainToEnabled) {
|
|
1322
|
+
this._adapter.setPreviousButtonDisabled(false);
|
|
1323
|
+
this._adapter.setNextButtonDisabled(false);
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
this._adapter.setPreviousButtonDisabled(!this._canGoBackward());
|
|
1327
|
+
this._adapter.setNextButtonDisabled(!this._canGoForward());
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* Sets the month text and attribute in the adapter.
|
|
1331
|
+
* @param userSelected Whether the month was explicitly selected by the user (optional)
|
|
1332
|
+
* */
|
|
1333
|
+
_setMonth(userSelected) {
|
|
1334
|
+
this._adapter.setMonth(this._month, this._locale);
|
|
1335
|
+
this._adapter.setHostAttribute(CALENDAR_CONSTANTS.attributes.MONTH, this._month.toString());
|
|
1336
|
+
if (this._isInitialized) {
|
|
1337
|
+
this._setNavigationButtonStates();
|
|
1338
|
+
this._adapter.emitHostEvent(CALENDAR_CONSTANTS.events.MONTH_CHANGE, { month: this._month, userSelected: userSelected !== null && userSelected !== void 0 ? userSelected : false, year: this._year });
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Sets the year text and attribute in the adapter.
|
|
1343
|
+
* @param userSelected Whether the year was explicilty selected by the user (optional)
|
|
1344
|
+
* */
|
|
1345
|
+
_setYear(userSelected) {
|
|
1346
|
+
this._adapter.setYear(this._year, this._locale);
|
|
1347
|
+
this._adapter.setHostAttribute(CALENDAR_CONSTANTS.attributes.YEAR, this._year.toString());
|
|
1348
|
+
if (this._isInitialized) {
|
|
1349
|
+
this._setNavigationButtonStates();
|
|
1350
|
+
this._adapter.emitHostEvent(CALENDAR_CONSTANTS.events.MONTH_CHANGE, { month: this._month, userSelected: userSelected !== null && userSelected !== void 0 ? userSelected : false, year: this._year });
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* Sets the year currently visible in the menu.
|
|
1355
|
+
* */
|
|
1356
|
+
_setMenuYear() {
|
|
1357
|
+
if (this._menuYear !== null) {
|
|
1358
|
+
this._setNavigationButtonStates();
|
|
1359
|
+
this._adapter.setYear(this._menuYear, this._locale);
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
_applyAllowSingleDateRange() {
|
|
1363
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.ALLOW_SINGLE_DATE_RANGE, this._allowSingleDateRange);
|
|
1364
|
+
this._adapter.setContainerClass(CALENDAR_CONSTANTS.classes.ALLOW_SINGLE_DATE_RANGE, this._allowSingleDateRange);
|
|
1365
|
+
}
|
|
1366
|
+
_applyClearButton() {
|
|
1367
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.CLEAR_BUTTON, true, this._clearButton.toString());
|
|
1368
|
+
if (!this._clearButton) {
|
|
1369
|
+
this._adapter.unregisterClearButtonListener(this._clearButtonListener);
|
|
1370
|
+
this._adapter.removeClearButton();
|
|
1371
|
+
if (!this._todayButton) {
|
|
1372
|
+
this._adapter.removeFooter();
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
else {
|
|
1376
|
+
this._adapter.setFooter();
|
|
1377
|
+
this._adapter.setClearButton();
|
|
1378
|
+
this._adapter.registerClearButtonListener(this._clearButtonListener);
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
_applyConstrainToEnabled() {
|
|
1382
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.CONSTRAIN_TO_ENABLED, true, this._constrainToEnabled.toString());
|
|
1383
|
+
if (this._isInitialized) {
|
|
1384
|
+
this._setNavigationButtonStates();
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
_applyDateBuilder() {
|
|
1388
|
+
if (this._view === 'date') {
|
|
1389
|
+
this._resetDateGrid();
|
|
1390
|
+
this._resumeTabindexOnDate(false);
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
_applyDayBuilder() {
|
|
1394
|
+
var _a;
|
|
1395
|
+
this._adapter.setDays(getSortedDaysOfWeek((_a = this._firstDayOfWeek) !== null && _a !== void 0 ? _a : this._localeFirstDayOfWeek), { builder: this._dayBuilder, locale: this._locale });
|
|
1396
|
+
}
|
|
1397
|
+
_applyDisabledDates() {
|
|
1398
|
+
switch (this._view) {
|
|
1399
|
+
case 'date':
|
|
1400
|
+
this._dates.forEach(d => {
|
|
1401
|
+
const inMonth = isInMonth(d, this._month, this._year);
|
|
1402
|
+
const disabledParams = this._getDisabledDateParams(!inMonth);
|
|
1403
|
+
this._adapter.setDateDisabled(d, isDisabled(d, disabledParams));
|
|
1404
|
+
});
|
|
1405
|
+
break;
|
|
1406
|
+
case 'month':
|
|
1407
|
+
this._openMonthMenu();
|
|
1408
|
+
break;
|
|
1409
|
+
case 'year':
|
|
1410
|
+
this._openYearMenu();
|
|
1411
|
+
break;
|
|
1412
|
+
}
|
|
1413
|
+
this._setNavigationButtonStates();
|
|
1414
|
+
}
|
|
1415
|
+
_applyEvents() {
|
|
1416
|
+
if (this._view !== 'date') {
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
this._dates.forEach(d => {
|
|
1420
|
+
this._setEventsOnDate(d);
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
_applyFirstDayOfWeek() {
|
|
1424
|
+
var _a, _b;
|
|
1425
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.FIRST_DAY_OF_WEEK, isDefined(this._firstDayOfWeek), ((_a = this._firstDayOfWeek) !== null && _a !== void 0 ? _a : 0).toString());
|
|
1426
|
+
this._adapter.setDays(getSortedDaysOfWeek((_b = this._firstDayOfWeek) !== null && _b !== void 0 ? _b : this._localeFirstDayOfWeek), { builder: this._dayBuilder, locale: this._locale });
|
|
1427
|
+
if (this._isInitialized && this._view === 'date') {
|
|
1428
|
+
this._resetDateGrid();
|
|
1429
|
+
this._resumeTabindexOnDate(false);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
_applyFixedHeight() {
|
|
1433
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.FIXED_HEIGHT, this._fixedHeight);
|
|
1434
|
+
this._adapter.setContainerClass(CALENDAR_CONSTANTS.classes.FIXED_HEIGHT, this._fixedHeight);
|
|
1435
|
+
}
|
|
1436
|
+
_applyListYears() {
|
|
1437
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.LIST_YEARS, this._listYears);
|
|
1438
|
+
if (this._isInitialized && this._view === 'year') {
|
|
1439
|
+
this._openYearMenu();
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
_applyLocale() {
|
|
1443
|
+
var _a;
|
|
1444
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.LOCALE, !!this._locale, this._locale);
|
|
1445
|
+
this._adapter.toggleContainerAttribute(!!this._locale, 'lang', this._locale);
|
|
1446
|
+
this._localeFirstDayOfWeek = getFirstDayOfWeekForLocale(this._locale);
|
|
1447
|
+
this._localeWeekendDays = getWeekendDaysForLocale(this._locale);
|
|
1448
|
+
this._applyRtl();
|
|
1449
|
+
if (this._isInitialized) {
|
|
1450
|
+
this._adapter.setMonth(this._month, this._locale);
|
|
1451
|
+
this._adapter.setYear(this._year, this._locale);
|
|
1452
|
+
switch (this._view) {
|
|
1453
|
+
case 'date':
|
|
1454
|
+
this._adapter.setDays(getSortedDaysOfWeek((_a = this._firstDayOfWeek) !== null && _a !== void 0 ? _a : this._localeFirstDayOfWeek), { builder: this._dayBuilder, locale: this._locale });
|
|
1455
|
+
this._resetDateGrid();
|
|
1456
|
+
this._resumeTabindexOnDate(false);
|
|
1457
|
+
break;
|
|
1458
|
+
case 'month':
|
|
1459
|
+
this._openMonthMenu();
|
|
1460
|
+
break;
|
|
1461
|
+
case 'year':
|
|
1462
|
+
this._openYearMenu();
|
|
1463
|
+
break;
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
_applyMenuAnimation() {
|
|
1468
|
+
this._adapter.setHostAttribute(CALENDAR_CONSTANTS.attributes.MENU_ANIMATION, this._menuAnimation);
|
|
1469
|
+
this._adapter.setMenuAnimation(this._menuAnimation);
|
|
1470
|
+
}
|
|
1471
|
+
_applyMin() {
|
|
1472
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.MIN, !!this._minAttribute, this._minAttribute);
|
|
1473
|
+
if (this._isInitialized) {
|
|
1474
|
+
this._applyDisabledDates();
|
|
1475
|
+
if (this._min && this._min > this._focusedDate) {
|
|
1476
|
+
const firstEnabledDate = this._getFirstEnabledDate();
|
|
1477
|
+
if (firstEnabledDate) {
|
|
1478
|
+
this._goToDate(firstEnabledDate, false);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
_applyMax() {
|
|
1484
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.MAX, !!this._maxAttribute, this._maxAttribute);
|
|
1485
|
+
if (this._isInitialized) {
|
|
1486
|
+
this._applyDisabledDates();
|
|
1487
|
+
if (this._max && this._max < this._focusedDate) {
|
|
1488
|
+
const lastEnabledDate = this._getLastEnabledDate();
|
|
1489
|
+
if (lastEnabledDate) {
|
|
1490
|
+
this._goToDate(lastEnabledDate, false);
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
_applyMode(oldMode) {
|
|
1496
|
+
switch (this._mode) {
|
|
1497
|
+
case 'single':
|
|
1498
|
+
this._applySingleMode();
|
|
1499
|
+
break;
|
|
1500
|
+
case 'multiple':
|
|
1501
|
+
this._applyMultipleMode(oldMode === 'range');
|
|
1502
|
+
break;
|
|
1503
|
+
case 'range':
|
|
1504
|
+
this._applyRangeMode();
|
|
1505
|
+
break;
|
|
1506
|
+
}
|
|
1507
|
+
if (this._mode !== 'range') {
|
|
1508
|
+
this._rangeSelectionState = 'none';
|
|
1509
|
+
this._adapter.unregisterHoverListener(this._hoverListener);
|
|
1510
|
+
this._clearRangePreview();
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
_applySingleMode() {
|
|
1514
|
+
this._adapter.setHostAttribute(CALENDAR_CONSTANTS.attributes.MODE, 'single');
|
|
1515
|
+
this._adapter.setMultiple(false);
|
|
1516
|
+
if (this._value.length > 1) {
|
|
1517
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
1518
|
+
for (let i = this._value.length - 2; i >= 0; i -= 1) {
|
|
1519
|
+
this._deselectDate(this._value[i]);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
_applyMultipleMode(fromRange = false) {
|
|
1524
|
+
this._adapter.setHostAttribute(CALENDAR_CONSTANTS.attributes.MODE, 'multiple');
|
|
1525
|
+
this._adapter.setMultiple(true);
|
|
1526
|
+
if (fromRange) {
|
|
1527
|
+
const newDates = getMultipleFromRange(this._value, this._getDisabledDateParams());
|
|
1528
|
+
this._deselectAllDates();
|
|
1529
|
+
newDates.forEach(d => {
|
|
1530
|
+
this._selectDate(d);
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
_applyRangeMode() {
|
|
1535
|
+
var _a, _b;
|
|
1536
|
+
this._adapter.setHostAttribute(CALENDAR_CONSTANTS.attributes.MODE, 'range');
|
|
1537
|
+
this._adapter.setMultiple(false);
|
|
1538
|
+
const newValue = getMinAndMaxDates(this._value);
|
|
1539
|
+
this._deselectAllDates();
|
|
1540
|
+
newValue.forEach(d => {
|
|
1541
|
+
this._selectDate(d);
|
|
1542
|
+
});
|
|
1543
|
+
this._rangeSelectionState = this._value[0] ? this._value[1] ? 'to' : 'from' : 'none';
|
|
1544
|
+
this._adapter.registerHoverListener(this._hoverListener);
|
|
1545
|
+
this._adapter.setRange(getDatesInRange(this._dates, this._value[0], this._value[1]));
|
|
1546
|
+
this._adapter.setRangeStart((_a = this._value[0]) !== null && _a !== void 0 ? _a : null);
|
|
1547
|
+
this._adapter.setRangeEnd((_b = this._value[1]) !== null && _b !== void 0 ? _b : null);
|
|
1548
|
+
}
|
|
1549
|
+
_applyMonth() {
|
|
1550
|
+
this._setMonth();
|
|
1551
|
+
if (this._isInitialized && this._view === 'date') {
|
|
1552
|
+
this._resetDateGrid();
|
|
1553
|
+
this._moveFocusToFirstOfMonth(false);
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
_applyPreventFocus() {
|
|
1557
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.PREVENT_FOCUS, this._preventFocus);
|
|
1558
|
+
this._adapter.setContainerClass(CALENDAR_CONSTANTS.classes.PREVENT_FOCUS, this._preventFocus);
|
|
1559
|
+
this._adapter.setPreventFocusOnMenu(this._preventFocus);
|
|
1560
|
+
if (this._preventFocus) {
|
|
1561
|
+
this._adapter.registerPreventFocusListener(this._preventFocusListener);
|
|
1562
|
+
}
|
|
1563
|
+
else {
|
|
1564
|
+
this._adapter.unregisterPreventFocusListener(this._preventFocusListener);
|
|
1565
|
+
}
|
|
1566
|
+
if (this._isInitialized && this._view === 'date') {
|
|
1567
|
+
this._resumeTabindexOnDate(false);
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
_applyReadOnly() {
|
|
1571
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.READONLY, this._readonly);
|
|
1572
|
+
this._adapter.toggleHostAttribute('aria-readonly', this._readonly, 'true');
|
|
1573
|
+
this._adapter.setContainerClass(CALENDAR_CONSTANTS.classes.READONLY, this._readonly);
|
|
1574
|
+
if (this._readonly) {
|
|
1575
|
+
this._adapter.unregisterDateClickListener(this._dateClickListener);
|
|
1576
|
+
this._adapter.unregisterHoverListener(this._hoverListener);
|
|
1577
|
+
}
|
|
1578
|
+
else {
|
|
1579
|
+
this._adapter.registerDateClickListener(this._dateClickListener);
|
|
1580
|
+
if (this._mode === 'range') {
|
|
1581
|
+
this._adapter.registerHoverListener(this._hoverListener);
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
_applyRtl() {
|
|
1586
|
+
this._rtl = isRtlLocale(this._locale);
|
|
1587
|
+
this._adapter.setContainerClass(CALENDAR_CONSTANTS.classes.RTL, this._rtl);
|
|
1588
|
+
this._adapter.toggleContainerAttribute(this._rtl, 'dir', 'rtl');
|
|
1589
|
+
}
|
|
1590
|
+
_applySelectionFollowsMonth() {
|
|
1591
|
+
this._adapter.setHostAttribute(CALENDAR_CONSTANTS.attributes.SELECTION_FOLLOWS_MONTH, this._selectionFollowsMonth.toString());
|
|
1592
|
+
}
|
|
1593
|
+
_applyShowHeader() {
|
|
1594
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.SHOW_HEADER, this._showHeader, this._showHeader.toString());
|
|
1595
|
+
if (this._showHeader) {
|
|
1596
|
+
this._adapter.setHeader();
|
|
1597
|
+
this._adapter.registerMonthButtonListener(this._monthButtonListener);
|
|
1598
|
+
this._adapter.registerNextButtonListener(this._nextButtonListener);
|
|
1599
|
+
this._adapter.registerPreviousButtonListener(this._previousButtonListener);
|
|
1600
|
+
this._adapter.registerYearButtonListener(this._yearButtonListener);
|
|
1601
|
+
this._setNavButtonLabels();
|
|
1602
|
+
}
|
|
1603
|
+
else {
|
|
1604
|
+
this._adapter.unregisterMonthButtonListener(this._monthButtonListener);
|
|
1605
|
+
this._adapter.unregisterNextButtonListener(this._nextButtonListener);
|
|
1606
|
+
this._adapter.unregisterPreviousButtonListener(this._previousButtonListener);
|
|
1607
|
+
this._adapter.unregisterYearButtonListener(this._yearButtonListener);
|
|
1608
|
+
this._adapter.removeHeader();
|
|
1609
|
+
}
|
|
1610
|
+
if (this._isInitialized) {
|
|
1611
|
+
this._adapter.setMonth(this._month, this._locale);
|
|
1612
|
+
this._adapter.setYear(this._year, this._locale);
|
|
1613
|
+
this._setNavigationButtonStates();
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
_applyShowOtherMonths() {
|
|
1617
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.SHOW_OTHER_MONTHS, this._showOtherMonths);
|
|
1618
|
+
if (this._isInitialized && this._view === 'date') {
|
|
1619
|
+
let skipFinalWeek = false;
|
|
1620
|
+
this._dates.forEach((d, i) => {
|
|
1621
|
+
if (isInMonth(d, this._month, this._year)) {
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1624
|
+
if (i === CALENDAR_CONSTANTS.numbers.PENULTIMATE_WEEK_BEGIN_INDEX || i === CALENDAR_CONSTANTS.numbers.FINAL_WEEK_BEGIN_INDEX) {
|
|
1625
|
+
skipFinalWeek = true;
|
|
1626
|
+
}
|
|
1627
|
+
if (this._showOtherMonths && !skipFinalWeek) {
|
|
1628
|
+
this._adapter.replaceDate(this._getDateConfig(d), { builder: this._dateBuilder, locale: this._locale });
|
|
1629
|
+
}
|
|
1630
|
+
else {
|
|
1631
|
+
this._adapter.replaceDateWithSpacer(d);
|
|
1632
|
+
}
|
|
1633
|
+
this._setEventsOnDate(d);
|
|
1634
|
+
this._applyWeekendDays();
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
_applyShowToday() {
|
|
1639
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.SHOW_TODAY, this._showToday);
|
|
1640
|
+
this._adapter.setContainerClass(CALENDAR_CONSTANTS.classes.SHOW_TODAY, this._showToday);
|
|
1641
|
+
}
|
|
1642
|
+
_applyTodayButton() {
|
|
1643
|
+
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.TODAY_BUTTON, true, this._todayButton.toString());
|
|
1644
|
+
if (!this._todayButton) {
|
|
1645
|
+
this._adapter.unregisterTodayButtonListener(this._todayButtonListener);
|
|
1646
|
+
this._adapter.removeTodayButton();
|
|
1647
|
+
if (!this._clearButton) {
|
|
1648
|
+
this._adapter.removeFooter();
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
else {
|
|
1652
|
+
this._adapter.setFooter();
|
|
1653
|
+
this._adapter.setTodayButton();
|
|
1654
|
+
this._adapter.registerTodayButtonListener(this._todayButtonListener);
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
_applyTooltipBuilder() {
|
|
1658
|
+
if (this._view === 'date') {
|
|
1659
|
+
this._dates.forEach(d => {
|
|
1660
|
+
var _a;
|
|
1661
|
+
if (!this._showOtherMonths && !isInMonth(d, this._month, this._year)) {
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
const events = getEventsOnDate(d, this._events, this._eventBuilder);
|
|
1665
|
+
let tooltipContent = getEventDescriptions(events);
|
|
1666
|
+
if (this._tooltipBuilder) {
|
|
1667
|
+
tooltipContent = (_a = this._tooltipBuilder(this._getCalendarDate(d), tooltipContent)) !== null && _a !== void 0 ? _a : '';
|
|
1668
|
+
}
|
|
1669
|
+
this._adapter.setDateTooltip(d, tooltipContent);
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
_applyWeekendDays() {
|
|
1674
|
+
var _a;
|
|
1675
|
+
const weekendDays = (_a = this._weekendDays) !== null && _a !== void 0 ? _a : this._localeWeekendDays;
|
|
1676
|
+
if (this._view === 'date') {
|
|
1677
|
+
this._dates.forEach(d => {
|
|
1678
|
+
const day = d.getDay();
|
|
1679
|
+
this._adapter.setWeekend(d, (this._showOtherMonths || isInMonth(d, this._month, this._year)) && weekendDays.includes(day));
|
|
1680
|
+
});
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
_applyValue(newValue) {
|
|
1684
|
+
newValue = newValue.map(d => new Date(d));
|
|
1685
|
+
sortDates(newValue);
|
|
1686
|
+
this._deselectAllDates();
|
|
1687
|
+
newValue.forEach(d => this._selectDate(d));
|
|
1688
|
+
if (this._mode === 'range') {
|
|
1689
|
+
this._rangeSelectionState = this._value.length === 2 ? 'to' : this._value.length === 1 ? 'from' : 'none';
|
|
1690
|
+
this._clearRangePreview();
|
|
1691
|
+
this._adapter.setRangeStart(this._value[0]);
|
|
1692
|
+
this._setRangePreview();
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
_applyView() {
|
|
1696
|
+
this._adapter.setHostAttribute(CALENDAR_CONSTANTS.attributes.VIEW, this._view);
|
|
1697
|
+
switch (this._view) {
|
|
1698
|
+
case 'date':
|
|
1699
|
+
this._closeMenu();
|
|
1700
|
+
break;
|
|
1701
|
+
case 'month':
|
|
1702
|
+
this._openMonthMenu();
|
|
1703
|
+
break;
|
|
1704
|
+
case 'year':
|
|
1705
|
+
this._openYearMenu();
|
|
1706
|
+
break;
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
_applyYear() {
|
|
1710
|
+
this._setYear();
|
|
1711
|
+
if (this._isInitialized && this._view === 'date') {
|
|
1712
|
+
this._resetDateGrid();
|
|
1713
|
+
this._moveFocusToFirstOfMonth(false);
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
_applyYearRange() {
|
|
1717
|
+
this._adapter.setHostAttribute(CALENDAR_CONSTANTS.attributes.YEAR_RANGE, this._yearRange);
|
|
1718
|
+
const range = parseYearRange(this._yearRange);
|
|
1719
|
+
this._minYear = range.min;
|
|
1720
|
+
this._maxYear = range.max;
|
|
1721
|
+
if (this._view === 'year') {
|
|
1722
|
+
this._openYearMenu();
|
|
1723
|
+
this._setNavigationButtonStates();
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
/** Get the currently focused date */
|
|
1727
|
+
get activeDate() {
|
|
1728
|
+
return new Date(this._focusedDate);
|
|
1729
|
+
}
|
|
1730
|
+
/** Get/set whether single date ranges are allowed */
|
|
1731
|
+
get allowSingleDateRange() {
|
|
1732
|
+
return this._allowSingleDateRange;
|
|
1733
|
+
}
|
|
1734
|
+
set allowSingleDateRange(value) {
|
|
1735
|
+
if (this._allowSingleDateRange !== value) {
|
|
1736
|
+
this._allowSingleDateRange = value;
|
|
1737
|
+
this._applyAllowSingleDateRange();
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
/** Get/set whether to show the clear button */
|
|
1741
|
+
get clearButton() {
|
|
1742
|
+
return this._clearButton;
|
|
1743
|
+
}
|
|
1744
|
+
set clearButton(value) {
|
|
1745
|
+
if (this._clearButton !== value) {
|
|
1746
|
+
this._clearButton = value;
|
|
1747
|
+
if (this._isInitialized) {
|
|
1748
|
+
this._applyClearButton();
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
/* Get/set the clear button callback */
|
|
1753
|
+
get clearCallback() {
|
|
1754
|
+
return this._clearCallback;
|
|
1755
|
+
}
|
|
1756
|
+
set clearCallback(value) {
|
|
1757
|
+
this._clearCallback = value;
|
|
1758
|
+
}
|
|
1759
|
+
/** Get/set whether to constain navigation to enabled dates */
|
|
1760
|
+
get constrainToEnabled() {
|
|
1761
|
+
return this._constrainToEnabled;
|
|
1762
|
+
}
|
|
1763
|
+
set constrainToEnabled(value) {
|
|
1764
|
+
if (this._constrainToEnabled !== value) {
|
|
1765
|
+
this._constrainToEnabled = value;
|
|
1766
|
+
if (this._isInitialized) {
|
|
1767
|
+
this._applyConstrainToEnabled();
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
/** Get/set date builder */
|
|
1772
|
+
get dateBuilder() {
|
|
1773
|
+
return this._dateBuilder;
|
|
1774
|
+
}
|
|
1775
|
+
set dateBuilder(value) {
|
|
1776
|
+
this._dateBuilder = value;
|
|
1777
|
+
if (this._isInitialized) {
|
|
1778
|
+
this._applyDateBuilder();
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
/** Get/set date select callback */
|
|
1782
|
+
get dateSelectCallback() {
|
|
1783
|
+
return this._dateSelectCallback;
|
|
1784
|
+
}
|
|
1785
|
+
set dateSelectCallback(value) {
|
|
1786
|
+
this._dateSelectCallback = value;
|
|
1787
|
+
}
|
|
1788
|
+
/** Get/set day builder */
|
|
1789
|
+
get dayBuilder() {
|
|
1790
|
+
return this.dayBuilder;
|
|
1791
|
+
}
|
|
1792
|
+
set dayBuilder(value) {
|
|
1793
|
+
this._dayBuilder = value;
|
|
1794
|
+
if (this._isInitialized) {
|
|
1795
|
+
this._applyDayBuilder();
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
/** Get/set disabled date builder */
|
|
1799
|
+
get disabledDateBuilder() {
|
|
1800
|
+
return this._disabledDateBuilder;
|
|
1801
|
+
}
|
|
1802
|
+
set disabledDateBuilder(value) {
|
|
1803
|
+
this._disabledDateBuilder = value;
|
|
1804
|
+
if (this._isInitialized) {
|
|
1805
|
+
this._applyDisabledDates();
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
/** Get/set disabled dates */
|
|
1809
|
+
get disabledDates() {
|
|
1810
|
+
const dates = this._disabledDates.map(d => new Date(d));
|
|
1811
|
+
return dates.length ? dates : null;
|
|
1812
|
+
}
|
|
1813
|
+
set disabledDates(value) {
|
|
1814
|
+
const dates = value ? isArray(value) ? value : [value] : [];
|
|
1815
|
+
this._disabledDates = dates.map(d => {
|
|
1816
|
+
const date = new Date(d);
|
|
1817
|
+
date.setHours(0, 0, 0, 0);
|
|
1818
|
+
return date;
|
|
1819
|
+
});
|
|
1820
|
+
if (this._isInitialized) {
|
|
1821
|
+
this._applyDisabledDates();
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
/** Get/set disabled days of week */
|
|
1825
|
+
get disabledDaysOfWeek() {
|
|
1826
|
+
return this._disabledDaysOfWeek.length ? [...this._disabledDaysOfWeek] : null;
|
|
1827
|
+
}
|
|
1828
|
+
set disabledDaysOfWeek(value) {
|
|
1829
|
+
this._disabledDaysOfWeek = (isDefined(value) ? isArray(value) ? value : [value] : []);
|
|
1830
|
+
if (this._isInitialized) {
|
|
1831
|
+
this._applyDisabledDates();
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
/** Get/set the event builder */
|
|
1835
|
+
get eventBuilder() {
|
|
1836
|
+
return this._eventBuilder;
|
|
1837
|
+
}
|
|
1838
|
+
set eventBuilder(value) {
|
|
1839
|
+
this._eventBuilder = value;
|
|
1840
|
+
if (this._isInitialized) {
|
|
1841
|
+
this._applyEvents();
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
/** Get/set events */
|
|
1845
|
+
get events() {
|
|
1846
|
+
return this._events ? [...this._events] : null;
|
|
1847
|
+
}
|
|
1848
|
+
set events(value) {
|
|
1849
|
+
this._events = (value === null || value === void 0 ? void 0 : value.length) ? [...value] : [];
|
|
1850
|
+
if (this._isInitialized) {
|
|
1851
|
+
this._applyEvents();
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
/** Get/set first day of week */
|
|
1855
|
+
get firstDayOfWeek() {
|
|
1856
|
+
return this._firstDayOfWeek;
|
|
1857
|
+
}
|
|
1858
|
+
set firstDayOfWeek(value) {
|
|
1859
|
+
if (this._firstDayOfWeek !== value) {
|
|
1860
|
+
this._firstDayOfWeek = isDefined(value) ? +value : value;
|
|
1861
|
+
if (this._isInitialized) {
|
|
1862
|
+
this._applyFirstDayOfWeek();
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
/** Get/set fixed height */
|
|
1867
|
+
get fixedHeight() {
|
|
1868
|
+
return this._fixedHeight;
|
|
1869
|
+
}
|
|
1870
|
+
set fixedHeight(value) {
|
|
1871
|
+
if (this._fixedHeight !== value) {
|
|
1872
|
+
this._fixedHeight = value;
|
|
1873
|
+
if (this._isInitialized) {
|
|
1874
|
+
this._applyFixedHeight();
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
/** Get/set list years */
|
|
1879
|
+
get listYears() {
|
|
1880
|
+
return this._listYears;
|
|
1881
|
+
}
|
|
1882
|
+
set listYears(value) {
|
|
1883
|
+
if (this._listYears !== value) {
|
|
1884
|
+
this._listYears = value;
|
|
1885
|
+
this._applyListYears();
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
/** Get/set locale */
|
|
1889
|
+
get locale() {
|
|
1890
|
+
return this._locale;
|
|
1891
|
+
}
|
|
1892
|
+
set locale(value) {
|
|
1893
|
+
if (typeof value === 'string' && !value.length) {
|
|
1894
|
+
value = undefined;
|
|
1895
|
+
}
|
|
1896
|
+
if (this._locale !== value) {
|
|
1897
|
+
this._locale = value;
|
|
1898
|
+
if (this._isInitialized) {
|
|
1899
|
+
this._applyLocale();
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
/** Get/set max date */
|
|
1904
|
+
get max() {
|
|
1905
|
+
return this._max;
|
|
1906
|
+
}
|
|
1907
|
+
set max(value) {
|
|
1908
|
+
var _a;
|
|
1909
|
+
if (this._maxAttribute !== value) {
|
|
1910
|
+
this._maxAttribute = (_a = value === null || value === void 0 ? void 0 : value.toString()) !== null && _a !== void 0 ? _a : null;
|
|
1911
|
+
this._max = coerceDateFromValue(value);
|
|
1912
|
+
this._applyMax();
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
/** Get/set menu animation type */
|
|
1916
|
+
get menuAnimation() {
|
|
1917
|
+
return this._menuAnimation;
|
|
1918
|
+
}
|
|
1919
|
+
set menuAnimation(value) {
|
|
1920
|
+
if (this._menuAnimation !== value) {
|
|
1921
|
+
this._menuAnimation = value;
|
|
1922
|
+
if (this._isInitialized) {
|
|
1923
|
+
this._applyMenuAnimation();
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
/** Get/set min date */
|
|
1928
|
+
get min() {
|
|
1929
|
+
return this._min;
|
|
1930
|
+
}
|
|
1931
|
+
set min(value) {
|
|
1932
|
+
var _a;
|
|
1933
|
+
if (this._minAttribute !== value) {
|
|
1934
|
+
this._minAttribute = (_a = value === null || value === void 0 ? void 0 : value.toString()) !== null && _a !== void 0 ? _a : null;
|
|
1935
|
+
this._min = coerceDateFromValue(value);
|
|
1936
|
+
this._applyMin();
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
/** Get/set mode */
|
|
1940
|
+
get mode() {
|
|
1941
|
+
return this._mode;
|
|
1942
|
+
}
|
|
1943
|
+
set mode(value) {
|
|
1944
|
+
if (this._mode !== value) {
|
|
1945
|
+
const oldMode = this._mode;
|
|
1946
|
+
this._mode = value;
|
|
1947
|
+
if (this._isInitialized) {
|
|
1948
|
+
this._applyMode(oldMode);
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
/** Get/set month */
|
|
1953
|
+
get month() {
|
|
1954
|
+
return this._month;
|
|
1955
|
+
}
|
|
1956
|
+
set month(value) {
|
|
1957
|
+
if (this._month !== value) {
|
|
1958
|
+
const newValue = isNaN(+value) ? this._month : +value;
|
|
1959
|
+
if (this._month === newValue) {
|
|
1960
|
+
return;
|
|
1961
|
+
}
|
|
1962
|
+
this._month = +value;
|
|
1963
|
+
if (this._isInitialized) {
|
|
1964
|
+
this._applyMonth();
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
/** Get/set prevent focus */
|
|
1969
|
+
get preventFocus() {
|
|
1970
|
+
return this._preventFocus;
|
|
1971
|
+
}
|
|
1972
|
+
set preventFocus(value) {
|
|
1973
|
+
if (this._preventFocus !== value) {
|
|
1974
|
+
this._preventFocus = value;
|
|
1975
|
+
if (this._isInitialized) {
|
|
1976
|
+
this._applyPreventFocus();
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
/** Get/set readonly */
|
|
1981
|
+
get readonly() {
|
|
1982
|
+
return this._readonly;
|
|
1983
|
+
}
|
|
1984
|
+
set readonly(value) {
|
|
1985
|
+
if (this._readonly !== value) {
|
|
1986
|
+
this._readonly = value;
|
|
1987
|
+
if (this._isInitialized) {
|
|
1988
|
+
this._applyReadOnly();
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
/** Get/set selection follows month */
|
|
1993
|
+
get selectionFollowsMonth() {
|
|
1994
|
+
return this._selectionFollowsMonth;
|
|
1995
|
+
}
|
|
1996
|
+
set selectionFollowsMonth(value) {
|
|
1997
|
+
if (this._selectionFollowsMonth !== value) {
|
|
1998
|
+
this._selectionFollowsMonth = value;
|
|
1999
|
+
if (this._isInitialized) {
|
|
2000
|
+
this._applySelectionFollowsMonth();
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
/** Get/set show nav */
|
|
2005
|
+
get showHeader() {
|
|
2006
|
+
return this._showHeader;
|
|
2007
|
+
}
|
|
2008
|
+
set showHeader(value) {
|
|
2009
|
+
if (this._showHeader !== value) {
|
|
2010
|
+
this._showHeader = value;
|
|
2011
|
+
if (this._isInitialized) {
|
|
2012
|
+
this._applyShowHeader();
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
/** Get/set show other months */
|
|
2017
|
+
get showOtherMonths() {
|
|
2018
|
+
return this._showOtherMonths;
|
|
2019
|
+
}
|
|
2020
|
+
set showOtherMonths(value) {
|
|
2021
|
+
if (this._showOtherMonths !== value) {
|
|
2022
|
+
this._showOtherMonths = value;
|
|
2023
|
+
if (this._isInitialized) {
|
|
2024
|
+
this._applyShowOtherMonths();
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
/** Get/set show today */
|
|
2029
|
+
get showToday() {
|
|
2030
|
+
return this._showToday;
|
|
2031
|
+
}
|
|
2032
|
+
set showToday(value) {
|
|
2033
|
+
if (this._showToday !== value) {
|
|
2034
|
+
this._showToday = value;
|
|
2035
|
+
if (this._isInitialized) {
|
|
2036
|
+
this._applyShowToday();
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
/** Get/set whether to show the today button */
|
|
2041
|
+
get todayButton() {
|
|
2042
|
+
return this._todayButton;
|
|
2043
|
+
}
|
|
2044
|
+
set todayButton(value) {
|
|
2045
|
+
if (this._todayButton !== value) {
|
|
2046
|
+
this._todayButton = value;
|
|
2047
|
+
if (this._isInitialized) {
|
|
2048
|
+
this._applyTodayButton();
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
/* Get/set the today button callback */
|
|
2053
|
+
get todayCallback() {
|
|
2054
|
+
return this._todayCallback;
|
|
2055
|
+
}
|
|
2056
|
+
set todayCallback(value) {
|
|
2057
|
+
this._todayCallback = value;
|
|
2058
|
+
}
|
|
2059
|
+
/** Get/set the tooltip builder */
|
|
2060
|
+
get tooltipBuilder() {
|
|
2061
|
+
return this._tooltipBuilder;
|
|
2062
|
+
}
|
|
2063
|
+
set tooltipBuilder(value) {
|
|
2064
|
+
this._tooltipBuilder = value;
|
|
2065
|
+
if (this._isInitialized) {
|
|
2066
|
+
this._applyTooltipBuilder();
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
/** Get/set value */
|
|
2070
|
+
get value() {
|
|
2071
|
+
var _a;
|
|
2072
|
+
if (this._mode === 'range') {
|
|
2073
|
+
return (_a = this._rangeSelectionStore) !== null && _a !== void 0 ? _a : getDateRangeFromDates(this._value);
|
|
2074
|
+
}
|
|
2075
|
+
const dates = this._value.map(d => new Date(d));
|
|
2076
|
+
return this._mode === 'multiple' ? dates : dates.length ? dates[0] : null;
|
|
2077
|
+
}
|
|
2078
|
+
set value(value) {
|
|
2079
|
+
let dates = [];
|
|
2080
|
+
this._rangeSelectionStore = undefined;
|
|
2081
|
+
if (!value || (Array.isArray(value) && !value.length)) {
|
|
2082
|
+
this._value = [];
|
|
2083
|
+
}
|
|
2084
|
+
else if (Array.isArray(value)) {
|
|
2085
|
+
switch (this._mode) {
|
|
2086
|
+
case 'single':
|
|
2087
|
+
dates = [value[0]];
|
|
2088
|
+
break;
|
|
2089
|
+
case 'multiple':
|
|
2090
|
+
dates = value;
|
|
2091
|
+
break;
|
|
2092
|
+
case 'range':
|
|
2093
|
+
const minAndMax = getMinAndMaxDates(value);
|
|
2094
|
+
dates.push(minAndMax[0]);
|
|
2095
|
+
if (minAndMax.length > 1) {
|
|
2096
|
+
dates.push(minAndMax[1]);
|
|
2097
|
+
}
|
|
2098
|
+
break;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
else if (isValidDate(new Date(value))) {
|
|
2102
|
+
dates = [value];
|
|
2103
|
+
}
|
|
2104
|
+
else {
|
|
2105
|
+
this._rangeSelectionStore = new DateRange(value);
|
|
2106
|
+
dates = getDatesFromDateRange(value);
|
|
2107
|
+
}
|
|
2108
|
+
this._applyValue(dates);
|
|
2109
|
+
}
|
|
2110
|
+
/** Get/set view */
|
|
2111
|
+
get view() {
|
|
2112
|
+
return this._view;
|
|
2113
|
+
}
|
|
2114
|
+
set view(value) {
|
|
2115
|
+
if (this._view !== value) {
|
|
2116
|
+
this._view = value;
|
|
2117
|
+
this._applyView();
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
/** Get/set weekend days */
|
|
2121
|
+
get weekendDays() {
|
|
2122
|
+
return this._weekendDays ? [...this._weekendDays] : null;
|
|
2123
|
+
}
|
|
2124
|
+
set weekendDays(value) {
|
|
2125
|
+
var _a;
|
|
2126
|
+
this._weekendDays = (_a = value === null || value === void 0 ? void 0 : value.map(v => +v)) !== null && _a !== void 0 ? _a : null;
|
|
2127
|
+
if (this._isInitialized) {
|
|
2128
|
+
this._applyWeekendDays();
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
/** Get/set year */
|
|
2132
|
+
get year() {
|
|
2133
|
+
return this._year;
|
|
2134
|
+
}
|
|
2135
|
+
set year(value) {
|
|
2136
|
+
if (this._year !== value) {
|
|
2137
|
+
const newValue = isNaN(+value) ? this._year : +value;
|
|
2138
|
+
if (this._year === newValue) {
|
|
2139
|
+
return;
|
|
2140
|
+
}
|
|
2141
|
+
this._year = newValue;
|
|
2142
|
+
if (this._isInitialized) {
|
|
2143
|
+
this._applyYear();
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
/** Get/set year range */
|
|
2148
|
+
get yearRange() {
|
|
2149
|
+
return this._yearRange;
|
|
2150
|
+
}
|
|
2151
|
+
set yearRange(value) {
|
|
2152
|
+
if (this._yearRange !== value) {
|
|
2153
|
+
this._yearRange = value;
|
|
2154
|
+
if (this._isInitialized) {
|
|
2155
|
+
this._applyYearRange();
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
/** Deselect all dates */
|
|
2160
|
+
clear() {
|
|
2161
|
+
this._deselectAllDates();
|
|
2162
|
+
if (this._clearCallback) {
|
|
2163
|
+
this._clearCallback();
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
/** Deselect a date */
|
|
2167
|
+
deselectDate(date, setFocus) {
|
|
2168
|
+
this._onDateSelected(date, false);
|
|
2169
|
+
if (setFocus) {
|
|
2170
|
+
this._focusedDate = date;
|
|
2171
|
+
this._resumeTabindexOnDate(true);
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
/** Go to a date and optionally set focus on it */
|
|
2175
|
+
goToDate(date, setFocus) {
|
|
2176
|
+
this._goToDate(date, setFocus !== null && setFocus !== void 0 ? setFocus : false);
|
|
2177
|
+
}
|
|
2178
|
+
/** Handle an external keyboard event */
|
|
2179
|
+
handleExternalKeyEvent(evt) {
|
|
2180
|
+
this._onKeydown(evt);
|
|
2181
|
+
}
|
|
2182
|
+
/** Reinitialize the calendar */
|
|
2183
|
+
layout() {
|
|
2184
|
+
this._applyFirstDayOfWeek();
|
|
2185
|
+
this._createDateView();
|
|
2186
|
+
this._applyShowHeader();
|
|
2187
|
+
this._applyConstrainToEnabled();
|
|
2188
|
+
}
|
|
2189
|
+
/** Select a date */
|
|
2190
|
+
selectDate(date, setFocus) {
|
|
2191
|
+
this._onDateSelected(date, true);
|
|
2192
|
+
if (setFocus) {
|
|
2193
|
+
this._focusedDate = date;
|
|
2194
|
+
this._resumeTabindexOnDate(true);
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
/** Sets the active date if in view */
|
|
2198
|
+
setActiveDate(date, setFocus) {
|
|
2199
|
+
if (this._dates.some(d => isSameDate(d, date) && (this._showOtherMonths || isInMonth(d, this._month, this._year)))) {
|
|
2200
|
+
this._goToDate(date, setFocus !== null && setFocus !== void 0 ? setFocus : false);
|
|
2201
|
+
return true;
|
|
2202
|
+
}
|
|
2203
|
+
return false;
|
|
2204
|
+
}
|
|
2205
|
+
/** Go to today */
|
|
2206
|
+
today() {
|
|
2207
|
+
const today = new Date();
|
|
2208
|
+
today.setHours(0, 0, 0, 0);
|
|
2209
|
+
this._goToDate(today, true);
|
|
2210
|
+
if (this._todayCallback) {
|
|
2211
|
+
this._todayCallback();
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
/** Toggles a date selected or unselected */
|
|
2215
|
+
toggleDate(date, force) {
|
|
2216
|
+
this._onDateSelected(date);
|
|
2217
|
+
}
|
|
2218
|
+
}
|