@sparkle-learning/core 0.0.33 → 0.0.36
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/dist/cjs/{auth.service-f878f6ab.js → PrivateRoute-074c584e.js} +34 -3
- package/dist/cjs/{active-router-eedb3bfe.js → active-router-f9e18bd8.js} +1 -1
- package/dist/cjs/{animation-6132e37f.js → animation-ee586546.js} +83 -78
- package/dist/cjs/{app-globals-9869bf67.js → app-globals-33c9f31b.js} +1 -1
- package/dist/cjs/{auth.store-ff3fda09.js → auth.store-1e630a7d.js} +48 -725
- package/dist/cjs/compass-svg.cjs.entry.js +1 -1
- package/dist/cjs/context-consumer.cjs.entry.js +1 -1
- package/dist/cjs/course-select.cjs.entry.js +1 -1
- package/dist/cjs/{cubic-bezier-293f4663.js → cubic-bezier-53d26d05.js} +10 -11
- package/dist/cjs/{facilitator.service-faac5c0c.js → facilitator.service-9e990274.js} +8 -7
- package/dist/cjs/{feed.service-66405969.js → feed.service-b4f09441.js} +8 -7
- package/dist/cjs/{focus-visible-ad3828a7.js → focus-visible-b0b07ba6.js} +19 -6
- package/dist/cjs/{framework-delegate-2470a246.js → framework-delegate-59a98abd.js} +11 -13
- package/dist/cjs/{gesture-controller-07c31f70.js → gesture-controller-0eb5579e.js} +1 -1
- package/dist/cjs/{haptic-91e86eb7.js → haptic-780f33c4.js} +3 -2
- package/dist/cjs/{hardware-back-button-f7b5d99e.js → hardware-back-button-92d97ff8.js} +8 -8
- package/dist/cjs/{sparkle-export-lessons_6.cjs.entry.js → header-mobile-collapse_61.cjs.entry.js} +11608 -2721
- package/dist/cjs/{helpers-7e28976c.js → helpers-c2496722.js} +81 -14
- package/dist/cjs/httpService-7211d93b.js +685 -0
- package/dist/cjs/{icons-80d477f6.js → icons-c61db785.js} +1 -1
- package/dist/cjs/{index-43642662.js → index-12082cba.js} +21 -18
- package/dist/cjs/{index-459a5fa9.js → index-15ea05f5.js} +19 -28
- package/dist/cjs/{index-bae2a754.js → index-51e8292e.js} +18 -11
- package/dist/cjs/{index-b12edb26.js → index-787d4498.js} +17 -25
- package/dist/cjs/{tap-click-1caf1780.js → index-8b5629a6.js} +30 -20
- package/dist/cjs/{index-8540d72e.js → index-975586fd.js} +7 -1
- package/dist/cjs/index-9c7b27e4.js +140 -0
- package/dist/cjs/{index-185f9c5a.js → index-af080b50.js} +9 -8
- package/dist/cjs/index-e56e09b8.js +38 -0
- package/dist/cjs/index.cjs.js +12 -12
- package/dist/cjs/{index.es-ef3efdfb.js → index.es-38cbcdbe.js} +2 -7
- package/dist/cjs/{input-shims-6c442c9f.js → input-shims-eff63b88.js} +21 -24
- package/dist/cjs/ion-accordion-group.cjs.entry.js +17 -9
- package/dist/cjs/ion-accordion.cjs.entry.js +19 -23
- package/dist/cjs/ion-action-sheet_4.cjs.entry.js +216 -212
- package/dist/cjs/ion-app.cjs.entry.js +8 -8
- package/dist/cjs/ion-back-button.cjs.entry.js +11 -11
- package/dist/cjs/ion-backdrop.cjs.entry.js +4 -4
- package/dist/cjs/ion-badge.cjs.entry.js +3 -3
- package/dist/cjs/ion-breadcrumb.cjs.entry.js +13 -21
- package/dist/cjs/ion-breadcrumbs.cjs.entry.js +12 -14
- package/dist/cjs/ion-buttons_3.cjs.entry.js +13 -13
- package/dist/cjs/ion-card-header.cjs.entry.js +4 -4
- package/dist/cjs/ion-card-subtitle.cjs.entry.js +4 -4
- package/dist/cjs/ion-card-title.cjs.entry.js +4 -4
- package/dist/cjs/ion-chip.cjs.entry.js +3 -3
- package/dist/cjs/ion-content_2.cjs.entry.js +59 -52
- package/dist/cjs/ion-datetime-button.cjs.entry.js +312 -0
- package/dist/cjs/ion-datetime.cjs.entry.js +752 -1245
- package/dist/cjs/ion-fab-button.cjs.entry.js +25 -9
- package/dist/cjs/ion-fab-list.cjs.entry.js +4 -4
- package/dist/cjs/ion-fab.cjs.entry.js +15 -13
- package/dist/cjs/ion-footer.cjs.entry.js +16 -14
- package/dist/cjs/ion-img.cjs.entry.js +4 -4
- package/dist/cjs/ion-infinite-scroll-content.cjs.entry.js +5 -5
- package/dist/cjs/ion-infinite-scroll.cjs.entry.js +13 -15
- package/dist/cjs/ion-item-divider.cjs.entry.js +4 -4
- package/dist/cjs/ion-item-group.cjs.entry.js +3 -3
- package/dist/cjs/ion-item-option.cjs.entry.js +8 -8
- package/dist/cjs/ion-item-options.cjs.entry.js +5 -5
- package/dist/cjs/ion-item-sliding.cjs.entry.js +41 -46
- package/dist/cjs/ion-loading.cjs.entry.js +23 -35
- package/dist/cjs/ion-menu-button.cjs.entry.js +13 -13
- package/dist/cjs/ion-menu-toggle.cjs.entry.js +7 -7
- package/dist/cjs/ion-menu.cjs.entry.js +47 -40
- package/dist/cjs/ion-modal.cjs.entry.js +935 -282
- package/dist/cjs/ion-nav-link.cjs.entry.js +2 -2
- package/dist/cjs/ion-nav.cjs.entry.js +45 -35
- package/dist/cjs/ion-picker-column-internal_2.cjs.entry.js +151 -43
- package/dist/cjs/ion-picker-column.cjs.entry.js +23 -25
- package/dist/cjs/ion-picker.cjs.entry.js +15 -17
- package/dist/cjs/ion-progress-bar.cjs.entry.js +6 -8
- package/dist/cjs/ion-refresher-content.cjs.entry.js +6 -12
- package/dist/cjs/ion-refresher.cjs.entry.js +68 -50
- package/dist/cjs/ion-reorder-group.cjs.entry.js +15 -16
- package/dist/cjs/ion-reorder.cjs.entry.js +3 -3
- package/dist/cjs/ion-route-redirect.cjs.entry.js +1 -1
- package/dist/cjs/ion-route.cjs.entry.js +1 -1
- package/dist/cjs/ion-router-link.cjs.entry.js +5 -5
- package/dist/cjs/ion-router-outlet.cjs.entry.js +22 -20
- package/dist/cjs/ion-router.cjs.entry.js +32 -31
- package/dist/cjs/ion-searchbar.cjs.entry.js +14 -16
- package/dist/cjs/ion-segment-button.cjs.entry.js +8 -8
- package/dist/cjs/ion-segment.cjs.entry.js +24 -26
- package/dist/cjs/ion-select_2.cjs.entry.js +59 -56
- package/dist/cjs/ion-skeleton-text.cjs.entry.js +4 -4
- package/dist/cjs/ion-slide.cjs.entry.js +3 -3
- package/dist/cjs/ion-slides.cjs.entry.js +23 -23
- package/dist/cjs/ion-split-pane.cjs.entry.js +10 -11
- package/dist/cjs/ion-tab-bar.cjs.entry.js +5 -5
- package/dist/cjs/ion-tab-button.cjs.entry.js +6 -6
- package/dist/cjs/ion-tab.cjs.entry.js +4 -4
- package/dist/cjs/ion-tabs.cjs.entry.js +4 -5
- package/dist/cjs/ion-textarea.cjs.entry.js +29 -28
- package/dist/cjs/ion-thumbnail.cjs.entry.js +2 -2
- package/dist/cjs/ion-toast.cjs.entry.js +23 -43
- package/dist/cjs/ion-toggle.cjs.entry.js +36 -19
- package/dist/cjs/ion-virtual-scroll.cjs.entry.js +29 -28
- package/dist/cjs/{ionic-global-878073d1.js → ionic-global-2cde9d3a.js} +27 -31
- package/dist/cjs/{ios.transition-c3bfb096.js → ios.transition-da235483.js} +71 -51
- package/dist/cjs/{keyboard-dfd76ac3.js → keyboard-91096619.js} +3 -3
- package/dist/cjs/loader.cjs.js +5 -5
- package/dist/cjs/{md.transition-7eb9a1a7.js → md.transition-be429e07.js} +9 -16
- package/dist/cjs/{menu-toggle-util-cb549c2c.js → menu-toggle-util-7a01448c.js} +2 -2
- package/dist/cjs/{overlays-0a748609.js → overlays-32df265a.js} +29 -29
- package/dist/cjs/parse-d0071120.js +1237 -0
- package/dist/cjs/{purify-d0ad2883.js → purify-fb9c107e.js} +1 -1
- package/dist/cjs/sparkle-animation-player.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-character-intro.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-code.cjs.entry.js +2 -2
- package/dist/cjs/sparkle-compass-post.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-compass.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-core.cjs.js +5 -5
- package/dist/cjs/sparkle-emoji.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-facilitator-notes-form.cjs.entry.js +8 -7
- package/dist/cjs/sparkle-feed-post.cjs.entry.js +104 -3
- package/dist/cjs/sparkle-feedback.cjs.entry.js +8 -8
- package/dist/cjs/sparkle-goal-form.cjs.entry.js +8 -7
- package/dist/cjs/sparkle-gww-comment-list.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-gww-graph.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-intro.cjs.entry.js +2 -2
- package/dist/cjs/sparkle-lower-content-nav.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-menu-collapsible.cjs.entry.js +2 -2
- package/dist/cjs/sparkle-modal-image.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-notfound-page.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-overlay.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-poll.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-quiz-container.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-quiz-feedback_5.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-quiz-v1.cjs.entry.js +105 -0
- package/dist/cjs/sparkle-quiz.cjs.entry.js +55 -41
- package/dist/cjs/sparkle-select.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-sidebar.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-tab.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-table-of-contents.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-tabs.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-youtube.cjs.entry.js +1 -1
- package/dist/cjs/{spinner-configs-6f6b7ef0.js → spinner-configs-0ac05f2d.js} +43 -43
- package/dist/cjs/{status-tap-8697433c.js → status-tap-033befa2.js} +7 -5
- package/dist/cjs/stencil-async-content.cjs.entry.js +1 -1
- package/dist/cjs/stencil-route-title.cjs.entry.js +2 -2
- package/dist/cjs/stencil-router-prompt.cjs.entry.js +2 -2
- package/dist/cjs/student.service-2e58f237.js +78 -0
- package/dist/cjs/{swipe-back-7e08b5e0.js → swipe-back-4a826f9b.js} +5 -5
- package/dist/cjs/{theme-4252ac15.js → theme-b0b295c1.js} +6 -5
- package/dist/collection/collection-manifest.json +4 -2
- package/dist/collection/components/sparkle-feed-post/sparkle-feed-post.css +16 -0
- package/dist/collection/components/sparkle-feed-post/sparkle-feed-post.js +197 -3
- package/dist/collection/components/sparkle-intro/sparkle-intro.css +0 -1
- package/dist/collection/components/sparkle-quiz/{sparkle-quiz.css → sparkle-quiz/sparkle-quiz.css} +0 -0
- package/dist/collection/components/sparkle-quiz/sparkle-quiz/sparkle-quiz.js +326 -0
- package/dist/collection/components/sparkle-quiz/sparkle-quiz-v1.css +48 -0
- package/dist/collection/components/sparkle-quiz/{sparkle-quiz.js → sparkle-quiz-v1.js} +4 -4
- package/dist/esm/{auth.service-7ab0ac58.js → PrivateRoute-c5441f35.js} +33 -3
- package/dist/esm/{active-router-909088d6.js → active-router-fc9e4e06.js} +1 -1
- package/dist/esm/{animation-7b083379.js → animation-12377cb3.js} +83 -78
- package/dist/esm/{app-globals-5c736ae5.js → app-globals-3f0347b0.js} +1 -1
- package/dist/esm/{auth.store-98fad96d.js → auth.store-dba2c2da.js} +45 -725
- package/dist/esm/compass-svg.entry.js +1 -1
- package/dist/esm/context-consumer.entry.js +1 -1
- package/dist/esm/course-select.entry.js +1 -1
- package/dist/esm/{cubic-bezier-a7ad9c8e.js → cubic-bezier-4c0db14f.js} +10 -11
- package/dist/esm/{facilitator.service-1524bf89.js → facilitator.service-b0292f7f.js} +2 -1
- package/dist/esm/{feed.service-4900fc62.js → feed.service-8fbe4ce3.js} +3 -2
- package/dist/esm/{focus-visible-40cda868.js → focus-visible-4e9a0764.js} +19 -6
- package/dist/esm/{framework-delegate-518bd233.js → framework-delegate-3e634a5c.js} +11 -13
- package/dist/esm/{gesture-controller-686622ba.js → gesture-controller-7be18351.js} +1 -1
- package/dist/esm/{haptic-99c9e346.js → haptic-522f76f2.js} +3 -2
- package/dist/esm/{hardware-back-button-b6ccf74a.js → hardware-back-button-fa04d6e9.js} +8 -8
- package/dist/esm/{sparkle-export-lessons_6.entry.js → header-mobile-collapse_61.entry.js} +11502 -2670
- package/dist/esm/{helpers-9d0930de.js → helpers-bf0e23d6.js} +81 -15
- package/dist/esm/httpService-7b75b095.js +683 -0
- package/dist/esm/{icons-05b6ce86.js → icons-9b62a1ec.js} +2 -2
- package/dist/esm/{index-a12c14bd.js → index-21661af2.js} +22 -19
- package/dist/esm/{index-8de9446b.js → index-2b84cad2.js} +17 -25
- package/dist/esm/{index-ea26196a.js → index-4044fde9.js} +5 -2
- package/dist/esm/{tap-click-cca25060.js → index-45fec1e7.js} +30 -20
- package/dist/esm/index-5e8971ae.js +128 -0
- package/dist/esm/{index-435af8e6.js → index-be6112f8.js} +9 -8
- package/dist/esm/{index-5568e3fa.js → index-c04b9ed5.js} +18 -11
- package/dist/esm/{index-fa5e93c5.js → index-cded2d87.js} +19 -28
- package/dist/esm/index-dad75b83.js +34 -0
- package/dist/esm/{index.es-89cff481.js → index.es-e0c0f891.js} +2 -7
- package/dist/esm/index.js +8 -8
- package/dist/esm/{input-shims-7f04e044.js → input-shims-671d8d9f.js} +21 -24
- package/dist/esm/ion-accordion-group.entry.js +17 -9
- package/dist/esm/ion-accordion.entry.js +19 -23
- package/dist/esm/ion-action-sheet_4.entry.js +216 -212
- package/dist/esm/ion-app.entry.js +8 -8
- package/dist/esm/ion-back-button.entry.js +11 -11
- package/dist/esm/ion-backdrop.entry.js +4 -4
- package/dist/esm/ion-badge.entry.js +3 -3
- package/dist/esm/ion-breadcrumb.entry.js +13 -21
- package/dist/esm/ion-breadcrumbs.entry.js +12 -14
- package/dist/esm/ion-buttons_3.entry.js +13 -13
- package/dist/esm/ion-card-header.entry.js +4 -4
- package/dist/esm/ion-card-subtitle.entry.js +4 -4
- package/dist/esm/ion-card-title.entry.js +4 -4
- package/dist/esm/ion-chip.entry.js +3 -3
- package/dist/esm/ion-content_2.entry.js +59 -52
- package/dist/esm/ion-datetime-button.entry.js +308 -0
- package/dist/esm/ion-datetime.entry.js +723 -1216
- package/dist/esm/ion-fab-button.entry.js +25 -9
- package/dist/esm/ion-fab-list.entry.js +4 -4
- package/dist/esm/ion-fab.entry.js +15 -13
- package/dist/esm/ion-footer.entry.js +16 -14
- package/dist/esm/ion-img.entry.js +4 -4
- package/dist/esm/ion-infinite-scroll-content.entry.js +5 -5
- package/dist/esm/ion-infinite-scroll.entry.js +13 -15
- package/dist/esm/ion-item-divider.entry.js +4 -4
- package/dist/esm/ion-item-group.entry.js +3 -3
- package/dist/esm/ion-item-option.entry.js +8 -8
- package/dist/esm/ion-item-options.entry.js +5 -5
- package/dist/esm/ion-item-sliding.entry.js +41 -46
- package/dist/esm/ion-loading.entry.js +23 -35
- package/dist/esm/ion-menu-button.entry.js +13 -13
- package/dist/esm/ion-menu-toggle.entry.js +7 -7
- package/dist/esm/ion-menu.entry.js +47 -40
- package/dist/esm/ion-modal.entry.js +921 -268
- package/dist/esm/ion-nav-link.entry.js +2 -2
- package/dist/esm/ion-nav.entry.js +45 -35
- package/dist/esm/ion-picker-column-internal_2.entry.js +151 -43
- package/dist/esm/ion-picker-column.entry.js +23 -25
- package/dist/esm/ion-picker.entry.js +15 -17
- package/dist/esm/ion-progress-bar.entry.js +6 -8
- package/dist/esm/ion-refresher-content.entry.js +6 -12
- package/dist/esm/ion-refresher.entry.js +68 -50
- package/dist/esm/ion-reorder-group.entry.js +15 -16
- package/dist/esm/ion-reorder.entry.js +3 -3
- package/dist/esm/ion-route-redirect.entry.js +1 -1
- package/dist/esm/ion-route.entry.js +1 -1
- package/dist/esm/ion-router-link.entry.js +5 -5
- package/dist/esm/ion-router-outlet.entry.js +22 -20
- package/dist/esm/ion-router.entry.js +32 -31
- package/dist/esm/ion-searchbar.entry.js +14 -16
- package/dist/esm/ion-segment-button.entry.js +8 -8
- package/dist/esm/ion-segment.entry.js +24 -26
- package/dist/esm/ion-select_2.entry.js +59 -56
- package/dist/esm/ion-skeleton-text.entry.js +4 -4
- package/dist/esm/ion-slide.entry.js +3 -3
- package/dist/esm/ion-slides.entry.js +23 -23
- package/dist/esm/ion-split-pane.entry.js +10 -11
- package/dist/esm/ion-tab-bar.entry.js +5 -5
- package/dist/esm/ion-tab-button.entry.js +6 -6
- package/dist/esm/ion-tab.entry.js +4 -4
- package/dist/esm/ion-tabs.entry.js +4 -5
- package/dist/esm/ion-textarea.entry.js +29 -28
- package/dist/esm/ion-thumbnail.entry.js +2 -2
- package/dist/esm/ion-toast.entry.js +23 -43
- package/dist/esm/ion-toggle.entry.js +36 -19
- package/dist/esm/ion-virtual-scroll.entry.js +29 -28
- package/dist/esm/{ionic-global-0939c477.js → ionic-global-4903e23e.js} +27 -31
- package/dist/esm/{ios.transition-db4f4ca6.js → ios.transition-131d64fe.js} +71 -51
- package/dist/esm/{keyboard-2503e874.js → keyboard-7e8329b3.js} +3 -3
- package/dist/esm/loader.js +5 -5
- package/dist/esm/{md.transition-8294b503.js → md.transition-f6126011.js} +9 -16
- package/dist/esm/{menu-toggle-util-06adade3.js → menu-toggle-util-bace8ae6.js} +2 -2
- package/dist/esm/{overlays-5c777f10.js → overlays-3b4dca92.js} +30 -30
- package/dist/esm/parse-1ae3a9bb.js +1196 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/{purify-eb68cf1d.js → purify-85bfcc69.js} +1 -1
- package/dist/esm/sparkle-animation-player.entry.js +2 -2
- package/dist/esm/sparkle-character-intro.entry.js +1 -1
- package/dist/esm/sparkle-code.entry.js +2 -2
- package/dist/esm/sparkle-compass-post.entry.js +1 -1
- package/dist/esm/sparkle-compass.entry.js +1 -1
- package/dist/esm/sparkle-core.js +5 -5
- package/dist/esm/sparkle-emoji.entry.js +1 -1
- package/dist/esm/sparkle-facilitator-notes-form.entry.js +8 -7
- package/dist/esm/sparkle-feed-post.entry.js +104 -3
- package/dist/esm/sparkle-feedback.entry.js +8 -8
- package/dist/esm/sparkle-goal-form.entry.js +9 -8
- package/dist/esm/sparkle-gww-comment-list.entry.js +1 -1
- package/dist/esm/sparkle-gww-graph.entry.js +1 -1
- package/dist/esm/sparkle-intro.entry.js +2 -2
- package/dist/esm/sparkle-lower-content-nav.entry.js +1 -1
- package/dist/esm/sparkle-menu-collapsible.entry.js +2 -2
- package/dist/esm/sparkle-modal-image.entry.js +1 -1
- package/dist/esm/sparkle-notfound-page.entry.js +1 -1
- package/dist/esm/sparkle-overlay.entry.js +1 -1
- package/dist/esm/sparkle-poll.entry.js +1 -1
- package/dist/esm/sparkle-quiz-container.entry.js +1 -1
- package/dist/esm/sparkle-quiz-feedback_5.entry.js +1 -1
- package/dist/esm/sparkle-quiz-v1.entry.js +101 -0
- package/dist/esm/sparkle-quiz.entry.js +55 -41
- package/dist/esm/sparkle-select.entry.js +1 -1
- package/dist/esm/sparkle-sidebar.entry.js +1 -1
- package/dist/esm/sparkle-tab.entry.js +1 -1
- package/dist/esm/sparkle-table-of-contents.entry.js +1 -1
- package/dist/esm/sparkle-tabs.entry.js +1 -1
- package/dist/esm/sparkle-youtube.entry.js +1 -1
- package/dist/esm/{spinner-configs-f609a655.js → spinner-configs-a37e628a.js} +43 -43
- package/dist/esm/{status-tap-e8c0c752.js → status-tap-dde52787.js} +7 -5
- package/dist/esm/stencil-async-content.entry.js +1 -1
- package/dist/esm/stencil-route-title.entry.js +2 -2
- package/dist/esm/stencil-router-prompt.entry.js +2 -2
- package/dist/esm/{student.service-c2f44f3a.js → student.service-0746418b.js} +19 -3
- package/dist/esm/{swipe-back-9a3b2cdd.js → swipe-back-7847a0c1.js} +5 -5
- package/dist/esm/{theme-c336c9d9.js → theme-7ef00c83.js} +6 -5
- package/dist/esm/{util-a831d09d.js → util-6ef753e9.js} +1 -1
- package/dist/node_modules/@ionic/core/dist/collection/components/content/content.css +8 -1
- package/dist/node_modules/@ionic/core/dist/collection/components/datetime/datetime.ios.css +46 -22
- package/dist/node_modules/@ionic/core/dist/collection/components/datetime/datetime.md.css +43 -19
- package/dist/node_modules/@ionic/core/dist/collection/components/datetime-button/datetime-button.css +60 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/item/item.ios.css +2 -1
- package/dist/node_modules/@ionic/core/dist/collection/components/item/item.md.css +2 -2
- package/dist/node_modules/@ionic/core/dist/collection/components/item-option/item-option.ios.css +6 -6
- package/dist/node_modules/@ionic/core/dist/collection/components/item-option/item-option.md.css +6 -6
- package/dist/node_modules/@ionic/core/dist/collection/components/label/label.ios.css +3 -3
- package/dist/node_modules/@ionic/core/dist/collection/components/loading/loading.ios.css +1 -6
- package/dist/node_modules/@ionic/core/dist/collection/components/loading/loading.md.css +1 -6
- package/dist/node_modules/@ionic/core/dist/collection/components/menu/menu.ios.css +1 -5
- package/dist/node_modules/@ionic/core/dist/collection/components/menu/menu.md.css +1 -5
- package/dist/node_modules/@ionic/core/dist/collection/components/modal/modal.ios.css +31 -3
- package/dist/node_modules/@ionic/core/dist/collection/components/modal/modal.md.css +29 -1
- package/dist/node_modules/@ionic/core/dist/collection/components/picker-column-internal/picker-column-internal.ios.css +24 -1
- package/dist/node_modules/@ionic/core/dist/collection/components/picker-column-internal/picker-column-internal.md.css +24 -1
- package/dist/node_modules/@ionic/core/dist/collection/components/picker-internal/picker-internal.ios.css +4 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/picker-internal/picker-internal.md.css +4 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/range/range.ios.css +2 -2
- package/dist/node_modules/@ionic/core/dist/collection/components/range/range.md.css +2 -2
- package/dist/node_modules/@ionic/core/dist/collection/components/spinner/spinner.css +8 -8
- package/dist/node_modules/@ionic/core/dist/collection/components/textarea/textarea.ios.css +34 -17
- package/dist/node_modules/@ionic/core/dist/collection/components/textarea/textarea.md.css +34 -17
- package/dist/node_modules/@ionic/core/dist/collection/components/toggle/toggle.ios.css +50 -1
- package/dist/node_modules/@ionic/core/dist/collection/components/toggle/toggle.md.css +27 -0
- package/dist/sparkle-core/index.esm.js +1 -1
- package/dist/sparkle-core/p-00d10dc9.js +4 -0
- package/dist/sparkle-core/p-0147266a.js +1 -0
- package/dist/sparkle-core/{p-797c23ed.entry.js → p-04c7b276.entry.js} +1 -1
- package/dist/sparkle-core/p-05c032dd.js +4 -0
- package/dist/sparkle-core/{p-5f45d206.entry.js → p-06642405.entry.js} +1 -1
- package/dist/sparkle-core/p-0664370b.entry.js +1 -0
- package/dist/sparkle-core/{p-39e5a90f.entry.js → p-06c7d0f2.entry.js} +1 -1
- package/dist/sparkle-core/{p-703ca87c.js → p-076f0239.js} +0 -0
- package/dist/sparkle-core/p-077c732b.js +4 -0
- package/dist/sparkle-core/p-0ad5c123.entry.js +1 -0
- package/dist/sparkle-core/{p-beb401e3.entry.js → p-0afa3a4d.entry.js} +1 -1
- package/dist/sparkle-core/{p-52f1d1ca.entry.js → p-0c3f3ea6.entry.js} +1 -1
- package/dist/sparkle-core/{p-69e7783d.js → p-0e4de1d0.js} +0 -0
- package/dist/sparkle-core/{p-337f92b0.entry.js → p-0f1c5899.entry.js} +5 -5
- package/dist/sparkle-core/{p-5e4ec238.entry.js → p-0fa3fd63.entry.js} +1 -1
- package/dist/sparkle-core/p-11356b03.entry.js +1 -0
- package/dist/sparkle-core/p-12dd96d7.js +4 -0
- package/dist/sparkle-core/{p-21db4e8e.entry.js → p-162bff1a.entry.js} +1 -1
- package/dist/sparkle-core/p-1b1ba156.entry.js +1 -0
- package/dist/sparkle-core/p-1d4c7c11.js +1 -0
- package/dist/sparkle-core/{p-11234d0f.entry.js → p-1e125ca5.entry.js} +1 -1
- package/dist/sparkle-core/{p-5b40aae5.entry.js → p-1e4782af.entry.js} +1 -1
- package/dist/sparkle-core/{p-4550e10f.entry.js → p-1e4f65ee.entry.js} +1 -1
- package/dist/sparkle-core/{p-f6bafe1d.js → p-2033cd86.js} +2 -2
- package/dist/sparkle-core/{p-ed0e9d29.entry.js → p-214d1229.entry.js} +1 -1
- package/dist/sparkle-core/p-23aca7ca.js +4 -0
- package/dist/sparkle-core/{p-85429b12.entry.js → p-24cb9a33.entry.js} +1 -1
- package/dist/sparkle-core/{p-37c00e39.entry.js → p-27fbabc3.entry.js} +1 -1
- package/dist/sparkle-core/{p-7d61177b.entry.js → p-2ba70507.entry.js} +1 -1
- package/dist/sparkle-core/{p-c8ae9e47.entry.js → p-2c1ca854.entry.js} +1 -1
- package/dist/sparkle-core/{p-23a9f7d1.entry.js → p-2d9659e2.entry.js} +1 -1
- package/dist/sparkle-core/p-2f569553.js +1 -0
- package/dist/sparkle-core/p-2ff67662.js +4 -0
- package/dist/sparkle-core/p-30b810d1.entry.js +4 -0
- package/dist/sparkle-core/p-32f4e565.entry.js +1 -0
- package/dist/sparkle-core/{p-057f6a23.entry.js → p-352677e6.entry.js} +1 -1
- package/dist/sparkle-core/{p-b49ca0ea.entry.js → p-370609ba.entry.js} +1 -1
- package/dist/sparkle-core/p-377b04c2.entry.js +10 -0
- package/dist/sparkle-core/{p-aa9ebc39.entry.js → p-38b7cf68.entry.js} +1 -1
- package/dist/sparkle-core/{p-667accac.entry.js → p-3963e02b.entry.js} +1 -1
- package/dist/sparkle-core/p-39712c56.entry.js +4 -0
- package/dist/sparkle-core/p-3a965828.entry.js +1 -0
- package/dist/sparkle-core/p-3de0e00c.js +4 -0
- package/dist/sparkle-core/{p-04583c51.entry.js → p-4053ecdb.entry.js} +1 -1
- package/dist/sparkle-core/p-462bffba.js +1 -0
- package/dist/sparkle-core/p-48f72e63.js +4 -0
- package/dist/sparkle-core/p-4c6a7e52.js +1 -0
- package/dist/sparkle-core/{p-8c6b6038.js → p-4d4077ea.js} +0 -0
- package/dist/sparkle-core/{p-3a202a38.entry.js → p-5096739e.entry.js} +1 -1
- package/dist/sparkle-core/p-5322c920.entry.js +1 -0
- package/dist/sparkle-core/{p-c748f64e.entry.js → p-54dd894f.entry.js} +1 -1
- package/dist/sparkle-core/p-564e64fc.entry.js +4 -0
- package/dist/sparkle-core/{p-b3909012.entry.js → p-5893bbe5.entry.js} +1 -1
- package/dist/sparkle-core/p-58e4bbe5.entry.js +1 -0
- package/dist/sparkle-core/p-590266d6.entry.js +1 -0
- package/dist/sparkle-core/p-594a6982.entry.js +1 -0
- package/dist/sparkle-core/{p-aef8aa31.entry.js → p-5c435d5a.entry.js} +1 -1
- package/dist/sparkle-core/{p-a7832a51.js → p-5cad23f1.js} +1 -1
- package/dist/sparkle-core/p-5efc6566.js +1 -0
- package/dist/sparkle-core/p-600cf6a3.js +1 -0
- package/dist/sparkle-core/{p-a9ee3f6d.entry.js → p-601397df.entry.js} +1 -1
- package/dist/sparkle-core/p-604a7987.js +4 -0
- package/dist/sparkle-core/{p-11cf398a.entry.js → p-616941c6.entry.js} +1 -1
- package/dist/sparkle-core/{p-aa87c7f0.entry.js → p-6316d124.entry.js} +1 -1
- package/dist/sparkle-core/p-63f71ada.entry.js +1 -0
- package/dist/sparkle-core/p-641bfc92.entry.js +1 -0
- package/dist/sparkle-core/p-69487d90.entry.js +1 -0
- package/dist/sparkle-core/{p-5a98d42e.entry.js → p-6faa194c.entry.js} +2 -2
- package/dist/sparkle-core/p-6ffd2420.entry.js +1 -0
- package/dist/sparkle-core/p-73721c84.js +4 -0
- package/dist/sparkle-core/p-74864276.entry.js +1 -0
- package/dist/sparkle-core/p-7d8427eb.js +4 -0
- package/dist/sparkle-core/{p-5264da79.js → p-7e7ce516.js} +0 -0
- package/dist/sparkle-core/{p-43a7391b.entry.js → p-80d6b0e6.entry.js} +1 -1
- package/dist/sparkle-core/{p-c5b9bdd6.entry.js → p-81714d94.entry.js} +1 -1
- package/dist/sparkle-core/p-8492a765.entry.js +1 -0
- package/dist/sparkle-core/p-859563db.entry.js +1 -0
- package/dist/sparkle-core/{p-4dc3ef96.entry.js → p-865f36a8.entry.js} +1 -1
- package/dist/sparkle-core/{p-52d4715a.js → p-86ed13f0.js} +1 -1
- package/dist/sparkle-core/p-871106e0.js +4 -0
- package/dist/sparkle-core/p-894ff7e6.entry.js +1 -0
- package/dist/sparkle-core/{p-7493ee15.entry.js → p-8a41b502.entry.js} +1 -1
- package/dist/sparkle-core/p-8c74cbb6.entry.js +1 -0
- package/dist/sparkle-core/{p-d4c07aca.js → p-924b2917.js} +0 -0
- package/dist/sparkle-core/p-9289cdbc.entry.js +1 -0
- package/dist/sparkle-core/{p-4bd4dab2.js → p-935e7cfc.js} +1 -1
- package/dist/sparkle-core/{p-d7baf31e.entry.js → p-975b99ee.entry.js} +1 -1
- package/dist/sparkle-core/p-99ee9919.js +1 -0
- package/dist/sparkle-core/p-9abbd715.entry.js +1 -0
- package/dist/sparkle-core/{p-ff4d6858.js → p-9d894ed4.js} +2 -2
- package/dist/sparkle-core/{p-fbd7eeca.entry.js → p-9e309b3e.entry.js} +1 -1
- package/dist/sparkle-core/{p-996361f9.entry.js → p-9e7fee8f.entry.js} +1 -1
- package/dist/sparkle-core/p-9ebf0537.entry.js +1 -0
- package/dist/sparkle-core/p-a102341e.entry.js +1 -0
- package/dist/sparkle-core/p-a208ab2d.js +4 -0
- package/dist/sparkle-core/p-a2638250.entry.js +1 -0
- package/dist/sparkle-core/{p-016a7aaf.entry.js → p-a2ebcf0a.entry.js} +1 -1
- package/dist/sparkle-core/{p-6823e6c1.entry.js → p-a98d7ebe.entry.js} +1 -1
- package/dist/sparkle-core/p-add30d46.js +4 -0
- package/dist/sparkle-core/p-af3cc111.entry.js +1 -0
- package/dist/sparkle-core/{p-0ad99881.js → p-b0603d19.js} +1 -1
- package/dist/sparkle-core/p-b3f375fb.entry.js +1 -0
- package/dist/sparkle-core/p-b5f3e1bf.entry.js +1 -0
- package/dist/sparkle-core/{p-90466494.entry.js → p-b96f3c84.entry.js} +2 -2
- package/dist/sparkle-core/p-bd80ff43.js +4 -0
- package/dist/sparkle-core/p-be64105c.entry.js +1 -0
- package/dist/sparkle-core/{p-08923b40.entry.js → p-c0533c23.entry.js} +1 -1
- package/dist/sparkle-core/p-c2990b24.entry.js +1 -0
- package/dist/sparkle-core/{p-c3d3d5c4.entry.js → p-c3cadfc6.entry.js} +1 -1
- package/dist/sparkle-core/p-c60b29bd.entry.js +4 -0
- package/dist/sparkle-core/p-cabfbf22.entry.js +1 -0
- package/dist/sparkle-core/p-cc518c36.entry.js +1 -0
- package/dist/sparkle-core/{p-b21d0d9f.entry.js → p-ce4b22f7.entry.js} +2 -2
- package/dist/sparkle-core/p-cffd4817.entry.js +1 -0
- package/dist/sparkle-core/{p-c69b0a7a.entry.js → p-d0adf726.entry.js} +1 -1
- package/dist/sparkle-core/{p-03ec54a8.entry.js → p-d20e4fcf.entry.js} +1 -1
- package/dist/sparkle-core/p-d24e53ab.entry.js +1 -0
- package/dist/sparkle-core/p-d288e6c1.entry.js +1 -0
- package/dist/sparkle-core/{p-ee0d7f19.entry.js → p-d601810e.entry.js} +1 -1
- package/dist/sparkle-core/p-d68092b7.js +4 -0
- package/dist/sparkle-core/p-de4deb61.entry.js +1 -0
- package/dist/sparkle-core/{p-b07a2cf2.entry.js → p-e249aebf.entry.js} +1 -1
- package/dist/sparkle-core/p-e3e36ce9.entry.js +1 -0
- package/dist/sparkle-core/{p-1726da2f.entry.js → p-e421d638.entry.js} +1 -1
- package/dist/sparkle-core/p-e686d8b5.entry.js +4 -0
- package/dist/sparkle-core/{p-401feeb0.js → p-e8073714.js} +1 -1
- package/dist/sparkle-core/p-e863bf1d.entry.js +1 -0
- package/dist/sparkle-core/{p-3defe550.entry.js → p-e8988989.entry.js} +1 -1
- package/dist/sparkle-core/p-e9431eeb.js +7 -0
- package/dist/sparkle-core/p-ea962e1b.entry.js +1 -0
- package/dist/sparkle-core/p-eaa8bbee.js +4 -0
- package/dist/sparkle-core/p-eaf76d1d.entry.js +352 -0
- package/dist/sparkle-core/p-ebd4354b.entry.js +1 -0
- package/dist/sparkle-core/p-ee1e0eb4.js +2 -0
- package/dist/sparkle-core/{p-d00f550b.entry.js → p-ef4edc48.entry.js} +1 -1
- package/dist/sparkle-core/{p-a9ccb0df.js → p-f3cba72a.js} +0 -0
- package/dist/sparkle-core/p-fb0ca75e.entry.js +5 -0
- package/dist/sparkle-core/p-fb757951.entry.js +1 -0
- package/dist/sparkle-core/p-fbccd30c.js +1 -0
- package/dist/sparkle-core/p-fd8d0738.entry.js +4 -0
- package/dist/sparkle-core/{p-90389886.entry.js → p-fda95b6e.entry.js} +1 -1
- package/dist/sparkle-core/{p-350adbaa.entry.js → p-fe6dc976.entry.js} +1 -1
- package/dist/sparkle-core/{p-ecd39170.entry.js → p-ff0e0d4e.entry.js} +1 -1
- package/dist/sparkle-core/sparkle-core.css +1 -1
- package/dist/sparkle-core/sparkle-core.esm.js +1 -1
- package/dist/types/components/sparkle-feed-post/sparkle-feed-post.d.ts +16 -0
- package/dist/types/components/sparkle-quiz/sparkle-quiz/sparkle-quiz.d.ts +42 -0
- package/dist/types/components/sparkle-quiz/sparkle-quiz-v1.d.ts +41 -0
- package/dist/types/components/sparkle-quiz/sparkle-quiz.d.ts +36 -36
- package/dist/types/components.d.ts +96 -11
- package/package.json +3 -3
- package/dist/cjs/PrivateRoute-482697a6.js +0 -35
- package/dist/cjs/dom-utils-b8befdd5.js +0 -63
- package/dist/cjs/header-mobile-collapse_2.cjs.entry.js +0 -112
- package/dist/cjs/index-07e8aa51.js +0 -3071
- package/dist/cjs/injectHistory-77d41284.js +0 -9
- package/dist/cjs/ion-avatar.cjs.entry.js +0 -25
- package/dist/cjs/ion-button_3.cjs.entry.js +0 -383
- package/dist/cjs/ion-card_2.cjs.entry.js +0 -93
- package/dist/cjs/ion-checkbox_4.cjs.entry.js +0 -370
- package/dist/cjs/ion-col_3.cjs.entry.js +0 -155
- package/dist/cjs/ion-icon_2.cjs.entry.js +0 -397
- package/dist/cjs/ion-input_2.cjs.entry.js +0 -316
- package/dist/cjs/ion-label_2.cjs.entry.js +0 -126
- package/dist/cjs/ion-range.cjs.entry.js +0 -445
- package/dist/cjs/ion-spinner.cjs.entry.js +0 -64
- package/dist/cjs/match-path-84c9f7ca.js +0 -511
- package/dist/cjs/sparkle-card_3.cjs.entry.js +0 -91
- package/dist/cjs/sparkle-course-root.cjs.entry.js +0 -145
- package/dist/cjs/sparkle-dropdown.cjs.entry.js +0 -61
- package/dist/cjs/sparkle-facilitator-header_19.cjs.entry.js +0 -2129
- package/dist/cjs/sparkle-goal-progress.cjs.entry.js +0 -19
- package/dist/cjs/sparkle-gww-item.cjs.entry.js +0 -74
- package/dist/cjs/sparkle-menu-toggle_3.cjs.entry.js +0 -236
- package/dist/cjs/sparkle-validation-error.cjs.entry.js +0 -21
- package/dist/cjs/stencil-route-link.cjs.entry.js +0 -77
- package/dist/cjs/stencil-router-redirect.cjs.entry.js +0 -32
- package/dist/cjs/student.service-7af424fe.js +0 -61
- package/dist/cjs/user.store-3d29139d.js +0 -21
- package/dist/esm/PrivateRoute-f59ba6b5.js +0 -33
- package/dist/esm/dom-utils-8e73e88b.js +0 -55
- package/dist/esm/header-mobile-collapse_2.entry.js +0 -107
- package/dist/esm/index-c92f99d4.js +0 -3067
- package/dist/esm/injectHistory-52d0c7eb.js +0 -7
- package/dist/esm/ion-avatar.entry.js +0 -21
- package/dist/esm/ion-button_3.entry.js +0 -377
- package/dist/esm/ion-card_2.entry.js +0 -88
- package/dist/esm/ion-checkbox_4.entry.js +0 -363
- package/dist/esm/ion-col_3.entry.js +0 -149
- package/dist/esm/ion-icon_2.entry.js +0 -392
- package/dist/esm/ion-input_2.entry.js +0 -311
- package/dist/esm/ion-label_2.entry.js +0 -121
- package/dist/esm/ion-range.entry.js +0 -441
- package/dist/esm/ion-spinner.entry.js +0 -60
- package/dist/esm/match-path-36fdf5c7.js +0 -499
- package/dist/esm/sparkle-card_3.entry.js +0 -85
- package/dist/esm/sparkle-course-root.entry.js +0 -141
- package/dist/esm/sparkle-dropdown.entry.js +0 -57
- package/dist/esm/sparkle-facilitator-header_19.entry.js +0 -2107
- package/dist/esm/sparkle-goal-progress.entry.js +0 -15
- package/dist/esm/sparkle-gww-item.entry.js +0 -70
- package/dist/esm/sparkle-menu-toggle_3.entry.js +0 -230
- package/dist/esm/sparkle-validation-error.entry.js +0 -17
- package/dist/esm/stencil-route-link.entry.js +0 -73
- package/dist/esm/stencil-router-redirect.entry.js +0 -28
- package/dist/esm/user.store-e6ff7558.js +0 -19
- package/dist/sparkle-core/p-021fde3c.entry.js +0 -1
- package/dist/sparkle-core/p-034306e2.js +0 -1
- package/dist/sparkle-core/p-034aa29f.entry.js +0 -5
- package/dist/sparkle-core/p-052caa63.js +0 -1
- package/dist/sparkle-core/p-0580419b.entry.js +0 -1
- package/dist/sparkle-core/p-063cd168.js +0 -4
- package/dist/sparkle-core/p-06c0cce3.entry.js +0 -1
- package/dist/sparkle-core/p-081968cc.entry.js +0 -1
- package/dist/sparkle-core/p-0934f5dd.entry.js +0 -1
- package/dist/sparkle-core/p-1133fcbd.js +0 -4
- package/dist/sparkle-core/p-1551190a.entry.js +0 -1
- package/dist/sparkle-core/p-1728ead7.js +0 -1
- package/dist/sparkle-core/p-1e8c22e0.entry.js +0 -1
- package/dist/sparkle-core/p-21bf4ca0.entry.js +0 -1
- package/dist/sparkle-core/p-232cc3bc.js +0 -1
- package/dist/sparkle-core/p-28950db0.entry.js +0 -1
- package/dist/sparkle-core/p-2af82cc1.entry.js +0 -1
- package/dist/sparkle-core/p-2bd4c60e.js +0 -1
- package/dist/sparkle-core/p-2f437793.entry.js +0 -348
- package/dist/sparkle-core/p-330ccc7c.entry.js +0 -1
- package/dist/sparkle-core/p-35a7bd6c.entry.js +0 -1
- package/dist/sparkle-core/p-35c5c110.entry.js +0 -1
- package/dist/sparkle-core/p-3ff617d5.js +0 -1
- package/dist/sparkle-core/p-4028676b.js +0 -4
- package/dist/sparkle-core/p-41124baa.js +0 -4
- package/dist/sparkle-core/p-41af3793.entry.js +0 -1
- package/dist/sparkle-core/p-44c23f72.js +0 -1
- package/dist/sparkle-core/p-45e6db62.entry.js +0 -1
- package/dist/sparkle-core/p-48f9b960.entry.js +0 -1
- package/dist/sparkle-core/p-4a72626a.js +0 -1
- package/dist/sparkle-core/p-4ba57978.entry.js +0 -4
- package/dist/sparkle-core/p-4ef4b8bd.entry.js +0 -5
- package/dist/sparkle-core/p-4f144efa.js +0 -4
- package/dist/sparkle-core/p-58e98f89.entry.js +0 -1
- package/dist/sparkle-core/p-59f7bf6e.entry.js +0 -1
- package/dist/sparkle-core/p-5ec7fd67.entry.js +0 -1
- package/dist/sparkle-core/p-618f6f82.entry.js +0 -1
- package/dist/sparkle-core/p-62a6c96f.entry.js +0 -1
- package/dist/sparkle-core/p-65ca1fb2.entry.js +0 -1
- package/dist/sparkle-core/p-663fafa9.entry.js +0 -1
- package/dist/sparkle-core/p-67f71099.entry.js +0 -4
- package/dist/sparkle-core/p-680663a2.entry.js +0 -1
- package/dist/sparkle-core/p-6a16b9ef.entry.js +0 -4
- package/dist/sparkle-core/p-6b6a8f0a.entry.js +0 -1
- package/dist/sparkle-core/p-6c5b5ea2.entry.js +0 -1
- package/dist/sparkle-core/p-6ebf52fb.entry.js +0 -1
- package/dist/sparkle-core/p-6f45db93.js +0 -1
- package/dist/sparkle-core/p-6fd4985d.js +0 -4
- package/dist/sparkle-core/p-7052c43a.entry.js +0 -1
- package/dist/sparkle-core/p-70b2452c.js +0 -4
- package/dist/sparkle-core/p-74106ca8.entry.js +0 -1
- package/dist/sparkle-core/p-75572037.js +0 -1
- package/dist/sparkle-core/p-7568dcab.entry.js +0 -1
- package/dist/sparkle-core/p-768bcc9e.entry.js +0 -1
- package/dist/sparkle-core/p-7703bae9.entry.js +0 -1
- package/dist/sparkle-core/p-77c23496.entry.js +0 -1
- package/dist/sparkle-core/p-79606a41.entry.js +0 -1
- package/dist/sparkle-core/p-7976e88c.entry.js +0 -1
- package/dist/sparkle-core/p-7c1f59ec.js +0 -1
- package/dist/sparkle-core/p-7de0a22b.entry.js +0 -1
- package/dist/sparkle-core/p-848fe770.entry.js +0 -1
- package/dist/sparkle-core/p-86d099f1.js +0 -4
- package/dist/sparkle-core/p-87549bb7.js +0 -4
- package/dist/sparkle-core/p-8c470e28.entry.js +0 -1
- package/dist/sparkle-core/p-954c89c2.entry.js +0 -1
- package/dist/sparkle-core/p-95d01c4c.js +0 -4
- package/dist/sparkle-core/p-987c64eb.js +0 -1
- package/dist/sparkle-core/p-9babd345.js +0 -1
- package/dist/sparkle-core/p-a89dea80.entry.js +0 -1
- package/dist/sparkle-core/p-b17dd6df.js +0 -4
- package/dist/sparkle-core/p-b3e6427d.js +0 -7
- package/dist/sparkle-core/p-b7dafaae.entry.js +0 -1
- package/dist/sparkle-core/p-bd062288.entry.js +0 -1
- package/dist/sparkle-core/p-bef34cfe.entry.js +0 -1
- package/dist/sparkle-core/p-c1c59771.js +0 -1
- package/dist/sparkle-core/p-c4104929.entry.js +0 -1
- package/dist/sparkle-core/p-c48bbc7c.entry.js +0 -4
- package/dist/sparkle-core/p-c753207f.entry.js +0 -1
- package/dist/sparkle-core/p-c8ed0575.js +0 -1
- package/dist/sparkle-core/p-c96b24bd.entry.js +0 -4
- package/dist/sparkle-core/p-ce13171b.entry.js +0 -1
- package/dist/sparkle-core/p-d394eed1.entry.js +0 -1
- package/dist/sparkle-core/p-d48e95c1.entry.js +0 -1
- package/dist/sparkle-core/p-d4b1a14a.entry.js +0 -1
- package/dist/sparkle-core/p-d56efeac.entry.js +0 -4
- package/dist/sparkle-core/p-d59a5984.entry.js +0 -1
- package/dist/sparkle-core/p-d8aff730.entry.js +0 -1
- package/dist/sparkle-core/p-da8921d0.entry.js +0 -1
- package/dist/sparkle-core/p-e08059b6.js +0 -4
- package/dist/sparkle-core/p-e3fdd0a8.entry.js +0 -1
- package/dist/sparkle-core/p-ec4d22e3.entry.js +0 -1
- package/dist/sparkle-core/p-ed3eed72.entry.js +0 -1
- package/dist/sparkle-core/p-ee0717e1.entry.js +0 -4
- package/dist/sparkle-core/p-ef2dace6.js +0 -4
- package/dist/sparkle-core/p-f1106984.entry.js +0 -1
- package/dist/sparkle-core/p-f61ca75c.entry.js +0 -1
- package/dist/sparkle-core/p-f9b73032.entry.js +0 -1
- package/dist/sparkle-core/p-fef04ab5.js +0 -4
@@ -2,878 +2,15 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
const index = require('./index-
|
6
|
-
const index$
|
7
|
-
const ionicGlobal = require('./ionic-global-
|
8
|
-
const focusVisible = require('./focus-visible-
|
9
|
-
const helpers = require('./helpers-
|
5
|
+
const index = require('./index-51e8292e.js');
|
6
|
+
const index$2 = require('./index-975586fd.js');
|
7
|
+
const ionicGlobal = require('./ionic-global-2cde9d3a.js');
|
8
|
+
const focusVisible = require('./focus-visible-b0b07ba6.js');
|
9
|
+
const helpers = require('./helpers-c2496722.js');
|
10
|
+
const index$1 = require('./index-e56e09b8.js');
|
10
11
|
const dir = require('./dir-5af5259a.js');
|
11
|
-
const theme = require('./theme-
|
12
|
-
|
13
|
-
/*!
|
14
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
15
|
-
*/
|
16
|
-
/**
|
17
|
-
* Returns true if the selected day is equal to the reference day
|
18
|
-
*/
|
19
|
-
const isSameDay = (baseParts, compareParts) => {
|
20
|
-
return (baseParts.month === compareParts.month &&
|
21
|
-
baseParts.day === compareParts.day &&
|
22
|
-
baseParts.year === compareParts.year);
|
23
|
-
};
|
24
|
-
/**
|
25
|
-
* Returns true is the selected day is before the reference day.
|
26
|
-
*/
|
27
|
-
const isBefore = (baseParts, compareParts) => {
|
28
|
-
return (baseParts.year < compareParts.year ||
|
29
|
-
baseParts.year === compareParts.year && baseParts.month < compareParts.month ||
|
30
|
-
baseParts.year === compareParts.year && baseParts.month === compareParts.month && baseParts.day < compareParts.day);
|
31
|
-
};
|
32
|
-
/**
|
33
|
-
* Returns true is the selected day is after the reference day.
|
34
|
-
*/
|
35
|
-
const isAfter = (baseParts, compareParts) => {
|
36
|
-
return (baseParts.year > compareParts.year ||
|
37
|
-
baseParts.year === compareParts.year && baseParts.month > compareParts.month ||
|
38
|
-
baseParts.year === compareParts.year && baseParts.month === compareParts.month && baseParts.day > compareParts.day);
|
39
|
-
};
|
40
|
-
|
41
|
-
/*!
|
42
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
43
|
-
*/
|
44
|
-
/**
|
45
|
-
* Determines if given year is a
|
46
|
-
* leap year. Returns `true` if year
|
47
|
-
* is a leap year. Returns `false`
|
48
|
-
* otherwise.
|
49
|
-
*/
|
50
|
-
const isLeapYear = (year) => {
|
51
|
-
return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0);
|
52
|
-
};
|
53
|
-
const is24Hour = (locale, hourCycle) => {
|
54
|
-
/**
|
55
|
-
* If developer has explicitly enabled h23 time
|
56
|
-
* then return early and do not look at the system default.
|
57
|
-
*/
|
58
|
-
if (hourCycle !== undefined) {
|
59
|
-
return hourCycle === 'h23';
|
60
|
-
}
|
61
|
-
/**
|
62
|
-
* If hourCycle was not specified, check the locale
|
63
|
-
* that is set on the user's device. We first check the
|
64
|
-
* Intl.DateTimeFormat hourCycle option as developers can encode this
|
65
|
-
* option into the locale string. Example: `en-US-u-hc-h23`
|
66
|
-
*/
|
67
|
-
const formatted = new Intl.DateTimeFormat(locale, { hour: 'numeric' });
|
68
|
-
const options = formatted.resolvedOptions();
|
69
|
-
if (options.hourCycle !== undefined) {
|
70
|
-
return options.hourCycle === 'h23';
|
71
|
-
}
|
72
|
-
/**
|
73
|
-
* If hourCycle is not specified (either through lack
|
74
|
-
* of browser support or locale information) then fall
|
75
|
-
* back to this slower hourCycle check.
|
76
|
-
*/
|
77
|
-
const date = new Date('5/18/2021 00:00');
|
78
|
-
const parts = formatted.formatToParts(date);
|
79
|
-
const hour = parts.find(p => p.type === 'hour');
|
80
|
-
if (!hour) {
|
81
|
-
throw new Error('Hour value not found from DateTimeFormat');
|
82
|
-
}
|
83
|
-
return hour.value === '00';
|
84
|
-
};
|
85
|
-
/**
|
86
|
-
* Given a date object, returns the number
|
87
|
-
* of days in that month.
|
88
|
-
* Month value begin at 1, not 0.
|
89
|
-
* i.e. January = month 1.
|
90
|
-
*/
|
91
|
-
const getNumDaysInMonth = (month, year) => {
|
92
|
-
return (month === 4 || month === 6 || month === 9 || month === 11) ? 30 : (month === 2) ? isLeapYear(year) ? 29 : 28 : 31;
|
93
|
-
};
|
94
|
-
/**
|
95
|
-
* Certain locales display month then year while
|
96
|
-
* others display year then month.
|
97
|
-
* We can use Intl.DateTimeFormat to determine
|
98
|
-
* the ordering for each locale.
|
99
|
-
*/
|
100
|
-
const isMonthFirstLocale = (locale) => {
|
101
|
-
/**
|
102
|
-
* By setting month and year we guarantee that only
|
103
|
-
* month, year, and literal (slashes '/', for example)
|
104
|
-
* values are included in the formatToParts results.
|
105
|
-
*
|
106
|
-
* The ordering of the parts will be determined by
|
107
|
-
* the locale. So if the month is the first value,
|
108
|
-
* then we know month should be shown first. If the
|
109
|
-
* year is the first value, then we know year should be shown first.
|
110
|
-
*
|
111
|
-
* This ordering can be controlled by customizing the locale property.
|
112
|
-
*/
|
113
|
-
const parts = new Intl.DateTimeFormat(locale, { month: 'numeric', year: 'numeric' }).formatToParts(new Date());
|
114
|
-
return parts[0].type === 'month';
|
115
|
-
};
|
116
|
-
|
117
|
-
/*!
|
118
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
119
|
-
*/
|
120
|
-
const twoDigit = (val) => {
|
121
|
-
return ('0' + (val !== undefined ? Math.abs(val) : '0')).slice(-2);
|
122
|
-
};
|
123
|
-
const fourDigit = (val) => {
|
124
|
-
return ('000' + (val !== undefined ? Math.abs(val) : '0')).slice(-4);
|
125
|
-
};
|
126
|
-
const convertDataToISO = (data) => {
|
127
|
-
// https://www.w3.org/TR/NOTE-datetime
|
128
|
-
let rtn = '';
|
129
|
-
if (data.year !== undefined) {
|
130
|
-
// YYYY
|
131
|
-
rtn = fourDigit(data.year);
|
132
|
-
if (data.month !== undefined) {
|
133
|
-
// YYYY-MM
|
134
|
-
rtn += '-' + twoDigit(data.month);
|
135
|
-
if (data.day !== undefined) {
|
136
|
-
// YYYY-MM-DD
|
137
|
-
rtn += '-' + twoDigit(data.day);
|
138
|
-
if (data.hour !== undefined) {
|
139
|
-
// YYYY-MM-DDTHH:mm:SS
|
140
|
-
rtn += `T${twoDigit(data.hour)}:${twoDigit(data.minute)}:00`;
|
141
|
-
if (data.tzOffset === undefined) {
|
142
|
-
// YYYY-MM-DDTHH:mm:SSZ
|
143
|
-
rtn += 'Z';
|
144
|
-
}
|
145
|
-
else {
|
146
|
-
// YYYY-MM-DDTHH:mm:SS+/-HH:mm
|
147
|
-
rtn += (data.tzOffset > 0 ? '+' : '-') + twoDigit(Math.floor(Math.abs(data.tzOffset / 60))) + ':' + twoDigit(data.tzOffset % 60);
|
148
|
-
}
|
149
|
-
}
|
150
|
-
}
|
151
|
-
}
|
152
|
-
}
|
153
|
-
else if (data.hour !== undefined) {
|
154
|
-
// HH:mm
|
155
|
-
rtn = twoDigit(data.hour) + ':' + twoDigit(data.minute);
|
156
|
-
}
|
157
|
-
return rtn;
|
158
|
-
};
|
159
|
-
/**
|
160
|
-
* Converts an 12 hour value to 24 hours.
|
161
|
-
*/
|
162
|
-
const convert12HourTo24Hour = (hour, ampm) => {
|
163
|
-
if (ampm === undefined) {
|
164
|
-
return hour;
|
165
|
-
}
|
166
|
-
/**
|
167
|
-
* If AM and 12am
|
168
|
-
* then return 00:00.
|
169
|
-
* Otherwise just return
|
170
|
-
* the hour since it is
|
171
|
-
* already in 24 hour format.
|
172
|
-
*/
|
173
|
-
if (ampm === 'am') {
|
174
|
-
if (hour === 12) {
|
175
|
-
return 0;
|
176
|
-
}
|
177
|
-
return hour;
|
178
|
-
}
|
179
|
-
/**
|
180
|
-
* If PM and 12pm
|
181
|
-
* just return 12:00
|
182
|
-
* since it is already
|
183
|
-
* in 24 hour format.
|
184
|
-
* Otherwise add 12 hours
|
185
|
-
* to the time.
|
186
|
-
*/
|
187
|
-
if (hour === 12) {
|
188
|
-
return 12;
|
189
|
-
}
|
190
|
-
return hour + 12;
|
191
|
-
};
|
192
|
-
const getStartOfWeek = (refParts) => {
|
193
|
-
const { dayOfWeek } = refParts;
|
194
|
-
if (dayOfWeek === null || dayOfWeek === undefined) {
|
195
|
-
throw new Error('No day of week provided');
|
196
|
-
}
|
197
|
-
return subtractDays(refParts, dayOfWeek);
|
198
|
-
};
|
199
|
-
const getEndOfWeek = (refParts) => {
|
200
|
-
const { dayOfWeek } = refParts;
|
201
|
-
if (dayOfWeek === null || dayOfWeek === undefined) {
|
202
|
-
throw new Error('No day of week provided');
|
203
|
-
}
|
204
|
-
return addDays(refParts, 6 - dayOfWeek);
|
205
|
-
};
|
206
|
-
const getNextDay = (refParts) => {
|
207
|
-
return addDays(refParts, 1);
|
208
|
-
};
|
209
|
-
const getPreviousDay = (refParts) => {
|
210
|
-
return subtractDays(refParts, 1);
|
211
|
-
};
|
212
|
-
const getPreviousWeek = (refParts) => {
|
213
|
-
return subtractDays(refParts, 7);
|
214
|
-
};
|
215
|
-
const getNextWeek = (refParts) => {
|
216
|
-
return addDays(refParts, 7);
|
217
|
-
};
|
218
|
-
/**
|
219
|
-
* Given datetime parts, subtract
|
220
|
-
* numDays from the date.
|
221
|
-
* Returns a new DatetimeParts object
|
222
|
-
* Currently can only go backward at most 1 month.
|
223
|
-
*/
|
224
|
-
const subtractDays = (refParts, numDays) => {
|
225
|
-
const { month, day, year } = refParts;
|
226
|
-
if (day === null) {
|
227
|
-
throw new Error('No day provided');
|
228
|
-
}
|
229
|
-
const workingParts = {
|
230
|
-
month,
|
231
|
-
day,
|
232
|
-
year
|
233
|
-
};
|
234
|
-
workingParts.day = day - numDays;
|
235
|
-
/**
|
236
|
-
* If wrapping to previous month
|
237
|
-
* update days and decrement month
|
238
|
-
*/
|
239
|
-
if (workingParts.day < 1) {
|
240
|
-
workingParts.month -= 1;
|
241
|
-
}
|
242
|
-
/**
|
243
|
-
* If moving to previous year, reset
|
244
|
-
* month to December and decrement year
|
245
|
-
*/
|
246
|
-
if (workingParts.month < 1) {
|
247
|
-
workingParts.month = 12;
|
248
|
-
workingParts.year -= 1;
|
249
|
-
}
|
250
|
-
/**
|
251
|
-
* Determine how many days are in the current
|
252
|
-
* month
|
253
|
-
*/
|
254
|
-
if (workingParts.day < 1) {
|
255
|
-
const daysInMonth = getNumDaysInMonth(workingParts.month, workingParts.year);
|
256
|
-
/**
|
257
|
-
* Take num days in month and add the
|
258
|
-
* number of underflow days. This number will
|
259
|
-
* be negative.
|
260
|
-
* Example: 1 week before Jan 2, 2021 is
|
261
|
-
* December 26, 2021 so:
|
262
|
-
* 2 - 7 = -5
|
263
|
-
* 31 + (-5) = 26
|
264
|
-
*/
|
265
|
-
workingParts.day = daysInMonth + workingParts.day;
|
266
|
-
}
|
267
|
-
return workingParts;
|
268
|
-
};
|
269
|
-
/**
|
270
|
-
* Given datetime parts, add
|
271
|
-
* numDays to the date.
|
272
|
-
* Returns a new DatetimeParts object
|
273
|
-
* Currently can only go forward at most 1 month.
|
274
|
-
*/
|
275
|
-
const addDays = (refParts, numDays) => {
|
276
|
-
const { month, day, year } = refParts;
|
277
|
-
if (day === null) {
|
278
|
-
throw new Error('No day provided');
|
279
|
-
}
|
280
|
-
const workingParts = {
|
281
|
-
month,
|
282
|
-
day,
|
283
|
-
year
|
284
|
-
};
|
285
|
-
const daysInMonth = getNumDaysInMonth(month, year);
|
286
|
-
workingParts.day = day + numDays;
|
287
|
-
/**
|
288
|
-
* If wrapping to next month
|
289
|
-
* update days and increment month
|
290
|
-
*/
|
291
|
-
if (workingParts.day > daysInMonth) {
|
292
|
-
workingParts.day -= daysInMonth;
|
293
|
-
workingParts.month += 1;
|
294
|
-
}
|
295
|
-
/**
|
296
|
-
* If moving to next year, reset
|
297
|
-
* month to January and increment year
|
298
|
-
*/
|
299
|
-
if (workingParts.month > 12) {
|
300
|
-
workingParts.month = 1;
|
301
|
-
workingParts.year += 1;
|
302
|
-
}
|
303
|
-
return workingParts;
|
304
|
-
};
|
305
|
-
/**
|
306
|
-
* Given DatetimeParts, generate the previous month.
|
307
|
-
*/
|
308
|
-
const getPreviousMonth = (refParts) => {
|
309
|
-
/**
|
310
|
-
* If current month is January, wrap backwards
|
311
|
-
* to December of the previous year.
|
312
|
-
*/
|
313
|
-
const month = (refParts.month === 1) ? 12 : refParts.month - 1;
|
314
|
-
const year = (refParts.month === 1) ? refParts.year - 1 : refParts.year;
|
315
|
-
const numDaysInMonth = getNumDaysInMonth(month, year);
|
316
|
-
const day = (numDaysInMonth < refParts.day) ? numDaysInMonth : refParts.day;
|
317
|
-
return { month, year, day };
|
318
|
-
};
|
319
|
-
/**
|
320
|
-
* Given DatetimeParts, generate the next month.
|
321
|
-
*/
|
322
|
-
const getNextMonth = (refParts) => {
|
323
|
-
/**
|
324
|
-
* If current month is December, wrap forwards
|
325
|
-
* to January of the next year.
|
326
|
-
*/
|
327
|
-
const month = (refParts.month === 12) ? 1 : refParts.month + 1;
|
328
|
-
const year = (refParts.month === 12) ? refParts.year + 1 : refParts.year;
|
329
|
-
const numDaysInMonth = getNumDaysInMonth(month, year);
|
330
|
-
const day = (numDaysInMonth < refParts.day) ? numDaysInMonth : refParts.day;
|
331
|
-
return { month, year, day };
|
332
|
-
};
|
333
|
-
const changeYear = (refParts, yearDelta) => {
|
334
|
-
const month = refParts.month;
|
335
|
-
const year = refParts.year + yearDelta;
|
336
|
-
const numDaysInMonth = getNumDaysInMonth(month, year);
|
337
|
-
const day = (numDaysInMonth < refParts.day) ? numDaysInMonth : refParts.day;
|
338
|
-
return { month, year, day };
|
339
|
-
};
|
340
|
-
/**
|
341
|
-
* Given DatetimeParts, generate the previous year.
|
342
|
-
*/
|
343
|
-
const getPreviousYear = (refParts) => {
|
344
|
-
return changeYear(refParts, -1);
|
345
|
-
};
|
346
|
-
/**
|
347
|
-
* Given DatetimeParts, generate the next year.
|
348
|
-
*/
|
349
|
-
const getNextYear = (refParts) => {
|
350
|
-
return changeYear(refParts, 1);
|
351
|
-
};
|
352
|
-
/**
|
353
|
-
* If PM, then internal value should
|
354
|
-
* be converted to 24-hr time.
|
355
|
-
* Does not apply when public
|
356
|
-
* values are already 24-hr time.
|
357
|
-
*/
|
358
|
-
const getInternalHourValue = (hour, use24Hour, ampm) => {
|
359
|
-
if (use24Hour) {
|
360
|
-
return hour;
|
361
|
-
}
|
362
|
-
return convert12HourTo24Hour(hour, ampm);
|
363
|
-
};
|
364
|
-
/**
|
365
|
-
* Unless otherwise stated, all month values are
|
366
|
-
* 1 indexed instead of the typical 0 index in JS Date.
|
367
|
-
* Example:
|
368
|
-
* January = Month 0 when using JS Date
|
369
|
-
* January = Month 1 when using this datetime util
|
370
|
-
*/
|
371
|
-
/**
|
372
|
-
* Given the current datetime parts and a new AM/PM value
|
373
|
-
* calculate what the hour should be in 24-hour time format.
|
374
|
-
* Used when toggling the AM/PM segment since we store our hours
|
375
|
-
* in 24-hour time format internally.
|
376
|
-
*/
|
377
|
-
const calculateHourFromAMPM = (currentParts, newAMPM) => {
|
378
|
-
const { ampm: currentAMPM, hour } = currentParts;
|
379
|
-
let newHour = hour;
|
380
|
-
/**
|
381
|
-
* If going from AM --> PM, need to update the
|
382
|
-
*
|
383
|
-
*/
|
384
|
-
if (currentAMPM === 'am' && newAMPM === 'pm') {
|
385
|
-
newHour = convert12HourTo24Hour(newHour, 'pm');
|
386
|
-
/**
|
387
|
-
* If going from PM --> AM
|
388
|
-
*/
|
389
|
-
}
|
390
|
-
else if (currentAMPM === 'pm' && newAMPM === 'am') {
|
391
|
-
newHour = Math.abs(newHour - 12);
|
392
|
-
}
|
393
|
-
return newHour;
|
394
|
-
};
|
395
|
-
|
396
|
-
/*!
|
397
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
398
|
-
*/
|
399
|
-
/**
|
400
|
-
* Returns the current date as
|
401
|
-
* an ISO string in the user's
|
402
|
-
* timezone.
|
403
|
-
*/
|
404
|
-
const getToday = () => {
|
405
|
-
/**
|
406
|
-
* Grab the current date object
|
407
|
-
* as well as the timezone offset
|
408
|
-
*/
|
409
|
-
const date = new Date();
|
410
|
-
const tzOffset = date.getTimezoneOffset();
|
411
|
-
/**
|
412
|
-
* When converting to ISO string, everything is
|
413
|
-
* set to UTC. Since we want to show these dates
|
414
|
-
* relative to the user's timezone, we need to
|
415
|
-
* subtract the timezone offset from the date
|
416
|
-
* so that when `toISOString()` adds it back
|
417
|
-
* there was a net change of zero hours from the
|
418
|
-
* local date.
|
419
|
-
*/
|
420
|
-
date.setHours(date.getHours() - (tzOffset / 60));
|
421
|
-
return date.toISOString();
|
422
|
-
};
|
423
|
-
const minutes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59];
|
424
|
-
const hour12 = [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
425
|
-
const hour23 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23];
|
426
|
-
/**
|
427
|
-
* Given a locale and a mode,
|
428
|
-
* return an array with formatted days
|
429
|
-
* of the week. iOS should display days
|
430
|
-
* such as "Mon" or "Tue".
|
431
|
-
* MD should display days such as "M"
|
432
|
-
* or "T".
|
433
|
-
*/
|
434
|
-
const getDaysOfWeek = (locale, mode, firstDayOfWeek = 0) => {
|
435
|
-
/**
|
436
|
-
* Nov 1st, 2020 starts on a Sunday.
|
437
|
-
* ion-datetime assumes weeks start on Sunday,
|
438
|
-
* but is configurable via `firstDayOfWeek`.
|
439
|
-
*/
|
440
|
-
const weekdayFormat = mode === 'ios' ? 'short' : 'narrow';
|
441
|
-
const intl = new Intl.DateTimeFormat(locale, { weekday: weekdayFormat });
|
442
|
-
const startDate = new Date('11/01/2020');
|
443
|
-
const daysOfWeek = [];
|
444
|
-
/**
|
445
|
-
* For each day of the week,
|
446
|
-
* get the day name.
|
447
|
-
*/
|
448
|
-
for (let i = firstDayOfWeek; i < firstDayOfWeek + 7; i++) {
|
449
|
-
const currentDate = new Date(startDate);
|
450
|
-
currentDate.setDate(currentDate.getDate() + i);
|
451
|
-
daysOfWeek.push(intl.format(currentDate));
|
452
|
-
}
|
453
|
-
return daysOfWeek;
|
454
|
-
};
|
455
|
-
/**
|
456
|
-
* Returns an array containing all of the
|
457
|
-
* days in a month for a given year. Values are
|
458
|
-
* aligned with a week calendar starting on
|
459
|
-
* the firstDayOfWeek value (Sunday by default)
|
460
|
-
* using null values.
|
461
|
-
*/
|
462
|
-
const getDaysOfMonth = (month, year, firstDayOfWeek) => {
|
463
|
-
const numDays = getNumDaysInMonth(month, year);
|
464
|
-
const firstOfMonth = new Date(`${month}/1/${year}`).getDay();
|
465
|
-
/**
|
466
|
-
* To get the first day of the month aligned on the correct
|
467
|
-
* day of the week, we need to determine how many "filler" days
|
468
|
-
* to generate. These filler days as empty/disabled buttons
|
469
|
-
* that fill the space of the days of the week before the first
|
470
|
-
* of the month.
|
471
|
-
*
|
472
|
-
* There are two cases here:
|
473
|
-
*
|
474
|
-
* 1. If firstOfMonth = 4, firstDayOfWeek = 0 then the offset
|
475
|
-
* is (4 - (0 + 1)) = 3. Since the offset loop goes from 0 to 3 inclusive,
|
476
|
-
* this will generate 4 filler days (0, 1, 2, 3), and then day of week 4 will have
|
477
|
-
* the first day of the month.
|
478
|
-
*
|
479
|
-
* 2. If firstOfMonth = 2, firstDayOfWeek = 4 then the offset
|
480
|
-
* is (6 - (4 - 2)) = 4. Since the offset loop goes from 0 to 4 inclusive,
|
481
|
-
* this will generate 5 filler days (0, 1, 2, 3, 4), and then day of week 5 will have
|
482
|
-
* the first day of the month.
|
483
|
-
*/
|
484
|
-
const offset = firstOfMonth >= firstDayOfWeek ? firstOfMonth - (firstDayOfWeek + 1) : 6 - (firstDayOfWeek - firstOfMonth);
|
485
|
-
let days = [];
|
486
|
-
for (let i = 1; i <= numDays; i++) {
|
487
|
-
days.push({ day: i, dayOfWeek: (offset + i) % 7 });
|
488
|
-
}
|
489
|
-
for (let i = 0; i <= offset; i++) {
|
490
|
-
days = [
|
491
|
-
{ day: null, dayOfWeek: null },
|
492
|
-
...days
|
493
|
-
];
|
494
|
-
}
|
495
|
-
return days;
|
496
|
-
};
|
497
|
-
/**
|
498
|
-
* Given a local, reference datetime parts and option
|
499
|
-
* max/min bound datetime parts, calculate the acceptable
|
500
|
-
* hour and minute values according to the bounds and locale.
|
501
|
-
*/
|
502
|
-
const generateTime = (refParts, hourCycle = 'h12', minParts, maxParts, hourValues, minuteValues) => {
|
503
|
-
const use24Hour = hourCycle === 'h23';
|
504
|
-
let processedHours = use24Hour ? hour23 : hour12;
|
505
|
-
let processedMinutes = minutes;
|
506
|
-
let isAMAllowed = true;
|
507
|
-
let isPMAllowed = true;
|
508
|
-
if (hourValues) {
|
509
|
-
processedHours = processedHours.filter(hour => hourValues.includes(hour));
|
510
|
-
}
|
511
|
-
if (minuteValues) {
|
512
|
-
processedMinutes = processedMinutes.filter(minute => minuteValues.includes(minute));
|
513
|
-
}
|
514
|
-
if (minParts) {
|
515
|
-
/**
|
516
|
-
* If ref day is the same as the
|
517
|
-
* minimum allowed day, filter hour/minute
|
518
|
-
* values according to min hour and minute.
|
519
|
-
*/
|
520
|
-
if (isSameDay(refParts, minParts)) {
|
521
|
-
/**
|
522
|
-
* Users may not always set the hour/minute for
|
523
|
-
* min value (i.e. 2021-06-02) so we should allow
|
524
|
-
* all hours/minutes in that case.
|
525
|
-
*/
|
526
|
-
if (minParts.hour !== undefined) {
|
527
|
-
processedHours = processedHours.filter(hour => {
|
528
|
-
const convertedHour = refParts.ampm === 'pm' ? (hour + 12) % 24 : hour;
|
529
|
-
return (use24Hour ? hour : convertedHour) >= minParts.hour;
|
530
|
-
});
|
531
|
-
isAMAllowed = minParts.hour < 13;
|
532
|
-
}
|
533
|
-
if (minParts.minute !== undefined) {
|
534
|
-
/**
|
535
|
-
* The minimum minute range should not be enforced when
|
536
|
-
* the hour is greater than the min hour.
|
537
|
-
*
|
538
|
-
* For example with a minimum range of 09:30, users
|
539
|
-
* should be able to select 10:00-10:29 and beyond.
|
540
|
-
*/
|
541
|
-
let isPastMinHour = false;
|
542
|
-
if (minParts.hour !== undefined && refParts.hour !== undefined) {
|
543
|
-
if (refParts.hour > minParts.hour) {
|
544
|
-
isPastMinHour = true;
|
545
|
-
}
|
546
|
-
}
|
547
|
-
processedMinutes = processedMinutes.filter(minute => {
|
548
|
-
if (isPastMinHour) {
|
549
|
-
return true;
|
550
|
-
}
|
551
|
-
return minute >= minParts.minute;
|
552
|
-
});
|
553
|
-
}
|
554
|
-
/**
|
555
|
-
* If ref day is before minimum
|
556
|
-
* day do not render any hours/minute values
|
557
|
-
*/
|
558
|
-
}
|
559
|
-
else if (isBefore(refParts, minParts)) {
|
560
|
-
processedHours = [];
|
561
|
-
processedMinutes = [];
|
562
|
-
isAMAllowed = isPMAllowed = false;
|
563
|
-
}
|
564
|
-
}
|
565
|
-
if (maxParts) {
|
566
|
-
/**
|
567
|
-
* If ref day is the same as the
|
568
|
-
* maximum allowed day, filter hour/minute
|
569
|
-
* values according to max hour and minute.
|
570
|
-
*/
|
571
|
-
if (isSameDay(refParts, maxParts)) {
|
572
|
-
/**
|
573
|
-
* Users may not always set the hour/minute for
|
574
|
-
* max value (i.e. 2021-06-02) so we should allow
|
575
|
-
* all hours/minutes in that case.
|
576
|
-
*/
|
577
|
-
if (maxParts.hour !== undefined) {
|
578
|
-
processedHours = processedHours.filter(hour => {
|
579
|
-
const convertedHour = refParts.ampm === 'pm' ? (hour + 12) % 24 : hour;
|
580
|
-
return (use24Hour ? hour : convertedHour) <= maxParts.hour;
|
581
|
-
});
|
582
|
-
isPMAllowed = maxParts.hour >= 13;
|
583
|
-
}
|
584
|
-
if (maxParts.minute !== undefined && refParts.hour === maxParts.hour) {
|
585
|
-
// The available minutes should only be filtered when the hour is the same as the max hour.
|
586
|
-
// For example if the max hour is 10:30 and the current hour is 10:00,
|
587
|
-
// users should be able to select 00-30 minutes.
|
588
|
-
// If the current hour is 09:00, users should be able to select 00-60 minutes.
|
589
|
-
processedMinutes = processedMinutes.filter(minute => minute <= maxParts.minute);
|
590
|
-
}
|
591
|
-
/**
|
592
|
-
* If ref day is after minimum
|
593
|
-
* day do not render any hours/minute values
|
594
|
-
*/
|
595
|
-
}
|
596
|
-
else if (isAfter(refParts, maxParts)) {
|
597
|
-
processedHours = [];
|
598
|
-
processedMinutes = [];
|
599
|
-
isAMAllowed = isPMAllowed = false;
|
600
|
-
}
|
601
|
-
}
|
602
|
-
return {
|
603
|
-
hours: processedHours,
|
604
|
-
minutes: processedMinutes,
|
605
|
-
am: isAMAllowed,
|
606
|
-
pm: isPMAllowed
|
607
|
-
};
|
608
|
-
};
|
609
|
-
/**
|
610
|
-
* Given DatetimeParts, generate the previous,
|
611
|
-
* current, and and next months.
|
612
|
-
*/
|
613
|
-
const generateMonths = (refParts) => {
|
614
|
-
return [
|
615
|
-
getPreviousMonth(refParts),
|
616
|
-
{ month: refParts.month, year: refParts.year, day: refParts.day },
|
617
|
-
getNextMonth(refParts)
|
618
|
-
];
|
619
|
-
};
|
620
|
-
const getPickerMonths = (locale, refParts, minParts, maxParts, monthValues) => {
|
621
|
-
const { year } = refParts;
|
622
|
-
const months = [];
|
623
|
-
if (monthValues !== undefined) {
|
624
|
-
let processedMonths = monthValues;
|
625
|
-
if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.month) !== undefined) {
|
626
|
-
processedMonths = processedMonths.filter(month => month <= maxParts.month);
|
627
|
-
}
|
628
|
-
if ((minParts === null || minParts === void 0 ? void 0 : minParts.month) !== undefined) {
|
629
|
-
processedMonths = processedMonths.filter(month => month >= minParts.month);
|
630
|
-
}
|
631
|
-
processedMonths.forEach(processedMonth => {
|
632
|
-
const date = new Date(`${processedMonth}/1/${year} GMT+0000`);
|
633
|
-
const monthString = new Intl.DateTimeFormat(locale, { month: 'long', timeZone: 'UTC' }).format(date);
|
634
|
-
months.push({ text: monthString, value: processedMonth });
|
635
|
-
});
|
636
|
-
}
|
637
|
-
else {
|
638
|
-
const maxMonth = maxParts && maxParts.year === year ? maxParts.month : 12;
|
639
|
-
const minMonth = minParts && minParts.year === year ? minParts.month : 1;
|
640
|
-
for (let i = minMonth; i <= maxMonth; i++) {
|
641
|
-
/**
|
642
|
-
*
|
643
|
-
* There is a bug on iOS 14 where
|
644
|
-
* Intl.DateTimeFormat takes into account
|
645
|
-
* the local timezone offset when formatting dates.
|
646
|
-
*
|
647
|
-
* Forcing the timezone to 'UTC' fixes the issue. However,
|
648
|
-
* we should keep this workaround as it is safer. In the event
|
649
|
-
* this breaks in another browser, we will not be impacted
|
650
|
-
* because all dates will be interpreted in UTC.
|
651
|
-
*
|
652
|
-
* Example:
|
653
|
-
* new Intl.DateTimeFormat('en-US', { month: 'long' }).format(new Date('Sat Apr 01 2006 00:00:00 GMT-0400 (EDT)')) // "March"
|
654
|
-
* new Intl.DateTimeFormat('en-US', { month: 'long', timeZone: 'UTC' }).format(new Date('Sat Apr 01 2006 00:00:00 GMT-0400 (EDT)')) // "April"
|
655
|
-
*
|
656
|
-
* In certain timezones, iOS 14 shows the wrong
|
657
|
-
* date for .toUTCString(). To combat this, we
|
658
|
-
* force all of the timezones to GMT+0000 (UTC).
|
659
|
-
*
|
660
|
-
* Example:
|
661
|
-
* Time Zone: Central European Standard Time
|
662
|
-
* new Date('1/1/1992').toUTCString() // "Tue, 31 Dec 1991 23:00:00 GMT"
|
663
|
-
* new Date('1/1/1992 GMT+0000').toUTCString() // "Wed, 01 Jan 1992 00:00:00 GMT"
|
664
|
-
*/
|
665
|
-
const date = new Date(`${i}/1/${year} GMT+0000`);
|
666
|
-
const monthString = new Intl.DateTimeFormat(locale, { month: 'long', timeZone: 'UTC' }).format(date);
|
667
|
-
months.push({ text: monthString, value: i });
|
668
|
-
}
|
669
|
-
}
|
670
|
-
return months;
|
671
|
-
};
|
672
|
-
const getCalendarYears = (refParts, minParts, maxParts, yearValues) => {
|
673
|
-
if (yearValues !== undefined) {
|
674
|
-
let processedYears = yearValues;
|
675
|
-
if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.year) !== undefined) {
|
676
|
-
processedYears = processedYears.filter(year => year <= maxParts.year);
|
677
|
-
}
|
678
|
-
if ((minParts === null || minParts === void 0 ? void 0 : minParts.year) !== undefined) {
|
679
|
-
processedYears = processedYears.filter(year => year >= minParts.year);
|
680
|
-
}
|
681
|
-
return processedYears;
|
682
|
-
}
|
683
|
-
else {
|
684
|
-
const { year } = refParts;
|
685
|
-
const maxYear = ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.year) || year);
|
686
|
-
const minYear = ((minParts === null || minParts === void 0 ? void 0 : minParts.year) || year - 100);
|
687
|
-
const years = [];
|
688
|
-
for (let i = maxYear; i >= minYear; i--) {
|
689
|
-
years.push(i);
|
690
|
-
}
|
691
|
-
return years;
|
692
|
-
}
|
693
|
-
};
|
694
|
-
|
695
|
-
/*!
|
696
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
697
|
-
*/
|
698
|
-
const get12HourTime = (hour) => {
|
699
|
-
return hour % 12 || 12;
|
700
|
-
};
|
701
|
-
const getFormattedAMPM = (ampm) => {
|
702
|
-
if (ampm === undefined) {
|
703
|
-
return '';
|
704
|
-
}
|
705
|
-
return ampm.toUpperCase();
|
706
|
-
};
|
707
|
-
const getFormattedTime = (refParts, use24Hour) => {
|
708
|
-
if (refParts.hour === undefined || refParts.minute === undefined) {
|
709
|
-
return 'Invalid Time';
|
710
|
-
}
|
711
|
-
const hour = use24Hour ? getFormattedHour(refParts.hour, use24Hour) : get12HourTime(refParts.hour);
|
712
|
-
const minute = addTimePadding(refParts.minute);
|
713
|
-
if (use24Hour) {
|
714
|
-
return `${hour}:${minute}`;
|
715
|
-
}
|
716
|
-
return `${hour}:${minute} ${getFormattedAMPM(refParts.ampm)}`;
|
717
|
-
};
|
718
|
-
/**
|
719
|
-
* Adds padding to a time value so
|
720
|
-
* that it is always 2 digits.
|
721
|
-
*/
|
722
|
-
const addTimePadding = (value) => {
|
723
|
-
const valueToString = value.toString();
|
724
|
-
if (valueToString.length > 1) {
|
725
|
-
return valueToString;
|
726
|
-
}
|
727
|
-
return `0${valueToString}`;
|
728
|
-
};
|
729
|
-
/**
|
730
|
-
* Formats the hour value so that it
|
731
|
-
* is always 2 digits. Only applies
|
732
|
-
* if using 12 hour format.
|
733
|
-
*/
|
734
|
-
const getFormattedHour = (hour, use24Hour) => {
|
735
|
-
if (!use24Hour) {
|
736
|
-
return hour.toString();
|
737
|
-
}
|
738
|
-
return addTimePadding(hour);
|
739
|
-
};
|
740
|
-
/**
|
741
|
-
* Generates an aria-label to be read by screen readers
|
742
|
-
* given a local, a date, and whether or not that date is
|
743
|
-
* today's date.
|
744
|
-
*/
|
745
|
-
const generateDayAriaLabel = (locale, today, refParts) => {
|
746
|
-
if (refParts.day === null) {
|
747
|
-
return null;
|
748
|
-
}
|
749
|
-
/**
|
750
|
-
* MM/DD/YYYY will return midnight in the user's timezone.
|
751
|
-
*/
|
752
|
-
const date = new Date(`${refParts.month}/${refParts.day}/${refParts.year} GMT+0000`);
|
753
|
-
const labelString = new Intl.DateTimeFormat(locale, { weekday: 'long', month: 'long', day: 'numeric', timeZone: 'UTC' }).format(date);
|
754
|
-
/**
|
755
|
-
* If date is today, prepend "Today" so screen readers indicate
|
756
|
-
* that the date is today.
|
757
|
-
*/
|
758
|
-
return (today) ? `Today, ${labelString}` : labelString;
|
759
|
-
};
|
760
|
-
/**
|
761
|
-
* Gets the day of the week, month, and day
|
762
|
-
* Used for the header in MD mode.
|
763
|
-
*/
|
764
|
-
const getMonthAndDay = (locale, refParts) => {
|
765
|
-
const date = new Date(`${refParts.month}/${refParts.day}/${refParts.year} GMT+0000`);
|
766
|
-
return new Intl.DateTimeFormat(locale, { weekday: 'short', month: 'short', day: 'numeric', timeZone: 'UTC' }).format(date);
|
767
|
-
};
|
768
|
-
/**
|
769
|
-
* Given a locale and a date object,
|
770
|
-
* return a formatted string that includes
|
771
|
-
* the month name and full year.
|
772
|
-
* Example: May 2021
|
773
|
-
*/
|
774
|
-
const getMonthAndYear = (locale, refParts) => {
|
775
|
-
const date = new Date(`${refParts.month}/${refParts.day}/${refParts.year} GMT+0000`);
|
776
|
-
return new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric', timeZone: 'UTC' }).format(date);
|
777
|
-
};
|
778
|
-
|
779
|
-
/*!
|
780
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
781
|
-
*/
|
782
|
-
const ISO_8601_REGEXP = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;
|
783
|
-
const TIME_REGEXP = /^((\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;
|
784
|
-
/**
|
785
|
-
* Use to convert a string of comma separated numbers or
|
786
|
-
* an array of numbers, and clean up any user input
|
787
|
-
*/
|
788
|
-
const convertToArrayOfNumbers = (input) => {
|
789
|
-
if (input === undefined) {
|
790
|
-
return;
|
791
|
-
}
|
792
|
-
let processedInput = input;
|
793
|
-
if (typeof input === 'string') {
|
794
|
-
// convert the string to an array of strings
|
795
|
-
// auto remove any whitespace and [] characters
|
796
|
-
processedInput = input.replace(/\[|\]|\s/g, '').split(',');
|
797
|
-
}
|
798
|
-
let values;
|
799
|
-
if (Array.isArray(processedInput)) {
|
800
|
-
// ensure each value is an actual number in the returned array
|
801
|
-
values = processedInput
|
802
|
-
.map((num) => parseInt(num, 10))
|
803
|
-
.filter(isFinite);
|
804
|
-
}
|
805
|
-
else {
|
806
|
-
values = [processedInput];
|
807
|
-
}
|
808
|
-
return values;
|
809
|
-
};
|
810
|
-
/**
|
811
|
-
* Extracts date information
|
812
|
-
* from a .calendar-day element
|
813
|
-
* into DatetimeParts.
|
814
|
-
*/
|
815
|
-
const getPartsFromCalendarDay = (el) => {
|
816
|
-
return {
|
817
|
-
month: parseInt(el.getAttribute('data-month'), 10),
|
818
|
-
day: parseInt(el.getAttribute('data-day'), 10),
|
819
|
-
year: parseInt(el.getAttribute('data-year'), 10),
|
820
|
-
dayOfWeek: parseInt(el.getAttribute('data-day-of-week'), 10)
|
821
|
-
};
|
822
|
-
};
|
823
|
-
/**
|
824
|
-
* Given an ISO-8601 string, format out the parts
|
825
|
-
* We do not use the JS Date object here because
|
826
|
-
* it adjusts the date for the current timezone.
|
827
|
-
*/
|
828
|
-
const parseDate = (val) => {
|
829
|
-
// manually parse IS0 cuz Date.parse cannot be trusted
|
830
|
-
// ISO 8601 format: 1994-12-15T13:47:20Z
|
831
|
-
let parse = null;
|
832
|
-
if (val != null && val !== '') {
|
833
|
-
// try parsing for just time first, HH:MM
|
834
|
-
parse = TIME_REGEXP.exec(val);
|
835
|
-
if (parse) {
|
836
|
-
// adjust the array so it fits nicely with the datetime parse
|
837
|
-
parse.unshift(undefined, undefined);
|
838
|
-
parse[2] = parse[3] = undefined;
|
839
|
-
}
|
840
|
-
else {
|
841
|
-
// try parsing for full ISO datetime
|
842
|
-
parse = ISO_8601_REGEXP.exec(val);
|
843
|
-
}
|
844
|
-
}
|
845
|
-
if (parse === null) {
|
846
|
-
// wasn't able to parse the ISO datetime
|
847
|
-
return undefined;
|
848
|
-
}
|
849
|
-
// ensure all the parse values exist with at least 0
|
850
|
-
for (let i = 1; i < 8; i++) {
|
851
|
-
parse[i] = parse[i] !== undefined ? parseInt(parse[i], 10) : undefined;
|
852
|
-
}
|
853
|
-
let tzOffset = 0;
|
854
|
-
if (parse[9] && parse[10]) {
|
855
|
-
// hours
|
856
|
-
tzOffset = parseInt(parse[10], 10) * 60;
|
857
|
-
if (parse[11]) {
|
858
|
-
// minutes
|
859
|
-
tzOffset += parseInt(parse[11], 10);
|
860
|
-
}
|
861
|
-
if (parse[9] === '-') {
|
862
|
-
// + or -
|
863
|
-
tzOffset *= -1;
|
864
|
-
}
|
865
|
-
}
|
866
|
-
return {
|
867
|
-
year: parse[1],
|
868
|
-
month: parse[2],
|
869
|
-
day: parse[3],
|
870
|
-
hour: parse[4],
|
871
|
-
minute: parse[5],
|
872
|
-
second: parse[6],
|
873
|
-
millisecond: parse[7],
|
874
|
-
tzOffset,
|
875
|
-
};
|
876
|
-
};
|
12
|
+
const theme = require('./theme-b0b295c1.js');
|
13
|
+
const parse = require('./parse-d0071120.js');
|
877
14
|
|
878
15
|
/*!
|
879
16
|
* (C) Ionic http://ionicframework.com - MIT License
|
@@ -919,7 +56,7 @@ const isDayDisabled = (refParts, minParts, maxParts, dayValues) => {
|
|
919
56
|
* current month === min allow month, but the current
|
920
57
|
* day < the min allowed day?
|
921
58
|
*/
|
922
|
-
if (minParts && isBefore(refParts, minParts)) {
|
59
|
+
if (minParts && parse.isBefore(refParts, minParts)) {
|
923
60
|
return true;
|
924
61
|
}
|
925
62
|
/**
|
@@ -933,7 +70,7 @@ const isDayDisabled = (refParts, minParts, maxParts, dayValues) => {
|
|
933
70
|
* current month === max allow month, but the current
|
934
71
|
* day > the max allowed day?
|
935
72
|
*/
|
936
|
-
if (maxParts && isAfter(refParts, maxParts)) {
|
73
|
+
if (maxParts && parse.isAfter(refParts, maxParts)) {
|
937
74
|
return true;
|
938
75
|
}
|
939
76
|
/**
|
@@ -944,33 +81,49 @@ const isDayDisabled = (refParts, minParts, maxParts, dayValues) => {
|
|
944
81
|
return false;
|
945
82
|
};
|
946
83
|
/**
|
947
|
-
* Given a locale, a date, the selected date, and today's date,
|
84
|
+
* Given a locale, a date, the selected date(s), and today's date,
|
948
85
|
* generate the state for a given calendar day button.
|
949
86
|
*/
|
950
87
|
const getCalendarDayState = (locale, refParts, activeParts, todayParts, minParts, maxParts, dayValues) => {
|
951
|
-
|
952
|
-
|
88
|
+
/**
|
89
|
+
* activeParts signals what day(s) are currently selected in the datetime.
|
90
|
+
* If multiple="true", this will be an array, but the logic in this util
|
91
|
+
* is the same whether we have one selected day or many because we're only
|
92
|
+
* calculating the state for one button. So, we treat a single activeParts value
|
93
|
+
* the same as an array of length one.
|
94
|
+
*/
|
95
|
+
const activePartsArray = Array.isArray(activeParts) ? activeParts : [activeParts];
|
96
|
+
/**
|
97
|
+
* The day button is active if it is selected, or in other words, if refParts
|
98
|
+
* matches at least one selected date.
|
99
|
+
*/
|
100
|
+
const isActive = activePartsArray.find((parts) => parse.isSameDay(refParts, parts)) !== undefined;
|
101
|
+
const isToday = parse.isSameDay(refParts, todayParts);
|
953
102
|
const disabled = isDayDisabled(refParts, minParts, maxParts, dayValues);
|
103
|
+
/**
|
104
|
+
* Note that we always return one object regardless of whether activeParts
|
105
|
+
* was an array, since we pare down to one value for isActive.
|
106
|
+
*/
|
954
107
|
return {
|
955
108
|
disabled,
|
956
109
|
isActive,
|
957
110
|
isToday,
|
958
111
|
ariaSelected: isActive ? 'true' : null,
|
959
|
-
ariaLabel: generateDayAriaLabel(locale, isToday, refParts)
|
112
|
+
ariaLabel: parse.generateDayAriaLabel(locale, isToday, refParts),
|
960
113
|
};
|
961
114
|
};
|
962
115
|
/**
|
963
116
|
* Returns `true` if the month is disabled given the
|
964
117
|
* current date value and min/max date constraints.
|
965
118
|
*/
|
966
|
-
const isMonthDisabled = (refParts, { minParts, maxParts }) => {
|
119
|
+
const isMonthDisabled = (refParts, { minParts, maxParts, }) => {
|
967
120
|
// If the year is disabled then the month is disabled.
|
968
121
|
if (isYearDisabled(refParts.year, minParts, maxParts)) {
|
969
122
|
return true;
|
970
123
|
}
|
971
124
|
// If the date value is before the min date, then the month is disabled.
|
972
125
|
// If the date value is after the max date, then the month is disabled.
|
973
|
-
if (minParts && isBefore(refParts, minParts) || maxParts && isAfter(refParts, maxParts)) {
|
126
|
+
if ((minParts && parse.isBefore(refParts, minParts)) || (maxParts && parse.isAfter(refParts, maxParts))) {
|
974
127
|
return true;
|
975
128
|
}
|
976
129
|
return false;
|
@@ -981,10 +134,10 @@ const isMonthDisabled = (refParts, { minParts, maxParts }) => {
|
|
981
134
|
* previous navigation button is disabled.
|
982
135
|
*/
|
983
136
|
const isPrevMonthDisabled = (refParts, minParts, maxParts) => {
|
984
|
-
const prevMonth = getPreviousMonth(refParts);
|
137
|
+
const prevMonth = Object.assign(Object.assign({}, parse.getPreviousMonth(refParts)), { day: null });
|
985
138
|
return isMonthDisabled(prevMonth, {
|
986
139
|
minParts,
|
987
|
-
maxParts
|
140
|
+
maxParts,
|
988
141
|
});
|
989
142
|
};
|
990
143
|
/**
|
@@ -992,15 +145,15 @@ const isPrevMonthDisabled = (refParts, minParts, maxParts) => {
|
|
992
145
|
* determine if the next navigation button is disabled.
|
993
146
|
*/
|
994
147
|
const isNextMonthDisabled = (refParts, maxParts) => {
|
995
|
-
const nextMonth = getNextMonth(refParts);
|
148
|
+
const nextMonth = Object.assign(Object.assign({}, parse.getNextMonth(refParts)), { day: null });
|
996
149
|
return isMonthDisabled(nextMonth, {
|
997
|
-
maxParts
|
150
|
+
maxParts,
|
998
151
|
});
|
999
152
|
};
|
1000
153
|
|
1001
|
-
const datetimeIosCss = ":host{display:flex;flex-flow:column;background:var(--background);overflow:hidden}:host(.datetime-size-fixed){width:auto;max-width:350px;
|
154
|
+
const datetimeIosCss = ":host{display:flex;flex-flow:column;background:var(--background);overflow:hidden}ion-picker-column-internal{min-width:26px}:host(.datetime-size-fixed){width:auto;height:auto}:host(.datetime-size-fixed:not(.datetime-prefer-wheel)){max-width:350px}:host(.datetime-size-fixed.datetime-prefer-wheel){min-width:350px;max-width:max-content}:host(.datetime-size-cover){width:100%}:host .calendar-body,:host .datetime-year{opacity:0}:host(:not(.datetime-ready)) .datetime-year{position:absolute;pointer-events:none}:host(.datetime-ready) .calendar-body{opacity:1}:host(.datetime-ready) .datetime-year{display:none;opacity:1}:host .wheel-order-year-first .day-column{order:3;text-align:end}:host .wheel-order-year-first .month-column{order:2;text-align:end}:host .wheel-order-year-first .year-column{order:1;text-align:start}:host .datetime-calendar,:host .datetime-year{display:flex;flex:1 1 auto;flex-flow:column}:host(.show-month-and-year) .datetime-year{display:flex}@supports (background: -webkit-named-image(apple-pay-logo-black)) and (not (aspect-ratio: 1/1)){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{left:-99999px;position:absolute;visibility:hidden;pointer-events:none}:host-context([dir=rtl]):host(.show-month-and-year) .calendar-next-prev,:host-context([dir=rtl]).show-month-and-year .calendar-next-prev,:host-context([dir=rtl]):host(.show-month-and-year) .calendar-days-of-week,:host-context([dir=rtl]).show-month-and-year .calendar-days-of-week,:host-context([dir=rtl]):host(.show-month-and-year) .calendar-body,:host-context([dir=rtl]).show-month-and-year .calendar-body,:host-context([dir=rtl]):host(.show-month-and-year) .datetime-time,:host-context([dir=rtl]).show-month-and-year .datetime-time{left:unset;right:unset;right:-99999px}}@supports (not (background: -webkit-named-image(apple-pay-logo-black))) or ((background: -webkit-named-image(apple-pay-logo-black)) and (aspect-ratio: 1/1)){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{display:none}}:host(.month-year-picker-open) .datetime-footer{display:none}:host(.datetime-readonly),:host(.datetime-disabled){pointer-events:none}:host(.datetime-disabled){opacity:0.4}:host .datetime-header .datetime-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host .datetime-action-buttons.has-clear-button{width:100%}:host .datetime-action-buttons ion-buttons{display:flex;justify-content:space-between}:host .calendar-action-buttons{display:flex;justify-content:space-between}:host .calendar-action-buttons ion-item,:host .calendar-action-buttons ion-button{--background:translucent}:host .calendar-action-buttons ion-item ion-label{display:flex;align-items:center}:host .calendar-action-buttons ion-item ion-icon{padding-left:4px;padding-right:0;padding-top:0;padding-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-action-buttons ion-item ion-icon{padding-left:unset;padding-right:unset;-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0}}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}:host .calendar-body{display:flex;flex-grow:1;scroll-snap-type:x mandatory;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;outline:none}:host .calendar-body .calendar-month{scroll-snap-align:start;scroll-snap-stop:always;flex-shrink:0;width:100%}:host .calendar-body .calendar-month-disabled{scroll-snap-align:none}:host .calendar-body::-webkit-scrollbar{display:none}:host .calendar-body .calendar-month-grid{display:grid;grid-template-columns:repeat(7, 1fr);height:100%}:host .calendar-day{padding-left:0px;padding-right:0px;padding-top:0px;padding-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;margin-bottom:0px;display:flex;position:relative;align-items:center;justify-content:center;border:none;outline:none;background:none;color:currentColor;cursor:pointer;appearance:none;z-index:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-day{padding-left:unset;padding-right:unset;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px}}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-day{margin-left:unset;margin-right:unset;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px}}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}:host .calendar-day:after{border-radius:32px;padding-left:4px;padding-right:4px;padding-top:4px;padding-bottom:4px;position:absolute;top:50%;left:50%;width:32px;height:32px;transform:translate(-50%, -50%);content:\" \";z-index:-1}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-day:after{padding-left:unset;padding-right:unset;-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px}}:host .datetime-time{display:flex;justify-content:space-between}:host(.datetime-presentation-time) .datetime-time{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host ion-popover{--height:200px}:host .time-header{display:flex;align-items:center}:host .time-body{border-radius:8px;padding-left:12px;padding-right:12px;padding-top:6px;padding-bottom:6px;display:flex;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;appearance:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .time-body{padding-left:unset;padding-right:unset;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px}}:host .time-body-active{color:var(--ion-color-base)}:host(.in-item){position:static}:host(.show-month-and-year) .calendar-action-buttons ion-item{--color:var(--ion-color-base)}:host{--background:var(--ion-color-light, #ffffff);--background-rgb:var(--ion-color-light-rgb);--title-color:var(--ion-color-step-600, #666666)}:host(.datetime-presentation-date-time:not(.datetime-prefer-wheel)),:host(.datetime-presentation-time-date:not(.datetime-prefer-wheel)),:host(.datetime-presentation-date:not(.datetime-prefer-wheel)){min-height:350px}:host .datetime-header{padding-left:16px;padding-right:16px;padding-top:16px;padding-bottom:16px;border-bottom:0.55px solid var(--ion-color-step-200, #cccccc)}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .datetime-header{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}:host .datetime-header .datetime-title{color:var(--title-color);font-size:14px}:host .calendar-action-buttons ion-item{--padding-start:16px;--background-hover:transparent;--background-activated:transparent;font-size:16px;font-weight:600}:host .calendar-action-buttons ion-item ion-icon,:host .calendar-action-buttons ion-buttons ion-button{color:var(--ion-color-base)}:host .calendar-action-buttons ion-buttons{padding-left:0;padding-right:0;padding-top:8px;padding-bottom:0}:host .calendar-action-buttons ion-buttons ion-button{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}:host .calendar-days-of-week{padding-left:8px;padding-right:8px;padding-top:0;padding-bottom:0;color:var(--ion-color-step-300, #b3b3b3);font-size:12px;font-weight:600;line-height:24px;text-transform:uppercase}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-days-of-week{padding-left:unset;padding-right:unset;-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px}}:host .calendar-body .calendar-month .calendar-month-grid{padding-left:8px;padding-right:8px;padding-top:8px;padding-bottom:8px;height:calc(100% - 16px)}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-body .calendar-month .calendar-month-grid{padding-left:unset;padding-right:unset;-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px}}:host .calendar-day{font-size:20px}:host .calendar-day:after{opacity:0.2}:host .calendar-day:focus:after{background:var(--ion-color-base)}:host .calendar-day.calendar-day-today{color:var(--ion-color-base)}:host .calendar-day.calendar-day-active{color:var(--ion-color-base);font-weight:600}:host .calendar-day.calendar-day-active:after{background:var(--ion-color-base)}:host .calendar-day.calendar-day-today.calendar-day-active{color:var(--ion-color-contrast)}:host .calendar-day.calendar-day-today.calendar-day-active:after{background:var(--ion-color-base);opacity:1}:host .datetime-time{padding-left:16px;padding-right:16px;padding-top:8px;padding-bottom:16px;font-size:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .datetime-time{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}:host .datetime-time .time-header{font-weight:600}:host .datetime-buttons{padding-left:8px;padding-right:8px;padding-top:8px;padding-bottom:8px;border-top:0.55px solid var(--ion-color-step-200, #cccccc)}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .datetime-buttons{padding-left:unset;padding-right:unset;-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px}}:host .datetime-buttons ::slotted(ion-buttons),:host .datetime-buttons ion-buttons{display:flex;align-items:center;justify-content:space-between}:host .datetime-action-buttons{width:100%}";
|
1002
155
|
|
1003
|
-
const datetimeMdCss = ":host{display:flex;flex-flow:column;background:var(--background);overflow:hidden}:host(.datetime-size-fixed){width:auto;max-width:350px;
|
156
|
+
const datetimeMdCss = ":host{display:flex;flex-flow:column;background:var(--background);overflow:hidden}ion-picker-column-internal{min-width:26px}:host(.datetime-size-fixed){width:auto;height:auto}:host(.datetime-size-fixed:not(.datetime-prefer-wheel)){max-width:350px}:host(.datetime-size-fixed.datetime-prefer-wheel){min-width:350px;max-width:max-content}:host(.datetime-size-cover){width:100%}:host .calendar-body,:host .datetime-year{opacity:0}:host(:not(.datetime-ready)) .datetime-year{position:absolute;pointer-events:none}:host(.datetime-ready) .calendar-body{opacity:1}:host(.datetime-ready) .datetime-year{display:none;opacity:1}:host .wheel-order-year-first .day-column{order:3;text-align:end}:host .wheel-order-year-first .month-column{order:2;text-align:end}:host .wheel-order-year-first .year-column{order:1;text-align:start}:host .datetime-calendar,:host .datetime-year{display:flex;flex:1 1 auto;flex-flow:column}:host(.show-month-and-year) .datetime-year{display:flex}@supports (background: -webkit-named-image(apple-pay-logo-black)) and (not (aspect-ratio: 1/1)){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{left:-99999px;position:absolute;visibility:hidden;pointer-events:none}:host-context([dir=rtl]):host(.show-month-and-year) .calendar-next-prev,:host-context([dir=rtl]).show-month-and-year .calendar-next-prev,:host-context([dir=rtl]):host(.show-month-and-year) .calendar-days-of-week,:host-context([dir=rtl]).show-month-and-year .calendar-days-of-week,:host-context([dir=rtl]):host(.show-month-and-year) .calendar-body,:host-context([dir=rtl]).show-month-and-year .calendar-body,:host-context([dir=rtl]):host(.show-month-and-year) .datetime-time,:host-context([dir=rtl]).show-month-and-year .datetime-time{left:unset;right:unset;right:-99999px}}@supports (not (background: -webkit-named-image(apple-pay-logo-black))) or ((background: -webkit-named-image(apple-pay-logo-black)) and (aspect-ratio: 1/1)){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{display:none}}:host(.month-year-picker-open) .datetime-footer{display:none}:host(.datetime-readonly),:host(.datetime-disabled){pointer-events:none}:host(.datetime-disabled){opacity:0.4}:host .datetime-header .datetime-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host .datetime-action-buttons.has-clear-button{width:100%}:host .datetime-action-buttons ion-buttons{display:flex;justify-content:space-between}:host .calendar-action-buttons{display:flex;justify-content:space-between}:host .calendar-action-buttons ion-item,:host .calendar-action-buttons ion-button{--background:translucent}:host .calendar-action-buttons ion-item ion-label{display:flex;align-items:center}:host .calendar-action-buttons ion-item ion-icon{padding-left:4px;padding-right:0;padding-top:0;padding-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-action-buttons ion-item ion-icon{padding-left:unset;padding-right:unset;-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0}}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}:host .calendar-body{display:flex;flex-grow:1;scroll-snap-type:x mandatory;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;outline:none}:host .calendar-body .calendar-month{scroll-snap-align:start;scroll-snap-stop:always;flex-shrink:0;width:100%}:host .calendar-body .calendar-month-disabled{scroll-snap-align:none}:host .calendar-body::-webkit-scrollbar{display:none}:host .calendar-body .calendar-month-grid{display:grid;grid-template-columns:repeat(7, 1fr);height:100%}:host .calendar-day{padding-left:0px;padding-right:0px;padding-top:0px;padding-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;margin-bottom:0px;display:flex;position:relative;align-items:center;justify-content:center;border:none;outline:none;background:none;color:currentColor;cursor:pointer;appearance:none;z-index:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-day{padding-left:unset;padding-right:unset;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px}}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-day{margin-left:unset;margin-right:unset;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px}}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}:host .calendar-day:after{border-radius:32px;padding-left:4px;padding-right:4px;padding-top:4px;padding-bottom:4px;position:absolute;top:50%;left:50%;width:32px;height:32px;transform:translate(-50%, -50%);content:\" \";z-index:-1}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-day:after{padding-left:unset;padding-right:unset;-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px}}:host .datetime-time{display:flex;justify-content:space-between}:host(.datetime-presentation-time) .datetime-time{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host ion-popover{--height:200px}:host .time-header{display:flex;align-items:center}:host .time-body{border-radius:8px;padding-left:12px;padding-right:12px;padding-top:6px;padding-bottom:6px;display:flex;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;appearance:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .time-body{padding-left:unset;padding-right:unset;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px}}:host .time-body-active{color:var(--ion-color-base)}:host(.in-item){position:static}:host(.show-month-and-year) .calendar-action-buttons ion-item{--color:var(--ion-color-base)}:host{--background:var(--ion-color-step-100, #ffffff);--title-color:var(--ion-color-contrast)}:host .datetime-header{padding-left:20px;padding-right:20px;padding-top:20px;padding-bottom:20px;background:var(--ion-color-base);color:var(--title-color)}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .datetime-header{padding-left:unset;padding-right:unset;-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px}}:host .datetime-header .datetime-title{font-size:12px;text-transform:uppercase}:host .datetime-header .datetime-selected-date{margin-top:30px;font-size:34px}:host .datetime-calendar .calendar-action-buttons ion-item{--padding-start:20px}:host .calendar-action-buttons ion-item,:host .calendar-action-buttons ion-button{color:var(--ion-color-step-650, #595959)}:host .calendar-days-of-week{padding-left:10px;padding-right:10px;padding-top:0px;padding-bottom:0px;color:var(--ion-color-step-500, gray);font-size:14px;line-height:36px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-days-of-week{padding-left:unset;padding-right:unset;-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px}}:host .calendar-body .calendar-month .calendar-month-grid{padding-left:10px;padding-right:10px;padding-top:3px;padding-bottom:0px;grid-template-rows:repeat(6, 1fr)}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-body .calendar-month .calendar-month-grid{padding-left:unset;padding-right:unset;-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px}}:host .calendar-day{padding-left:0px;padding-right:0;padding-top:13px;padding-bottom:13px;font-size:14px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .calendar-day{padding-left:unset;padding-right:unset;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0;padding-inline-end:0}}:host .calendar-day:focus:after{background:rgba(var(--ion-color-base-rgb), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2)}:host .calendar-day.calendar-day-today{color:var(--ion-color-base)}:host .calendar-day.calendar-day-today:after{border:1px solid var(--ion-color-base)}:host .calendar-day.calendar-day-active{color:var(--ion-color-contrast)}:host .calendar-day.calendar-day-active:after{border:1px solid var(--ion-color-base);background:var(--ion-color-base)}:host .datetime-time{padding-left:16px;padding-right:16px;padding-top:8px;padding-bottom:8px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .datetime-time{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}:host .time-header{color:var(--ion-color-step-650, #595959)}:host(.datetime-presentation-month) .datetime-year,:host(.datetime-presentation-year) .datetime-year,:host(.datetime-presentation-month-year) .datetime-year{margin-top:20px;margin-bottom:20px}:host .datetime-buttons{padding-left:10px;padding-right:10px;padding-top:10px;padding-bottom:10px;display:flex;align-items:center;justify-content:flex-end}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host .datetime-buttons{padding-left:unset;padding-right:unset;-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px}}:host .datetime-view-buttons ion-button{color:var(--ion-color-step-800, #333333)}";
|
1004
157
|
|
1005
158
|
const Datetime = class {
|
1006
159
|
constructor(hostRef) {
|
@@ -1010,9 +163,18 @@ const Datetime = class {
|
|
1010
163
|
this.ionFocus = index.createEvent(this, "ionFocus", 7);
|
1011
164
|
this.ionBlur = index.createEvent(this, "ionBlur", 7);
|
1012
165
|
this.ionStyle = index.createEvent(this, "ionStyle", 7);
|
166
|
+
this.ionRender = index.createEvent(this, "ionRender", 7);
|
1013
167
|
this.inputId = `ion-dt-${datetimeIds++}`;
|
1014
|
-
|
1015
|
-
|
168
|
+
/**
|
169
|
+
* Whether to highlight the active day with a solid circle (as opposed
|
170
|
+
* to the outline circle around today). If you don't specify an initial
|
171
|
+
* value for the datetime, it doesn't automatically init to a default to
|
172
|
+
* avoid unwanted change events firing. If the solid circle were still
|
173
|
+
* shown then, it would look like a date had already been selected, which
|
174
|
+
* is misleading UX.
|
175
|
+
*/
|
176
|
+
this.highlightActiveParts = false;
|
177
|
+
this.todayParts = parse.parseDate(parse.getToday());
|
1016
178
|
this.prevPresentation = null;
|
1017
179
|
this.showMonthAndYear = false;
|
1018
180
|
this.activeParts = {
|
@@ -1021,7 +183,7 @@ const Datetime = class {
|
|
1021
183
|
year: 2021,
|
1022
184
|
hour: 13,
|
1023
185
|
minute: 52,
|
1024
|
-
ampm: 'pm'
|
186
|
+
ampm: 'pm',
|
1025
187
|
};
|
1026
188
|
this.workingParts = {
|
1027
189
|
month: 5,
|
@@ -1029,7 +191,7 @@ const Datetime = class {
|
|
1029
191
|
year: 2021,
|
1030
192
|
hour: 13,
|
1031
193
|
minute: 52,
|
1032
|
-
ampm: 'pm'
|
194
|
+
ampm: 'pm',
|
1033
195
|
};
|
1034
196
|
this.isPresented = false;
|
1035
197
|
this.isTimePopoverOpen = false;
|
@@ -1083,6 +245,11 @@ const Datetime = class {
|
|
1083
245
|
* default value is `0` and represents Sunday.
|
1084
246
|
*/
|
1085
247
|
this.firstDayOfWeek = 0;
|
248
|
+
/**
|
249
|
+
* If `true`, multiple dates can be selected at once. Only
|
250
|
+
* applies to `presentation="date"` and `preferWheel="false"`.
|
251
|
+
*/
|
252
|
+
this.multiple = false;
|
1086
253
|
/**
|
1087
254
|
* If `true`, a header will be shown above the calendar
|
1088
255
|
* picker. On `ios` mode this will include the
|
@@ -1122,6 +289,19 @@ const Datetime = class {
|
|
1122
289
|
* If `fixed`, the `ion-datetime` will have a fixed width.
|
1123
290
|
*/
|
1124
291
|
this.size = 'fixed';
|
292
|
+
/**
|
293
|
+
* If `true`, a wheel picker will be rendered instead of a calendar grid
|
294
|
+
* where possible. If `false`, a calendar grid will be rendered instead of
|
295
|
+
* a wheel picker where possible.
|
296
|
+
*
|
297
|
+
* A wheel picker can be rendered instead of a grid when `presentation` is
|
298
|
+
* one of the following values: `'date'`, `'date-time'`, or `'time-date'`.
|
299
|
+
*
|
300
|
+
* A wheel picker will always be rendered regardless of
|
301
|
+
* the `preferWheel` value when `presentation` is one of the following values:
|
302
|
+
* `'time'`, `'month'`, `'month-year'`, or `'year'`.
|
303
|
+
*/
|
304
|
+
this.preferWheel = false;
|
1125
305
|
this.closeParentOverlay = () => {
|
1126
306
|
const popoverOrModal = this.el.closest('ion-modal, ion-popover');
|
1127
307
|
if (popoverOrModal) {
|
@@ -1131,8 +311,48 @@ const Datetime = class {
|
|
1131
311
|
this.setWorkingParts = (parts) => {
|
1132
312
|
this.workingParts = Object.assign({}, parts);
|
1133
313
|
};
|
1134
|
-
this.setActiveParts = (parts) => {
|
1135
|
-
|
314
|
+
this.setActiveParts = (parts, removeDate = false) => {
|
315
|
+
const { multiple, activePartsClone, highlightActiveParts } = this;
|
316
|
+
if (multiple) {
|
317
|
+
/**
|
318
|
+
* We read from activePartsClone here because valueChanged() only updates that,
|
319
|
+
* so it's the more reliable source of truth. If we read from activeParts, then
|
320
|
+
* if you click July 1, manually set the value to July 2, and then click July 3,
|
321
|
+
* the new value would be [July 1, July 3], ignoring the value set.
|
322
|
+
*
|
323
|
+
* We can then pass the new value to activeParts (rather than activePartsClone)
|
324
|
+
* since the clone will be updated automatically by activePartsChanged().
|
325
|
+
*/
|
326
|
+
const activePartsArray = Array.isArray(activePartsClone) ? activePartsClone : [activePartsClone];
|
327
|
+
if (removeDate) {
|
328
|
+
this.activeParts = activePartsArray.filter((p) => !parse.isSameDay(p, parts));
|
329
|
+
}
|
330
|
+
else if (highlightActiveParts) {
|
331
|
+
this.activeParts = [...activePartsArray, parts];
|
332
|
+
}
|
333
|
+
else {
|
334
|
+
/**
|
335
|
+
* If highlightActiveParts is false, that means we just have a
|
336
|
+
* default value of today in activeParts; we need to replace that
|
337
|
+
* rather than adding to it since it's just a placeholder.
|
338
|
+
*/
|
339
|
+
this.activeParts = [parts];
|
340
|
+
}
|
341
|
+
}
|
342
|
+
else {
|
343
|
+
this.activeParts = Object.assign({}, parts);
|
344
|
+
}
|
345
|
+
/**
|
346
|
+
* Now that the user has interacted somehow to select something, we can
|
347
|
+
* show the solid highlight. This needs to be done after checking it above,
|
348
|
+
* but before the confirm call below.
|
349
|
+
*
|
350
|
+
* Note that for datetimes with confirm/cancel buttons, the value
|
351
|
+
* isn't updated until you call confirm(). We need to bring the
|
352
|
+
* solid circle back on day click for UX reasons, rather than only
|
353
|
+
* show the circle if `value` is truthy.
|
354
|
+
*/
|
355
|
+
this.highlightActiveParts = true;
|
1136
356
|
const hasSlottedButtons = this.el.querySelector('[slot="buttons"]') !== null;
|
1137
357
|
if (hasSlottedButtons || this.showDefaultButtons) {
|
1138
358
|
return;
|
@@ -1175,8 +395,7 @@ const Datetime = class {
|
|
1175
395
|
* if not currently focused, we should not re-focus
|
1176
396
|
* the inner day.
|
1177
397
|
*/
|
1178
|
-
if (((_a = record.oldValue) === null || _a === void 0 ? void 0 : _a.includes('ion-focused')) ||
|
1179
|
-
!calendarBodyRef.classList.contains('ion-focused')) {
|
398
|
+
if (((_a = record.oldValue) === null || _a === void 0 ? void 0 : _a.includes('ion-focused')) || !calendarBodyRef.classList.contains('ion-focused')) {
|
1180
399
|
return;
|
1181
400
|
}
|
1182
401
|
this.focusWorkingDay(currentMonth);
|
@@ -1195,40 +414,40 @@ const Datetime = class {
|
|
1195
414
|
if (!activeElement || !activeElement.classList.contains('calendar-day')) {
|
1196
415
|
return;
|
1197
416
|
}
|
1198
|
-
const parts = getPartsFromCalendarDay(activeElement);
|
417
|
+
const parts = parse.getPartsFromCalendarDay(activeElement);
|
1199
418
|
let partsToFocus;
|
1200
419
|
switch (ev.key) {
|
1201
420
|
case 'ArrowDown':
|
1202
421
|
ev.preventDefault();
|
1203
|
-
partsToFocus = getNextWeek(parts);
|
422
|
+
partsToFocus = parse.getNextWeek(parts);
|
1204
423
|
break;
|
1205
424
|
case 'ArrowUp':
|
1206
425
|
ev.preventDefault();
|
1207
|
-
partsToFocus = getPreviousWeek(parts);
|
426
|
+
partsToFocus = parse.getPreviousWeek(parts);
|
1208
427
|
break;
|
1209
428
|
case 'ArrowRight':
|
1210
429
|
ev.preventDefault();
|
1211
|
-
partsToFocus = getNextDay(parts);
|
430
|
+
partsToFocus = parse.getNextDay(parts);
|
1212
431
|
break;
|
1213
432
|
case 'ArrowLeft':
|
1214
433
|
ev.preventDefault();
|
1215
|
-
partsToFocus = getPreviousDay(parts);
|
434
|
+
partsToFocus = parse.getPreviousDay(parts);
|
1216
435
|
break;
|
1217
436
|
case 'Home':
|
1218
437
|
ev.preventDefault();
|
1219
|
-
partsToFocus = getStartOfWeek(parts);
|
438
|
+
partsToFocus = parse.getStartOfWeek(parts);
|
1220
439
|
break;
|
1221
440
|
case 'End':
|
1222
441
|
ev.preventDefault();
|
1223
|
-
partsToFocus = getEndOfWeek(parts);
|
442
|
+
partsToFocus = parse.getEndOfWeek(parts);
|
1224
443
|
break;
|
1225
444
|
case 'PageUp':
|
1226
445
|
ev.preventDefault();
|
1227
|
-
partsToFocus = ev.shiftKey ? getPreviousYear(parts) : getPreviousMonth(parts);
|
446
|
+
partsToFocus = ev.shiftKey ? parse.getPreviousYear(parts) : parse.getPreviousMonth(parts);
|
1228
447
|
break;
|
1229
448
|
case 'PageDown':
|
1230
449
|
ev.preventDefault();
|
1231
|
-
partsToFocus = ev.shiftKey ? getNextYear(parts) : getNextMonth(parts);
|
450
|
+
partsToFocus = ev.shiftKey ? parse.getNextYear(parts) : parse.getNextMonth(parts);
|
1232
451
|
break;
|
1233
452
|
/**
|
1234
453
|
* Do not preventDefault here
|
@@ -1279,13 +498,13 @@ const Datetime = class {
|
|
1279
498
|
this.minParts = undefined;
|
1280
499
|
return;
|
1281
500
|
}
|
1282
|
-
const { month, day, year, hour, minute } = parseDate(this.min);
|
501
|
+
const { month, day, year, hour, minute } = parse.parseDate(this.min);
|
1283
502
|
this.minParts = {
|
1284
503
|
month,
|
1285
504
|
day,
|
1286
505
|
year,
|
1287
506
|
hour,
|
1288
|
-
minute
|
507
|
+
minute,
|
1289
508
|
};
|
1290
509
|
};
|
1291
510
|
this.processMaxParts = () => {
|
@@ -1293,27 +512,25 @@ const Datetime = class {
|
|
1293
512
|
this.maxParts = undefined;
|
1294
513
|
return;
|
1295
514
|
}
|
1296
|
-
const { month, day, year, hour, minute } = parseDate(this.max);
|
515
|
+
const { month, day, year, hour, minute } = parse.parseDate(this.max);
|
1297
516
|
this.maxParts = {
|
1298
517
|
month,
|
1299
518
|
day,
|
1300
519
|
year,
|
1301
520
|
hour,
|
1302
|
-
minute
|
521
|
+
minute,
|
1303
522
|
};
|
1304
523
|
};
|
1305
|
-
this.
|
524
|
+
this.initializeCalendarListener = () => {
|
1306
525
|
const calendarBodyRef = this.getCalendarBodyEl();
|
1307
526
|
if (!calendarBodyRef) {
|
1308
527
|
return;
|
1309
528
|
}
|
1310
|
-
const mode = ionicGlobal.getIonMode(this);
|
1311
529
|
/**
|
1312
530
|
* For performance reasons, we only render 3
|
1313
531
|
* months at a time: The current month, the previous
|
1314
|
-
* month, and the next month. We have
|
1315
|
-
* on the
|
1316
|
-
* new months.
|
532
|
+
* month, and the next month. We have a scroll listener
|
533
|
+
* on the calendar body to append/prepend new months.
|
1317
534
|
*
|
1318
535
|
* We can do this because Stencil is smart enough to not
|
1319
536
|
* re-create the .calendar-month containers, but rather
|
@@ -1328,61 +545,80 @@ const Datetime = class {
|
|
1328
545
|
const startMonth = months[0];
|
1329
546
|
const workingMonth = months[1];
|
1330
547
|
const endMonth = months[2];
|
548
|
+
const mode = ionicGlobal.getIonMode(this);
|
549
|
+
const needsiOSRubberBandFix = mode === 'ios' && typeof navigator !== 'undefined' && navigator.maxTouchPoints > 1;
|
1331
550
|
/**
|
1332
|
-
* Before setting up the
|
551
|
+
* Before setting up the scroll listener,
|
1333
552
|
* scroll the middle month into view.
|
1334
553
|
* scrollIntoView() will scroll entire page
|
1335
554
|
* if element is not in viewport. Use scrollLeft instead.
|
1336
555
|
*/
|
1337
556
|
index.writeTask(() => {
|
1338
557
|
calendarBodyRef.scrollLeft = startMonth.clientWidth * (dir.isRTL(this.el) ? -1 : 1);
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
558
|
+
const getChangedMonth = (parts) => {
|
559
|
+
const box = calendarBodyRef.getBoundingClientRect();
|
560
|
+
const root = this.el.shadowRoot;
|
561
|
+
/**
|
562
|
+
* Get the element that is in the center of the calendar body.
|
563
|
+
* This will be an element inside of the active month.
|
564
|
+
*/
|
565
|
+
const elementAtCenter = root.elementFromPoint(box.x + box.width / 2, box.y + box.height / 2);
|
1345
566
|
/**
|
1346
|
-
* If
|
567
|
+
* If there is no element then the
|
568
|
+
* component may be re-rendering on a slow device.
|
1347
569
|
*/
|
1348
|
-
|
1349
|
-
|
570
|
+
if (!elementAtCenter)
|
571
|
+
return;
|
572
|
+
const month = elementAtCenter.closest('.calendar-month');
|
573
|
+
if (!month)
|
1350
574
|
return;
|
1351
|
-
}
|
1352
575
|
/**
|
1353
|
-
*
|
1354
|
-
*
|
1355
|
-
* the
|
1356
|
-
*
|
1357
|
-
*
|
576
|
+
* The edge of the month must be lined up with
|
577
|
+
* the edge of the calendar body in order for
|
578
|
+
* the component to update. Otherwise, it
|
579
|
+
* may be the case that the user has paused their
|
580
|
+
* swipe or the browser has not finished snapping yet.
|
581
|
+
* Rather than check if the x values are equal,
|
582
|
+
* we give it a tolerance of 2px to account for
|
583
|
+
* sub pixel rendering.
|
1358
584
|
*/
|
1359
|
-
|
1360
|
-
|
585
|
+
const monthBox = month.getBoundingClientRect();
|
586
|
+
if (Math.abs(monthBox.x - box.x) > 2)
|
1361
587
|
return;
|
588
|
+
/**
|
589
|
+
* From here, we can determine if the start
|
590
|
+
* month or the end month was scrolled into view.
|
591
|
+
* If no month was changed, then we can return from
|
592
|
+
* the scroll callback early.
|
593
|
+
*/
|
594
|
+
if (month === startMonth) {
|
595
|
+
return parse.getPreviousMonth(parts);
|
1362
596
|
}
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
})) {
|
597
|
+
else if (month === endMonth) {
|
598
|
+
return parse.getNextMonth(parts);
|
599
|
+
}
|
600
|
+
else {
|
1368
601
|
return;
|
1369
602
|
}
|
603
|
+
};
|
604
|
+
const updateActiveMonth = () => {
|
605
|
+
if (needsiOSRubberBandFix) {
|
606
|
+
calendarBodyRef.style.removeProperty('pointer-events');
|
607
|
+
appliediOSRubberBandFix = false;
|
608
|
+
}
|
1370
609
|
/**
|
1371
|
-
*
|
1372
|
-
*
|
1373
|
-
* so that they cannot quickly swipe while
|
1374
|
-
* the scrollable container is snapping.
|
1375
|
-
* Updating the container while snapping
|
1376
|
-
* causes WebKit to snap incorrectly.
|
610
|
+
* If the month did not change
|
611
|
+
* then we can return early.
|
1377
612
|
*/
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
613
|
+
const newDate = getChangedMonth(this.workingParts);
|
614
|
+
if (!newDate)
|
615
|
+
return;
|
616
|
+
const { month, day, year } = newDate;
|
617
|
+
if (isMonthDisabled({ month, year, day: null }, {
|
618
|
+
minParts: Object.assign(Object.assign({}, this.minParts), { day: null }),
|
619
|
+
maxParts: Object.assign(Object.assign({}, this.maxParts), { day: null }),
|
620
|
+
})) {
|
621
|
+
return;
|
1386
622
|
}
|
1387
623
|
/**
|
1388
624
|
* Prevent scrolling for other browsers
|
@@ -1390,15 +626,6 @@ const Datetime = class {
|
|
1390
626
|
* time to properly snap.
|
1391
627
|
*/
|
1392
628
|
calendarBodyRef.style.setProperty('overflow', 'hidden');
|
1393
|
-
/**
|
1394
|
-
* Remove the IO temporarily
|
1395
|
-
* otherwise you can sometimes get duplicate
|
1396
|
-
* events when rubber banding.
|
1397
|
-
*/
|
1398
|
-
if (refIO === undefined) {
|
1399
|
-
return;
|
1400
|
-
}
|
1401
|
-
refIO.disconnect();
|
1402
629
|
/**
|
1403
630
|
* Use a writeTask here to ensure
|
1404
631
|
* that the state is updated and the
|
@@ -1409,74 +636,45 @@ const Datetime = class {
|
|
1409
636
|
* if we did not do this.
|
1410
637
|
*/
|
1411
638
|
index.writeTask(() => {
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
this.destroyCalendarIO();
|
1416
|
-
}
|
1417
|
-
helpers.raf(() => {
|
1418
|
-
this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), { month, day: day, year }));
|
1419
|
-
calendarBodyRef.scrollLeft = workingMonth.clientWidth * (dir.isRTL(this.el) ? -1 : 1);
|
1420
|
-
calendarBodyRef.style.removeProperty('overflow');
|
1421
|
-
calendarBodyRef.style.removeProperty('pointer-events');
|
1422
|
-
endIO === null || endIO === void 0 ? void 0 : endIO.observe(endMonth);
|
1423
|
-
startIO === null || startIO === void 0 ? void 0 : startIO.observe(startMonth);
|
1424
|
-
});
|
1425
|
-
/**
|
1426
|
-
* Now that state has been updated
|
1427
|
-
* and the correct month is in view,
|
1428
|
-
* we can resume the IO.
|
1429
|
-
*/
|
1430
|
-
// tslint:disable-next-line
|
1431
|
-
if (refIO === undefined) {
|
1432
|
-
return;
|
1433
|
-
}
|
1434
|
-
refIO.observe(refMonth);
|
639
|
+
this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), { month, day: day, year }));
|
640
|
+
calendarBodyRef.scrollLeft = workingMonth.clientWidth * (dir.isRTL(this.el) ? -1 : 1);
|
641
|
+
calendarBodyRef.style.removeProperty('overflow');
|
1435
642
|
});
|
1436
643
|
};
|
1437
|
-
const threshold = mode === 'ios' &&
|
1438
|
-
// tslint:disable-next-line
|
1439
|
-
typeof navigator !== 'undefined' &&
|
1440
|
-
navigator.maxTouchPoints > 1 ?
|
1441
|
-
[0.7, 1] : 1;
|
1442
|
-
// Intersection observers cannot accurately detect the
|
1443
|
-
// intersection with a threshold of 1, when the observed
|
1444
|
-
// element width is a sub-pixel value (i.e. 334.05px).
|
1445
|
-
// Setting a root margin to 1px solves the issue.
|
1446
|
-
const rootMargin = '1px';
|
1447
644
|
/**
|
1448
|
-
*
|
1449
|
-
*
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
*
|
1454
|
-
*
|
1455
|
-
*
|
1456
|
-
* completely work as expected in WebKit.
|
1457
|
-
* Adding pointer-events: none allows us to
|
1458
|
-
* avoid these issues.
|
1459
|
-
*
|
1460
|
-
* This should be fine on Chromium, but
|
1461
|
-
* when you set pointer-events: none
|
1462
|
-
* it applies to active gestures which is not
|
1463
|
-
* something WebKit does.
|
645
|
+
* When the container finishes scrolling we
|
646
|
+
* need to update the DOM with the selected month.
|
647
|
+
*/
|
648
|
+
let scrollTimeout;
|
649
|
+
/**
|
650
|
+
* We do not want to attempt to set pointer-events
|
651
|
+
* multiple times within a single swipe gesture as
|
652
|
+
* that adds unnecessary work to the main thread.
|
1464
653
|
*/
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
654
|
+
let appliediOSRubberBandFix = false;
|
655
|
+
const scrollCallback = () => {
|
656
|
+
if (scrollTimeout) {
|
657
|
+
clearTimeout(scrollTimeout);
|
658
|
+
}
|
659
|
+
/**
|
660
|
+
* On iOS it is possible to quickly rubber band
|
661
|
+
* the scroll area before the scroll timeout has fired.
|
662
|
+
* This results in users reaching the end of the scrollable
|
663
|
+
* container before the DOM has updated.
|
664
|
+
* By setting `pointer-events: none` we can ensure that
|
665
|
+
* subsequent swipes do not happen while the container
|
666
|
+
* is snapping.
|
667
|
+
*/
|
668
|
+
if (!appliediOSRubberBandFix && needsiOSRubberBandFix) {
|
669
|
+
calendarBodyRef.style.setProperty('pointer-events', 'none');
|
670
|
+
appliediOSRubberBandFix = true;
|
671
|
+
}
|
672
|
+
// Wait ~3 frames
|
673
|
+
scrollTimeout = setTimeout(updateActiveMonth, 50);
|
674
|
+
};
|
675
|
+
calendarBodyRef.addEventListener('scroll', scrollCallback);
|
676
|
+
this.destroyCalendarListener = () => {
|
677
|
+
calendarBodyRef.removeEventListener('scroll', scrollCallback);
|
1480
678
|
};
|
1481
679
|
});
|
1482
680
|
};
|
@@ -1486,55 +684,54 @@ const Datetime = class {
|
|
1486
684
|
* if the datetime has been hidden/presented by a modal or popover.
|
1487
685
|
*/
|
1488
686
|
this.destroyInteractionListeners = () => {
|
1489
|
-
const {
|
1490
|
-
if (
|
1491
|
-
|
687
|
+
const { destroyCalendarListener, destroyKeyboardMO } = this;
|
688
|
+
if (destroyCalendarListener !== undefined) {
|
689
|
+
destroyCalendarListener();
|
1492
690
|
}
|
1493
691
|
if (destroyKeyboardMO !== undefined) {
|
1494
692
|
destroyKeyboardMO();
|
1495
693
|
}
|
1496
694
|
};
|
1497
|
-
/**
|
1498
|
-
* When doing subsequent presentations of an inline
|
1499
|
-
* overlay, the IO callback will fire again causing
|
1500
|
-
* the calendar to go back one month. We need to listen
|
1501
|
-
* for the presentation of the overlay so we can properly
|
1502
|
-
* cancel that IO callback.
|
1503
|
-
*/
|
1504
|
-
this.initializeOverlayListener = () => {
|
1505
|
-
const overlay = this.el.closest('ion-popover, ion-modal');
|
1506
|
-
if (overlay === null) {
|
1507
|
-
return;
|
1508
|
-
}
|
1509
|
-
const overlayListener = () => {
|
1510
|
-
this.overlayIsPresenting = true;
|
1511
|
-
};
|
1512
|
-
overlay.addEventListener('willPresent', overlayListener);
|
1513
|
-
this.destroyOverlayListener = () => {
|
1514
|
-
overlay.removeEventListener('willPresent', overlayListener);
|
1515
|
-
};
|
1516
|
-
};
|
1517
695
|
this.processValue = (value) => {
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
696
|
+
this.highlightActiveParts = !!value;
|
697
|
+
let valueToProcess = parse.parseDate(value || parse.getToday());
|
698
|
+
const { minParts, maxParts, multiple } = this;
|
699
|
+
if (!multiple && Array.isArray(value)) {
|
700
|
+
this.value = value[0];
|
701
|
+
valueToProcess = valueToProcess[0];
|
702
|
+
}
|
703
|
+
parse.warnIfValueOutOfBounds(valueToProcess, minParts, maxParts);
|
704
|
+
/**
|
705
|
+
* If there are multiple values, pick an arbitrary one to clamp to. This way,
|
706
|
+
* if the values are across months, we always show at least one of them. Note
|
707
|
+
* that the values don't necessarily have to be in order.
|
708
|
+
*/
|
709
|
+
const singleValue = Array.isArray(valueToProcess) ? valueToProcess[0] : valueToProcess;
|
710
|
+
const { month, day, year, hour, minute, tzOffset } = parse.clampDate(singleValue, minParts, maxParts);
|
711
|
+
const ampm = parse.parseAmPm(hour);
|
712
|
+
this.setWorkingParts({
|
1530
713
|
month,
|
1531
714
|
day,
|
1532
715
|
year,
|
1533
716
|
hour,
|
1534
717
|
minute,
|
1535
718
|
tzOffset,
|
1536
|
-
ampm
|
1537
|
-
};
|
719
|
+
ampm,
|
720
|
+
});
|
721
|
+
if (Array.isArray(valueToProcess)) {
|
722
|
+
this.activeParts = [...valueToProcess];
|
723
|
+
}
|
724
|
+
else {
|
725
|
+
this.activeParts = {
|
726
|
+
month,
|
727
|
+
day,
|
728
|
+
year,
|
729
|
+
hour,
|
730
|
+
minute,
|
731
|
+
tzOffset,
|
732
|
+
ampm,
|
733
|
+
};
|
734
|
+
}
|
1538
735
|
};
|
1539
736
|
this.onFocus = () => {
|
1540
737
|
this.ionFocus.emit();
|
@@ -1558,7 +755,7 @@ const Datetime = class {
|
|
1558
755
|
calendarBodyRef.scrollTo({
|
1559
756
|
top: 0,
|
1560
757
|
left: left * (dir.isRTL(this.el) ? -1 : 1),
|
1561
|
-
behavior: 'smooth'
|
758
|
+
behavior: 'smooth',
|
1562
759
|
});
|
1563
760
|
};
|
1564
761
|
this.prevMonth = () => {
|
@@ -1573,7 +770,7 @@ const Datetime = class {
|
|
1573
770
|
calendarBodyRef.scrollTo({
|
1574
771
|
top: 0,
|
1575
772
|
left: 0,
|
1576
|
-
behavior: 'smooth'
|
773
|
+
behavior: 'smooth',
|
1577
774
|
});
|
1578
775
|
};
|
1579
776
|
this.toggleMonthAndYearView = () => {
|
@@ -1590,19 +787,19 @@ const Datetime = class {
|
|
1590
787
|
this.processMaxParts();
|
1591
788
|
}
|
1592
789
|
yearValuesChanged() {
|
1593
|
-
this.parsedYearValues = convertToArrayOfNumbers(this.yearValues);
|
790
|
+
this.parsedYearValues = parse.convertToArrayOfNumbers(this.yearValues);
|
1594
791
|
}
|
1595
792
|
monthValuesChanged() {
|
1596
|
-
this.parsedMonthValues = convertToArrayOfNumbers(this.monthValues);
|
793
|
+
this.parsedMonthValues = parse.convertToArrayOfNumbers(this.monthValues);
|
1597
794
|
}
|
1598
795
|
dayValuesChanged() {
|
1599
|
-
this.parsedDayValues = convertToArrayOfNumbers(this.dayValues);
|
796
|
+
this.parsedDayValues = parse.convertToArrayOfNumbers(this.dayValues);
|
1600
797
|
}
|
1601
798
|
hourValuesChanged() {
|
1602
|
-
this.parsedHourValues = convertToArrayOfNumbers(this.hourValues);
|
799
|
+
this.parsedHourValues = parse.convertToArrayOfNumbers(this.hourValues);
|
1603
800
|
}
|
1604
801
|
minuteValuesChanged() {
|
1605
|
-
this.parsedMinuteValues = convertToArrayOfNumbers(this.minuteValues);
|
802
|
+
this.parsedMinuteValues = parse.convertToArrayOfNumbers(this.minuteValues);
|
1606
803
|
}
|
1607
804
|
activePartsChanged() {
|
1608
805
|
this.activePartsClone = this.activeParts;
|
@@ -1611,7 +808,12 @@ const Datetime = class {
|
|
1611
808
|
* Update the datetime value when the value changes
|
1612
809
|
*/
|
1613
810
|
valueChanged() {
|
811
|
+
const { value, minParts, maxParts, workingParts, multiple } = this;
|
1614
812
|
if (this.hasValue()) {
|
813
|
+
if (!multiple && Array.isArray(value)) {
|
814
|
+
this.value = value[0];
|
815
|
+
return; // setting this.value will trigger re-run of this function
|
816
|
+
}
|
1615
817
|
/**
|
1616
818
|
* Clones the value of the `activeParts` to the private clone, to update
|
1617
819
|
* the date display on the current render cycle without causing another render.
|
@@ -1619,17 +821,37 @@ const Datetime = class {
|
|
1619
821
|
* This allows us to update the current value's date/time display without
|
1620
822
|
* refocusing or shifting the user's display (leaves the user in place).
|
1621
823
|
*/
|
1622
|
-
const
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
824
|
+
const valueDateParts = parse.parseDate(value);
|
825
|
+
if (valueDateParts) {
|
826
|
+
parse.warnIfValueOutOfBounds(valueDateParts, minParts, maxParts);
|
827
|
+
if (Array.isArray(valueDateParts)) {
|
828
|
+
this.activePartsClone = [...valueDateParts];
|
829
|
+
}
|
830
|
+
else {
|
831
|
+
const { month, day, year, hour, minute } = valueDateParts;
|
832
|
+
const ampm = hour != null ? (hour >= 12 ? 'pm' : 'am') : undefined;
|
833
|
+
this.activePartsClone = Object.assign(Object.assign({}, this.activeParts), { month,
|
834
|
+
day,
|
835
|
+
year,
|
836
|
+
hour,
|
837
|
+
minute,
|
838
|
+
ampm });
|
839
|
+
/**
|
840
|
+
* The working parts am/pm value must be updated when the value changes, to
|
841
|
+
* ensure the time picker hour column values are generated correctly.
|
842
|
+
*
|
843
|
+
* Note that we don't need to do this if valueDateParts is an array, since
|
844
|
+
* multiple="true" does not apply to time pickers.
|
845
|
+
*/
|
846
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm }));
|
847
|
+
}
|
848
|
+
}
|
849
|
+
else {
|
850
|
+
index$1.printIonWarning(`Unable to parse date string: ${value}. Please provide a valid ISO 8601 datetime string.`);
|
851
|
+
}
|
1628
852
|
}
|
1629
853
|
this.emitStyle();
|
1630
|
-
this.ionChange.emit({
|
1631
|
-
value: this.value
|
1632
|
-
});
|
854
|
+
this.ionChange.emit({ value });
|
1633
855
|
}
|
1634
856
|
/**
|
1635
857
|
* Confirms the selected datetime value, updates the
|
@@ -1637,18 +859,42 @@ const Datetime = class {
|
|
1637
859
|
* or modal that the datetime was presented in.
|
1638
860
|
*/
|
1639
861
|
async confirm(closeOverlay = false) {
|
862
|
+
const { highlightActiveParts, isCalendarPicker, activeParts } = this;
|
1640
863
|
/**
|
1641
|
-
*
|
1642
|
-
*
|
1643
|
-
*
|
864
|
+
* We only update the value if the presentation is not a calendar picker,
|
865
|
+
* or if `highlightActiveParts` is true; indicating that the user
|
866
|
+
* has selected a date from the calendar picker.
|
1644
867
|
*
|
1645
|
-
*
|
1646
|
-
* the date that is currently selected, otherwise
|
1647
|
-
* there can be 1 hr difference when dealing w/ DST
|
868
|
+
* Otherwise "today" would accidentally be set as the value.
|
1648
869
|
*/
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
870
|
+
if (highlightActiveParts || !isCalendarPicker) {
|
871
|
+
const activePartsIsArray = Array.isArray(activeParts);
|
872
|
+
if (activePartsIsArray && activeParts.length === 0) {
|
873
|
+
this.value = undefined;
|
874
|
+
}
|
875
|
+
else {
|
876
|
+
/**
|
877
|
+
* Prevent convertDataToISO from doing any
|
878
|
+
* kind of transformation based on timezone
|
879
|
+
* This cancels out any change it attempts to make
|
880
|
+
*
|
881
|
+
* Important: Take the timezone offset based on
|
882
|
+
* the date that is currently selected, otherwise
|
883
|
+
* there can be 1 hr difference when dealing w/ DST
|
884
|
+
*/
|
885
|
+
if (activePartsIsArray) {
|
886
|
+
const dates = parse.convertDataToISO(activeParts).map((str) => new Date(str));
|
887
|
+
for (let i = 0; i < dates.length; i++) {
|
888
|
+
activeParts[i].tzOffset = dates[i].getTimezoneOffset() * -1;
|
889
|
+
}
|
890
|
+
}
|
891
|
+
else {
|
892
|
+
const date = new Date(parse.convertDataToISO(activeParts));
|
893
|
+
activeParts.tzOffset = date.getTimezoneOffset() * -1;
|
894
|
+
}
|
895
|
+
this.value = parse.convertDataToISO(activeParts);
|
896
|
+
}
|
897
|
+
}
|
1652
898
|
if (closeOverlay) {
|
1653
899
|
this.closeParentOverlay();
|
1654
900
|
}
|
@@ -1656,7 +902,7 @@ const Datetime = class {
|
|
1656
902
|
/**
|
1657
903
|
* Resets the internal state of the datetime but does not update the value.
|
1658
904
|
* Passing a valid ISO-8601 string will reset the state of the component to the provided date.
|
1659
|
-
* If no value is provided, the internal state will be reset to today.
|
905
|
+
* If no value is provided, the internal state will be reset to the clamped value of the min, max and today.
|
1660
906
|
*/
|
1661
907
|
async reset(startDate) {
|
1662
908
|
this.processValue(startDate);
|
@@ -1673,6 +919,10 @@ const Datetime = class {
|
|
1673
919
|
this.closeParentOverlay();
|
1674
920
|
}
|
1675
921
|
}
|
922
|
+
get isCalendarPicker() {
|
923
|
+
const { presentation } = this;
|
924
|
+
return presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
925
|
+
}
|
1676
926
|
connectedCallback() {
|
1677
927
|
this.clearFocusVisible = focusVisible.startFocusVisible(this.el).destroy;
|
1678
928
|
}
|
@@ -1683,9 +933,8 @@ const Datetime = class {
|
|
1683
933
|
}
|
1684
934
|
}
|
1685
935
|
initializeListeners() {
|
1686
|
-
this.
|
936
|
+
this.initializeCalendarListener();
|
1687
937
|
this.initializeKeyboardListeners();
|
1688
|
-
this.initializeOverlayListener();
|
1689
938
|
}
|
1690
939
|
componentDidLoad() {
|
1691
940
|
/**
|
@@ -1695,7 +944,6 @@ const Datetime = class {
|
|
1695
944
|
* visible if used inside of a modal or a popover otherwise the scrollable
|
1696
945
|
* areas will not have the correct values snapped into place.
|
1697
946
|
*/
|
1698
|
-
let visibleIO;
|
1699
947
|
const visibleCallback = (entries) => {
|
1700
948
|
const ev = entries[0];
|
1701
949
|
if (!ev.isIntersecting) {
|
@@ -1714,7 +962,7 @@ const Datetime = class {
|
|
1714
962
|
this.el.classList.add('datetime-ready');
|
1715
963
|
});
|
1716
964
|
};
|
1717
|
-
visibleIO = new IntersectionObserver(visibleCallback, { threshold: 0.01 });
|
965
|
+
const visibleIO = new IntersectionObserver(visibleCallback, { threshold: 0.01 });
|
1718
966
|
/**
|
1719
967
|
* Use raf to avoid a race condition between the component loading and
|
1720
968
|
* its display animation starting (such as when shown in a modal). This
|
@@ -1729,7 +977,6 @@ const Datetime = class {
|
|
1729
977
|
* the scroll areas have scroll widths/heights of 0px, so any snapping
|
1730
978
|
* we did originally has been lost.
|
1731
979
|
*/
|
1732
|
-
let hiddenIO;
|
1733
980
|
const hiddenCallback = (entries) => {
|
1734
981
|
const ev = entries[0];
|
1735
982
|
if (ev.isIntersecting) {
|
@@ -1740,7 +987,7 @@ const Datetime = class {
|
|
1740
987
|
this.el.classList.remove('datetime-ready');
|
1741
988
|
});
|
1742
989
|
};
|
1743
|
-
hiddenIO = new IntersectionObserver(hiddenCallback, { threshold: 0 });
|
990
|
+
const hiddenIO = new IntersectionObserver(hiddenCallback, { threshold: 0 });
|
1744
991
|
helpers.raf(() => hiddenIO === null || hiddenIO === void 0 ? void 0 : hiddenIO.observe(this.el));
|
1745
992
|
/**
|
1746
993
|
* Datetime uses Ionic components that emit
|
@@ -1770,29 +1017,49 @@ const Datetime = class {
|
|
1770
1017
|
}
|
1771
1018
|
this.prevPresentation = presentation;
|
1772
1019
|
this.destroyInteractionListeners();
|
1773
|
-
if (this.destroyOverlayListener !== undefined) {
|
1774
|
-
this.destroyOverlayListener();
|
1775
|
-
}
|
1776
1020
|
this.initializeListeners();
|
1021
|
+
/**
|
1022
|
+
* The month/year picker from the date interface
|
1023
|
+
* should be closed as it is not available in non-date
|
1024
|
+
* interfaces.
|
1025
|
+
*/
|
1026
|
+
this.showMonthAndYear = false;
|
1027
|
+
helpers.raf(() => {
|
1028
|
+
this.ionRender.emit();
|
1029
|
+
});
|
1777
1030
|
}
|
1778
1031
|
componentWillLoad() {
|
1032
|
+
const { el, multiple, presentation, preferWheel } = this;
|
1033
|
+
if (multiple) {
|
1034
|
+
if (presentation !== 'date') {
|
1035
|
+
index$1.printIonWarning('Multiple date selection is only supported for presentation="date".', el);
|
1036
|
+
}
|
1037
|
+
if (preferWheel) {
|
1038
|
+
index$1.printIonWarning('Multiple date selection is not supported with preferWheel="true".', el);
|
1039
|
+
}
|
1040
|
+
}
|
1779
1041
|
this.processMinParts();
|
1780
1042
|
this.processMaxParts();
|
1781
1043
|
this.processValue(this.value);
|
1782
|
-
this.parsedHourValues = convertToArrayOfNumbers(this.hourValues);
|
1783
|
-
this.parsedMinuteValues = convertToArrayOfNumbers(this.minuteValues);
|
1784
|
-
this.parsedMonthValues = convertToArrayOfNumbers(this.monthValues);
|
1785
|
-
this.parsedYearValues = convertToArrayOfNumbers(this.yearValues);
|
1786
|
-
this.parsedDayValues = convertToArrayOfNumbers(this.dayValues);
|
1044
|
+
this.parsedHourValues = parse.convertToArrayOfNumbers(this.hourValues);
|
1045
|
+
this.parsedMinuteValues = parse.convertToArrayOfNumbers(this.minuteValues);
|
1046
|
+
this.parsedMonthValues = parse.convertToArrayOfNumbers(this.monthValues);
|
1047
|
+
this.parsedYearValues = parse.convertToArrayOfNumbers(this.yearValues);
|
1048
|
+
this.parsedDayValues = parse.convertToArrayOfNumbers(this.dayValues);
|
1787
1049
|
this.emitStyle();
|
1788
1050
|
}
|
1789
1051
|
emitStyle() {
|
1790
1052
|
this.ionStyle.emit({
|
1791
|
-
|
1792
|
-
|
1053
|
+
interactive: true,
|
1054
|
+
datetime: true,
|
1793
1055
|
'interactive-disabled': this.disabled,
|
1794
1056
|
});
|
1795
1057
|
}
|
1058
|
+
/**
|
1059
|
+
* Universal render methods
|
1060
|
+
* These are pieces of datetime that
|
1061
|
+
* are rendered independently of presentation.
|
1062
|
+
*/
|
1796
1063
|
renderFooter() {
|
1797
1064
|
const { showDefaultButtons, showClearButton } = this;
|
1798
1065
|
const hasSlottedButtons = this.el.querySelector('[slot="buttons"]') !== null;
|
@@ -1812,83 +1079,316 @@ const Datetime = class {
|
|
1812
1079
|
*/
|
1813
1080
|
return (index.h("div", { class: "datetime-footer" }, index.h("div", { class: "datetime-buttons" }, index.h("div", { class: {
|
1814
1081
|
['datetime-action-buttons']: true,
|
1815
|
-
['has-clear-button']: this.showClearButton
|
1816
|
-
} }, index.h("slot", { name: "buttons" }, index.h("ion-buttons", null, showDefaultButtons && index.h("ion-button", { id: "cancel-button", color: this.color, onClick: () => this.cancel(true) }, this.cancelText), index.h("div", null, showClearButton && index.h("ion-button", { id: "clear-button", color: this.color, onClick: () => clearButtonClick() }, this.clearText), showDefaultButtons && index.h("ion-button", { id: "confirm-button", color: this.color, onClick: () => this.confirm(true) }, this.doneText))))))));
|
1082
|
+
['has-clear-button']: this.showClearButton,
|
1083
|
+
} }, index.h("slot", { name: "buttons" }, index.h("ion-buttons", null, showDefaultButtons && (index.h("ion-button", { id: "cancel-button", color: this.color, onClick: () => this.cancel(true) }, this.cancelText)), index.h("div", null, showClearButton && (index.h("ion-button", { id: "clear-button", color: this.color, onClick: () => clearButtonClick() }, this.clearText)), showDefaultButtons && (index.h("ion-button", { id: "confirm-button", color: this.color, onClick: () => this.confirm(true) }, this.doneText)))))))));
|
1817
1084
|
}
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1085
|
+
/**
|
1086
|
+
* Wheel picker render methods
|
1087
|
+
*/
|
1088
|
+
renderWheelPicker(forcePresentation = this.presentation) {
|
1089
|
+
/**
|
1090
|
+
* If presentation="time-date" we switch the
|
1091
|
+
* order of the render array here instead of
|
1092
|
+
* manually reordering each date/time picker
|
1093
|
+
* column with CSS. This allows for additional
|
1094
|
+
* flexibility if we need to render subsets
|
1095
|
+
* of the date/time data or do additional ordering
|
1096
|
+
* within the child render functions.
|
1097
|
+
*/
|
1098
|
+
const renderArray = forcePresentation === 'time-date'
|
1099
|
+
? [this.renderTimePickerColumns(forcePresentation), this.renderDatePickerColumns(forcePresentation)]
|
1100
|
+
: [this.renderDatePickerColumns(forcePresentation), this.renderTimePickerColumns(forcePresentation)];
|
1101
|
+
return index.h("ion-picker-internal", null, renderArray);
|
1102
|
+
}
|
1103
|
+
renderDatePickerColumns(forcePresentation) {
|
1104
|
+
return forcePresentation === 'date-time' || forcePresentation === 'time-date'
|
1105
|
+
? this.renderCombinedDatePickerColumn()
|
1106
|
+
: this.renderIndividualDatePickerColumns(forcePresentation);
|
1107
|
+
}
|
1108
|
+
renderCombinedDatePickerColumn() {
|
1109
|
+
const { activeParts, workingParts, locale, minParts, maxParts, todayParts, isDateEnabled } = this;
|
1110
|
+
/**
|
1111
|
+
* By default, generate a range of 3 months:
|
1112
|
+
* Previous month, current month, and next month
|
1113
|
+
*/
|
1114
|
+
const monthsToRender = parse.generateMonths(workingParts);
|
1115
|
+
/**
|
1116
|
+
* generateMonths returns the day data as well,
|
1117
|
+
* but we do not want the day value to act as a max/min
|
1118
|
+
* on the data we are going to generate.
|
1119
|
+
*/
|
1120
|
+
for (let i = 0; i <= monthsToRender.length - 1; i++) {
|
1121
|
+
monthsToRender[i].day = null;
|
1122
|
+
}
|
1123
|
+
/**
|
1124
|
+
* If developers have provided their own
|
1125
|
+
* min/max values, use that instead. Otherwise,
|
1126
|
+
* fallback to the default range of 3 months.
|
1127
|
+
*/
|
1128
|
+
const min = minParts || monthsToRender[0];
|
1129
|
+
const max = maxParts || monthsToRender[monthsToRender.length - 1];
|
1130
|
+
const result = parse.getCombinedDateColumnData(locale, workingParts, todayParts, min, max, this.parsedDayValues, this.parsedMonthValues);
|
1131
|
+
let items = result.items;
|
1132
|
+
const parts = result.parts;
|
1133
|
+
if (isDateEnabled) {
|
1134
|
+
items = items.map((itemObject, index) => {
|
1135
|
+
const referenceParts = parts[index];
|
1136
|
+
let disabled;
|
1137
|
+
try {
|
1138
|
+
/**
|
1139
|
+
* The `isDateEnabled` implementation is try-catch wrapped
|
1140
|
+
* to prevent exceptions in the user's function from
|
1141
|
+
* interrupting the calendar rendering.
|
1142
|
+
*/
|
1143
|
+
disabled = !isDateEnabled(parse.convertDataToISO(referenceParts));
|
1144
|
+
}
|
1145
|
+
catch (e) {
|
1146
|
+
index$1.printIonError('Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', e);
|
1147
|
+
}
|
1148
|
+
return Object.assign(Object.assign({}, itemObject), { disabled });
|
1149
|
+
});
|
1150
|
+
}
|
1151
|
+
/**
|
1152
|
+
* If we have selected a day already, then default the column
|
1153
|
+
* to that value. Otherwise, default it to today.
|
1154
|
+
*/
|
1155
|
+
const todayString = workingParts.day
|
1156
|
+
? `${workingParts.year}-${workingParts.month}-${workingParts.day}`
|
1157
|
+
: `${todayParts.year}-${todayParts.month}-${todayParts.day}`;
|
1158
|
+
return (index.h("ion-picker-column-internal", { class: "date-column", color: this.color, items: items, value: todayString, onIonChange: (ev) => {
|
1159
|
+
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
1160
|
+
// Due to a Safari 14 issue we need to destroy
|
1161
|
+
// the scroll listener before we update state
|
1162
|
+
// and trigger a re-render.
|
1163
|
+
if (this.destroyCalendarListener) {
|
1164
|
+
this.destroyCalendarListener();
|
1165
|
+
}
|
1166
|
+
const { value } = ev.detail;
|
1167
|
+
const findPart = parts.find(({ month, day, year }) => value === `${year}-${month}-${day}`);
|
1168
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), findPart));
|
1169
|
+
if (!Array.isArray(activeParts)) {
|
1170
|
+
this.setActiveParts(Object.assign(Object.assign({}, activeParts), findPart));
|
1171
|
+
}
|
1172
|
+
// We can re-attach the scroll listener after
|
1173
|
+
// the working parts have been updated.
|
1174
|
+
this.initializeCalendarListener();
|
1175
|
+
ev.stopPropagation();
|
1176
|
+
} }));
|
1177
|
+
}
|
1178
|
+
renderIndividualDatePickerColumns(forcePresentation) {
|
1179
|
+
const { workingParts, isDateEnabled } = this;
|
1180
|
+
const shouldRenderMonths = forcePresentation !== 'year' && forcePresentation !== 'time';
|
1181
|
+
const months = shouldRenderMonths
|
1182
|
+
? parse.getMonthColumnData(this.locale, workingParts, this.minParts, this.maxParts, this.parsedMonthValues)
|
1183
|
+
: [];
|
1184
|
+
const shouldRenderDays = forcePresentation === 'date';
|
1185
|
+
let days = shouldRenderDays
|
1186
|
+
? parse.getDayColumnData(this.locale, workingParts, this.minParts, this.maxParts, this.parsedDayValues)
|
1187
|
+
: [];
|
1188
|
+
if (isDateEnabled) {
|
1189
|
+
days = days.map((dayObject) => {
|
1190
|
+
const { value } = dayObject;
|
1191
|
+
const valueNum = typeof value === 'string' ? parseInt(value) : value;
|
1192
|
+
const referenceParts = {
|
1193
|
+
month: workingParts.month,
|
1194
|
+
day: valueNum,
|
1195
|
+
year: workingParts.year,
|
1196
|
+
};
|
1197
|
+
let disabled;
|
1198
|
+
try {
|
1199
|
+
/**
|
1200
|
+
* The `isDateEnabled` implementation is try-catch wrapped
|
1201
|
+
* to prevent exceptions in the user's function from
|
1202
|
+
* interrupting the calendar rendering.
|
1203
|
+
*/
|
1204
|
+
disabled = !isDateEnabled(parse.convertDataToISO(referenceParts));
|
1205
|
+
}
|
1206
|
+
catch (e) {
|
1207
|
+
index$1.printIonError('Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', e);
|
1208
|
+
}
|
1209
|
+
return Object.assign(Object.assign({}, dayObject), { disabled });
|
1210
|
+
});
|
1211
|
+
}
|
1212
|
+
const shouldRenderYears = forcePresentation !== 'month' && forcePresentation !== 'time';
|
1213
|
+
const years = shouldRenderYears
|
1214
|
+
? parse.getYearColumnData(this.todayParts, this.minParts, this.maxParts, this.parsedYearValues)
|
1215
|
+
: [];
|
1216
|
+
/**
|
1217
|
+
* Certain locales show the day before the month.
|
1218
|
+
*/
|
1219
|
+
const showMonthFirst = parse.isMonthFirstLocale(this.locale, { month: 'numeric', day: 'numeric' });
|
1220
|
+
let renderArray = [];
|
1221
|
+
if (showMonthFirst) {
|
1222
|
+
renderArray = [
|
1223
|
+
this.renderMonthPickerColumn(months),
|
1224
|
+
this.renderDayPickerColumn(days),
|
1225
|
+
this.renderYearPickerColumn(years),
|
1226
|
+
];
|
1227
|
+
}
|
1228
|
+
else {
|
1229
|
+
renderArray = [
|
1230
|
+
this.renderDayPickerColumn(days),
|
1231
|
+
this.renderMonthPickerColumn(months),
|
1232
|
+
this.renderYearPickerColumn(years),
|
1233
|
+
];
|
1234
|
+
}
|
1235
|
+
return renderArray;
|
1236
|
+
}
|
1237
|
+
renderDayPickerColumn(days) {
|
1238
|
+
var _a;
|
1239
|
+
if (days.length === 0) {
|
1240
|
+
return [];
|
1241
|
+
}
|
1242
|
+
const { activeParts, workingParts } = this;
|
1243
|
+
return (index.h("ion-picker-column-internal", { class: "day-column", color: this.color, items: days, value: (_a = (workingParts.day || this.todayParts.day)) !== null && _a !== void 0 ? _a : undefined, onIonChange: (ev) => {
|
1244
|
+
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
1245
|
+
// Due to a Safari 14 issue we need to destroy
|
1246
|
+
// the scroll listener before we update state
|
1247
|
+
// and trigger a re-render.
|
1248
|
+
if (this.destroyCalendarListener) {
|
1249
|
+
this.destroyCalendarListener();
|
1250
|
+
}
|
1251
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { day: ev.detail.value }));
|
1252
|
+
if (!Array.isArray(activeParts)) {
|
1253
|
+
this.setActiveParts(Object.assign(Object.assign({}, activeParts), { day: ev.detail.value }));
|
1254
|
+
}
|
1255
|
+
// We can re-attach the scroll listener after
|
1256
|
+
// the working parts have been updated.
|
1257
|
+
this.initializeCalendarListener();
|
1258
|
+
ev.stopPropagation();
|
1259
|
+
} }));
|
1260
|
+
}
|
1261
|
+
renderMonthPickerColumn(months) {
|
1262
|
+
if (months.length === 0) {
|
1263
|
+
return [];
|
1264
|
+
}
|
1265
|
+
const { activeParts, workingParts } = this;
|
1266
|
+
return (index.h("ion-picker-column-internal", { class: "month-column", color: this.color, items: months, value: workingParts.month, onIonChange: (ev) => {
|
1267
|
+
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
1268
|
+
// Due to a Safari 14 issue we need to destroy
|
1269
|
+
// the scroll listener before we update state
|
1270
|
+
// and trigger a re-render.
|
1271
|
+
if (this.destroyCalendarListener) {
|
1272
|
+
this.destroyCalendarListener();
|
1273
|
+
}
|
1274
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { month: ev.detail.value }));
|
1275
|
+
if (!Array.isArray(activeParts)) {
|
1276
|
+
this.setActiveParts(Object.assign(Object.assign({}, activeParts), { month: ev.detail.value }));
|
1277
|
+
}
|
1278
|
+
// We can re-attach the scroll listener after
|
1279
|
+
// the working parts have been updated.
|
1280
|
+
this.initializeCalendarListener();
|
1281
|
+
ev.stopPropagation();
|
1282
|
+
} }));
|
1283
|
+
}
|
1284
|
+
renderYearPickerColumn(years) {
|
1285
|
+
if (years.length === 0) {
|
1286
|
+
return [];
|
1287
|
+
}
|
1288
|
+
const { activeParts, workingParts } = this;
|
1289
|
+
return (index.h("ion-picker-column-internal", { class: "year-column", color: this.color, items: years, value: workingParts.year, onIonChange: (ev) => {
|
1290
|
+
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
1291
|
+
// Due to a Safari 14 issue we need to destroy
|
1292
|
+
// the scroll listener before we update state
|
1293
|
+
// and trigger a re-render.
|
1294
|
+
if (this.destroyCalendarListener) {
|
1295
|
+
this.destroyCalendarListener();
|
1296
|
+
}
|
1297
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { year: ev.detail.value }));
|
1298
|
+
if (!Array.isArray(activeParts)) {
|
1299
|
+
this.setActiveParts(Object.assign(Object.assign({}, activeParts), { year: ev.detail.value }));
|
1300
|
+
}
|
1301
|
+
// We can re-attach the scroll listener after
|
1302
|
+
// the working parts have been updated.
|
1303
|
+
this.initializeCalendarListener();
|
1304
|
+
ev.stopPropagation();
|
1305
|
+
} }));
|
1306
|
+
}
|
1307
|
+
renderTimePickerColumns(forcePresentation) {
|
1308
|
+
if (['date', 'month', 'month-year', 'year'].includes(forcePresentation)) {
|
1309
|
+
return [];
|
1310
|
+
}
|
1311
|
+
const { hoursData, minutesData, dayPeriodData } = parse.getTimeColumnsData(this.locale, this.workingParts, this.hourCycle, this.value ? this.minParts : undefined, this.value ? this.maxParts : undefined, this.parsedHourValues, this.parsedMinuteValues);
|
1312
|
+
return [
|
1313
|
+
this.renderHourPickerColumn(hoursData),
|
1314
|
+
this.renderMinutePickerColumn(minutesData),
|
1315
|
+
this.renderDayPeriodPickerColumn(dayPeriodData),
|
1316
|
+
];
|
1317
|
+
}
|
1318
|
+
renderHourPickerColumn(hoursData) {
|
1319
|
+
const { workingParts, activePartsClone } = this;
|
1320
|
+
if (hoursData.length === 0)
|
1321
|
+
return [];
|
1322
|
+
return (index.h("ion-picker-column-internal", { color: this.color, value: activePartsClone.hour, items: hoursData, numericInput: true, onIonChange: (ev) => {
|
1323
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
|
1324
|
+
if (!Array.isArray(activePartsClone)) {
|
1325
|
+
this.setActiveParts(Object.assign(Object.assign({}, activePartsClone), { hour: ev.detail.value }));
|
1326
|
+
}
|
1327
|
+
ev.stopPropagation();
|
1328
|
+
} }));
|
1329
|
+
}
|
1330
|
+
renderMinutePickerColumn(minutesData) {
|
1331
|
+
const { workingParts, activePartsClone } = this;
|
1332
|
+
if (minutesData.length === 0)
|
1333
|
+
return [];
|
1334
|
+
return (index.h("ion-picker-column-internal", { color: this.color, value: activePartsClone.minute, items: minutesData, numericInput: true, onIonChange: (ev) => {
|
1335
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
|
1336
|
+
if (!Array.isArray(activePartsClone)) {
|
1337
|
+
this.setActiveParts(Object.assign(Object.assign({}, activePartsClone), { minute: ev.detail.value }));
|
1338
|
+
}
|
1339
|
+
ev.stopPropagation();
|
1340
|
+
} }));
|
1341
|
+
}
|
1342
|
+
renderDayPeriodPickerColumn(dayPeriodData) {
|
1343
|
+
const { workingParts, activePartsClone } = this;
|
1344
|
+
if (dayPeriodData.length === 0) {
|
1345
|
+
return [];
|
1346
|
+
}
|
1347
|
+
const isDayPeriodRTL = parse.isLocaleDayPeriodRTL(this.locale);
|
1348
|
+
return (index.h("ion-picker-column-internal", { style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, value: activePartsClone.ampm, items: dayPeriodData, onIonChange: (ev) => {
|
1349
|
+
const hour = parse.calculateHourFromAMPM(workingParts, ev.detail.value);
|
1350
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
|
1351
|
+
if (!Array.isArray(activePartsClone)) {
|
1352
|
+
this.setActiveParts(Object.assign(Object.assign({}, activePartsClone), { ampm: ev.detail.value, hour }));
|
1353
|
+
}
|
1354
|
+
ev.stopPropagation();
|
1355
|
+
} }));
|
1356
|
+
}
|
1357
|
+
renderWheelView(forcePresentation) {
|
1358
|
+
const { locale } = this;
|
1359
|
+
const showMonthFirst = parse.isMonthFirstLocale(locale);
|
1831
1360
|
const columnOrder = showMonthFirst ? 'month-first' : 'year-first';
|
1832
|
-
return (index.h("div", { class:
|
1833
|
-
|
1834
|
-
|
1835
|
-
} }, index.h("ion-picker-internal", null, showMonth &&
|
1836
|
-
index.h("ion-picker-column-internal", { class: "month-column", color: this.color, items: months, value: workingParts.month, onIonChange: (ev) => {
|
1837
|
-
// Due to a Safari 14 issue we need to destroy
|
1838
|
-
// the intersection observer before we update state
|
1839
|
-
// and trigger a re-render.
|
1840
|
-
if (this.destroyCalendarIO) {
|
1841
|
-
this.destroyCalendarIO();
|
1842
|
-
}
|
1843
|
-
this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), { month: ev.detail.value }));
|
1844
|
-
if (presentation === 'month' || presentation === 'month-year') {
|
1845
|
-
this.setActiveParts(Object.assign(Object.assign({}, this.activeParts), { month: ev.detail.value }));
|
1846
|
-
}
|
1847
|
-
// We can re-attach the intersection observer after
|
1848
|
-
// the working parts have been updated.
|
1849
|
-
this.initializeCalendarIOListeners();
|
1850
|
-
ev.stopPropagation();
|
1851
|
-
} }), showYear &&
|
1852
|
-
index.h("ion-picker-column-internal", { class: "year-column", color: this.color, items: years, value: workingParts.year, onIonChange: (ev) => {
|
1853
|
-
// Due to a Safari 14 issue we need to destroy
|
1854
|
-
// the intersection observer before we update state
|
1855
|
-
// and trigger a re-render.
|
1856
|
-
if (this.destroyCalendarIO) {
|
1857
|
-
this.destroyCalendarIO();
|
1858
|
-
}
|
1859
|
-
this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), { year: ev.detail.value }));
|
1860
|
-
if (presentation === 'year' || presentation === 'month-year') {
|
1861
|
-
this.setActiveParts(Object.assign(Object.assign({}, this.activeParts), { year: ev.detail.value }));
|
1862
|
-
}
|
1863
|
-
// We can re-attach the intersection observer after
|
1864
|
-
// the working parts have been updated.
|
1865
|
-
this.initializeCalendarIOListeners();
|
1866
|
-
ev.stopPropagation();
|
1867
|
-
} })))));
|
1361
|
+
return (index.h("div", { class: {
|
1362
|
+
[`wheel-order-${columnOrder}`]: true,
|
1363
|
+
} }, this.renderWheelPicker(forcePresentation)));
|
1868
1364
|
}
|
1365
|
+
/**
|
1366
|
+
* Grid Render Methods
|
1367
|
+
*/
|
1869
1368
|
renderCalendarHeader(mode) {
|
1870
|
-
const expandedIcon = mode === 'ios' ? index$
|
1871
|
-
const collapsedIcon = mode === 'ios' ? index$
|
1369
|
+
const expandedIcon = mode === 'ios' ? index$2.chevronDown : index$2.caretUpSharp;
|
1370
|
+
const collapsedIcon = mode === 'ios' ? index$2.chevronForward : index$2.caretDownSharp;
|
1872
1371
|
const prevMonthDisabled = isPrevMonthDisabled(this.workingParts, this.minParts, this.maxParts);
|
1873
1372
|
const nextMonthDisabled = isNextMonthDisabled(this.workingParts, this.maxParts);
|
1874
|
-
return (index.h("div", { class: "calendar-header" }, index.h("div", { class: "calendar-action-buttons" }, index.h("div", { class: "calendar-month-year" }, index.h("ion-item", { button: true, detail: false, lines: "none", onClick: () => this.toggleMonthAndYearView() }, index.h("ion-label", null, getMonthAndYear(this.locale, this.workingParts),
|
1373
|
+
return (index.h("div", { class: "calendar-header" }, index.h("div", { class: "calendar-action-buttons" }, index.h("div", { class: "calendar-month-year" }, index.h("ion-item", { button: true, detail: false, lines: "none", onClick: () => this.toggleMonthAndYearView() }, index.h("ion-label", null, parse.getMonthAndYear(this.locale, this.workingParts), ' ', index.h("ion-icon", { icon: this.showMonthAndYear ? expandedIcon : collapsedIcon, lazy: false })))), index.h("div", { class: "calendar-next-prev" }, index.h("ion-buttons", null, index.h("ion-button", { disabled: prevMonthDisabled, onClick: () => this.prevMonth() }, index.h("ion-icon", { slot: "icon-only", icon: index$2.chevronBack, lazy: false, flipRtl: true })), index.h("ion-button", { disabled: nextMonthDisabled, onClick: () => this.nextMonth() }, index.h("ion-icon", { slot: "icon-only", icon: index$2.chevronForward, lazy: false, flipRtl: true }))))), index.h("div", { class: "calendar-days-of-week" }, parse.getDaysOfWeek(this.locale, mode, this.firstDayOfWeek % 7).map((d) => {
|
1875
1374
|
return index.h("div", { class: "day-of-week" }, d);
|
1876
1375
|
}))));
|
1877
1376
|
}
|
1878
1377
|
renderMonth(month, year) {
|
1378
|
+
const { highlightActiveParts } = this;
|
1879
1379
|
const yearAllowed = this.parsedYearValues === undefined || this.parsedYearValues.includes(year);
|
1880
1380
|
const monthAllowed = this.parsedMonthValues === undefined || this.parsedMonthValues.includes(month);
|
1881
1381
|
const isCalMonthDisabled = !yearAllowed || !monthAllowed;
|
1882
1382
|
const swipeDisabled = isMonthDisabled({
|
1883
1383
|
month,
|
1884
1384
|
year,
|
1885
|
-
day: null
|
1385
|
+
day: null,
|
1886
1386
|
}, {
|
1887
1387
|
// The day is not used when checking if a month is disabled.
|
1888
1388
|
// Users should be able to access the min or max month, even if the
|
1889
1389
|
// min/max date is out of bounds (e.g. min is set to Feb 15, Feb should not be disabled).
|
1890
1390
|
minParts: Object.assign(Object.assign({}, this.minParts), { day: null }),
|
1891
|
-
maxParts: Object.assign(Object.assign({}, this.maxParts), { day: null })
|
1391
|
+
maxParts: Object.assign(Object.assign({}, this.maxParts), { day: null }),
|
1892
1392
|
});
|
1893
1393
|
// The working month should never have swipe disabled.
|
1894
1394
|
// Otherwise the CSS scroll snap will not work and the user
|
@@ -1897,16 +1397,31 @@ const Datetime = class {
|
|
1897
1397
|
return (index.h("div", { class: {
|
1898
1398
|
'calendar-month': true,
|
1899
1399
|
// Prevents scroll snap swipe gestures for months outside of the min/max bounds
|
1900
|
-
'calendar-month-disabled': !isWorkingMonth && swipeDisabled
|
1901
|
-
} }, index.h("div", { class: "calendar-month-grid" }, getDaysOfMonth(month, year, this.firstDayOfWeek % 7).map((dateObject, index$
|
1400
|
+
'calendar-month-disabled': !isWorkingMonth && swipeDisabled,
|
1401
|
+
} }, index.h("div", { class: "calendar-month-grid" }, parse.getDaysOfMonth(month, year, this.firstDayOfWeek % 7).map((dateObject, index$2) => {
|
1902
1402
|
const { day, dayOfWeek } = dateObject;
|
1403
|
+
const { isDateEnabled, multiple } = this;
|
1903
1404
|
const referenceParts = { month, day, year };
|
1904
1405
|
const { isActive, isToday, ariaLabel, ariaSelected, disabled } = getCalendarDayState(this.locale, referenceParts, this.activePartsClone, this.todayParts, this.minParts, this.maxParts, this.parsedDayValues);
|
1905
|
-
|
1406
|
+
let isCalDayDisabled = isCalMonthDisabled || disabled;
|
1407
|
+
if (!isCalDayDisabled && isDateEnabled !== undefined) {
|
1408
|
+
try {
|
1409
|
+
/**
|
1410
|
+
* The `isDateEnabled` implementation is try-catch wrapped
|
1411
|
+
* to prevent exceptions in the user's function from
|
1412
|
+
* interrupting the calendar rendering.
|
1413
|
+
*/
|
1414
|
+
isCalDayDisabled = !isDateEnabled(parse.convertDataToISO(referenceParts));
|
1415
|
+
}
|
1416
|
+
catch (e) {
|
1417
|
+
index$1.printIonError('Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', e);
|
1418
|
+
}
|
1419
|
+
}
|
1420
|
+
return (index.h("button", { tabindex: "-1", "data-day": day, "data-month": month, "data-year": year, "data-index": index$2, "data-day-of-week": dayOfWeek, disabled: isCalDayDisabled, class: {
|
1906
1421
|
'calendar-day-padding': day === null,
|
1907
1422
|
'calendar-day': true,
|
1908
|
-
'calendar-day-active': isActive,
|
1909
|
-
'calendar-day-today': isToday
|
1423
|
+
'calendar-day-active': isActive && highlightActiveParts,
|
1424
|
+
'calendar-day-today': isToday,
|
1910
1425
|
}, "aria-selected": ariaSelected, "aria-label": ariaLabel, onClick: () => {
|
1911
1426
|
if (day === null) {
|
1912
1427
|
return;
|
@@ -1914,14 +1429,24 @@ const Datetime = class {
|
|
1914
1429
|
this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), { month,
|
1915
1430
|
day,
|
1916
1431
|
year }));
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1432
|
+
// multiple only needs date info, so we can wipe out other fields like time
|
1433
|
+
if (multiple) {
|
1434
|
+
this.setActiveParts({
|
1435
|
+
month,
|
1436
|
+
day,
|
1437
|
+
year,
|
1438
|
+
}, isActive && highlightActiveParts);
|
1439
|
+
}
|
1440
|
+
else {
|
1441
|
+
this.setActiveParts(Object.assign(Object.assign({}, this.activeParts), { month,
|
1442
|
+
day,
|
1443
|
+
year }));
|
1444
|
+
}
|
1920
1445
|
} }, day));
|
1921
1446
|
}))));
|
1922
1447
|
}
|
1923
1448
|
renderCalendarBody() {
|
1924
|
-
return (index.h("div", { class: "calendar-body ion-focusable", ref: el => this.calendarBodyRef = el, tabindex: "0" }, generateMonths(this.workingParts).map(({ month, year }) => {
|
1449
|
+
return (index.h("div", { class: "calendar-body ion-focusable", ref: (el) => (this.calendarBodyRef = el), tabindex: "0" }, parse.generateMonths(this.workingParts).map(({ month, year }) => {
|
1925
1450
|
return this.renderMonth(month, year);
|
1926
1451
|
})));
|
1927
1452
|
}
|
@@ -1933,45 +1458,29 @@ const Datetime = class {
|
|
1933
1458
|
if (!hasSlottedTimeLabel && !this.showDefaultTimeLabel) {
|
1934
1459
|
return;
|
1935
1460
|
}
|
1936
|
-
return
|
1937
|
-
}
|
1938
|
-
renderTimePicker(hoursItems, minutesItems, ampmItems, use24Hour) {
|
1939
|
-
const { color, activePartsClone, workingParts } = this;
|
1940
|
-
return (index.h("ion-picker-internal", null, index.h("ion-picker-column-internal", { color: color, value: activePartsClone.hour, items: hoursItems, numericInput: true, onIonChange: (ev) => {
|
1941
|
-
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
|
1942
|
-
this.setActiveParts(Object.assign(Object.assign({}, activePartsClone), { hour: ev.detail.value }));
|
1943
|
-
ev.stopPropagation();
|
1944
|
-
} }), index.h("ion-picker-column-internal", { color: color, value: activePartsClone.minute, items: minutesItems, numericInput: true, onIonChange: (ev) => {
|
1945
|
-
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
|
1946
|
-
this.setActiveParts(Object.assign(Object.assign({}, activePartsClone), { minute: ev.detail.value }));
|
1947
|
-
ev.stopPropagation();
|
1948
|
-
} }), !use24Hour && index.h("ion-picker-column-internal", { color: color, value: activePartsClone.ampm, items: ampmItems, onIonChange: (ev) => {
|
1949
|
-
const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
|
1950
|
-
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
|
1951
|
-
this.setActiveParts(Object.assign(Object.assign({}, activePartsClone), { ampm: ev.detail.value, hour }));
|
1952
|
-
ev.stopPropagation();
|
1953
|
-
} })));
|
1461
|
+
return index.h("slot", { name: "time-label" }, "Time");
|
1954
1462
|
}
|
1955
|
-
renderTimeOverlay(
|
1463
|
+
renderTimeOverlay() {
|
1464
|
+
const use24Hour = parse.is24Hour(this.locale, this.hourCycle);
|
1956
1465
|
return [
|
1957
1466
|
index.h("div", { class: "time-header" }, this.renderTimeLabel()),
|
1958
1467
|
index.h("button", { class: {
|
1959
1468
|
'time-body': true,
|
1960
|
-
'time-body-active': this.isTimePopoverOpen
|
1469
|
+
'time-body-active': this.isTimePopoverOpen,
|
1961
1470
|
}, "aria-expanded": "false", "aria-haspopup": "true", onClick: async (ev) => {
|
1962
1471
|
const { popoverRef } = this;
|
1963
1472
|
if (popoverRef) {
|
1964
1473
|
this.isTimePopoverOpen = true;
|
1965
1474
|
popoverRef.present(new CustomEvent('ionShadowTarget', {
|
1966
1475
|
detail: {
|
1967
|
-
ionShadowTarget: ev.target
|
1968
|
-
}
|
1476
|
+
ionShadowTarget: ev.target,
|
1477
|
+
},
|
1969
1478
|
}));
|
1970
1479
|
await popoverRef.onWillDismiss();
|
1971
1480
|
this.isTimePopoverOpen = false;
|
1972
1481
|
}
|
1973
|
-
} },
|
1974
|
-
index.h("ion-popover", { alignment: "center", translucent: true, overlayIndex: 1, arrow: false, onWillPresent: ev => {
|
1482
|
+
} }, parse.getLocalizedTime(this.locale, this.activePartsClone, use24Hour)),
|
1483
|
+
index.h("ion-popover", { alignment: "center", translucent: true, overlayIndex: 1, arrow: false, onWillPresent: (ev) => {
|
1975
1484
|
/**
|
1976
1485
|
* Intersection Observers do not consistently fire between Blink and Webkit
|
1977
1486
|
* when toggling the visibility of the popover and trying to scroll the picker
|
@@ -1982,15 +1491,23 @@ const Datetime = class {
|
|
1982
1491
|
*/
|
1983
1492
|
const cols = ev.target.querySelectorAll('ion-picker-column-internal');
|
1984
1493
|
// TODO (FW-615): Potentially remove this when intersection observers are fixed in picker column
|
1985
|
-
cols.forEach(col => col.scrollActiveItemIntoView());
|
1494
|
+
cols.forEach((col) => col.scrollActiveItemIntoView());
|
1986
1495
|
}, style: {
|
1987
|
-
'--offset-y': '-10px'
|
1496
|
+
'--offset-y': '-10px',
|
1497
|
+
'--min-width': 'fit-content',
|
1988
1498
|
},
|
1989
1499
|
// Allow native browser keyboard events to support up/down/home/end key
|
1990
1500
|
// navigation within the time picker.
|
1991
|
-
keyboardEvents: true, ref: el => this.popoverRef = el }, this.
|
1501
|
+
keyboardEvents: true, ref: (el) => (this.popoverRef = el) }, this.renderWheelPicker('time')),
|
1992
1502
|
];
|
1993
1503
|
}
|
1504
|
+
renderCalendarViewHeader(mode) {
|
1505
|
+
const hasSlottedTitle = this.el.querySelector('[slot="title"]') !== null;
|
1506
|
+
if (!hasSlottedTitle && !this.showDefaultTitle) {
|
1507
|
+
return;
|
1508
|
+
}
|
1509
|
+
return (index.h("div", { class: "datetime-header" }, index.h("div", { class: "datetime-title" }, index.h("slot", { name: "title" }, "Select Date")), mode === 'md' && !this.multiple && (index.h("div", { class: "datetime-selected-date" }, parse.getMonthAndDay(this.locale, this.activeParts)))));
|
1510
|
+
}
|
1994
1511
|
/**
|
1995
1512
|
* Render time picker inside of datetime.
|
1996
1513
|
* Do not pass color prop to segment on
|
@@ -1999,98 +1516,88 @@ const Datetime = class {
|
|
1999
1516
|
* should just be the default segment.
|
2000
1517
|
*/
|
2001
1518
|
renderTime() {
|
2002
|
-
const {
|
1519
|
+
const { presentation } = this;
|
2003
1520
|
const timeOnlyPresentation = presentation === 'time';
|
2004
|
-
|
2005
|
-
const { hours, minutes, am, pm } = generateTime(this.workingParts, use24Hour ? 'h23' : 'h12', this.minParts, this.maxParts, this.parsedHourValues, this.parsedMinuteValues);
|
2006
|
-
const hoursItems = hours.map(hour => {
|
2007
|
-
return {
|
2008
|
-
text: getFormattedHour(hour, use24Hour),
|
2009
|
-
value: getInternalHourValue(hour, use24Hour, workingParts.ampm)
|
2010
|
-
};
|
2011
|
-
});
|
2012
|
-
const minutesItems = minutes.map(minute => {
|
2013
|
-
return {
|
2014
|
-
text: addTimePadding(minute),
|
2015
|
-
value: minute
|
2016
|
-
};
|
2017
|
-
});
|
2018
|
-
const ampmItems = [];
|
2019
|
-
if (am) {
|
2020
|
-
ampmItems.push({
|
2021
|
-
text: 'AM',
|
2022
|
-
value: 'am'
|
2023
|
-
});
|
2024
|
-
}
|
2025
|
-
if (pm) {
|
2026
|
-
ampmItems.push({
|
2027
|
-
text: 'PM',
|
2028
|
-
value: 'pm'
|
2029
|
-
});
|
2030
|
-
}
|
2031
|
-
return (index.h("div", { class: "datetime-time" }, timeOnlyPresentation ? this.renderTimePicker(hoursItems, minutesItems, ampmItems, use24Hour) : this.renderTimeOverlay(hoursItems, minutesItems, ampmItems, use24Hour)));
|
1521
|
+
return (index.h("div", { class: "datetime-time" }, timeOnlyPresentation ? this.renderWheelPicker() : this.renderTimeOverlay()));
|
2032
1522
|
}
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
1523
|
+
/**
|
1524
|
+
* Renders the month/year picker that is
|
1525
|
+
* displayed on the calendar grid.
|
1526
|
+
* The .datetime-year class has additional
|
1527
|
+
* styles that let us show/hide the
|
1528
|
+
* picker when the user clicks on the
|
1529
|
+
* toggle in the calendar header.
|
1530
|
+
*/
|
1531
|
+
renderCalendarViewMonthYearPicker() {
|
1532
|
+
return index.h("div", { class: "datetime-year" }, this.renderWheelView('month-year'));
|
2039
1533
|
}
|
1534
|
+
/**
|
1535
|
+
* Render entry point
|
1536
|
+
* All presentation types are rendered from here.
|
1537
|
+
*/
|
2040
1538
|
renderDatetime(mode) {
|
2041
|
-
const { presentation } = this;
|
1539
|
+
const { presentation, preferWheel } = this;
|
1540
|
+
/**
|
1541
|
+
* Certain presentation types have separate grid and wheel displays.
|
1542
|
+
* If preferWheel is true then we should show a wheel picker instead.
|
1543
|
+
*/
|
1544
|
+
const hasWheelVariant = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
1545
|
+
if (preferWheel && hasWheelVariant) {
|
1546
|
+
return [this.renderWheelView(), this.renderFooter()];
|
1547
|
+
}
|
2042
1548
|
switch (presentation) {
|
2043
1549
|
case 'date-time':
|
2044
1550
|
return [
|
2045
1551
|
this.renderCalendarViewHeader(mode),
|
2046
1552
|
this.renderCalendar(mode),
|
2047
|
-
this.
|
1553
|
+
this.renderCalendarViewMonthYearPicker(),
|
2048
1554
|
this.renderTime(),
|
2049
|
-
this.renderFooter()
|
1555
|
+
this.renderFooter(),
|
2050
1556
|
];
|
2051
1557
|
case 'time-date':
|
2052
1558
|
return [
|
2053
1559
|
this.renderCalendarViewHeader(mode),
|
2054
1560
|
this.renderTime(),
|
2055
1561
|
this.renderCalendar(mode),
|
2056
|
-
this.
|
2057
|
-
this.renderFooter()
|
1562
|
+
this.renderCalendarViewMonthYearPicker(),
|
1563
|
+
this.renderFooter(),
|
2058
1564
|
];
|
2059
1565
|
case 'time':
|
2060
|
-
return [
|
2061
|
-
this.renderTime(),
|
2062
|
-
this.renderFooter()
|
2063
|
-
];
|
1566
|
+
return [this.renderTime(), this.renderFooter()];
|
2064
1567
|
case 'month':
|
2065
1568
|
case 'month-year':
|
2066
1569
|
case 'year':
|
2067
|
-
return [
|
2068
|
-
this.renderYearView(),
|
2069
|
-
this.renderFooter()
|
2070
|
-
];
|
1570
|
+
return [this.renderWheelView(), this.renderFooter()];
|
2071
1571
|
default:
|
2072
1572
|
return [
|
2073
1573
|
this.renderCalendarViewHeader(mode),
|
2074
1574
|
this.renderCalendar(mode),
|
2075
|
-
this.
|
2076
|
-
this.renderFooter()
|
1575
|
+
this.renderCalendarViewMonthYearPicker(),
|
1576
|
+
this.renderFooter(),
|
2077
1577
|
];
|
2078
1578
|
}
|
2079
1579
|
}
|
2080
1580
|
render() {
|
2081
|
-
const { name, value, disabled, el, color, isPresented, readonly, showMonthAndYear, presentation, size } = this;
|
1581
|
+
const { name, value, disabled, el, color, isPresented, readonly, showMonthAndYear, preferWheel, presentation, size, } = this;
|
2082
1582
|
const mode = ionicGlobal.getIonMode(this);
|
2083
1583
|
const isMonthAndYearPresentation = presentation === 'year' || presentation === 'month' || presentation === 'month-year';
|
2084
1584
|
const shouldShowMonthAndYear = showMonthAndYear || isMonthAndYearPresentation;
|
2085
|
-
|
1585
|
+
const monthYearPickerOpen = showMonthAndYear && !isMonthAndYearPresentation;
|
1586
|
+
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
1587
|
+
const hasWheelVariant = hasDatePresentation && preferWheel;
|
1588
|
+
const hasGrid = hasDatePresentation && !preferWheel;
|
1589
|
+
helpers.renderHiddenInput(true, el, name, parse.formatValue(value), disabled);
|
2086
1590
|
return (index.h(index.Host, { "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, theme.createColorClasses(color, {
|
2087
1591
|
[mode]: true,
|
2088
1592
|
['datetime-presented']: isPresented,
|
2089
1593
|
['datetime-readonly']: readonly,
|
2090
1594
|
['datetime-disabled']: disabled,
|
2091
1595
|
'show-month-and-year': shouldShowMonthAndYear,
|
1596
|
+
'month-year-picker-open': monthYearPickerOpen,
|
2092
1597
|
[`datetime-presentation-${presentation}`]: true,
|
2093
|
-
[`datetime-size-${size}`]: true
|
1598
|
+
[`datetime-size-${size}`]: true,
|
1599
|
+
[`datetime-prefer-wheel`]: hasWheelVariant,
|
1600
|
+
[`datetime-grid`]: hasGrid,
|
2094
1601
|
})) }, this.renderDatetime(mode)));
|
2095
1602
|
}
|
2096
1603
|
get el() { return index.getElement(this); }
|