@jetbrains/ring-ui-built 6.0.1
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.txt +202 -0
- package/README.md +103 -0
- package/components/_helpers/_rollupPluginBabelHelpers.js +648 -0
- package/components/_helpers/anchor.js +31 -0
- package/components/_helpers/badge.js +3 -0
- package/components/_helpers/button__classes.js +34 -0
- package/components/_helpers/caption.js +31 -0
- package/components/_helpers/card.js +132 -0
- package/components/_helpers/date-picker.js +3 -0
- package/components/_helpers/dialog__body-scroll-preventer.js +54 -0
- package/components/_helpers/grid.js +3 -0
- package/components/_helpers/header.js +3 -0
- package/components/_helpers/heading.js +3 -0
- package/components/_helpers/icon__svg.js +75 -0
- package/components/_helpers/input.js +235 -0
- package/components/_helpers/island.js +3 -0
- package/components/_helpers/link.js +3 -0
- package/components/_helpers/list.js +3 -0
- package/components/_helpers/query-assist__suggestions.js +102 -0
- package/components/_helpers/select__filter.js +94 -0
- package/components/_helpers/services-link.js +48 -0
- package/components/_helpers/sidebar.js +123 -0
- package/components/_helpers/tab-link.js +34 -0
- package/components/_helpers/table.js +3 -0
- package/components/_helpers/theme.js +95 -0
- package/components/_helpers/title.js +103 -0
- package/components/alert/alert.d.ts +113 -0
- package/components/alert/alert.js +294 -0
- package/components/alert/container.d.ts +15 -0
- package/components/alert/container.js +52 -0
- package/components/alert-service/alert-service.d.ts +36 -0
- package/components/alert-service/alert-service.js +220 -0
- package/components/analytics/analytics.d.ts +18 -0
- package/components/analytics/analytics.js +31 -0
- package/components/analytics/analytics__custom-plugin.d.ts +28 -0
- package/components/analytics/analytics__custom-plugin.js +89 -0
- package/components/auth/auth.d.ts +3 -0
- package/components/auth/auth.js +133 -0
- package/components/auth/auth__core.d.ts +236 -0
- package/components/auth/auth__core.js +1653 -0
- package/components/auth/background-flow.d.ts +31 -0
- package/components/auth/background-flow.js +147 -0
- package/components/auth/down-notification.d.ts +15 -0
- package/components/auth/down-notification.js +157 -0
- package/components/auth/iframe-flow.d.ts +20 -0
- package/components/auth/iframe-flow.js +196 -0
- package/components/auth/request-builder.d.ts +48 -0
- package/components/auth/request-builder.js +104 -0
- package/components/auth/response-parser.d.ts +70 -0
- package/components/auth/response-parser.js +138 -0
- package/components/auth/storage.d.ts +112 -0
- package/components/auth/storage.js +429 -0
- package/components/auth/token-validator.d.ts +93 -0
- package/components/auth/token-validator.js +269 -0
- package/components/auth/window-flow.d.ts +26 -0
- package/components/auth/window-flow.js +154 -0
- package/components/auth-dialog/auth-dialog.d.ts +60 -0
- package/components/auth-dialog/auth-dialog.js +221 -0
- package/components/auth-dialog-service/auth-dialog-service.d.ts +6 -0
- package/components/auth-dialog-service/auth-dialog-service.js +92 -0
- package/components/avatar/avatar-example-datauri.d.ts +1 -0
- package/components/avatar/avatar-example-datauri.js +4 -0
- package/components/avatar/avatar.d.ts +52 -0
- package/components/avatar/avatar.js +183 -0
- package/components/avatar/fallback-avatar.d.ts +17 -0
- package/components/avatar/fallback-avatar.js +151 -0
- package/components/badge/badge.d.ts +24 -0
- package/components/badge/badge.js +59 -0
- package/components/button/button.d.ts +67 -0
- package/components/button/button.js +131 -0
- package/components/button/button__classes.d.ts +2 -0
- package/components/button/button__classes.js +2 -0
- package/components/button-group/button-group.d.ts +18 -0
- package/components/button-group/button-group.js +48 -0
- package/components/button-group/caption.d.ts +8 -0
- package/components/button-group/caption.js +5 -0
- package/components/button-set/button-set.d.ts +16 -0
- package/components/button-set/button-set.js +47 -0
- package/components/button-toolbar/button-toolbar.d.ts +16 -0
- package/components/button-toolbar/button-toolbar.js +46 -0
- package/components/caret/caret.d.ts +66 -0
- package/components/caret/caret.js +259 -0
- package/components/checkbox/checkbox.d.ts +45 -0
- package/components/checkbox/checkbox.js +130 -0
- package/components/clipboard/clipboard-fallback.d.ts +2 -0
- package/components/clipboard/clipboard-fallback.js +42 -0
- package/components/clipboard/clipboard.d.ts +5 -0
- package/components/clipboard/clipboard.js +185 -0
- package/components/code/code.d.ts +44 -0
- package/components/code/code.js +191 -0
- package/components/confirm/confirm.d.ts +48 -0
- package/components/confirm/confirm.js +153 -0
- package/components/confirm-service/confirm-service.d.ts +21 -0
- package/components/confirm-service/confirm-service.js +141 -0
- package/components/content-layout/content-layout.d.ts +26 -0
- package/components/content-layout/content-layout.js +79 -0
- package/components/content-layout/sidebar.d.ts +31 -0
- package/components/content-layout/sidebar.js +7 -0
- package/components/contenteditable/contenteditable.d.ts +47 -0
- package/components/contenteditable/contenteditable.js +84 -0
- package/components/control-label/control-label.d.ts +11 -0
- package/components/control-label/control-label.js +36 -0
- package/components/data-list/data-list.d.ts +85 -0
- package/components/data-list/data-list.js +251 -0
- package/components/data-list/data-list.mock.d.ts +16 -0
- package/components/data-list/data-list.mock.js +192 -0
- package/components/data-list/item.d.ts +50 -0
- package/components/data-list/item.js +235 -0
- package/components/data-list/selection.d.ts +16 -0
- package/components/data-list/selection.js +148 -0
- package/components/data-list/title.d.ts +26 -0
- package/components/data-list/title.js +28 -0
- package/components/date-picker/consts.d.ts +98 -0
- package/components/date-picker/consts.js +46 -0
- package/components/date-picker/date-input.d.ts +47 -0
- package/components/date-picker/date-input.js +177 -0
- package/components/date-picker/date-picker.d.ts +77 -0
- package/components/date-picker/date-picker.js +404 -0
- package/components/date-picker/date-popup.d.ts +55 -0
- package/components/date-picker/date-popup.js +488 -0
- package/components/date-picker/day.d.ts +30 -0
- package/components/date-picker/day.js +133 -0
- package/components/date-picker/formats.d.ts +2 -0
- package/components/date-picker/formats.js +3 -0
- package/components/date-picker/month-names.d.ts +13 -0
- package/components/date-picker/month-names.js +110 -0
- package/components/date-picker/month-slider.d.ts +29 -0
- package/components/date-picker/month-slider.js +93 -0
- package/components/date-picker/month.d.ts +14 -0
- package/components/date-picker/month.js +58 -0
- package/components/date-picker/months.d.ts +11 -0
- package/components/date-picker/months.js +133 -0
- package/components/date-picker/weekdays.d.ts +13 -0
- package/components/date-picker/weekdays.js +39 -0
- package/components/date-picker/years.d.ts +25 -0
- package/components/date-picker/years.js +134 -0
- package/components/dialog/dialog.d.ts +64 -0
- package/components/dialog/dialog.js +240 -0
- package/components/dialog/dialog__body-scroll-preventer.d.ts +9 -0
- package/components/dialog/dialog__body-scroll-preventer.js +6 -0
- package/components/dropdown/anchor.d.ts +11 -0
- package/components/dropdown/anchor.js +24 -0
- package/components/dropdown/dropdown.d.ts +87 -0
- package/components/dropdown/dropdown.js +247 -0
- package/components/dropdown-menu/dropdown-menu.d.ts +36 -0
- package/components/dropdown-menu/dropdown-menu.js +199 -0
- package/components/editable-heading/editable-heading.d.ts +32 -0
- package/components/editable-heading/editable-heading.js +276 -0
- package/components/error-bubble/error-bubble.d.ts +18 -0
- package/components/error-bubble/error-bubble.js +88 -0
- package/components/error-message/error-message.d.ts +27 -0
- package/components/error-message/error-message.js +78 -0
- package/components/footer/footer.d.ts +28 -0
- package/components/footer/footer.js +118 -0
- package/components/global/compose.d.ts +7 -0
- package/components/global/compose.js +17 -0
- package/components/global/composeRefs.d.ts +3 -0
- package/components/global/composeRefs.js +19 -0
- package/components/global/controls-height.d.ts +9 -0
- package/components/global/controls-height.js +19 -0
- package/components/global/create-stateful-context.d.ts +27 -0
- package/components/global/create-stateful-context.js +49 -0
- package/components/global/data-tests.d.ts +3 -0
- package/components/global/data-tests.js +30 -0
- package/components/global/dom.d.ts +37 -0
- package/components/global/dom.js +151 -0
- package/components/global/focus-sensor-hoc.d.ts +19 -0
- package/components/global/focus-sensor-hoc.js +165 -0
- package/components/global/fuzzy-highlight.d.ts +11 -0
- package/components/global/fuzzy-highlight.js +90 -0
- package/components/global/get-event-key.d.ts +2 -0
- package/components/global/get-event-key.js +101 -0
- package/components/global/get-uid.d.ts +1 -0
- package/components/global/get-uid.js +22 -0
- package/components/global/inject-styles.d.ts +3 -0
- package/components/global/inject-styles.js +22 -0
- package/components/global/linear-function.d.ts +6 -0
- package/components/global/linear-function.js +15 -0
- package/components/global/listeners.d.ts +8 -0
- package/components/global/listeners.js +58 -0
- package/components/global/memoize.d.ts +1 -0
- package/components/global/memoize.js +23 -0
- package/components/global/normalize-indent.d.ts +1 -0
- package/components/global/normalize-indent.js +60 -0
- package/components/global/promise-with-timeout.d.ts +5 -0
- package/components/global/promise-with-timeout.js +19 -0
- package/components/global/prop-types.d.ts +4 -0
- package/components/global/prop-types.js +9 -0
- package/components/global/react-dom-renderer.d.ts +16 -0
- package/components/global/react-dom-renderer.js +54 -0
- package/components/global/react-render-adapter.d.ts +1 -0
- package/components/global/react-render-adapter.js +6 -0
- package/components/global/rerender-hoc.d.ts +10 -0
- package/components/global/rerender-hoc.js +46 -0
- package/components/global/schedule-raf.d.ts +1 -0
- package/components/global/schedule-raf.js +28 -0
- package/components/global/sniffer.d.ts +3 -0
- package/components/global/sniffer.js +6 -0
- package/components/global/theme.d.ts +21 -0
- package/components/global/theme.js +42 -0
- package/components/global/trivial-template-tag.d.ts +1 -0
- package/components/global/trivial-template-tag.js +21 -0
- package/components/global/typescript-utils.d.ts +2 -0
- package/components/global/typescript-utils.js +8 -0
- package/components/global/url.d.ts +57 -0
- package/components/global/url.js +142 -0
- package/components/global/use-event-callback.d.ts +1 -0
- package/components/global/use-event-callback.js +17 -0
- package/components/global/variables.d.ts +89 -0
- package/components/global/variables.js +1 -0
- package/components/grid/col.d.ts +31 -0
- package/components/grid/col.js +80 -0
- package/components/grid/grid.d.ts +14 -0
- package/components/grid/grid.js +46 -0
- package/components/grid/row.d.ts +40 -0
- package/components/grid/row.js +75 -0
- package/components/group/group.d.ts +12 -0
- package/components/group/group.js +39 -0
- package/components/header/header.d.ts +34 -0
- package/components/header/header.js +189 -0
- package/components/header/logo.d.ts +14 -0
- package/components/header/logo.js +51 -0
- package/components/header/profile.d.ts +75 -0
- package/components/header/profile.js +258 -0
- package/components/header/services-link.d.ts +25 -0
- package/components/header/services-link.js +13 -0
- package/components/header/services.d.ts +33 -0
- package/components/header/services.js +174 -0
- package/components/header/smart-profile.d.ts +36 -0
- package/components/header/smart-profile.js +303 -0
- package/components/header/smart-services.d.ts +26 -0
- package/components/header/smart-services.js +192 -0
- package/components/header/tray-icon.d.ts +32 -0
- package/components/header/tray-icon.js +57 -0
- package/components/header/tray.d.ts +9 -0
- package/components/header/tray.js +41 -0
- package/components/heading/heading.d.ts +25 -0
- package/components/heading/heading.js +69 -0
- package/components/http/http.d.ts +61 -0
- package/components/http/http.js +386 -0
- package/components/http/http.mock.d.ts +20 -0
- package/components/http/http.mock.js +113 -0
- package/components/hub-source/hub-source.d.ts +44 -0
- package/components/hub-source/hub-source.js +217 -0
- package/components/hub-source/hub-source__user.d.ts +4 -0
- package/components/hub-source/hub-source__user.js +60 -0
- package/components/hub-source/hub-source__users-groups.d.ts +24 -0
- package/components/hub-source/hub-source__users-groups.js +86 -0
- package/components/i18n/i18n-context.d.ts +13 -0
- package/components/i18n/i18n-context.js +27 -0
- package/components/i18n/i18n.d.ts +59 -0
- package/components/i18n/i18n.js +139 -0
- package/components/icon/icon.d.ts +43 -0
- package/components/icon/icon.js +109 -0
- package/components/icon/icon__constants.d.ts +30 -0
- package/components/icon/icon__constants.js +34 -0
- package/components/icon/icon__svg.d.ts +15 -0
- package/components/icon/icon__svg.js +14 -0
- package/components/icon/index.d.ts +2 -0
- package/components/icon/index.js +17 -0
- package/components/input/input.d.ts +77 -0
- package/components/input/input.js +35 -0
- package/components/island/adaptive-island-hoc.d.ts +61 -0
- package/components/island/adaptive-island-hoc.js +53 -0
- package/components/island/content.d.ts +43 -0
- package/components/island/content.js +151 -0
- package/components/island/header.d.ts +8 -0
- package/components/island/header.js +100 -0
- package/components/island/island.d.ts +78 -0
- package/components/island/island.js +60 -0
- package/components/island-legacy/content-legacy.d.ts +10 -0
- package/components/island-legacy/content-legacy.js +34 -0
- package/components/island-legacy/header-legacy.d.ts +10 -0
- package/components/island-legacy/header-legacy.js +36 -0
- package/components/island-legacy/island-legacy.d.ts +12 -0
- package/components/island-legacy/island-legacy.js +36 -0
- package/components/link/clickableLink.d.ts +20 -0
- package/components/link/clickableLink.js +69 -0
- package/components/link/link.d.ts +138 -0
- package/components/link/link.js +86 -0
- package/components/list/consts.d.ts +77 -0
- package/components/list/consts.js +27 -0
- package/components/list/list.d.ts +205 -0
- package/components/list/list.js +802 -0
- package/components/list/list__custom.d.ts +6 -0
- package/components/list/list__custom.js +92 -0
- package/components/list/list__hint.d.ts +15 -0
- package/components/list/list__hint.js +33 -0
- package/components/list/list__item.d.ts +8 -0
- package/components/list/list__item.js +237 -0
- package/components/list/list__link.d.ts +9 -0
- package/components/list/list__link.js +76 -0
- package/components/list/list__separator.d.ts +5 -0
- package/components/list/list__separator.js +39 -0
- package/components/list/list__title.d.ts +5 -0
- package/components/list/list__title.js +48 -0
- package/components/list/list__users-groups-source.d.ts +27 -0
- package/components/list/list__users-groups-source.js +195 -0
- package/components/loader/loader.d.ts +28 -0
- package/components/loader/loader.js +93 -0
- package/components/loader/loader__core.d.ts +75 -0
- package/components/loader/loader__core.js +327 -0
- package/components/loader-inline/loader-inline.d.ts +18 -0
- package/components/loader-inline/loader-inline.js +50 -0
- package/components/loader-screen/loader-screen.d.ts +17 -0
- package/components/loader-screen/loader-screen.js +64 -0
- package/components/login-dialog/login-dialog.d.ts +47 -0
- package/components/login-dialog/login-dialog.js +216 -0
- package/components/login-dialog/service.d.ts +2 -0
- package/components/login-dialog/service.js +98 -0
- package/components/markdown/markdown.d.ts +12 -0
- package/components/markdown/markdown.js +43 -0
- package/components/message/message.d.ts +55 -0
- package/components/message/message.js +267 -0
- package/components/old-browsers-message/old-browsers-message.d.ts +2 -0
- package/components/old-browsers-message/old-browsers-message.js +92 -0
- package/components/old-browsers-message/old-browsers-message__stop.d.ts +1 -0
- package/components/old-browsers-message/old-browsers-message__stop.js +11 -0
- package/components/old-browsers-message/white-list.d.ts +2 -0
- package/components/old-browsers-message/white-list.js +37 -0
- package/components/pager/pager.d.ts +78 -0
- package/components/pager/pager.js +390 -0
- package/components/panel/panel.d.ts +12 -0
- package/components/panel/panel.js +39 -0
- package/components/permissions/permissions.d.ts +111 -0
- package/components/permissions/permissions.js +221 -0
- package/components/permissions/permissions__cache.d.ts +93 -0
- package/components/permissions/permissions__cache.js +257 -0
- package/components/popup/popup.consts.d.ts +37 -0
- package/components/popup/popup.consts.js +44 -0
- package/components/popup/popup.d.ts +147 -0
- package/components/popup/popup.js +424 -0
- package/components/popup/popup.target.d.ts +7 -0
- package/components/popup/popup.target.js +24 -0
- package/components/popup/position.d.ts +30 -0
- package/components/popup/position.js +271 -0
- package/components/popup-menu/popup-menu.d.ts +80 -0
- package/components/popup-menu/popup-menu.js +141 -0
- package/components/progress-bar/progress-bar.d.ts +64 -0
- package/components/progress-bar/progress-bar.js +120 -0
- package/components/query-assist/query-assist.d.ts +306 -0
- package/components/query-assist/query-assist.js +1098 -0
- package/components/query-assist/query-assist__suggestions.d.ts +29 -0
- package/components/query-assist/query-assist__suggestions.js +75 -0
- package/components/radio/radio.d.ts +18 -0
- package/components/radio/radio.js +48 -0
- package/components/radio/radio__item.d.ts +28 -0
- package/components/radio/radio__item.js +88 -0
- package/components/select/select.d.ts +276 -0
- package/components/select/select.js +1310 -0
- package/components/select/select__filter.d.ts +19 -0
- package/components/select/select__filter.js +85 -0
- package/components/select/select__popup.d.ts +166 -0
- package/components/select/select__popup.js +631 -0
- package/components/shortcuts/core.d.ts +74 -0
- package/components/shortcuts/core.js +249 -0
- package/components/shortcuts/shortcut-title.d.ts +1 -0
- package/components/shortcuts/shortcut-title.js +56 -0
- package/components/shortcuts/shortcuts-hoc.d.ts +65 -0
- package/components/shortcuts/shortcuts-hoc.js +61 -0
- package/components/shortcuts/shortcuts.d.ts +28 -0
- package/components/shortcuts/shortcuts.js +92 -0
- package/components/storage/storage.d.ts +18 -0
- package/components/storage/storage.js +92 -0
- package/components/storage/storage__fallback.d.ts +79 -0
- package/components/storage/storage__fallback.js +254 -0
- package/components/storage/storage__local.d.ts +38 -0
- package/components/storage/storage__local.js +217 -0
- package/components/style.css +1 -0
- package/components/tab-trap/tab-trap.d.ts +43 -0
- package/components/tab-trap/tab-trap.js +180 -0
- package/components/table/cell.d.ts +13 -0
- package/components/table/cell.js +37 -0
- package/components/table/disable-hover-hoc.d.ts +64 -0
- package/components/table/disable-hover-hoc.js +62 -0
- package/components/table/header-cell.d.ts +43 -0
- package/components/table/header-cell.js +109 -0
- package/components/table/header.d.ts +56 -0
- package/components/table/header.js +151 -0
- package/components/table/multitable.d.ts +25 -0
- package/components/table/multitable.js +140 -0
- package/components/table/row-with-focus-sensor.d.ts +18 -0
- package/components/table/row-with-focus-sensor.js +117 -0
- package/components/table/row.d.ts +59 -0
- package/components/table/row.js +299 -0
- package/components/table/selection-adapter.d.ts +5 -0
- package/components/table/selection-adapter.js +14 -0
- package/components/table/selection-shortcuts-hoc.d.ts +17 -0
- package/components/table/selection-shortcuts-hoc.js +205 -0
- package/components/table/selection.d.ts +47 -0
- package/components/table/selection.js +257 -0
- package/components/table/smart-table.d.ts +64 -0
- package/components/table/smart-table.js +149 -0
- package/components/table/table.d.ts +159 -0
- package/components/table/table.js +463 -0
- package/components/tabs/collapsible-more.d.ts +29 -0
- package/components/tabs/collapsible-more.js +222 -0
- package/components/tabs/collapsible-tab.d.ts +16 -0
- package/components/tabs/collapsible-tab.js +88 -0
- package/components/tabs/collapsible-tabs.d.ts +43 -0
- package/components/tabs/collapsible-tabs.js +354 -0
- package/components/tabs/custom-item.d.ts +9 -0
- package/components/tabs/custom-item.js +11 -0
- package/components/tabs/dumb-tabs.d.ts +35 -0
- package/components/tabs/dumb-tabs.js +189 -0
- package/components/tabs/smart-tabs.d.ts +20 -0
- package/components/tabs/smart-tabs.js +141 -0
- package/components/tabs/tab-link.d.ts +18 -0
- package/components/tabs/tab-link.js +13 -0
- package/components/tabs/tab.d.ts +27 -0
- package/components/tabs/tab.js +41 -0
- package/components/tabs/tabs.d.ts +7 -0
- package/components/tabs/tabs.js +99 -0
- package/components/tag/tag.d.ts +64 -0
- package/components/tag/tag.js +213 -0
- package/components/tags-input/tags-input.d.ts +138 -0
- package/components/tags-input/tags-input.js +534 -0
- package/components/tags-list/tags-list.d.ts +46 -0
- package/components/tags-list/tags-list.js +102 -0
- package/components/text/text.d.ts +23 -0
- package/components/text/text.js +57 -0
- package/components/toggle/toggle.d.ts +39 -0
- package/components/toggle/toggle.js +86 -0
- package/components/tooltip/tooltip.d.ts +65 -0
- package/components/tooltip/tooltip.js +229 -0
- package/components/user-agreement/service.d.ts +69 -0
- package/components/user-agreement/service.js +487 -0
- package/components/user-agreement/toolbox.eula.d.ts +2 -0
- package/components/user-agreement/toolbox.eula.js +3 -0
- package/components/user-agreement/user-agreement.d.ts +60 -0
- package/components/user-agreement/user-agreement.js +172 -0
- package/components/user-card/card.d.ts +70 -0
- package/components/user-card/card.js +80 -0
- package/components/user-card/smart-user-card-tooltip.d.ts +20 -0
- package/components/user-card/smart-user-card-tooltip.js +172 -0
- package/components/user-card/tooltip.d.ts +36 -0
- package/components/user-card/tooltip.js +144 -0
- package/components/user-card/user-card.d.ts +11 -0
- package/components/user-card/user-card.js +85 -0
- package/package.json +118 -0
- package/typings.d.ts +43 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { _ as _defineProperty, a as _inherits, b as _createSuper, c as _classCallCheck, k as _assertThisInitialized, d as _createClass } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import 'core-js/modules/es.array.concat.js';
|
|
3
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
4
|
+
import 'core-js/modules/es.array.includes.js';
|
|
5
|
+
import 'core-js/modules/es.string.includes.js';
|
|
6
|
+
import React, { Component } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
import addDays from 'date-fns/addDays';
|
|
10
|
+
import format from 'date-fns/format';
|
|
11
|
+
import getDay from 'date-fns/getDay';
|
|
12
|
+
import getDate from 'date-fns/getDate';
|
|
13
|
+
import isAfter from 'date-fns/isAfter';
|
|
14
|
+
import isBefore from 'date-fns/isBefore';
|
|
15
|
+
import isSameDay from 'date-fns/isSameDay';
|
|
16
|
+
import isToday from 'date-fns/isToday';
|
|
17
|
+
import startOfDay from 'date-fns/startOfDay';
|
|
18
|
+
import { dateType, weekdays } from './consts.js';
|
|
19
|
+
import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
|
|
20
|
+
import 'core-js/modules/es.regexp.exec.js';
|
|
21
|
+
import 'date-fns/add';
|
|
22
|
+
|
|
23
|
+
var hoverTO;
|
|
24
|
+
var Day = /*#__PURE__*/function (_Component) {
|
|
25
|
+
_inherits(Day, _Component);
|
|
26
|
+
var _super = _createSuper(Day);
|
|
27
|
+
function Day() {
|
|
28
|
+
var _this;
|
|
29
|
+
_classCallCheck(this, Day);
|
|
30
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
31
|
+
args[_key] = arguments[_key];
|
|
32
|
+
}
|
|
33
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
34
|
+
_defineProperty(_assertThisInitialized(_this), "handleClick", function () {
|
|
35
|
+
return _this.props.onSelect(_this.props.day);
|
|
36
|
+
});
|
|
37
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseOver", function () {
|
|
38
|
+
if (hoverTO) {
|
|
39
|
+
window.clearTimeout(hoverTO);
|
|
40
|
+
hoverTO = null;
|
|
41
|
+
}
|
|
42
|
+
_this.props.onHover(_this.props.day);
|
|
43
|
+
});
|
|
44
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseOut", function () {
|
|
45
|
+
hoverTO = window.setTimeout(_this.props.onHover, 0);
|
|
46
|
+
});
|
|
47
|
+
_defineProperty(_assertThisInitialized(_this), "isDay", function (date) {
|
|
48
|
+
return isSameDay(_this.props.day, date);
|
|
49
|
+
});
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "is", function (name) {
|
|
51
|
+
var value = _this.props[name];
|
|
52
|
+
return value != null && _this.isDay(value);
|
|
53
|
+
});
|
|
54
|
+
_defineProperty(_assertThisInitialized(_this), "inRange", function (range) {
|
|
55
|
+
return range && isAfter(startOfDay(_this.props.day), startOfDay(range[0])) && isBefore(startOfDay(_this.props.day), startOfDay(range[1]));
|
|
56
|
+
});
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "isDisabled", function (date) {
|
|
58
|
+
var min = _this.parse(_this.props.minDate);
|
|
59
|
+
var max = _this.parse(_this.props.maxDate);
|
|
60
|
+
return min != null && isBefore(startOfDay(date), startOfDay(min)) || max != null && isAfter(startOfDay(date), startOfDay(max));
|
|
61
|
+
});
|
|
62
|
+
return _this;
|
|
63
|
+
}
|
|
64
|
+
_createClass(Day, [{
|
|
65
|
+
key: "parse",
|
|
66
|
+
value: function parse(text) {
|
|
67
|
+
return this.props.parseDateInput(text);
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
key: "render",
|
|
71
|
+
value: function render() {
|
|
72
|
+
var _this$props = this.props,
|
|
73
|
+
day = _this$props.day,
|
|
74
|
+
from = _this$props.from,
|
|
75
|
+
currentRange = _this$props.currentRange,
|
|
76
|
+
activeRange = _this$props.activeRange,
|
|
77
|
+
empty = _this$props.empty;
|
|
78
|
+
var reverse = activeRange && activeRange[1] === from;
|
|
79
|
+
function makeSpreadRange(range) {
|
|
80
|
+
return range && [range[0], addDays(range[1], 1)];
|
|
81
|
+
}
|
|
82
|
+
var spreadRange = makeSpreadRange(currentRange);
|
|
83
|
+
var disabled = this.isDisabled(day);
|
|
84
|
+
var activeSpreadRange = makeSpreadRange(activeRange);
|
|
85
|
+
return (
|
|
86
|
+
/*#__PURE__*/
|
|
87
|
+
// TODO make keyboard navigation actually work
|
|
88
|
+
React.createElement("button", {
|
|
89
|
+
type: "button",
|
|
90
|
+
className: classNames(modules_0c7b7d96.day, modules_0c7b7d96[format(day, 'EEEE')], {
|
|
91
|
+
[modules_0c7b7d96.current]: ['date', 'from', 'to'].some(this.is),
|
|
92
|
+
[modules_0c7b7d96.active]: !disabled && this.is('activeDate'),
|
|
93
|
+
[modules_0c7b7d96.weekend]: [weekdays.SA, weekdays.SU].includes(getDay(day)),
|
|
94
|
+
[modules_0c7b7d96.empty]: empty,
|
|
95
|
+
[modules_0c7b7d96.from]: currentRange && this.isDay(currentRange[0]) && !reverse || activeRange && this.isDay(activeRange[0]),
|
|
96
|
+
[modules_0c7b7d96.to]: currentRange && this.isDay(currentRange[1]) || activeRange && this.isDay(activeRange[1]),
|
|
97
|
+
[modules_0c7b7d96.between]: this.inRange(currentRange),
|
|
98
|
+
[modules_0c7b7d96.activeBetween]: !disabled && this.inRange(activeRange),
|
|
99
|
+
[modules_0c7b7d96.first]: getDate(day) === 1,
|
|
100
|
+
[modules_0c7b7d96.spread]: this.inRange(spreadRange),
|
|
101
|
+
[modules_0c7b7d96.activeSpread]: !disabled && this.inRange(activeSpreadRange),
|
|
102
|
+
[modules_0c7b7d96.disabled]: disabled
|
|
103
|
+
}),
|
|
104
|
+
onClick: this.handleClick,
|
|
105
|
+
onMouseOver: this.handleMouseOver,
|
|
106
|
+
onFocus: this.handleMouseOver,
|
|
107
|
+
onMouseOut: this.handleMouseOut,
|
|
108
|
+
onBlur: this.handleMouseOut,
|
|
109
|
+
disabled: disabled
|
|
110
|
+
}, empty || /*#__PURE__*/React.createElement("span", {
|
|
111
|
+
className: classNames({
|
|
112
|
+
[modules_0c7b7d96.today]: isToday(day)
|
|
113
|
+
})
|
|
114
|
+
}, format(day, 'd')))
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
}]);
|
|
118
|
+
return Day;
|
|
119
|
+
}(Component);
|
|
120
|
+
_defineProperty(Day, "propTypes", {
|
|
121
|
+
day: dateType,
|
|
122
|
+
from: dateType,
|
|
123
|
+
currentRange: PropTypes.arrayOf(dateType),
|
|
124
|
+
activeRange: PropTypes.arrayOf(dateType),
|
|
125
|
+
empty: PropTypes.bool,
|
|
126
|
+
onSelect: PropTypes.func,
|
|
127
|
+
parseDateInput: PropTypes.func,
|
|
128
|
+
onHover: PropTypes.func,
|
|
129
|
+
minDate: dateType,
|
|
130
|
+
maxDate: dateType
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
export { Day as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var formats = ['d M', 'dd M', 'dd MM', 'd-M', 'dd-M', 'dd-MM', 'd.M', 'dd.M', 'dd.MM', 'd\\M', 'dd\\M', 'dd\\MM', 'd/M', 'dd/M', 'dd/MM', 'd M yy', 'dd M yy', 'dd MM yy', 'd M yyyy', 'dd M yyyy', 'dd MM yyyy', 'd-M-yy', 'dd-M-yy', 'dd-MM-yy', 'd-M-yyyy', 'dd-M-yyyy', 'dd-MM-yyyy', 'd.M.yy', 'dd.M.yy', 'dd.MM.yy', 'd.M.yyyy', 'dd.M.yyyy', 'dd.MM.yyyy', 'd\\M\\yy', 'dd\\M\\yy', 'dd\\MM\\yy', 'd\\M\\yyyy', 'dd\\M\\yyyy', 'dd\\MM\\yyyy', 'd/M/yy', 'dd/M/yy', 'dd/MM/yy', 'd/M/yyyy', 'dd/M/yyyy', 'dd/MM/yyyy', 'd M yy', 'dd M yy', 'dd MM yy', 'd M yyyy', 'dd M yyyy', 'dd MM yyyy', 'd-M-yy', 'dd-M-yy', 'dd-MM-yy', 'd-M-yyyy', 'dd-M-yyyy', 'dd-MM-yyyy', 'd.M.yy', 'dd.M.yy', 'dd.MM.yy', 'd.M.yyyy', 'dd.M.yyyy', 'dd.MM.yyyy', 'd\\M\\yy', 'dd\\M\\yy', 'dd\\MM\\yy', 'd\\M\\yyyy', 'dd\\M\\yyyy', 'dd\\MM\\yyyy', 'd/M/yy', 'dd/M/yy', 'dd/MM/yy', 'd/M/yyyy', 'dd/M/yyyy', 'dd/MM/yyyy', 'yy M d', 'yy M dd', 'yy MM dd', 'yyyy M d', 'yyyy M dd', 'yyyy MM dd', 'yy-M-d', 'yy-M-dd', 'yy-MM-dd', 'yyyy-M-d', 'yyyy-M-dd', 'yyyy-MM-dd', 'yy.M.d', 'yy.M.dd', 'yy.MM.dd', 'yyyy.M.d', 'yyyy.M.dd', 'yyyy.MM.dd', 'yy\\M\\d', 'yy\\M\\dd', 'yy\\MM\\dd', 'yyyy\\M\\d', 'yyyy\\M\\dd', 'yyyy\\MM\\dd', 'yy/M/d', 'yy/M/dd', 'yy/MM/dd', 'yyyy/M/d', 'yyyy/M/dd', 'yyyy/MM/dd', 'yy d M', 'yy dd M', 'yy dd MM', 'yyyy d M', 'yyyy dd MM', 'yyyy dd MM', 'yy-d-M', 'yy-dd-M', 'yy-dd-MM', 'yyyy-d-M', 'yyyy-dd-MM', 'yyyy-dd-MM', 'yy.d.M', 'yy.dd.M', 'yy.dd.MM', 'yyyy.d.M', 'yyyy.dd.MM', 'yyyy.dd.MM', 'yy\\d\\M', 'yy\\dd\\M', 'yy\\dd\\MM', 'yyyy\\d\\M', 'yyyy\\dd\\MM', 'yyyy\\dd\\MM', 'yy/d/M', 'yy/dd/M', 'yy/dd/MM', 'yyyy/d/M', 'yyyy/dd/MM', 'yyyy/dd/MM', 'd MMM', 'd MMMM', 'dd MMM', 'dd MMMM', 'd M HH:mm', 'd M, HH:mm', 'dd M HH:mm', 'dd M, HH:mm', 'dd MM HH:mm', 'dd MM, HH:mm', 'd-M HH:mm', 'd-M, HH:mm', 'dd-M HH:mm', 'dd-M, HH:mm', 'dd-MM HH:mm', 'dd-MM, HH:mm', 'd.M HH:mm', 'd.M, HH:mm', 'dd.M HH:mm', 'dd.M, HH:mm', 'dd.MM HH:mm', 'dd.MM, HH:mm', 'd\\M HH:mm', 'd\\M, HH:mm', 'dd\\M HH:mm', 'dd\\M, HH:mm', 'dd\\MM HH:mm', 'dd\\MM, HH:mm', 'd/M HH:mm', 'd/M, HH:mm', 'dd/M HH:mm', 'dd/M, HH:mm', 'dd/MM HH:mm', 'dd/MM, HH:mm', 'd M yy HH:mm', 'd M yy, HH:mm', 'dd M yy HH:mm', 'dd M yy, HH:mm', 'dd MM yy HH:mm', 'dd MM yy, HH:mm', 'd M yyyy HH:mm', 'd M yyyy, HH:mm', 'dd M yyyy HH:mm', 'dd M yyyy, HH:mm', 'dd MM yyyy HH:mm', 'dd MM yyyy, HH:mm', 'd-M-yy HH:mm', 'd-M-yy, HH:mm', 'dd-M-yy HH:mm', 'dd-M-yy, HH:mm', 'dd-MM-yy HH:mm', 'dd-MM-yy, HH:mm', 'd-M-yyyy HH:mm', 'd-M-yyyy, HH:mm', 'dd-M-yyyy HH:mm', 'dd-M-yyyy, HH:mm', 'dd-MM-yyyy HH:mm', 'dd-MM-yyyy, HH:mm', 'd.M.yy HH:mm', 'd.M.yy, HH:mm', 'dd.M.yy HH:mm', 'dd.M.yy, HH:mm', 'dd.MM.yy HH:mm', 'dd.MM.yy, HH:mm', 'd.M.yyyy HH:mm', 'd.M.yyyy, HH:mm', 'dd.M.yyyy HH:mm', 'dd.M.yyyy, HH:mm', 'dd.MM.yyyy HH:mm', 'dd.MM.yyyy, HH:mm', 'd\\M\\yy HH:mm', 'd\\M\\yy, HH:mm', 'dd\\M\\yy HH:mm', 'dd\\M\\yy, HH:mm', 'dd\\MM\\yy HH:mm', 'dd\\MM\\yy, HH:mm', 'd\\M\\yyyy HH:mm', 'd\\M\\yyyy, HH:mm', 'dd\\M\\yyyy HH:mm', 'dd\\M\\yyyy, HH:mm', 'dd\\MM\\yyyy HH:mm', 'dd\\MM\\yyyy, HH:mm', 'd/M/yy HH:mm', 'd/M/yy, HH:mm', 'dd/M/yy HH:mm', 'dd/M/yy, HH:mm', 'dd/MM/yy HH:mm', 'dd/MM/yy, HH:mm', 'd/M/yyyy HH:mm', 'd/M/yyyy, HH:mm', 'dd/M/yyyy HH:mm', 'dd/M/yyyy, HH:mm', 'dd/MM/yyyy HH:mm', 'dd/MM/yyyy, HH:mm', 'd M yy HH:mm', 'd M yy, HH:mm', 'dd M yy HH:mm', 'dd M yy, HH:mm', 'dd MM yy HH:mm', 'dd MM yy, HH:mm', 'd M yyyy HH:mm', 'd M yyyy, HH:mm', 'dd M yyyy HH:mm', 'dd M yyyy, HH:mm', 'dd MM yyyy HH:mm', 'dd MM yyyy, HH:mm', 'd-M-yy HH:mm', 'd-M-yy, HH:mm', 'dd-M-yy HH:mm', 'dd-M-yy, HH:mm', 'dd-MM-yy HH:mm', 'dd-MM-yy, HH:mm', 'd-M-yyyy HH:mm', 'd-M-yyyy, HH:mm', 'dd-M-yyyy HH:mm', 'dd-M-yyyy, HH:mm', 'dd-MM-yyyy HH:mm', 'dd-MM-yyyy, HH:mm', 'd.M.yy HH:mm', 'd.M.yy, HH:mm', 'dd.M.yy HH:mm', 'dd.M.yy, HH:mm', 'dd.MM.yy HH:mm', 'dd.MM.yy, HH:mm', 'd.M.yyyy HH:mm', 'd.M.yyyy, HH:mm', 'dd.M.yyyy HH:mm', 'dd.M.yyyy, HH:mm', 'dd.MM.yyyy HH:mm', 'dd.MM.yyyy, HH:mm', 'd\\M\\yy HH:mm', 'd\\M\\yy, HH:mm', 'dd\\M\\yy HH:mm', 'dd\\M\\yy, HH:mm', 'dd\\MM\\yy HH:mm', 'dd\\MM\\yy, HH:mm', 'd\\M\\yyyy HH:mm', 'd\\M\\yyyy, HH:mm', 'dd\\M\\yyyy HH:mm', 'dd\\M\\yyyy, HH:mm', 'dd\\MM\\yyyy HH:mm', 'dd\\MM\\yyyy, HH:mm', 'd/M/yy HH:mm', 'd/M/yy, HH:mm', 'dd/M/yy HH:mm', 'dd/M/yy, HH:mm', 'dd/MM/yy HH:mm', 'dd/MM/yy, HH:mm', 'd/M/yyyy HH:mm', 'd/M/yyyy, HH:mm', 'dd/M/yyyy HH:mm', 'dd/M/yyyy, HH:mm', 'dd/MM/yyyy HH:mm', 'dd/MM/yyyy, HH:mm', 'yy M d HH:mm', 'yy M d, HH:mm', 'yy M dd HH:mm', 'yy M dd, HH:mm', 'yy MM dd HH:mm', 'yy MM dd, HH:mm', 'yyyy M d HH:mm', 'yyyy M d, HH:mm', 'yyyy M dd HH:mm', 'yyyy M dd, HH:mm', 'yyyy MM dd HH:mm', 'yyyy MM dd, HH:mm', 'yy-M-d HH:mm', 'yy-M-d, HH:mm', 'yy-M-dd HH:mm', 'yy-M-dd, HH:mm', 'yy-MM-dd HH:mm', 'yy-MM-dd, HH:mm', 'yyyy-M-d HH:mm', 'yyyy-M-d, HH:mm', 'yyyy-M-dd HH:mm', 'yyyy-M-dd, HH:mm', 'yyyy-MM-dd HH:mm', 'yyyy-MM-dd, HH:mm', 'yy.M.d HH:mm', 'yy.M.d, HH:mm', 'yy.M.dd HH:mm', 'yy.M.dd, HH:mm', 'yy.MM.dd HH:mm', 'yy.MM.dd, HH:mm', 'yyyy.M.d HH:mm', 'yyyy.M.d, HH:mm', 'yyyy.M.dd HH:mm', 'yyyy.M.dd, HH:mm', 'yyyy.MM.dd HH:mm', 'yyyy.MM.dd, HH:mm', 'yy\\M\\d HH:mm', 'yy\\M\\d, HH:mm', 'yy\\M\\dd HH:mm', 'yy\\M\\dd, HH:mm', 'yy\\MM\\dd HH:mm', 'yy\\MM\\dd, HH:mm', 'yyyy\\M\\d HH:mm', 'yyyy\\M\\d, HH:mm', 'yyyy\\M\\dd HH:mm', 'yyyy\\M\\dd, HH:mm', 'yyyy\\MM\\dd HH:mm', 'yyyy\\MM\\dd, HH:mm', 'yy/M/d HH:mm', 'yy/M/d, HH:mm', 'yy/M/dd HH:mm', 'yy/M/dd, HH:mm', 'yy/MM/dd HH:mm', 'yy/MM/dd, HH:mm', 'yyyy/M/d HH:mm', 'yyyy/M/d, HH:mm', 'yyyy/M/dd HH:mm', 'yyyy/M/dd, HH:mm', 'yyyy/MM/dd HH:mm', 'yyyy/MM/dd, HH:mm', 'yy d M HH:mm', 'yy d M, HH:mm', 'yy dd M HH:mm', 'yy dd M, HH:mm', 'yy dd MM HH:mm', 'yy dd MM, HH:mm', 'yyyy d M HH:mm', 'yyyy d M, HH:mm', 'yyyy dd MM HH:mm', 'yyyy dd MM, HH:mm', 'yyyy dd MM HH:mm', 'yyyy dd MM, HH:mm', 'yy-d-M HH:mm', 'yy-d-M, HH:mm', 'yy-dd-M HH:mm', 'yy-dd-M, HH:mm', 'yy-dd-MM HH:mm', 'yy-dd-MM, HH:mm', 'yyyy-d-M HH:mm', 'yyyy-d-M, HH:mm', 'yyyy-dd-MM HH:mm', 'yyyy-dd-MM, HH:mm', 'yyyy-dd-MM HH:mm', 'yyyy-dd-MM, HH:mm', 'yy.d.M HH:mm', 'yy.d.M, HH:mm', 'yy.dd.M HH:mm', 'yy.dd.M, HH:mm', 'yy.dd.MM HH:mm', 'yy.dd.MM, HH:mm', 'yyyy.d.M HH:mm', 'yyyy.d.M, HH:mm', 'yyyy.dd.MM HH:mm', 'yyyy.dd.MM, HH:mm', 'yyyy.dd.MM HH:mm', 'yyyy.dd.MM, HH:mm', 'yy\\d\\M HH:mm', 'yy\\d\\M, HH:mm', 'yy\\dd\\M HH:mm', 'yy\\dd\\M, HH:mm', 'yy\\dd\\MM HH:mm', 'yy\\dd\\MM, HH:mm', 'yyyy\\d\\M HH:mm', 'yyyy\\d\\M, HH:mm', 'yyyy\\dd\\MM HH:mm', 'yyyy\\dd\\MM, HH:mm', 'yyyy\\dd\\MM HH:mm', 'yyyy\\dd\\MM, HH:mm', 'yy/d/M HH:mm', 'yy/d/M, HH:mm', 'yy/dd/M HH:mm', 'yy/dd/M, HH:mm', 'yy/dd/MM HH:mm', 'yy/dd/MM, HH:mm', 'yyyy/d/M HH:mm', 'yyyy/d/M, HH:mm', 'yyyy/dd/MM HH:mm', 'yyyy/dd/MM, HH:mm', 'yyyy/dd/MM HH:mm', 'yyyy/dd/MM, HH:mm', 'd MMM HH:mm', 'd MMM, HH:mm', 'd MMMM HH:mm', 'd MMMM, HH:mm', 'dd MMM HH:mm', 'dd MMM, HH:mm', 'dd MMMM HH:mm', 'dd MMMM, HH:mm', 'yyyy MMM d', 'yyyy MMMM d', 'yyyy MMM dd', 'yyyy MMMM dd', 'yyyy d MMM', 'yyyy d MMMM', 'yyyy dd MMM', 'yyyy dd MMMM', 'd MMM yy', 'd MMMM yy', 'dd MMM yy', 'dd MMMM yy', 'd MMM yyyy', 'd MMMM yyyy', 'dd MMM yyyy', 'dd MMMM yyyy', 'd MMM yy', 'd MMMM yy', 'dd MMM yy', 'dd MMMM yy', 'd MMM yyyy', 'd MMMM yyyy', 'dd MMM yyyy', 'dd MMMM yyyy', 'MMM d yyyy', 'MMMM d yyyy', 'MMM dd yyyy', 'MMMM dd yyyy', 'yy MMM d', 'yy MMMM d', 'yy MMM dd', 'yy MMMM dd', 'yy d MMM', 'yy d MMMM', 'yy dd MMM', 'yy dd MMMM', 'd MMM', 'd MMMM', 'dd MMM', 'dd MMMM', 'yyyy MMM d HH:mm', 'yyyy MMM d, HH:mm', 'yyyy MMMM d HH:mm', 'yyyy MMMM d, HH:mm', 'yyyy MMM dd HH:mm', 'yyyy MMM dd, HH:mm', 'yyyy MMMM dd HH:mm', 'yyyy MMMM dd, HH:mm', 'yyyy d MMM HH:mm', 'yyyy d MMM, HH:mm', 'yyyy d MMMM HH:mm', 'yyyy d MMMM, HH:mm', 'yyyy dd MMM HH:mm', 'yyyy dd MMM, HH:mm', 'yyyy dd MMMM HH:mm', 'yyyy dd MMMM, HH:mm', 'd MMM yy HH:mm', 'd MMM yy, HH:mm', 'd MMMM yy HH:mm', 'd MMMM yy, HH:mm', 'dd MMM yy HH:mm', 'dd MMM yy, HH:mm', 'dd MMMM yy HH:mm', 'dd MMMM yy, HH:mm', 'd MMM yyyy HH:mm', 'd MMM yyyy, HH:mm', 'd MMMM yyyy HH:mm', 'd MMMM yyyy, HH:mm', 'dd MMM yyyy HH:mm', 'dd MMM yyyy, HH:mm', 'dd MMMM yyyy HH:mm', 'dd MMMM yyyy, HH:mm', 'd MMM yy HH:mm', 'd MMM yy, HH:mm', 'd MMMM yy HH:mm', 'd MMMM yy, HH:mm', 'dd MMM yy HH:mm', 'dd MMM yy, HH:mm', 'dd MMMM yy HH:mm', 'dd MMMM yy, HH:mm', 'd MMM yyyy HH:mm', 'd MMM yyyy, HH:mm', 'd MMMM yyyy HH:mm', 'd MMMM yyyy, HH:mm', 'dd MMM yyyy HH:mm', 'dd MMM yyyy, HH:mm', 'dd MMMM yyyy HH:mm', 'dd MMMM yyyy, HH:mm', 'MMM d yyyy HH:mm', 'MMM d yyyy, HH:mm', 'MMMM d yyyy HH:mm', 'MMMM d yyyy, HH:mm', 'MMM dd yyyy HH:mm', 'MMM dd yyyy, HH:mm', 'MMMM dd yyyy HH:mm', 'MMMM dd yyyy, HH:mm', 'yy MMM d HH:mm', 'yy MMM d, HH:mm', 'yy MMMM d HH:mm', 'yy MMMM d, HH:mm', 'yy MMM dd HH:mm', 'yy MMM dd, HH:mm', 'yy MMMM dd HH:mm', 'yy MMMM dd, HH:mm', 'yy d MMM HH:mm', 'yy d MMM, HH:mm', 'yy d MMMM HH:mm', 'yy d MMMM, HH:mm', 'yy dd MMM HH:mm', 'yy dd MMM, HH:mm', 'yy dd MMMM HH:mm', 'yy dd MMMM, HH:mm', 'd MMM HH:mm', 'd MMM, HH:mm', 'd MMMM HH:mm', 'd MMMM, HH:mm', 'dd MMM HH:mm', 'dd MMM, HH:mm', 'dd MMMM HH:mm', 'dd MMMM, HH:mm', 'yyyy MMM d', 'yyyy MMMM d', 'yyyy MMM dd', 'yyyy MMMM dd', 'yyyy d MMM', 'yyyy d MMMM', 'yyyy dd MMM', 'yyyy dd MMMM', 'd MMM yy', 'd MMMM yy', 'dd MMM yy', 'dd MMMM yy', 'd MMM yyyy', 'd MMMM yyyy', 'dd MMM yyyy', 'dd MMMM yyyy', 'd MMM yy', 'd MMMM yy', 'dd MMM yy', 'dd MMMM yy', 'd MMM yyyy', 'd MMMM yyyy', 'dd MMM yyyy', 'dd MMMM yyyy', 'MMM d yyyy', 'MMMM d yyyy', 'MMM dd yyyy', 'MMMM dd yyyy', 'yy MMM d', 'yy MMMM d', 'yy MMM dd', 'yy MMMM dd', 'yy d MMM', 'yy d MMMM', 'yy dd MMM', 'yy dd MMMM', 'yyyy MMM d HH:mm', 'yyyy MMM d, HH:mm', 'yyyy MMMM d HH:mm', 'yyyy MMMM d, HH:mm', 'yyyy MMM dd HH:mm', 'yyyy MMM dd, HH:mm', 'yyyy MMMM dd HH:mm', 'yyyy MMMM dd, HH:mm', 'yyyy d MMM HH:mm', 'yyyy d MMM, HH:mm', 'yyyy d MMMM HH:mm', 'yyyy d MMMM, HH:mm', 'yyyy dd MMM HH:mm', 'yyyy dd MMM, HH:mm', 'yyyy dd MMMM HH:mm', 'yyyy dd MMMM, HH:mm', 'd MMM yy HH:mm', 'd MMM yy, HH:mm', 'd MMMM yy HH:mm', 'd MMMM yy, HH:mm', 'dd MMM yy HH:mm', 'dd MMM yy, HH:mm', 'dd MMMM yy HH:mm', 'dd MMMM yy, HH:mm', 'd MMM yyyy HH:mm', 'd MMM yyyy, HH:mm', 'd MMMM yyyy HH:mm', 'd MMMM yyyy, HH:mm', 'dd MMM yyyy HH:mm', 'dd MMM yyyy, HH:mm', 'dd MMMM yyyy HH:mm', 'dd MMMM yyyy, HH:mm', 'd MMM yy HH:mm', 'd MMM yy, HH:mm', 'd MMMM yy HH:mm', 'd MMMM yy, HH:mm', 'dd MMM yy HH:mm', 'dd MMM yy, HH:mm', 'dd MMMM yy HH:mm', 'dd MMMM yy, HH:mm', 'd MMM yyyy HH:mm', 'd MMM yyyy, HH:mm', 'd MMMM yyyy HH:mm', 'd MMMM yyyy, HH:mm', 'dd MMM yyyy HH:mm', 'dd MMM yyyy, HH:mm', 'dd MMMM yyyy HH:mm', 'dd MMMM yyyy, HH:mm', 'MMM d yyyy HH:mm', 'MMM d yyyy, HH:mm', 'MMMM d yyyy HH:mm', 'MMMM d yyyy, HH:mm', 'MMM dd yyyy HH:mm', 'MMM dd yyyy, HH:mm', 'MMMM dd yyyy HH:mm', 'MMMM dd yyyy, HH:mm', 'yy MMM d HH:mm', 'yy MMM d, HH:mm', 'yy MMMM d HH:mm', 'yy MMMM d, HH:mm', 'yy MMM dd HH:mm', 'yy MMM dd, HH:mm', 'yy MMMM dd HH:mm', 'yy MMMM dd, HH:mm', 'yy d MMM HH:mm', 'yy d MMM, HH:mm', 'yy d MMMM HH:mm', 'yy d MMMM, HH:mm', 'yy dd MMM HH:mm', 'yy dd MMM, HH:mm', 'yy dd MMMM HH:mm', 'yy dd MMMM, HH:mm'];
|
|
2
|
+
|
|
3
|
+
export { formats as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { MonthsProps } from './consts';
|
|
4
|
+
declare function MonthNames(props: MonthsProps): React.JSX.Element;
|
|
5
|
+
declare namespace MonthNames {
|
|
6
|
+
var propTypes: {
|
|
7
|
+
scrollDate: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
|
|
8
|
+
onScrollChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
9
|
+
currentRange: PropTypes.Requireable<(NonNullable<string | number | Date | null | undefined> | null | undefined)[]>;
|
|
10
|
+
locale: PropTypes.Requireable<string>;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export default MonthNames;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { _ as _defineProperty, j as _slicedToArray, f as _extends, a as _inherits, b as _createSuper, c as _classCallCheck, k as _assertThisInitialized, d as _createClass } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import 'core-js/modules/es.array.concat.js';
|
|
3
|
+
import 'core-js/modules/es.array.map.js';
|
|
4
|
+
import React, { PureComponent } from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import endOfMonth from 'date-fns/endOfMonth';
|
|
8
|
+
import format from 'date-fns/format';
|
|
9
|
+
import isThisMonth from 'date-fns/isThisMonth';
|
|
10
|
+
import set from 'date-fns/set';
|
|
11
|
+
import startOfDay from 'date-fns/startOfDay';
|
|
12
|
+
import startOfYear from 'date-fns/startOfYear';
|
|
13
|
+
import linearFunction from '../global/linear-function.js';
|
|
14
|
+
import MonthSlider from './month-slider.js';
|
|
15
|
+
import { dateType, YEAR, MIDDLE_DAY, yearScrollSpeed } from './consts.js';
|
|
16
|
+
import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
|
|
17
|
+
import 'date-fns/addYears';
|
|
18
|
+
import 'date-fns/subYears';
|
|
19
|
+
import 'core-js/modules/es.regexp.exec.js';
|
|
20
|
+
import 'date-fns/add';
|
|
21
|
+
|
|
22
|
+
var MonthName = /*#__PURE__*/function (_PureComponent) {
|
|
23
|
+
_inherits(MonthName, _PureComponent);
|
|
24
|
+
var _super = _createSuper(MonthName);
|
|
25
|
+
function MonthName() {
|
|
26
|
+
var _this;
|
|
27
|
+
_classCallCheck(this, MonthName);
|
|
28
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
29
|
+
args[_key] = arguments[_key];
|
|
30
|
+
}
|
|
31
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
32
|
+
_defineProperty(_assertThisInitialized(_this), "handleClick", function () {
|
|
33
|
+
var end = endOfMonth(_this.props.month);
|
|
34
|
+
_this.props.onScrollChange(end.getTime());
|
|
35
|
+
});
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
_createClass(MonthName, [{
|
|
39
|
+
key: "render",
|
|
40
|
+
value: function render() {
|
|
41
|
+
var _this$props = this.props,
|
|
42
|
+
month = _this$props.month,
|
|
43
|
+
locale = _this$props.locale;
|
|
44
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
45
|
+
type: "button",
|
|
46
|
+
className: classNames(modules_0c7b7d96.monthName, {
|
|
47
|
+
[modules_0c7b7d96.today]: isThisMonth(month)
|
|
48
|
+
}),
|
|
49
|
+
onClick: this.handleClick
|
|
50
|
+
}, format(month, 'LLL', {
|
|
51
|
+
locale
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
}]);
|
|
55
|
+
return MonthName;
|
|
56
|
+
}(PureComponent);
|
|
57
|
+
_defineProperty(MonthName, "propTypes", {
|
|
58
|
+
month: dateType,
|
|
59
|
+
onScrollChange: PropTypes.func,
|
|
60
|
+
locale: PropTypes.string
|
|
61
|
+
});
|
|
62
|
+
function MonthNames(props) {
|
|
63
|
+
var scrollDate = props.scrollDate,
|
|
64
|
+
locale = props.locale;
|
|
65
|
+
var months = [];
|
|
66
|
+
for (var i = 0; i < YEAR; i++) {
|
|
67
|
+
var middleDay = set(scrollDate, {
|
|
68
|
+
month: i,
|
|
69
|
+
date: MIDDLE_DAY
|
|
70
|
+
});
|
|
71
|
+
months.push(startOfDay(middleDay));
|
|
72
|
+
}
|
|
73
|
+
var pxToDate = linearFunction(0, Number(startOfYear(scrollDate)), yearScrollSpeed);
|
|
74
|
+
var top = 0;
|
|
75
|
+
var bottom = 0;
|
|
76
|
+
if (props.currentRange) {
|
|
77
|
+
var _props$currentRange$m = props.currentRange.map(function (date) {
|
|
78
|
+
return Math.floor(pxToDate.x(Number(date)));
|
|
79
|
+
});
|
|
80
|
+
var _props$currentRange$m2 = _slicedToArray(_props$currentRange$m, 2);
|
|
81
|
+
top = _props$currentRange$m2[0];
|
|
82
|
+
bottom = _props$currentRange$m2[1];
|
|
83
|
+
}
|
|
84
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: modules_0c7b7d96.monthNames
|
|
86
|
+
}, months.map(function (month) {
|
|
87
|
+
return /*#__PURE__*/React.createElement(MonthName, {
|
|
88
|
+
key: +month,
|
|
89
|
+
month: month,
|
|
90
|
+
onScrollChange: props.onScrollChange,
|
|
91
|
+
locale: locale
|
|
92
|
+
});
|
|
93
|
+
}), props.currentRange && /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
className: modules_0c7b7d96.range,
|
|
95
|
+
style: {
|
|
96
|
+
top: top - 1,
|
|
97
|
+
height: bottom + 1 - (top - 1)
|
|
98
|
+
}
|
|
99
|
+
}), /*#__PURE__*/React.createElement(MonthSlider, _extends({}, props, {
|
|
100
|
+
pxToDate: pxToDate
|
|
101
|
+
})));
|
|
102
|
+
}
|
|
103
|
+
MonthNames.propTypes = {
|
|
104
|
+
scrollDate: dateType,
|
|
105
|
+
onScrollChange: PropTypes.func,
|
|
106
|
+
currentRange: PropTypes.arrayOf(dateType),
|
|
107
|
+
locale: PropTypes.string
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export { MonthNames as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { LinearFunction } from '../global/linear-function';
|
|
4
|
+
import { MonthsProps } from './consts';
|
|
5
|
+
export interface MonthSliderProps extends MonthsProps {
|
|
6
|
+
pxToDate: LinearFunction;
|
|
7
|
+
}
|
|
8
|
+
interface MonthSliderState {
|
|
9
|
+
dragging: boolean;
|
|
10
|
+
}
|
|
11
|
+
export default class MonthSlider extends PureComponent<MonthSliderProps> {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
scrollDate: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
|
|
14
|
+
onScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
+
pxToDate: PropTypes.Requireable<PropTypes.InferProps<{
|
|
16
|
+
x: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
+
y: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
+
}>>;
|
|
19
|
+
};
|
|
20
|
+
state: {
|
|
21
|
+
dragging: boolean;
|
|
22
|
+
};
|
|
23
|
+
componentDidUpdate(prevProps: MonthSliderProps, prevState: MonthSliderState): void;
|
|
24
|
+
onMouseDown: () => void;
|
|
25
|
+
onMouseUp: () => void;
|
|
26
|
+
onMouseMove: (e: MouseEvent) => void;
|
|
27
|
+
render(): React.JSX.Element;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { _ as _defineProperty, a as _inherits, b as _createSuper, c as _classCallCheck, k as _assertThisInitialized, d as _createClass } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import 'core-js/modules/es.array.concat.js';
|
|
3
|
+
import 'core-js/modules/es.array.map.js';
|
|
4
|
+
import React, { PureComponent } from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import addYears from 'date-fns/addYears';
|
|
8
|
+
import startOfDay from 'date-fns/startOfDay';
|
|
9
|
+
import subYears from 'date-fns/subYears';
|
|
10
|
+
import linearFunction from '../global/linear-function.js';
|
|
11
|
+
import units, { dateType, yearScrollSpeed } from './consts.js';
|
|
12
|
+
import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
|
|
13
|
+
import 'core-js/modules/es.regexp.exec.js';
|
|
14
|
+
import 'date-fns/add';
|
|
15
|
+
|
|
16
|
+
var COVERYEARS = 3;
|
|
17
|
+
var MonthSlider = /*#__PURE__*/function (_PureComponent) {
|
|
18
|
+
_inherits(MonthSlider, _PureComponent);
|
|
19
|
+
var _super = _createSuper(MonthSlider);
|
|
20
|
+
function MonthSlider() {
|
|
21
|
+
var _this;
|
|
22
|
+
_classCallCheck(this, MonthSlider);
|
|
23
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
24
|
+
args[_key] = arguments[_key];
|
|
25
|
+
}
|
|
26
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
27
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
28
|
+
dragging: false
|
|
29
|
+
});
|
|
30
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseDown", function () {
|
|
31
|
+
_this.setState({
|
|
32
|
+
dragging: true
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseUp", function () {
|
|
36
|
+
_this.setState({
|
|
37
|
+
dragging: false
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseMove", function (e) {
|
|
41
|
+
_this.props.onScroll(linearFunction(0, Number(_this.props.scrollDate), yearScrollSpeed).y(e.movementY));
|
|
42
|
+
});
|
|
43
|
+
return _this;
|
|
44
|
+
}
|
|
45
|
+
_createClass(MonthSlider, [{
|
|
46
|
+
key: "componentDidUpdate",
|
|
47
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
48
|
+
if (this.state.dragging && !prevState.dragging) {
|
|
49
|
+
window.addEventListener('mousemove', this.onMouseMove);
|
|
50
|
+
window.addEventListener('mouseup', this.onMouseUp);
|
|
51
|
+
} else if (!this.state.dragging && prevState.dragging) {
|
|
52
|
+
window.removeEventListener('mousemove', this.onMouseMove);
|
|
53
|
+
window.removeEventListener('mouseup', this.onMouseUp);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "render",
|
|
58
|
+
value: function render() {
|
|
59
|
+
var _this2 = this;
|
|
60
|
+
var year = subYears(startOfDay(this.props.scrollDate), 1);
|
|
61
|
+
var years = [year];
|
|
62
|
+
for (var i = 0; i <= COVERYEARS; i++) {
|
|
63
|
+
year = addYears(year, 1);
|
|
64
|
+
years.push(year);
|
|
65
|
+
}
|
|
66
|
+
var classes = classNames(modules_0c7b7d96.monthSlider, {
|
|
67
|
+
[modules_0c7b7d96.dragging]: this.state.dragging
|
|
68
|
+
});
|
|
69
|
+
return /*#__PURE__*/React.createElement("div", null, years.map(function (date) {
|
|
70
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
71
|
+
type: "button",
|
|
72
|
+
key: +date,
|
|
73
|
+
className: classes,
|
|
74
|
+
style: {
|
|
75
|
+
top: Math.floor(_this2.props.pxToDate.x(Number(date)) - units.cellSize)
|
|
76
|
+
},
|
|
77
|
+
onMouseDown: _this2.onMouseDown
|
|
78
|
+
});
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
}]);
|
|
82
|
+
return MonthSlider;
|
|
83
|
+
}(PureComponent);
|
|
84
|
+
_defineProperty(MonthSlider, "propTypes", {
|
|
85
|
+
scrollDate: dateType,
|
|
86
|
+
onScroll: PropTypes.func,
|
|
87
|
+
pxToDate: PropTypes.shape({
|
|
88
|
+
x: PropTypes.func,
|
|
89
|
+
y: PropTypes.func
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export { MonthSlider as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { MonthsProps } from './consts';
|
|
4
|
+
export interface MonthProps extends MonthsProps {
|
|
5
|
+
month: Date;
|
|
6
|
+
}
|
|
7
|
+
declare function Month(props: MonthProps): React.JSX.Element;
|
|
8
|
+
declare namespace Month {
|
|
9
|
+
var propTypes: {
|
|
10
|
+
month: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
|
|
11
|
+
locale: PropTypes.Requireable<string>;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export default Month;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { f as _extends } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import 'core-js/modules/es.array.map.js';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import addDays from 'date-fns/addDays';
|
|
5
|
+
import endOfMonth from 'date-fns/endOfMonth';
|
|
6
|
+
import format from 'date-fns/format';
|
|
7
|
+
import getDay from 'date-fns/getDay';
|
|
8
|
+
import setDay from 'date-fns/setDay';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import Day from './day.js';
|
|
11
|
+
import { dateType, weekdays, WEEK } from './consts.js';
|
|
12
|
+
import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
|
|
13
|
+
import 'core-js/modules/es.array.concat.js';
|
|
14
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
15
|
+
import 'core-js/modules/es.array.includes.js';
|
|
16
|
+
import 'core-js/modules/es.string.includes.js';
|
|
17
|
+
import 'classnames';
|
|
18
|
+
import 'date-fns/getDate';
|
|
19
|
+
import 'date-fns/isAfter';
|
|
20
|
+
import 'date-fns/isBefore';
|
|
21
|
+
import 'date-fns/isSameDay';
|
|
22
|
+
import 'date-fns/isToday';
|
|
23
|
+
import 'date-fns/startOfDay';
|
|
24
|
+
import 'core-js/modules/es.regexp.exec.js';
|
|
25
|
+
import 'date-fns/add';
|
|
26
|
+
|
|
27
|
+
function Month(props) {
|
|
28
|
+
var start = props.month;
|
|
29
|
+
var end = endOfMonth(start);
|
|
30
|
+
var locale = props.locale;
|
|
31
|
+
// pad with empty cells starting from last friday
|
|
32
|
+
var weekday = getDay(start);
|
|
33
|
+
var day = setDay(start, weekday >= weekdays.FR ? weekdays.FR : weekdays.FR - WEEK);
|
|
34
|
+
var days = [];
|
|
35
|
+
while (day < end) {
|
|
36
|
+
days.push(day);
|
|
37
|
+
day = addDays(day, 1);
|
|
38
|
+
}
|
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: modules_0c7b7d96.month
|
|
41
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
42
|
+
className: modules_0c7b7d96.monthTitle
|
|
43
|
+
}, format(props.month, 'LLLL', {
|
|
44
|
+
locale
|
|
45
|
+
})), days.map(function (date) {
|
|
46
|
+
return /*#__PURE__*/React.createElement(Day, _extends({}, props, {
|
|
47
|
+
day: date,
|
|
48
|
+
empty: date < start,
|
|
49
|
+
key: +date
|
|
50
|
+
}));
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
Month.propTypes = {
|
|
54
|
+
month: dateType,
|
|
55
|
+
locale: PropTypes.string
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export { Month as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { MonthsProps } from './consts';
|
|
4
|
+
declare function Months(props: MonthsProps): React.JSX.Element;
|
|
5
|
+
declare namespace Months {
|
|
6
|
+
var propTypes: {
|
|
7
|
+
onScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
8
|
+
scrollDate: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export default Months;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { f as _extends } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import 'core-js/modules/es.array.map.js';
|
|
3
|
+
import React, { useMemo, useRef, useEffect } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import addMonths from 'date-fns/addMonths';
|
|
6
|
+
import getDay from 'date-fns/getDay';
|
|
7
|
+
import getDaysInMonth from 'date-fns/getDaysInMonth';
|
|
8
|
+
import startOfMonth from 'date-fns/startOfMonth';
|
|
9
|
+
import subMonths from 'date-fns/subMonths';
|
|
10
|
+
import endOfMonth from 'date-fns/endOfMonth';
|
|
11
|
+
import scheduleRAF from '../global/schedule-raf.js';
|
|
12
|
+
import linearFunction from '../global/linear-function.js';
|
|
13
|
+
import useEventCallback from '../global/use-event-callback.js';
|
|
14
|
+
import Month from './month.js';
|
|
15
|
+
import MonthNames from './month-names.js';
|
|
16
|
+
import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
|
|
17
|
+
import units, { dateType, DOUBLE, HALF, WEEK, weekdays } from './consts.js';
|
|
18
|
+
import 'date-fns/addDays';
|
|
19
|
+
import 'date-fns/format';
|
|
20
|
+
import 'date-fns/setDay';
|
|
21
|
+
import './day.js';
|
|
22
|
+
import 'core-js/modules/es.array.concat.js';
|
|
23
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
24
|
+
import 'core-js/modules/es.array.includes.js';
|
|
25
|
+
import 'core-js/modules/es.string.includes.js';
|
|
26
|
+
import 'classnames';
|
|
27
|
+
import 'date-fns/getDate';
|
|
28
|
+
import 'date-fns/isAfter';
|
|
29
|
+
import 'date-fns/isBefore';
|
|
30
|
+
import 'date-fns/isSameDay';
|
|
31
|
+
import 'date-fns/isToday';
|
|
32
|
+
import 'date-fns/startOfDay';
|
|
33
|
+
import 'date-fns/isThisMonth';
|
|
34
|
+
import 'date-fns/set';
|
|
35
|
+
import 'date-fns/startOfYear';
|
|
36
|
+
import './month-slider.js';
|
|
37
|
+
import 'date-fns/addYears';
|
|
38
|
+
import 'date-fns/subYears';
|
|
39
|
+
import 'core-js/modules/es.regexp.exec.js';
|
|
40
|
+
import 'date-fns/add';
|
|
41
|
+
|
|
42
|
+
var unit = units.unit,
|
|
43
|
+
cellSize = units.cellSize,
|
|
44
|
+
calHeight = units.calHeight;
|
|
45
|
+
var FridayToSunday = WEEK + weekdays.SU - weekdays.FR;
|
|
46
|
+
var FIVELINES = 31;
|
|
47
|
+
var TALLMONTH = 6;
|
|
48
|
+
var SHORTMONTH = 5;
|
|
49
|
+
var PADDING = 2;
|
|
50
|
+
var MONTHSBACK = 2;
|
|
51
|
+
function monthHeight(date) {
|
|
52
|
+
var monthStart = startOfMonth(date);
|
|
53
|
+
var daysSinceLastFriday = (getDay(monthStart) + FridayToSunday) % WEEK;
|
|
54
|
+
var monthLines = daysSinceLastFriday + getDaysInMonth(monthStart) > FIVELINES ? TALLMONTH : SHORTMONTH;
|
|
55
|
+
return monthLines * cellSize + unit * PADDING;
|
|
56
|
+
}
|
|
57
|
+
// in milliseconds per pixel
|
|
58
|
+
function scrollSpeed(date) {
|
|
59
|
+
var monthStart = startOfMonth(date);
|
|
60
|
+
var monthEnd = endOfMonth(date);
|
|
61
|
+
return (Number(monthEnd) - Number(monthStart)) / monthHeight(monthStart);
|
|
62
|
+
}
|
|
63
|
+
var scrollSchedule = scheduleRAF();
|
|
64
|
+
var dy = 0;
|
|
65
|
+
function Months(props) {
|
|
66
|
+
var scrollDate = props.scrollDate;
|
|
67
|
+
var monthDate = scrollDate instanceof Date ? scrollDate : new Date(scrollDate);
|
|
68
|
+
var monthStart = startOfMonth(monthDate);
|
|
69
|
+
var months = useMemo(function () {
|
|
70
|
+
var month = subMonths(monthStart, MONTHSBACK);
|
|
71
|
+
var result = [month];
|
|
72
|
+
for (var i = 0; i < MONTHSBACK * DOUBLE; i++) {
|
|
73
|
+
month = addMonths(month, 1);
|
|
74
|
+
result.push(month);
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}, [monthStart]);
|
|
78
|
+
var currentSpeed = scrollSpeed(scrollDate);
|
|
79
|
+
var pxToDate = linearFunction(0, Number(scrollDate), currentSpeed);
|
|
80
|
+
var offset = pxToDate.x(Number(monthStart)); // is a negative number
|
|
81
|
+
var bottomOffset = monthHeight(scrollDate) + offset;
|
|
82
|
+
var componentRef = useRef(null);
|
|
83
|
+
var handleWheel = useEventCallback(function (e) {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
dy += e.deltaY;
|
|
86
|
+
scrollSchedule(function () {
|
|
87
|
+
var date;
|
|
88
|
+
// adjust scroll speed to prevent glitches
|
|
89
|
+
if (dy < offset) {
|
|
90
|
+
date = pxToDate.y(offset) + (dy - offset) * scrollSpeed(months[1]);
|
|
91
|
+
} else if (dy > bottomOffset) {
|
|
92
|
+
date = pxToDate.y(bottomOffset) + (dy - bottomOffset) * scrollSpeed(months[MONTHSBACK + 1]);
|
|
93
|
+
} else {
|
|
94
|
+
date = pxToDate.y(dy);
|
|
95
|
+
}
|
|
96
|
+
props.onScroll(date);
|
|
97
|
+
dy = 0;
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
useEffect(function () {
|
|
101
|
+
var current = componentRef.current;
|
|
102
|
+
if (current !== null) {
|
|
103
|
+
current.addEventListener('wheel', handleWheel, {
|
|
104
|
+
passive: false
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return function () {
|
|
108
|
+
if (current !== null) {
|
|
109
|
+
current.removeEventListener('wheel', handleWheel);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}, [handleWheel]);
|
|
113
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
className: modules_0c7b7d96.months,
|
|
115
|
+
ref: componentRef
|
|
116
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
117
|
+
style: {
|
|
118
|
+
top: Math.floor(calHeight * HALF - monthHeight(months[0]) - monthHeight(months[1]) + offset)
|
|
119
|
+
},
|
|
120
|
+
className: modules_0c7b7d96.days
|
|
121
|
+
}, months.map(function (date) {
|
|
122
|
+
return /*#__PURE__*/React.createElement(Month, _extends({}, props, {
|
|
123
|
+
month: date,
|
|
124
|
+
key: +date
|
|
125
|
+
}));
|
|
126
|
+
})), /*#__PURE__*/React.createElement(MonthNames, props));
|
|
127
|
+
}
|
|
128
|
+
Months.propTypes = {
|
|
129
|
+
onScroll: PropTypes.func,
|
|
130
|
+
scrollDate: dateType
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export { Months as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Locale } from 'date-fns';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
interface WeekdaysProps {
|
|
5
|
+
locale: Locale | undefined;
|
|
6
|
+
}
|
|
7
|
+
declare function Weekdays(props: WeekdaysProps): React.JSX.Element;
|
|
8
|
+
declare namespace Weekdays {
|
|
9
|
+
var propTypes: {
|
|
10
|
+
locale: PropTypes.Requireable<string>;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export default Weekdays;
|