@amwaljs/checkout-button 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/checkout/checkout.esm.js +1 -1
- package/dist/checkout/{p-c03b6161.entry.js → p-00045a8c.entry.js} +1 -1
- package/dist/checkout/p-01bbe74f.entry.js +1 -0
- package/dist/checkout/p-051412fa.entry.js +1 -0
- package/dist/checkout/p-09cbe586.entry.js +4 -0
- package/dist/checkout/{p-439ad699.entry.js → p-0a85a01f.entry.js} +2 -2
- package/dist/checkout/{p-d5652cd4.entry.js → p-0bbfeb3c.entry.js} +1 -1
- package/dist/checkout/{p-4ae1a390.entry.js → p-0d96b482.entry.js} +1 -1
- package/dist/checkout/{p-DUa_5Mmb.js → p-0f03cd28.js} +2 -2
- package/dist/checkout/p-104d7733.entry.js +1 -0
- package/dist/checkout/{p-8036cf49.entry.js → p-10ad151a.entry.js} +5 -5
- package/dist/checkout/p-112455b1.js +1 -0
- package/dist/checkout/p-11beffea.entry.js +1 -0
- package/dist/checkout/p-13245fd4.js +1 -0
- package/dist/checkout/p-13741a94.entry.js +1 -0
- package/dist/checkout/p-14ea2c82.entry.js +1 -0
- package/dist/checkout/p-167dc7a7.entry.js +4 -0
- package/dist/checkout/p-1a749b59.entry.js +1 -0
- package/dist/checkout/p-1c718939.entry.js +1 -0
- package/dist/checkout/{p-11205aeb.entry.js → p-1cbb13f2.entry.js} +1 -1
- package/dist/checkout/{p-46ff73b3.entry.js → p-20df5234.entry.js} +1 -1
- package/dist/checkout/p-24068b1c.entry.js +1 -0
- package/dist/checkout/{p-7006753a.entry.js → p-28ccecc7.entry.js} +2 -2
- package/dist/checkout/p-361649c3.js +4 -0
- package/dist/{components/p-DoR35tr_.js → checkout/p-39ad94cf.js} +2 -2
- package/dist/checkout/p-3b75b22a.js +5 -0
- package/dist/checkout/p-3b80783d.js +8 -0
- package/dist/checkout/p-3d3eefc3.js +4 -0
- package/dist/checkout/p-3e1e3453.js +4 -0
- package/dist/checkout/p-3e681e57.js +4 -0
- package/dist/checkout/{p-bf933eb6.entry.js → p-3e8da476.entry.js} +1 -1
- package/dist/checkout/{p-1dc08181.entry.js → p-4028c0d2.entry.js} +1 -1
- package/dist/checkout/p-44c91c42.entry.js +1 -0
- package/dist/checkout/p-464f5a60.entry.js +1 -0
- package/dist/checkout/p-46b7ee7f.entry.js +1 -0
- package/dist/checkout/p-48784250.entry.js +1 -0
- package/dist/{components/p-wiOwkFtc.js → checkout/p-4be20bf2.js} +1 -1
- package/dist/{components/p-Dl_WhQZu.js → checkout/p-4f78d3a0.js} +2 -2
- package/dist/checkout/{p-4da4ecc4.entry.js → p-529bce3f.entry.js} +1 -1
- package/dist/checkout/p-536a0294.js +4 -0
- package/dist/checkout/{p-eae2d3f2.entry.js → p-5eecd5ef.entry.js} +1 -1
- package/dist/checkout/p-64257c8d.entry.js +1 -0
- package/dist/checkout/{p-5903b3af.entry.js → p-64bd1dd3.entry.js} +1 -1
- package/dist/checkout/{p-9b7d7231.entry.js → p-68a4caba.entry.js} +1 -1
- package/dist/checkout/{p-978b3762.entry.js → p-69242ed6.entry.js} +1 -1
- package/dist/checkout/{p-62b7c8b0.entry.js → p-6d886d7e.entry.js} +1 -1
- package/dist/checkout/{p-ofaUly0p.js → p-6fa979e3.js} +2 -2
- package/dist/checkout/p-6fb474f3.entry.js +1 -0
- package/dist/checkout/p-77104220.js +7 -0
- package/dist/checkout/{p-aba43d04.entry.js → p-79ec3e4b.entry.js} +1 -1
- package/dist/checkout/{p-cd2c344b.entry.js → p-7b51bf67.entry.js} +2 -2
- package/dist/checkout/p-7f0004c9.js +4 -0
- package/dist/checkout/p-7fe50ab4.entry.js +1 -0
- package/dist/checkout/p-880b451c.entry.js +4 -0
- package/dist/checkout/p-886dad62.entry.js +1 -0
- package/dist/checkout/p-886e8746.entry.js +1 -0
- package/dist/checkout/p-88abdf59.js +4 -0
- package/dist/checkout/{p-f845e91b.entry.js → p-8a97a411.entry.js} +1 -1
- package/dist/checkout/p-8af3c6cc.entry.js +1 -0
- package/dist/checkout/{p-8b015c21.entry.js → p-8c022f5d.entry.js} +1 -1
- package/dist/checkout/{p-56e307eb.entry.js → p-91855eae.entry.js} +1 -1
- package/dist/checkout/{p-ca257d45.entry.js → p-9185e55b.entry.js} +1 -1
- package/dist/checkout/{p-4b34896c.entry.js → p-926eda98.entry.js} +1 -1
- package/dist/checkout/p-93e5b313.entry.js +4 -0
- package/dist/checkout/{p-4a86b731.entry.js → p-97024acb.entry.js} +1 -1
- package/dist/checkout/p-99e447f9.js +1 -0
- package/dist/{components/p-BgOwfqIY.js → checkout/p-9b519de5.js} +2 -2
- package/dist/checkout/{p-b8245f6a.entry.js → p-9b65a6e5.entry.js} +1 -1
- package/dist/checkout/{p-53ae9dd0.entry.js → p-9cc1fdfb.entry.js} +1 -1
- package/dist/checkout/{p-8fc1287a.entry.js → p-9f26fb71.entry.js} +1 -1
- package/dist/checkout/p-9f41a631.entry.js +1 -0
- package/dist/checkout/{p-5f005b5e.entry.js → p-a2ce8858.entry.js} +1 -1
- package/dist/checkout/{p-e4d0702d.entry.js → p-a3fca65c.entry.js} +1 -1
- package/dist/checkout/{p-d370e756.entry.js → p-a6056eb1.entry.js} +2 -2
- package/dist/checkout/{p-c929d6ea.entry.js → p-a7b2cbb9.entry.js} +1 -1
- package/dist/{components/p-Dwo-QLgs.js → checkout/p-ab16e6ce.js} +1 -1
- package/dist/checkout/{p-63db3363.entry.js → p-ab9a18c4.entry.js} +1 -1
- package/dist/checkout/p-b038db20.js +4 -0
- package/dist/checkout/p-b4ad8642.entry.js +1 -0
- package/dist/checkout/p-b4cf78ad.entry.js +1 -0
- package/dist/checkout/p-b7be2ec0.js +4 -0
- package/dist/checkout/p-b84d9e44.js +4 -0
- package/dist/{components/p-CwRU9ccI.js → checkout/p-b8fdd517.js} +1 -1
- package/dist/checkout/{p-d799009b.entry.js → p-b9d8ab12.entry.js} +1 -1
- package/dist/checkout/p-bb1f698e.js +4 -0
- package/dist/checkout/p-bd17be25.js +4 -0
- package/dist/checkout/p-bd4df0bc.entry.js +1 -0
- package/dist/checkout/p-c152bdea.js +4 -0
- package/dist/checkout/{p-f22v7XAM.js → p-c30e2b28.js} +2 -2
- package/dist/checkout/{p-c2296aa1.entry.js → p-c61a3d5d.entry.js} +1 -1
- package/dist/checkout/p-c6ee4bb6.entry.js +1 -0
- package/dist/checkout/p-c771a565.entry.js +1 -0
- package/dist/checkout/{p-3c9a8bee.entry.js → p-c82b2823.entry.js} +1 -1
- package/dist/checkout/p-c8f7d1b5.entry.js +1 -0
- package/dist/checkout/p-ceef30cd.entry.js +1 -0
- package/dist/checkout/p-d5733333.entry.js +1 -0
- package/dist/checkout/p-d5bba69c.entry.js +1 -0
- package/dist/checkout/p-d60b2328.js +4 -0
- package/dist/checkout/p-d60e05e2.entry.js +1 -0
- package/dist/checkout/p-d6b04157.entry.js +1 -0
- package/dist/checkout/p-d7a430bf.js +2 -0
- package/dist/checkout/{p-B3WORC1a.js → p-d839c693.js} +1 -1
- package/dist/checkout/{p-141f2eab.entry.js → p-d9dfb3ae.entry.js} +3 -3
- package/dist/checkout/p-dc51d318.js +5 -0
- package/dist/checkout/p-ddbe30b8.entry.js +1 -0
- package/dist/checkout/p-de418dd1.entry.js +1 -0
- package/dist/checkout/{p-b4000357.entry.js → p-defa5f72.entry.js} +2 -2
- package/dist/checkout/{p-b90c064e.entry.js → p-df0fa5e1.entry.js} +2 -2
- package/dist/checkout/{p-c8740acc.entry.js → p-e0f073f1.entry.js} +3 -3
- package/dist/checkout/p-e237d611.entry.js +1 -0
- package/dist/checkout/p-ea71fb8d.entry.js +1 -0
- package/dist/checkout/{p-95563c4c.entry.js → p-eda93a0b.entry.js} +1 -1
- package/dist/checkout/p-eee05053.entry.js +1 -0
- package/dist/checkout/{p-95431a73.entry.js → p-f8460dc4.entry.js} +1 -1
- package/dist/checkout/p-f875507d.entry.js +1 -0
- package/dist/checkout/p-faf06441.js +4 -0
- package/dist/checkout/p-fb147065.entry.js +1 -0
- package/dist/checkout/{p-af32124b.entry.js → p-fb45cdd1.entry.js} +1 -1
- package/dist/cjs/_commonjsHelpers-537d719a.js +20 -0
- package/dist/cjs/amwal-checkout-button_5.cjs.entry.js +1298 -2881
- package/dist/cjs/amwal-installments-guide.cjs.entry.js +42 -43
- package/dist/cjs/amwal-pos.cjs.entry.js +3180 -3452
- package/dist/cjs/amwal-widget-modal.cjs.entry.js +162 -175
- package/dist/cjs/amwal-widget.cjs.entry.js +314 -343
- package/dist/cjs/{animation-BhN-MT4J.js → animation-26241cb2.js} +2 -2
- package/dist/cjs/{app-globals-NtXImkuk.js → app-globals-42a13029.js} +1 -1
- package/dist/cjs/{ar-CbT6TM-Q.js → ar-3a6829a4.js} +10 -4
- package/dist/cjs/{capacitor-CqhugS19.js → capacitor-a9365f60.js} +1 -1
- package/dist/cjs/checkout.cjs.js +19 -16
- package/dist/cjs/{data-UgkxeXMB.js → data-19081291.js} +1 -1
- package/dist/cjs/{form-controller-DRf0gBOg.js → form-controller-3ffb27b1.js} +1 -1
- package/dist/cjs/{framework-delegate-D-6PUvOi.js → framework-delegate-ab2cc190.js} +1 -1
- package/dist/cjs/{gesture-controller-IMq9Cgi2.js → gesture-controller-b1c0efac.js} +1 -1
- package/dist/cjs/{haptic-CC9tl6g8.js → haptic-80174512.js} +1 -1
- package/dist/cjs/{hardware-back-button-C2D2eOk8.js → hardware-back-button-ddfefd22.js} +3 -3
- package/dist/cjs/{helpers-B4vhh9gt.js → helpers-72ba682d.js} +4 -1
- package/dist/cjs/i18n-18ad02d5.js +13 -0
- package/dist/cjs/{index-CKcQE8Zg.js → index-0d0b84fb.js} +4 -3
- package/dist/cjs/{index-6eOg4xTk.js → index-2602a653.js} +0 -1
- package/dist/cjs/{index-DZA7ogU0.js → index-2cd1a895.js} +4 -4
- package/dist/cjs/index-7522b3a9.js +2256 -0
- package/dist/cjs/{index-bc_r9XRf.js → index-9b7d2c31.js} +9 -9
- package/dist/cjs/{index-q1ImtF5k.js → index-ce06e6a3.js} +3 -3
- package/dist/cjs/{index-XMjUjboS.js → index-da554121.js} +3 -3
- package/dist/cjs/{input-shims-CCRbO2DB.js → input-shims-1a8ed779.js} +6 -6
- package/dist/cjs/{input.utils-CyVgmmWQ.js → input.utils-67143876.js} +3 -3
- package/dist/cjs/ion-accordion-group.cjs.entry.js +199 -203
- package/dist/cjs/ion-accordion.cjs.entry.js +305 -305
- package/dist/cjs/ion-action-sheet_3.cjs.entry.js +695 -705
- package/dist/cjs/ion-app.cjs.entry.js +95 -93
- package/dist/cjs/ion-avatar.cjs.entry.js +14 -12
- package/dist/cjs/ion-back-button.cjs.entry.js +78 -76
- package/dist/cjs/ion-backdrop.cjs.entry.js +44 -42
- package/dist/cjs/ion-badge.cjs.entry.js +19 -17
- package/dist/cjs/ion-breadcrumb.cjs.entry.js +86 -84
- package/dist/cjs/ion-breadcrumbs.cjs.entry.js +120 -124
- package/dist/cjs/ion-buttons_3.cjs.entry.js +822 -822
- package/dist/cjs/ion-card-content.cjs.entry.js +19 -17
- package/dist/cjs/ion-card-header.cjs.entry.js +22 -20
- package/dist/cjs/ion-card-subtitle.cjs.entry.js +20 -18
- package/dist/cjs/ion-card-title.cjs.entry.js +20 -18
- package/dist/cjs/ion-card.cjs.entry.js +55 -53
- package/dist/cjs/ion-checkbox_7.cjs.entry.js +862 -882
- package/dist/cjs/ion-chip.cjs.entry.js +24 -22
- package/dist/cjs/ion-col.cjs.entry.js +110 -108
- package/dist/cjs/ion-content.cjs.entry.js +376 -374
- package/dist/cjs/ion-datetime-button.cjs.entry.js +330 -328
- package/dist/cjs/ion-datetime.cjs.entry.js +1547 -1567
- package/dist/cjs/ion-fab-button.cjs.entry.js +78 -76
- package/dist/cjs/ion-fab-list.cjs.entry.js +31 -31
- package/dist/cjs/ion-fab.cjs.entry.js +58 -58
- package/dist/cjs/ion-footer.cjs.entry.js +94 -92
- package/dist/cjs/ion-grid.cjs.entry.js +17 -15
- package/dist/cjs/ion-header.cjs.entry.js +143 -141
- package/dist/cjs/ion-icon.cjs.entry.js +104 -112
- package/dist/cjs/ion-img.cjs.entry.js +83 -83
- package/dist/cjs/ion-infinite-scroll-content.cjs.entry.js +34 -32
- package/dist/cjs/ion-infinite-scroll.cjs.entry.js +174 -176
- package/dist/cjs/ion-input.cjs.entry.js +447 -453
- package/dist/cjs/ion-item-divider.cjs.entry.js +23 -21
- package/dist/cjs/ion-item-group.cjs.entry.js +20 -18
- package/dist/cjs/ion-item-option.cjs.entry.js +45 -43
- package/dist/cjs/ion-item-options.cjs.entry.js +40 -38
- package/dist/cjs/ion-item-sliding.cjs.entry.js +391 -391
- package/dist/cjs/ion-loading.cjs.entry.js +162 -164
- package/dist/cjs/ion-menu-button.cjs.entry.js +60 -58
- package/dist/cjs/ion-menu-toggle.cjs.entry.js +36 -34
- package/dist/cjs/ion-menu.cjs.entry.js +606 -612
- package/dist/cjs/ion-modal.cjs.entry.js +551 -553
- package/dist/cjs/ion-nav-link.cjs.entry.js +17 -15
- package/dist/cjs/ion-nav.cjs.entry.js +823 -825
- package/dist/cjs/ion-note.cjs.entry.js +19 -17
- package/dist/cjs/ion-picker-column.cjs.entry.js +327 -327
- package/dist/cjs/ion-picker.cjs.entry.js +198 -200
- package/dist/cjs/ion-popover.cjs.entry.js +326 -330
- package/dist/cjs/ion-progress-bar.cjs.entry.js +44 -42
- package/dist/cjs/ion-range.cjs.entry.js +644 -654
- package/dist/cjs/ion-refresher-content.cjs.entry.js +53 -51
- package/dist/cjs/ion-refresher.cjs.entry.js +586 -586
- package/dist/cjs/ion-reorder-group.cjs.entry.js +252 -252
- package/dist/cjs/ion-reorder.cjs.entry.js +26 -24
- package/dist/cjs/ion-route-redirect.cjs.entry.js +19 -21
- package/dist/cjs/ion-route.cjs.entry.js +37 -41
- package/dist/cjs/ion-router-link.cjs.entry.js +31 -29
- package/dist/cjs/ion-router-outlet.cjs.entry.js +178 -178
- package/dist/cjs/ion-router.cjs.entry.js +266 -264
- package/dist/cjs/ion-row.cjs.entry.js +12 -10
- package/dist/cjs/ion-searchbar.cjs.entry.js +388 -396
- package/dist/cjs/ion-segment-button.cjs.entry.js +96 -96
- package/dist/cjs/ion-segment.cjs.entry.js +414 -420
- package/dist/cjs/ion-select-option.cjs.entry.js +16 -14
- package/dist/cjs/ion-select.cjs.entry.js +693 -699
- package/dist/cjs/ion-skeleton-text.cjs.entry.js +35 -33
- package/dist/cjs/ion-spinner.cjs.entry.js +50 -48
- package/dist/cjs/ion-split-pane.cjs.entry.js +120 -124
- package/dist/cjs/ion-tab-bar.cjs.entry.js +66 -66
- package/dist/cjs/ion-tab-button.cjs.entry.js +82 -80
- package/dist/cjs/ion-tab.cjs.entry.js +50 -50
- package/dist/cjs/ion-tabs.cjs.entry.js +134 -132
- package/dist/cjs/ion-textarea.cjs.entry.js +396 -400
- package/dist/cjs/ion-thumbnail.cjs.entry.js +12 -10
- package/dist/cjs/ion-title.cjs.entry.js +43 -43
- package/dist/cjs/ion-toast.cjs.entry.js +371 -375
- package/dist/cjs/ion-toggle.cjs.entry.js +230 -230
- package/dist/cjs/ion-toolbar.cjs.entry.js +61 -59
- package/dist/cjs/{ionic-global-DRLi5Iq3.js → ionic-global-3915f1f1.js} +55 -58
- package/dist/cjs/{ios.transition-D4vyO_a_.js → ios.transition-b9c0b967.js} +5 -5
- package/dist/cjs/{keyboard-iyHR2ZF4.js → keyboard-5d4b83b3.js} +3 -3
- package/dist/cjs/{keyboard-DuKzsHsS.js → keyboard-bc8ebbf7.js} +1 -1
- package/dist/cjs/{keyboard-controller-rH21qC_2.js → keyboard-controller-c6633754.js} +2 -2
- package/dist/cjs/loader.cjs.js +19 -8
- package/dist/cjs/{md.transition-Dkxy3kpE.js → md.transition-830acbb7.js} +5 -5
- package/dist/cjs/{menu-toggle-util-CmPuayU0.js → menu-toggle-util-315c26b3.js} +1 -1
- package/dist/cjs/{notch-controller-Dtpow1eD.js → notch-controller-dcf09601.js} +2 -2
- package/dist/cjs/{overlays-Bc8tk6t5.js → overlays-08819e3f.js} +6 -6
- package/dist/cjs/{refresher.utils-CPl6gciv.js → refresher.utils-e41509f7.js} +3 -3
- package/dist/cjs/{status-tap-XtIhF72O.js → status-tap-ec021cb4.js} +4 -4
- package/dist/cjs/{swipe-back-C9j0kufI.js → swipe-back-3d3a5129.js} +4 -4
- package/dist/collection/collection-manifest.json +8 -8
- package/dist/collection/components/amwal-checkout-button/amwal-checkout-button.js +1714 -1888
- package/dist/collection/components/amwal-checkout-button/amwal-checkout-button.stories.js +84 -84
- package/dist/collection/components/amwal-installments-guide/amwal-installments-guide.js +75 -80
- package/dist/collection/components/amwal-installments-guide/amwal-installments-guide.stories.js +25 -25
- package/dist/collection/components/amwal-installments-timeline/amwal-installments-timeline.js +506 -569
- package/dist/collection/components/amwal-installments-timeline/amwal-installments-timeline.stories.js +80 -80
- package/dist/collection/components/amwal-pos/amwal-pos.js +1022 -1094
- package/dist/collection/components/amwal-pos/amwal-pos.stories.js +209 -209
- package/dist/collection/components/amwal-widget/amwal-widget-modal.js +326 -350
- package/dist/collection/components/amwal-widget/amwal-widget.js +673 -736
- package/dist/collection/components/amwal-widget/amwal-widget.stories.js +184 -184
- package/dist/collection/lang/i18n.js +7 -7
- package/dist/components/amwal-checkout-button.d.ts +2 -2
- package/dist/components/amwal-checkout-button.js +3811 -1
- package/dist/components/amwal-installments-guide.d.ts +2 -2
- package/dist/components/amwal-installments-guide.js +75 -1
- package/dist/components/amwal-installments-timeline.d.ts +2 -2
- package/dist/components/amwal-installments-timeline.js +6 -1
- package/dist/components/amwal-pos.d.ts +2 -2
- package/dist/components/amwal-pos.js +3391 -1
- package/dist/components/amwal-widget-modal.d.ts +2 -2
- package/dist/components/amwal-widget-modal.js +6 -1
- package/dist/components/amwal-widget.d.ts +2 -2
- package/dist/components/amwal-widget.js +389 -1
- package/dist/components/index.d.ts +0 -6
- package/dist/components/index.js +6 -1
- package/dist/components/ion-accordion-group.js +248 -1
- package/dist/components/ion-accordion.js +353 -1
- package/dist/components/ion-action-sheet.js +6 -1
- package/dist/components/ion-alert.js +6 -1
- package/dist/components/ion-app.js +125 -1
- package/dist/components/ion-avatar.js +39 -1
- package/dist/components/ion-back-button.js +127 -1
- package/dist/components/ion-backdrop.js +6 -1
- package/dist/components/ion-badge.js +46 -1
- package/dist/components/ion-breadcrumb.js +131 -1
- package/dist/components/ion-breadcrumbs.js +152 -1
- package/dist/components/ion-button.js +6 -1
- package/dist/components/ion-buttons.js +6 -1
- package/dist/components/ion-card-content.js +43 -1
- package/dist/components/ion-card-header.js +50 -1
- package/dist/components/ion-card-subtitle.js +47 -1
- package/dist/components/ion-card-title.js +47 -1
- package/dist/components/ion-card.js +98 -1
- package/dist/components/ion-checkbox.js +6 -1
- package/dist/components/ion-chip.js +59 -1
- package/dist/components/ion-col.js +186 -2
- package/dist/components/ion-content.js +440 -1
- package/dist/components/ion-datetime-button.js +378 -1
- package/dist/components/ion-datetime.js +1961 -2
- package/dist/components/ion-fab-button.js +130 -1
- package/dist/components/ion-fab-list.js +56 -1
- package/dist/components/ion-fab.js +90 -1
- package/dist/components/ion-footer.js +152 -2
- package/dist/components/ion-grid.js +41 -1
- package/dist/components/ion-header.js +356 -2
- package/dist/components/ion-icon.js +6 -1
- package/dist/components/ion-img.js +124 -1
- package/dist/components/ion-infinite-scroll-content.js +69 -1
- package/dist/components/ion-infinite-scroll.js +209 -1
- package/dist/components/ion-input.js +564 -1
- package/dist/components/ion-item-divider.js +51 -1
- package/dist/components/ion-item-group.js +44 -1
- package/dist/components/ion-item-option.js +85 -1
- package/dist/components/ion-item-options.js +67 -1
- package/dist/components/ion-item-sliding.js +449 -1
- package/dist/components/ion-item.js +6 -1
- package/dist/components/ion-label.js +6 -1
- package/dist/components/ion-list-header.js +6 -1
- package/dist/components/ion-list.js +6 -1
- package/dist/components/ion-loading.js +325 -3
- package/dist/components/ion-menu-button.js +100 -1
- package/dist/components/ion-menu-toggle.js +57 -1
- package/dist/components/ion-menu.js +679 -1
- package/dist/components/ion-modal.js +1775 -3
- package/dist/components/ion-nav-link.js +63 -2
- package/dist/components/ion-nav.js +945 -2
- package/dist/components/ion-note.js +6 -1
- package/dist/components/ion-picker-column-internal.js +6 -1
- package/dist/components/ion-picker-column.js +6 -1
- package/dist/components/ion-picker-internal.js +6 -1
- package/dist/components/ion-picker.js +317 -3
- package/dist/components/ion-popover.js +6 -1
- package/dist/components/ion-progress-bar.js +79 -1
- package/dist/components/ion-radio-group.js +6 -1
- package/dist/components/ion-radio.js +6 -1
- package/dist/components/ion-range.js +778 -2
- package/dist/components/ion-refresher-content.js +90 -1
- package/dist/components/ion-refresher.js +652 -1
- package/dist/components/ion-reorder-group.js +300 -1
- package/dist/components/ion-reorder.js +58 -1
- package/dist/components/ion-ripple-effect.js +6 -1
- package/dist/components/ion-route-redirect.js +42 -1
- package/dist/components/ion-route.js +66 -1
- package/dist/components/ion-router-link.js +60 -1
- package/dist/components/ion-router-outlet.js +219 -1
- package/dist/components/ion-router.js +833 -3
- package/dist/components/ion-row.js +34 -1
- package/dist/components/ion-searchbar.js +472 -1
- package/dist/components/ion-segment-button.js +139 -1
- package/dist/components/ion-segment.js +472 -1
- package/dist/components/ion-select-option.js +42 -1
- package/dist/components/ion-select-popover.js +6 -1
- package/dist/components/ion-select.js +864 -1
- package/dist/components/ion-skeleton-text.js +59 -1
- package/dist/components/ion-spinner.js +6 -1
- package/dist/components/ion-split-pane.js +166 -1
- package/dist/components/ion-tab-bar.js +95 -1
- package/dist/components/ion-tab-button.js +125 -1
- package/dist/components/ion-tab.js +80 -1
- package/dist/components/ion-tabs.js +176 -1
- package/dist/components/ion-text.js +6 -1
- package/dist/components/ion-textarea.js +496 -1
- package/dist/components/ion-thumbnail.js +34 -1
- package/dist/components/ion-title.js +71 -1
- package/dist/components/ion-toast.js +914 -3
- package/dist/components/ion-toggle.js +282 -1
- package/dist/components/ion-toolbar.js +91 -1
- package/dist/components/p-01b49f83.js +269 -0
- package/dist/{esm/ios.transition-DMsViooj.js → components/p-02b77441.js} +2 -5
- package/dist/components/p-02bc6b21.js +203 -0
- package/dist/components/p-031ed92d.js +389 -0
- package/dist/components/p-03803c7d.js +369 -0
- package/dist/components/p-089e034e.js +234 -0
- package/dist/components/p-0dc7a5ff.js +512 -0
- package/dist/components/p-110f8490.js +566 -0
- package/dist/components/p-112455b1.js +17 -0
- package/dist/{esm/index-BMJhFU53.js → components/p-1596e301.js} +4 -4
- package/dist/components/p-1785e30a.js +318 -0
- package/dist/{esm/helpers-C6kqtbmV.js → components/p-2bb89b46.js} +5 -2
- package/dist/components/p-2d7d745d.js +224 -0
- package/dist/components/p-2fc99fef.js +262 -0
- package/dist/{esm/input-shims-DSFPFhb7.js → components/p-3296ebd9.js} +4 -6
- package/dist/{esm/data-Cl-_yBA0.js → components/p-39ad94cf.js} +2 -2
- package/dist/{esm/capacitor-CG3xQUND.js → components/p-3d3eefc3.js} +1 -1
- package/dist/{esm/form-controller-xetTxjL6.js → components/p-3e1d2896.js} +1 -1
- package/dist/{esm/keyboard-controller-CqGCg8tB.js → components/p-3e1e3453.js} +2 -2
- package/dist/{esm/md.transition-BQT2r4ED.js → components/p-503328f2.js} +2 -5
- package/dist/components/p-51c44f42.js +98 -0
- package/dist/components/p-5280b372.js +42 -0
- package/dist/{esm/index-DuUXGZp2.js → components/p-53e2dbe4.js} +3 -3
- package/dist/components/p-5441c730.js +851 -0
- package/dist/{esm/refresher.utils-D4tPnZsM.js → components/p-74e68924.js} +4 -4
- package/dist/{esm/framework-delegate-D_uGiYYw.js → components/p-76525f0f.js} +1 -1
- package/dist/{esm/index-CcopIPA0.js → components/p-77104220.js} +6 -4
- package/dist/components/p-77ccb793.js +185 -0
- package/dist/components/p-83e529db.js +380 -0
- package/dist/{esm/animation-DRf3dwMu.js → components/p-89c4c5cb.js} +2 -2
- package/dist/components/p-8b3d1e06.js +67 -0
- package/dist/components/p-901c16c5.js +210 -0
- package/dist/components/p-93e2a608.js +374 -0
- package/dist/components/p-95c79593.js +43 -0
- package/dist/components/p-96073863.js +82 -0
- package/dist/components/p-99e447f9.js +13 -0
- package/dist/{esm/keyboard-DgiyREKb.js → components/p-9b519de5.js} +1 -1
- package/dist/{esm/input.utils-BuIvhxo3.js → components/p-9d350d61.js} +3 -3
- package/dist/{esm/notch-controller-CQeDnZLe.js → components/p-9df67c24.js} +2 -2
- package/dist/components/p-a0e691dd.js +39 -0
- package/dist/components/p-ab10d1ae.js +47 -0
- package/dist/components/p-abc01c5d.js +194 -0
- package/dist/components/p-abd248d1.js +196 -0
- package/dist/{esm/haptic-D5jGzBs8.js → components/p-af073aaf.js} +2 -2
- package/dist/{esm/swipe-back-DE05lWQD.js → components/p-b32529b9.js} +3 -4
- package/dist/{esm/index-C75BfBAE.js → components/p-b8fdd517.js} +1 -2
- package/dist/components/p-cebc113f.js +38 -0
- package/dist/components/p-d25fd077.js +331 -0
- package/dist/{esm/menu-toggle-util-wdO31cdC.js → components/p-d3596f64.js} +1 -1
- package/dist/{esm/keyboard-DcbqYXj5.js → components/p-d60b2328.js} +1 -3
- package/dist/components/p-d69dc32f.js +97 -0
- package/dist/{esm/hardware-back-button-CzxcJiYO.js → components/p-d72e8d7b.js} +2 -3
- package/dist/{esm/ar-B3WORC1a.js → components/p-d839c693.js} +12 -5
- package/dist/{esm/index-D8d_89Nl.js → components/p-e187a77c.js} +1 -1
- package/dist/components/p-e65ea9fb.js +1379 -0
- package/dist/components/p-ec0e3f3f.js +2040 -0
- package/dist/components/p-ecb4db1c.js +64 -0
- package/dist/{esm/gesture-controller-CukVBo5-.js → components/p-f728a68f.js} +1 -1
- package/dist/components/p-f7e3c502.js +73 -0
- package/dist/components/p-fe463a42.js +272 -0
- package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
- package/dist/esm/amwal-checkout-button_5.entry.js +1296 -2881
- package/dist/esm/amwal-installments-guide.entry.js +40 -43
- package/dist/esm/amwal-pos.entry.js +3178 -3452
- package/dist/esm/amwal-widget-modal.entry.js +160 -175
- package/dist/esm/amwal-widget.entry.js +312 -343
- package/dist/esm/animation-a6d5c3b1.js +1063 -0
- package/dist/esm/{app-globals-BHnkZZiH.js → app-globals-c817b28b.js} +1 -1
- package/dist/esm/ar-7d2629bf.js +51 -0
- package/dist/esm/capacitor-ba4337da.js +13 -0
- package/dist/esm/checkout.js +18 -16
- package/dist/esm/config-8e06237c.js +171 -0
- package/dist/esm/cubic-bezier-874f336d.js +90 -0
- package/dist/esm/data-8916315d.js +1628 -0
- package/dist/esm/dir-1d4aa386.js +18 -0
- package/dist/esm/focus-visible-32968d3d.js +75 -0
- package/dist/esm/form-controller-b1aa7393.js +64 -0
- package/dist/esm/framework-delegate-de1aa369.js +140 -0
- package/dist/esm/gesture-controller-58ffa500.js +195 -0
- package/dist/esm/haptic-4d4d8eb1.js +206 -0
- package/dist/esm/hardware-back-button-f93acff0.js +116 -0
- package/dist/esm/helpers-f0dcbd72.js +418 -0
- package/dist/esm/i18n-53f85411.js +13 -0
- package/dist/esm/{index-CNcx43L8.js → index-0b560278.js} +4 -4
- package/dist/esm/index-5894dd63.js +196 -0
- package/dist/esm/{index-DUF6JAQL.js → index-5a126e54.js} +6 -6
- package/dist/esm/index-5e663431.js +128 -0
- package/dist/esm/index-8cc94b11.js +2219 -0
- package/dist/esm/index-afdf867c.js +26 -0
- package/dist/esm/index-d9b41a43.js +34 -0
- package/dist/esm/index-f6dce931.js +466 -0
- package/dist/esm/index-fb97e55c.js +7 -0
- package/dist/esm/input-shims-75d4750d.js +617 -0
- package/dist/esm/input.utils-79bde07f.js +138 -0
- package/dist/esm/ion-accordion-group.entry.js +197 -203
- package/dist/esm/ion-accordion.entry.js +303 -305
- package/dist/esm/ion-action-sheet_3.entry.js +693 -705
- package/dist/esm/ion-app.entry.js +93 -93
- package/dist/esm/ion-avatar.entry.js +12 -12
- package/dist/esm/ion-back-button.entry.js +76 -76
- package/dist/esm/ion-backdrop.entry.js +42 -42
- package/dist/esm/ion-badge.entry.js +17 -17
- package/dist/esm/ion-breadcrumb.entry.js +84 -84
- package/dist/esm/ion-breadcrumbs.entry.js +118 -124
- package/dist/esm/ion-buttons_3.entry.js +820 -822
- package/dist/esm/ion-card-content.entry.js +17 -17
- package/dist/esm/ion-card-header.entry.js +20 -20
- package/dist/esm/ion-card-subtitle.entry.js +18 -18
- package/dist/esm/ion-card-title.entry.js +18 -18
- package/dist/esm/ion-card.entry.js +53 -53
- package/dist/esm/ion-checkbox_7.entry.js +860 -882
- package/dist/esm/ion-chip.entry.js +22 -22
- package/dist/esm/ion-col.entry.js +108 -108
- package/dist/esm/ion-content.entry.js +374 -374
- package/dist/esm/ion-datetime-button.entry.js +328 -328
- package/dist/esm/ion-datetime.entry.js +1545 -1567
- package/dist/esm/ion-fab-button.entry.js +76 -76
- package/dist/esm/ion-fab-list.entry.js +29 -31
- package/dist/esm/ion-fab.entry.js +56 -58
- package/dist/esm/ion-footer.entry.js +92 -92
- package/dist/esm/ion-grid.entry.js +15 -15
- package/dist/esm/ion-header.entry.js +141 -141
- package/dist/esm/ion-icon.entry.js +102 -112
- package/dist/esm/ion-img.entry.js +81 -83
- package/dist/esm/ion-infinite-scroll-content.entry.js +32 -32
- package/dist/esm/ion-infinite-scroll.entry.js +172 -176
- package/dist/esm/ion-input.entry.js +445 -453
- package/dist/esm/ion-item-divider.entry.js +21 -21
- package/dist/esm/ion-item-group.entry.js +18 -18
- package/dist/esm/ion-item-option.entry.js +43 -43
- package/dist/esm/ion-item-options.entry.js +38 -38
- package/dist/esm/ion-item-sliding.entry.js +389 -391
- package/dist/esm/ion-loading.entry.js +160 -164
- package/dist/esm/ion-menu-button.entry.js +58 -58
- package/dist/esm/ion-menu-toggle.entry.js +34 -34
- package/dist/esm/ion-menu.entry.js +604 -612
- package/dist/esm/ion-modal.entry.js +549 -553
- package/dist/esm/ion-nav-link.entry.js +15 -15
- package/dist/esm/ion-nav.entry.js +821 -825
- package/dist/esm/ion-note.entry.js +17 -17
- package/dist/esm/ion-picker-column.entry.js +325 -327
- package/dist/esm/ion-picker.entry.js +196 -200
- package/dist/esm/ion-popover.entry.js +324 -330
- package/dist/esm/ion-progress-bar.entry.js +42 -42
- package/dist/esm/ion-range.entry.js +642 -654
- package/dist/esm/ion-refresher-content.entry.js +51 -51
- package/dist/esm/ion-refresher.entry.js +584 -586
- package/dist/esm/ion-reorder-group.entry.js +250 -252
- package/dist/esm/ion-reorder.entry.js +24 -24
- package/dist/esm/ion-route-redirect.entry.js +17 -21
- package/dist/esm/ion-route.entry.js +35 -41
- package/dist/esm/ion-router-link.entry.js +29 -29
- package/dist/esm/ion-router-outlet.entry.js +176 -178
- package/dist/esm/ion-router.entry.js +264 -264
- package/dist/esm/ion-row.entry.js +10 -10
- package/dist/esm/ion-searchbar.entry.js +386 -396
- package/dist/esm/ion-segment-button.entry.js +94 -96
- package/dist/esm/ion-segment.entry.js +412 -420
- package/dist/esm/ion-select-option.entry.js +14 -14
- package/dist/esm/ion-select.entry.js +691 -699
- package/dist/esm/ion-skeleton-text.entry.js +33 -33
- package/dist/esm/ion-spinner.entry.js +48 -48
- package/dist/esm/ion-split-pane.entry.js +118 -124
- package/dist/esm/ion-tab-bar.entry.js +64 -66
- package/dist/esm/ion-tab-button.entry.js +80 -80
- package/dist/esm/ion-tab.entry.js +48 -50
- package/dist/esm/ion-tabs.entry.js +132 -132
- package/dist/esm/ion-textarea.entry.js +394 -400
- package/dist/esm/ion-thumbnail.entry.js +10 -10
- package/dist/esm/ion-title.entry.js +41 -43
- package/dist/esm/ion-toast.entry.js +369 -375
- package/dist/esm/ion-toggle.entry.js +228 -230
- package/dist/esm/ion-toolbar.entry.js +59 -59
- package/dist/esm/{ionic-global-DXXzPLPc.js → ionic-global-0b7766cb.js} +55 -58
- package/dist/esm/ios.transition-22fb53bc.js +651 -0
- package/dist/esm/keyboard-1f073554.js +82 -0
- package/dist/esm/keyboard-96b6e80b.js +146 -0
- package/dist/esm/keyboard-controller-5a2f625f.js +165 -0
- package/dist/esm/loader.js +17 -8
- package/dist/esm/lock-controller-632e3c10.js +38 -0
- package/dist/esm/md.transition-f6ff9834.js +57 -0
- package/dist/esm/menu-toggle-util-594849ff.js +12 -0
- package/dist/esm/notch-controller-d511b3b3.js +153 -0
- package/dist/esm/{overlays-SBLrmFy6.js → overlays-642a91df.js} +7 -7
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/refresher.utils-19137568.js +196 -0
- package/dist/esm/{status-tap-CjxQA4Bj.js → status-tap-bb6959a8.js} +4 -4
- package/dist/esm/swipe-back-6cec4c33.js +79 -0
- package/dist/esm/theme-35c700b7.js +43 -0
- package/dist/esm/watch-options-7bf43687.js +47 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/accordion/accordion.ios.css +193 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/accordion/accordion.md.css +135 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/accordion-group/accordion-group.ios.css +127 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/accordion-group/accordion-group.md.css +229 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/action-sheet/action-sheet.ios.css +456 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/action-sheet/action-sheet.md.css +384 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/alert/alert.ios.css +755 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/alert/alert.md.css +770 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/app/app.css +17 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/avatar/avatar.ios.css +132 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/avatar/avatar.md.css +132 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/back-button/back-button.ios.css +372 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/back-button/back-button.md.css +385 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/backdrop/backdrop.ios.css +136 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/backdrop/backdrop.md.css +136 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/badge/badge.ios.css +168 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/badge/badge.md.css +164 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/breadcrumb/breadcrumb.ios.css +326 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/breadcrumb/breadcrumb.md.css +310 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/breadcrumbs/breadcrumbs.ios.css +81 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/breadcrumbs/breadcrumbs.md.css +80 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/button/button.ios.css +596 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/button/button.md.css +517 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/buttons/buttons.ios.css +279 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/buttons/buttons.md.css +299 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/card/card.ios.css +203 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/card/card.md.css +198 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/card-content/card-content.ios.css +163 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/card-content/card-content.md.css +165 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/card-header/card-header.ios.css +141 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/card-header/card-header.md.css +138 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/card-subtitle/card-subtitle.ios.css +138 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/card-subtitle/card-subtitle.md.css +136 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/card-title/card-title.ios.css +137 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/card-title/card-title.md.css +137 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/checkbox/checkbox.ios.css +536 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/checkbox/checkbox.md.css +552 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/chip/chip.ios.css +212 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/chip/chip.md.css +207 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/col/col.css +200 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/content/content.css +282 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/datetime/datetime.ios.css +850 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/datetime/datetime.md.css +706 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/datetime-button/datetime-button.css +100 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/fab/fab.css +366 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/fab-button/fab-button.ios.css +422 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/fab-button/fab-button.md.css +393 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/fab-list/fab-list.css +240 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/footer/footer.ios.css +146 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/footer/footer.md.css +129 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/grid/grid.css +235 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/header/header.ios.css +250 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/header/header.md.css +133 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/img/img.css +12 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/infinite-scroll/infinite-scroll.css +8 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/infinite-scroll-content/infinite-scroll-content.ios.css +156 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/infinite-scroll-content/infinite-scroll-content.md.css +156 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/input/input.ios.css +833 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/input/input.md.css +1446 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/item/item.ios.css +815 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/item/item.md.css +1187 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/item-divider/item-divider.ios.css +351 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/item-divider/item-divider.md.css +417 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/item-group/item-group.ios.css +114 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/item-group/item-group.md.css +114 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/item-option/item-option.ios.css +242 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/item-option/item-option.md.css +236 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/item-options/item-options.ios.css +287 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/item-options/item-options.md.css +284 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/item-sliding/item-sliding.css +121 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/label/label.ios.css +334 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/label/label.md.css +421 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/list/list.ios.css +242 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/list/list.md.css +287 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/list-header/list-header.ios.css +285 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/list-header/list-header.md.css +266 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/loading/loading.ios.css +205 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/loading/loading.md.css +196 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/menu/menu.ios.css +378 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/menu/menu.md.css +374 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/menu-button/menu-button.ios.css +279 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/menu-button/menu-button.md.css +282 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/menu-toggle/menu-toggle.css +3 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/modal/modal.ios.css +357 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/modal/modal.md.css +272 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/nav/nav.css +64 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/note/note.ios.css +127 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/note/note.md.css +127 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/picker/picker.ios.css +367 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/picker/picker.md.css +354 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/picker-column/picker-column.ios.css +255 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/picker-column/picker-column.md.css +246 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/picker-column-internal/picker-column-internal.ios.css +138 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/picker-column-internal/picker-column-internal.md.css +196 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/picker-internal/picker-internal.ios.css +262 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/picker-internal/picker-internal.md.css +258 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/popover/popover.ios.css +366 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/popover/popover.md.css +266 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/progress-bar/progress-bar.ios.css +261 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/progress-bar/progress-bar.md.css +261 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/radio/radio.ios.css +557 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/radio/radio.md.css +580 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/range/range.ios.css +660 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/range/range.md.css +819 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/refresher/refresher.ios.css +321 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/refresher/refresher.md.css +316 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/reorder/reorder.ios.css +77 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/reorder/reorder.md.css +77 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/reorder-group/reorder-group.css +89 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/ripple-effect/ripple-effect.css +113 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/router-link/router-link.css +84 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/router-outlet/router-outlet.css +64 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/row/row.css +136 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/searchbar/searchbar.ios.css +477 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/searchbar/searchbar.md.css +456 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/segment/segment.ios.css +224 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/segment/segment.md.css +214 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/segment-button/segment-button.ios.css +520 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/segment-button/segment-button.md.css +506 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/select/select.ios.css +787 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/select/select.md.css +1374 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/select-option/select-option.css +3 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/select-popover/select-popover.ios.css +190 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/select-popover/select-popover.md.css +212 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/skeleton-text/skeleton-text.css +108 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/spinner/spinner.css +232 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/split-pane/split-pane.ios.css +265 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/split-pane/split-pane.md.css +265 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/tab/tab.css +4 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/tab-bar/tab-bar.ios.css +252 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/tab-bar/tab-bar.md.css +239 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/tab-button/tab-button.ios.css +477 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/tab-button/tab-button.md.css +501 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/tabs/tabs.css +74 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/text/text.css +58 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/textarea/textarea.ios.css +987 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/textarea/textarea.md.css +1553 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/thumbnail/thumbnail.css +76 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/title/title.ios.css +183 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/title/title.md.css +102 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/toast/toast.ios.css +399 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/toast/toast.md.css +429 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/toggle/toggle.ios.css +680 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/toggle/toggle.md.css +625 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/toolbar/toolbar.ios.css +265 -0
- package/dist/node_modules/@ionic/core/dist/collection/components/toolbar/toolbar.md.css +244 -0
- package/dist/node_modules/ionicons/dist/collection/components/icon/icon.css +144 -0
- package/dist/types/components/amwal-checkout-button/amwal-checkout-button.d.ts +327 -327
- package/dist/types/components/amwal-checkout-button/amwal-checkout-button.stories.d.ts +34 -34
- package/dist/types/components/amwal-installments-guide/amwal-installments-guide.d.ts +14 -14
- package/dist/types/components/amwal-installments-guide/amwal-installments-guide.stories.d.ts +17 -17
- package/dist/types/components/amwal-installments-timeline/amwal-installments-timeline.d.ts +106 -106
- package/dist/types/components/amwal-installments-timeline/amwal-installments-timeline.stories.d.ts +67 -67
- package/dist/types/components/amwal-pos/amwal-pos.d.ts +228 -228
- package/dist/types/components/amwal-pos/amwal-pos.stories.d.ts +185 -185
- package/dist/types/components/amwal-widget/amwal-widget-modal.d.ts +56 -56
- package/dist/types/components/amwal-widget/amwal-widget.d.ts +165 -165
- package/dist/types/components/amwal-widget/amwal-widget.stories.d.ts +101 -101
- package/dist/types/components.d.ts +0 -206
- package/dist/types/lang/i18n.d.ts +1 -1
- package/dist/types/stencil-public-runtime.d.ts +21 -191
- package/loader/cdn.js +3 -1
- package/loader/index.cjs.js +3 -1
- package/loader/index.d.ts +1 -4
- package/loader/index.es2017.js +3 -1
- package/loader/index.js +3 -1
- package/loader/package.json +11 -0
- package/package.json +28 -34
- package/dist/checkout/p-0161d109.entry.js +0 -1
- package/dist/checkout/p-0a8ef1ec.entry.js +0 -1
- package/dist/checkout/p-10a72fbe.entry.js +0 -1
- package/dist/checkout/p-12ed4081.entry.js +0 -1
- package/dist/checkout/p-13c36adc.entry.js +0 -1
- package/dist/checkout/p-194b17d8.entry.js +0 -1
- package/dist/checkout/p-272a1ffd.entry.js +0 -1
- package/dist/checkout/p-307af48b.entry.js +0 -1
- package/dist/checkout/p-3207674d.entry.js +0 -1
- package/dist/checkout/p-3208e56f.entry.js +0 -1
- package/dist/checkout/p-4426eb3b.entry.js +0 -1
- package/dist/checkout/p-458da59f.entry.js +0 -1
- package/dist/checkout/p-46e69508.entry.js +0 -1
- package/dist/checkout/p-49046c16.entry.js +0 -4
- package/dist/checkout/p-53dc0e86.entry.js +0 -1
- package/dist/checkout/p-5a6fc9fd.entry.js +0 -1
- package/dist/checkout/p-5e65653a.entry.js +0 -1
- package/dist/checkout/p-5f124c24.entry.js +0 -1
- package/dist/checkout/p-6a8ad104.entry.js +0 -1
- package/dist/checkout/p-76fb4325.entry.js +0 -1
- package/dist/checkout/p-78db60fb.entry.js +0 -1
- package/dist/checkout/p-8e34a1bb.entry.js +0 -1
- package/dist/checkout/p-91474b10.entry.js +0 -1
- package/dist/checkout/p-93OyAGoo.js +0 -2
- package/dist/checkout/p-94a57258.entry.js +0 -1
- package/dist/checkout/p-BEVStXwd.js +0 -7
- package/dist/checkout/p-BQu7QPd5.js +0 -4
- package/dist/checkout/p-BR7SJd-v.js +0 -4
- package/dist/checkout/p-BcFRJSFv.js +0 -4
- package/dist/checkout/p-BcUxrseY.js +0 -1
- package/dist/checkout/p-BdG893XR.js +0 -4
- package/dist/checkout/p-BgOwfqIY.js +0 -4
- package/dist/checkout/p-Bm9bMvCb.js +0 -4
- package/dist/checkout/p-C03M5ZSM.js +0 -1
- package/dist/checkout/p-C6kqtbmV.js +0 -4
- package/dist/checkout/p-C75BfBAE.js +0 -1
- package/dist/checkout/p-CVrvo9Qz.js +0 -4
- package/dist/checkout/p-ChixdDt6.js +0 -4
- package/dist/checkout/p-Cjnmql4G.js +0 -8
- package/dist/checkout/p-D0I0TqZU.js +0 -4
- package/dist/checkout/p-D2NxOvQ8.js +0 -4
- package/dist/checkout/p-D8d_89Nl.js +0 -4
- package/dist/checkout/p-DAhcxcAh.js +0 -4
- package/dist/checkout/p-DDtPO7yO.js +0 -4
- package/dist/checkout/p-DKg_dYcq.js +0 -4
- package/dist/checkout/p-DMAPbDyG.js +0 -4
- package/dist/checkout/p-DihS-5gH.js +0 -4
- package/dist/checkout/p-DkrNcwKK.js +0 -5
- package/dist/checkout/p-Dzj_jqIY.js +0 -4
- package/dist/checkout/p-E8AXUhZ3.js +0 -7
- package/dist/checkout/p-Ufaww5Lq.js +0 -4
- package/dist/checkout/p-a90efa79.entry.js +0 -1
- package/dist/checkout/p-abd12b84.entry.js +0 -1
- package/dist/checkout/p-abe1becc.entry.js +0 -1
- package/dist/checkout/p-b2f66c60.entry.js +0 -4
- package/dist/checkout/p-b45f5952.entry.js +0 -1
- package/dist/checkout/p-c2240d19.entry.js +0 -1
- package/dist/checkout/p-c28b4374.entry.js +0 -1
- package/dist/checkout/p-cb2db223.entry.js +0 -1
- package/dist/checkout/p-cb3967fc.entry.js +0 -1
- package/dist/checkout/p-cef16f11.entry.js +0 -1
- package/dist/checkout/p-df1b4347.entry.js +0 -4
- package/dist/checkout/p-e4bc42fb.entry.js +0 -1
- package/dist/checkout/p-e785fb8a.entry.js +0 -1
- package/dist/checkout/p-e8bd206a.entry.js +0 -1
- package/dist/checkout/p-ef749875.entry.js +0 -1
- package/dist/checkout/p-f157b6b2.entry.js +0 -4
- package/dist/checkout/p-f351a19a.entry.js +0 -1
- package/dist/checkout/p-ff2e59e3.entry.js +0 -1
- package/dist/checkout/p-hAETByzF.js +0 -5
- package/dist/checkout/p-vn1iXXUO.js +0 -9
- package/dist/cjs/i18n-uGNv9SLK.js +0 -13
- package/dist/cjs/index-DncWzXDA.js +0 -3738
- package/dist/components/p-55BwDerf.js +0 -8
- package/dist/components/p-B-M4K7iJ.js +0 -7
- package/dist/components/p-B-hirT0v.js +0 -4
- package/dist/components/p-B3WORC1a.js +0 -1
- package/dist/components/p-B5XH2zAk.js +0 -1
- package/dist/components/p-B5ZghgSh.js +0 -4
- package/dist/components/p-BEVStXwd.js +0 -7
- package/dist/components/p-BH0TCnxk.js +0 -4
- package/dist/components/p-BIA8A9ZO.js +0 -1
- package/dist/components/p-BOkYKP6F.js +0 -1
- package/dist/components/p-BOm0KT2x.js +0 -1
- package/dist/components/p-Bb_Zji0h.js +0 -4
- package/dist/components/p-BmVRXR1y.js +0 -4
- package/dist/components/p-BnQDByf2.js +0 -1
- package/dist/components/p-BoxjYI-Q.js +0 -4
- package/dist/components/p-BriBxgcM.js +0 -1
- package/dist/components/p-BwKjt_Dc.js +0 -4
- package/dist/components/p-Bx78uXfc.js +0 -5
- package/dist/components/p-C-20JWsp.js +0 -4
- package/dist/components/p-C03M5ZSM.js +0 -1
- package/dist/components/p-C53feagD.js +0 -4
- package/dist/components/p-CLrB3zV0.js +0 -4
- package/dist/components/p-CN34uOrj.js +0 -9
- package/dist/components/p-CQmcNwZM.js +0 -4
- package/dist/components/p-CYd0Smt1.js +0 -1
- package/dist/components/p-CgPXSjzI.js +0 -4
- package/dist/components/p-Cho32MPa.js +0 -4
- package/dist/components/p-ClE6rMJs.js +0 -4
- package/dist/components/p-Cm9b7fIl.js +0 -1
- package/dist/components/p-CukVBo5-.js +0 -4
- package/dist/components/p-D2NxOvQ8.js +0 -4
- package/dist/components/p-D4DqwBlW.js +0 -4
- package/dist/components/p-D7YY0NXg.js +0 -4
- package/dist/components/p-D8OVJo1v.js +0 -7
- package/dist/components/p-DKg_dYcq.js +0 -4
- package/dist/components/p-DLVYPrYs.js +0 -1
- package/dist/components/p-DMmSL7_l.js +0 -1
- package/dist/components/p-DOPF2QRF.js +0 -1
- package/dist/components/p-DTgJTJD6.js +0 -1
- package/dist/components/p-DiVJyqlX.js +0 -4
- package/dist/components/p-DrS88eFz.js +0 -1
- package/dist/components/p-Dtdm8lKC.js +0 -4
- package/dist/components/p-DuZ7hY1a.js +0 -4
- package/dist/components/p-Dx-C8Ob_.js +0 -7
- package/dist/components/p-DxEgz9x_.js +0 -1
- package/dist/components/p-DxSo4SXG.js +0 -1
- package/dist/components/p-HSPzo8it.js +0 -1
- package/dist/components/p-OrwCUtWu.js +0 -4
- package/dist/components/p-UgkI2Wa4.js +0 -1
- package/dist/components/p-VeNdmYSo.js +0 -1
- package/dist/components/p-YbpebnFS.js +0 -4
- package/dist/components/p-ZjP4CjeZ.js +0 -4
- package/dist/components/p-_VuKPdkD.js +0 -4
- package/dist/components/p-aWL6BxTN.js +0 -4
- package/dist/components/p-hHmYLOfE.js +0 -4
- package/dist/components/p-qoI-S7yk.js +0 -4
- package/dist/components/p-uXV7tzS3.js +0 -1
- package/dist/components/p-yu3xCFhr.js +0 -7
- package/dist/components/p-zp5f483d.js +0 -1
- package/dist/esm/i18n-C_AfxZ5D.js +0 -13
- package/dist/esm/index-93OyAGoo.js +0 -3721
- /package/dist/checkout/{p-B-hirT0v.js → p-01ad898f.js} +0 -0
- /package/dist/checkout/{p-DiVJyqlX.js → p-350e7423.js} +0 -0
- /package/dist/checkout/{p-sObYyvOy.js → p-52b4c112.js} +0 -0
- /package/dist/checkout/{p-BmVRXR1y.js → p-620fa0ec.js} +0 -0
- /package/dist/checkout/{p-hHmYLOfE.js → p-94286cc3.js} +0 -0
- /package/dist/checkout/{p-D4RIp70E.js → p-9efbca93.js} +0 -0
- /package/dist/checkout/{p-Dtdm8lKC.js → p-9f4ac833.js} +0 -0
- /package/dist/checkout/{p-yu3xCFhr.js → p-b2289937.js} +0 -0
- /package/dist/checkout/{p-C53feagD.js → p-d5862637.js} +0 -0
- /package/dist/checkout/{p-ZjP4CjeZ.js → p-d7fe59ee.js} +0 -0
- /package/dist/{components/p-CYPPT3AE.js → checkout/p-e187a77c.js} +0 -0
- /package/dist/checkout/{p-CukVBo5-.js → p-f728a68f.js} +0 -0
- /package/dist/cjs/{compare-with-utils-JlLIkecm.js → compare-with-utils-adbe64a6.js} +0 -0
- /package/dist/cjs/{config-ptk2Lf4l.js → config-e2a8c0c7.js} +0 -0
- /package/dist/cjs/{cubic-bezier-Bv3PvaRI.js → cubic-bezier-5ff9b04e.js} +0 -0
- /package/dist/cjs/{dir-Br-7_bel.js → dir-374f13f2.js} +0 -0
- /package/dist/cjs/{focus-visible-Da2o6bTP.js → focus-visible-b7381162.js} +0 -0
- /package/dist/cjs/{index-CH3IFTaK.js → index-071786b4.js} +0 -0
- /package/dist/cjs/{index-D3mJ1Cix.js → index-a281cac3.js} +0 -0
- /package/dist/cjs/{lock-controller-58TZFRHC.js → lock-controller-e2dfece6.js} +0 -0
- /package/dist/cjs/{spinner-configs-BN41iw42.js → spinner-configs-036ebfd8.js} +0 -0
- /package/dist/cjs/{theme-DbHdw1Nx.js → theme-12dec869.js} +0 -0
- /package/dist/cjs/{watch-options-DOFUPyuf.js → watch-options-1cccbe6a.js} +0 -0
- /package/dist/{esm/lock-controller-B-hirT0v.js → components/p-01ad898f.js} +0 -0
- /package/dist/{esm/theme-DiVJyqlX.js → components/p-350e7423.js} +0 -0
- /package/dist/{esm/focus-visible-BmVRXR1y.js → components/p-620fa0ec.js} +0 -0
- /package/dist/{esm/cubic-bezier-hHmYLOfE.js → components/p-94286cc3.js} +0 -0
- /package/dist/{esm/watch-options-Dtdm8lKC.js → components/p-9f4ac833.js} +0 -0
- /package/dist/{esm/config-yu3xCFhr.js → components/p-b2289937.js} +0 -0
- /package/dist/{esm/dir-C53feagD.js → components/p-d5862637.js} +0 -0
- /package/dist/{esm/index-ZjP4CjeZ.js → components/p-d7fe59ee.js} +0 -0
- /package/dist/esm/{compare-with-utils-sObYyvOy.js → compare-with-utils-d58be312.js} +0 -0
- /package/dist/esm/{spinner-configs-D4RIp70E.js → spinner-configs-c9fb0813.js} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { r as registerInstance,
|
|
2
|
-
import { startFocusVisible } from './focus-visible-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { i as isRTL } from './dir-
|
|
6
|
-
import { c as createColorClasses } from './theme-
|
|
7
|
-
import {
|
|
8
|
-
import { g as getIonMode } from './ionic-global-
|
|
9
|
-
import { i as isBefore,
|
|
1
|
+
import { r as registerInstance, d as createEvent, w as writeTask, h, H as Host, e as getElement } from './index-8cc94b11.js';
|
|
2
|
+
import { startFocusVisible } from './focus-visible-32968d3d.js';
|
|
3
|
+
import { b as raf, j as renderHiddenInput, g as getElementRoot } from './helpers-f0dcbd72.js';
|
|
4
|
+
import { a as printIonError, p as printIonWarning } from './index-d9b41a43.js';
|
|
5
|
+
import { i as isRTL } from './dir-1d4aa386.js';
|
|
6
|
+
import { c as createColorClasses } from './theme-35c700b7.js';
|
|
7
|
+
import { a as chevronBack, f as chevronForward, c as chevronDown, g as caretUpSharp, h as caretDownSharp } from './index-afdf867c.js';
|
|
8
|
+
import { g as getIonMode } from './ionic-global-0b7766cb.js';
|
|
9
|
+
import { g as generateDayAriaLabel, a as getDay, i as isBefore, b as isAfter, c as isSameDay, d as getPreviousMonth, e as getNextMonth, v as validateParts, f as getPartsFromCalendarDay, h as getEndOfWeek, j as getStartOfWeek, k as getPreviousDay, l as getNextDay, m as getPreviousWeek, n as getNextWeek, p as parseMinParts, o as parseMaxParts, q as parseDate, w as warnIfValueOutOfBounds, r as convertToArrayOfNumbers, s as convertDataToISO, t as getToday, u as getClosestValidDate, x as getNumDaysInMonth, y as getCombinedDateColumnData, z as getMonthColumnData, A as getDayColumnData, B as getYearColumnData, C as isMonthFirstLocale, D as getTimeColumnsData, E as isLocaleDayPeriodRTL, F as getDaysOfWeek, G as getMonthAndYear, H as getDaysOfMonth, I as generateMonths, J as getHourCycle, K as getLocalizedTime, L as getLocalizedDateTime, M as formatValue, N as getNextYear, O as getPreviousYear, P as clampDate, Q as parseAmPm, R as calculateHourFromAMPM } from './data-8916315d.js';
|
|
10
10
|
|
|
11
11
|
/*!
|
|
12
12
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
@@ -223,1640 +223,1618 @@ const checkForPresentationFormatMismatch = (el, presentation, formatOptions) =>
|
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
225
|
|
|
226
|
-
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{position:absolute;visibility:hidden;pointer-events:none}@supports (inset-inline-start: 0){: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{inset-inline-start:-99999px}}@supports not (inset-inline-start: 0){: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}: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 selector(:dir(rtl)){:host(.show-month-and-year:dir(rtl)) .calendar-next-prev,:host(.show-month-and-year:dir(rtl)) .calendar-days-of-week,:host(.show-month-and-year:dir(rtl)) .calendar-body,:host(.show-month-and-year:dir(rtl)) .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-disabled){pointer-events:none}:host(.datetime-disabled) .calendar-days-of-week,:host(.datetime-disabled) .datetime-time{opacity:0.4}:host(.datetime-readonly){pointer-events:none;}:host(.datetime-readonly) .calendar-action-buttons,:host(.datetime-readonly) .calendar-body,:host(.datetime-readonly) .datetime-year{pointer-events:initial}:host(.datetime-readonly) .calendar-day[disabled]:not(.calendar-day-constrained),:host(.datetime-readonly) .datetime-action-buttons ion-button[disabled]{opacity:1}: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}.datetime-action-buttons .datetime-action-buttons-container{display:flex}: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;width:auto}:host .calendar-action-buttons ion-item ion-icon{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0;padding-top:0;padding-bottom:0}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}.calendar-days-of-week .day-of-week{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}: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{display:flex;flex-flow:column;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)}:host .calendar-day-wrapper{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;overflow:visible}.calendar-day{border-radius:50%;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:0px;padding-bottom:0px;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end: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;font-family:var(--ion-font-family, inherit);cursor:pointer;appearance:none;z-index:0}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}.calendar-day:focus{background:rgba(var(--ion-color-base-rgb), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2)}: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;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end: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}: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{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:16px;padding-bottom:16px;border-bottom:0.55px solid var(--ion-color-step-200, #cccccc);font-size:min(0.875rem, 22.4px)}:host .datetime-header .datetime-title{color:var(--title-color)}:host .datetime-header .datetime-selected-date{margin-top:10px}:host .calendar-action-buttons ion-item{--padding-start:16px;--background-hover:transparent;--background-activated:transparent;font-size:min(1rem, 25.6px);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{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:0;padding-bottom:0;color:var(--ion-color-step-300, #b3b3b3);font-size:min(0.75rem, 19.2px);font-weight:600;line-height:24px;text-transform:uppercase}@supports (border-radius: mod(1px, 1px)){.calendar-days-of-week .day-of-week{width:clamp(20px, calc(mod(min(1rem, 24px), 24px) * 10), 100%);height:24px;overflow:hidden}.calendar-day{border-radius:max(8px, mod(min(1rem, 24px), 24px) * 10)}}@supports ((border-radius: mod(1px, 1px)) and (background: -webkit-named-image(apple-pay-logo-black)) and (not (contain-intrinsic-size: none))) or (not (border-radius: mod(1px, 1px))){.calendar-days-of-week .day-of-week{width:auto;height:auto;overflow:initial}.calendar-day{border-radius:32px}}:host .calendar-body .calendar-month .calendar-month-grid{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;align-items:center;height:calc(100% - 16px)}:host .calendar-day-wrapper{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;height:0;min-height:1rem}:host .calendar-day{width:40px;min-width:40px;height:40px;font-size:min(1.25rem, 32px)}.calendar-day.calendar-day-active{background:rgba(var(--ion-color-base-rgb), 0.2)}: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-today.calendar-day-active{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host .datetime-time{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:8px;padding-bottom:16px;font-size:min(1rem, 25.6px)}:host .datetime-time .time-header{font-weight:600}:host .datetime-buttons{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;border-top:0.55px solid var(--ion-color-step-200, #cccccc)}: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%}`;
|
|
226
|
+
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{position:absolute;visibility:hidden;pointer-events:none}@supports (inset-inline-start: 0){: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{inset-inline-start:-99999px}}@supports not (inset-inline-start: 0){: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}: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 selector(:dir(rtl)){:host(.show-month-and-year:dir(rtl)) .calendar-next-prev,:host(.show-month-and-year:dir(rtl)) .calendar-days-of-week,:host(.show-month-and-year:dir(rtl)) .calendar-body,:host(.show-month-and-year:dir(rtl)) .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-disabled){pointer-events:none}:host(.datetime-disabled) .calendar-days-of-week,:host(.datetime-disabled) .datetime-time{opacity:0.4}:host(.datetime-readonly){pointer-events:none;}:host(.datetime-readonly) .calendar-action-buttons,:host(.datetime-readonly) .calendar-body,:host(.datetime-readonly) .datetime-year{pointer-events:initial}:host(.datetime-readonly) .calendar-day[disabled]:not(.calendar-day-constrained),:host(.datetime-readonly) .datetime-action-buttons ion-button[disabled]{opacity:1}: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}.datetime-action-buttons .datetime-action-buttons-container{display:flex}: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;width:auto}:host .calendar-action-buttons ion-item ion-icon{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0;padding-top:0;padding-bottom:0}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}.calendar-days-of-week .day-of-week{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}: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{display:flex;flex-flow:column;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)}:host .calendar-day-wrapper{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;overflow:visible}.calendar-day{border-radius:50%;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:0px;padding-bottom:0px;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end: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;font-family:var(--ion-font-family, inherit);cursor:pointer;appearance:none;z-index:0}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}.calendar-day:focus{background:rgba(var(--ion-color-base-rgb), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2)}: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;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end: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}: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{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:16px;padding-bottom:16px;border-bottom:0.55px solid var(--ion-color-step-200, #cccccc);font-size:min(0.875rem, 22.4px)}:host .datetime-header .datetime-title{color:var(--title-color)}:host .datetime-header .datetime-selected-date{margin-top:10px}:host .calendar-action-buttons ion-item{--padding-start:16px;--background-hover:transparent;--background-activated:transparent;font-size:min(1rem, 25.6px);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{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:0;padding-bottom:0;color:var(--ion-color-step-300, #b3b3b3);font-size:min(0.75rem, 19.2px);font-weight:600;line-height:24px;text-transform:uppercase}@supports (border-radius: mod(1px, 1px)){.calendar-days-of-week .day-of-week{width:clamp(20px, calc(mod(min(1rem, 24px), 24px) * 10), 100%);height:24px;overflow:hidden}.calendar-day{border-radius:max(8px, mod(min(1rem, 24px), 24px) * 10)}}@supports ((border-radius: mod(1px, 1px)) and (background: -webkit-named-image(apple-pay-logo-black)) and (not (contain-intrinsic-size: none))) or (not (border-radius: mod(1px, 1px))){.calendar-days-of-week .day-of-week{width:auto;height:auto;overflow:initial}.calendar-day{border-radius:32px}}:host .calendar-body .calendar-month .calendar-month-grid{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;align-items:center;height:calc(100% - 16px)}:host .calendar-day-wrapper{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;height:0;min-height:1rem}:host .calendar-day{width:40px;min-width:40px;height:40px;font-size:min(1.25rem, 32px)}.calendar-day.calendar-day-active{background:rgba(var(--ion-color-base-rgb), 0.2)}: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-today.calendar-day-active{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host .datetime-time{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:8px;padding-bottom:16px;font-size:min(1rem, 25.6px)}:host .datetime-time .time-header{font-weight:600}:host .datetime-buttons{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;border-top:0.55px solid var(--ion-color-step-200, #cccccc)}: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%}";
|
|
227
227
|
|
|
228
|
-
const datetimeMdCss =
|
|
228
|
+
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{position:absolute;visibility:hidden;pointer-events:none}@supports (inset-inline-start: 0){: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{inset-inline-start:-99999px}}@supports not (inset-inline-start: 0){: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}: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 selector(:dir(rtl)){:host(.show-month-and-year:dir(rtl)) .calendar-next-prev,:host(.show-month-and-year:dir(rtl)) .calendar-days-of-week,:host(.show-month-and-year:dir(rtl)) .calendar-body,:host(.show-month-and-year:dir(rtl)) .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-disabled){pointer-events:none}:host(.datetime-disabled) .calendar-days-of-week,:host(.datetime-disabled) .datetime-time{opacity:0.4}:host(.datetime-readonly){pointer-events:none;}:host(.datetime-readonly) .calendar-action-buttons,:host(.datetime-readonly) .calendar-body,:host(.datetime-readonly) .datetime-year{pointer-events:initial}:host(.datetime-readonly) .calendar-day[disabled]:not(.calendar-day-constrained),:host(.datetime-readonly) .datetime-action-buttons ion-button[disabled]{opacity:1}: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}.datetime-action-buttons .datetime-action-buttons-container{display:flex}: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;width:auto}:host .calendar-action-buttons ion-item ion-icon{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0;padding-top:0;padding-bottom:0}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}.calendar-days-of-week .day-of-week{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}: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{display:flex;flex-flow:column;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)}:host .calendar-day-wrapper{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;overflow:visible}.calendar-day{border-radius:50%;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:0px;padding-bottom:0px;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end: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;font-family:var(--ion-font-family, inherit);cursor:pointer;appearance:none;z-index:0}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}.calendar-day:focus{background:rgba(var(--ion-color-base-rgb), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2)}: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;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end: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}: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{-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px;padding-top:20px;padding-bottom:20px;background:var(--ion-color-base);color:var(--title-color)}:host .datetime-header .datetime-title{font-size:0.75rem;text-transform:uppercase}:host .datetime-header .datetime-selected-date{margin-top:30px;font-size:2.125rem}: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{-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px;padding-top:0px;padding-bottom:0px;color:var(--ion-color-step-500, gray);font-size:0.875rem;line-height:36px}:host .calendar-body .calendar-month .calendar-month-grid{-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px;padding-top:4px;padding-bottom:4px;grid-template-rows:repeat(6, 1fr)}:host .calendar-day{width:42px;min-width:42px;height:42px;font-size:0.875rem}:host .calendar-day.calendar-day-today{border:1px solid var(--ion-color-base);color:var(--ion-color-base)}:host .calendar-day.calendar-day-active{color:var(--ion-color-contrast)}.calendar-day.calendar-day-active{border:1px solid var(--ion-color-base);background:var(--ion-color-base)}:host .datetime-time{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:8px;padding-bottom:8px}: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{-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px;padding-top:10px;padding-bottom:10px;display:flex;align-items:center;justify-content:flex-end}";
|
|
229
229
|
|
|
230
230
|
const Datetime = class {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
231
|
+
constructor(hostRef) {
|
|
232
|
+
registerInstance(this, hostRef);
|
|
233
|
+
this.ionCancel = createEvent(this, "ionCancel", 7);
|
|
234
|
+
this.ionChange = createEvent(this, "ionChange", 7);
|
|
235
|
+
this.ionValueChange = createEvent(this, "ionValueChange", 7);
|
|
236
|
+
this.ionFocus = createEvent(this, "ionFocus", 7);
|
|
237
|
+
this.ionBlur = createEvent(this, "ionBlur", 7);
|
|
238
|
+
this.ionStyle = createEvent(this, "ionStyle", 7);
|
|
239
|
+
this.ionRender = createEvent(this, "ionRender", 7);
|
|
240
|
+
this.inputId = `ion-dt-${datetimeIds++}`;
|
|
241
|
+
this.prevPresentation = null;
|
|
242
|
+
this.warnIfIncorrectValueUsage = () => {
|
|
243
|
+
const { multiple, value } = this;
|
|
244
|
+
if (!multiple && Array.isArray(value)) {
|
|
245
|
+
/**
|
|
246
|
+
* We do some processing on the `value` array so
|
|
247
|
+
* that it looks more like an array when logged to
|
|
248
|
+
* the console.
|
|
249
|
+
* Example given ['a', 'b']
|
|
250
|
+
* Default toString() behavior: a,b
|
|
251
|
+
* Custom behavior: ['a', 'b']
|
|
252
|
+
*/
|
|
253
|
+
printIonWarning(`ion-datetime was passed an array of values, but multiple="false". This is incorrect usage and may result in unexpected behaviors. To dismiss this warning, pass a string to the "value" property when multiple="false".
|
|
254
254
|
|
|
255
255
|
Value Passed: [${value.map((v) => `'${v}'`).join(', ')}]
|
|
256
256
|
`, this.el);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Returns the DatetimePart interface
|
|
265
|
-
* to use when rendering an initial set of
|
|
266
|
-
* data. This should be used when rendering an
|
|
267
|
-
* interface in an environment where the `value`
|
|
268
|
-
* may not be set. This function works
|
|
269
|
-
* by returning the first selected date and then
|
|
270
|
-
* falling back to defaultParts if no active date
|
|
271
|
-
* is selected.
|
|
272
|
-
*/
|
|
273
|
-
this.getActivePartsWithFallback = () => {
|
|
274
|
-
var _a;
|
|
275
|
-
const { defaultParts } = this;
|
|
276
|
-
return (_a = this.getActivePart()) !== null && _a !== void 0 ? _a : defaultParts;
|
|
277
|
-
};
|
|
278
|
-
this.getActivePart = () => {
|
|
279
|
-
const { activeParts } = this;
|
|
280
|
-
return Array.isArray(activeParts) ? activeParts[0] : activeParts;
|
|
281
|
-
};
|
|
282
|
-
this.closeParentOverlay = () => {
|
|
283
|
-
const popoverOrModal = this.el.closest('ion-modal, ion-popover');
|
|
284
|
-
if (popoverOrModal) {
|
|
285
|
-
popoverOrModal.dismiss();
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
this.setWorkingParts = (parts) => {
|
|
289
|
-
this.workingParts = Object.assign({}, parts);
|
|
290
|
-
};
|
|
291
|
-
this.setActiveParts = (parts, removeDate = false) => {
|
|
292
|
-
/** if the datetime component is in readonly mode,
|
|
293
|
-
* allow browsing of the calendar without changing
|
|
294
|
-
* the set value
|
|
295
|
-
*/
|
|
296
|
-
if (this.readonly) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
const { multiple, minParts, maxParts, activeParts } = this;
|
|
300
|
-
/**
|
|
301
|
-
* When setting the active parts, it is possible
|
|
302
|
-
* to set invalid data. For example,
|
|
303
|
-
* when updating January 31 to February,
|
|
304
|
-
* February 31 does not exist. As a result
|
|
305
|
-
* we need to validate the active parts and
|
|
306
|
-
* ensure that we are only setting valid dates.
|
|
307
|
-
* Additionally, we need to update the working parts
|
|
308
|
-
* too in the event that the validated parts are different.
|
|
309
|
-
*/
|
|
310
|
-
const validatedParts = validateParts(parts, minParts, maxParts);
|
|
311
|
-
this.setWorkingParts(validatedParts);
|
|
312
|
-
if (multiple) {
|
|
313
|
-
const activePartsArray = Array.isArray(activeParts) ? activeParts : [activeParts];
|
|
314
|
-
if (removeDate) {
|
|
315
|
-
this.activeParts = activePartsArray.filter((p) => !isSameDay(p, validatedParts));
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
this.activeParts = [...activePartsArray, validatedParts];
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
322
|
-
this.activeParts = Object.assign({}, validatedParts);
|
|
323
|
-
}
|
|
324
|
-
const hasSlottedButtons = this.el.querySelector('[slot="buttons"]') !== null;
|
|
325
|
-
if (hasSlottedButtons || this.showDefaultButtons) {
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
this.confirm();
|
|
329
|
-
};
|
|
330
|
-
this.initializeKeyboardListeners = () => {
|
|
331
|
-
const calendarBodyRef = this.calendarBodyRef;
|
|
332
|
-
if (!calendarBodyRef) {
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
const root = this.el.shadowRoot;
|
|
336
|
-
/**
|
|
337
|
-
* Get a reference to the month
|
|
338
|
-
* element we are currently viewing.
|
|
339
|
-
*/
|
|
340
|
-
const currentMonth = calendarBodyRef.querySelector('.calendar-month:nth-of-type(2)');
|
|
341
|
-
/**
|
|
342
|
-
* When focusing the calendar body, we want to pass focus
|
|
343
|
-
* to the working day, but other days should
|
|
344
|
-
* only be accessible using the arrow keys. Pressing
|
|
345
|
-
* Tab should jump between bodies of selectable content.
|
|
346
|
-
*/
|
|
347
|
-
const checkCalendarBodyFocus = (ev) => {
|
|
348
|
-
var _a;
|
|
349
|
-
const record = ev[0];
|
|
350
|
-
/**
|
|
351
|
-
* If calendar body was already focused
|
|
352
|
-
* when this fired or if the calendar body
|
|
353
|
-
* if not currently focused, we should not re-focus
|
|
354
|
-
* the inner day.
|
|
355
|
-
*/
|
|
356
|
-
if (((_a = record.oldValue) === null || _a === void 0 ? void 0 : _a.includes('ion-focused')) || !calendarBodyRef.classList.contains('ion-focused')) {
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
this.focusWorkingDay(currentMonth);
|
|
360
|
-
};
|
|
361
|
-
const mo = new MutationObserver(checkCalendarBodyFocus);
|
|
362
|
-
mo.observe(calendarBodyRef, { attributeFilter: ['class'], attributeOldValue: true });
|
|
363
|
-
this.destroyKeyboardMO = () => {
|
|
364
|
-
mo === null || mo === void 0 ? void 0 : mo.disconnect();
|
|
365
|
-
};
|
|
366
|
-
/**
|
|
367
|
-
* We must use keydown not keyup as we want
|
|
368
|
-
* to prevent scrolling when using the arrow keys.
|
|
369
|
-
*/
|
|
370
|
-
calendarBodyRef.addEventListener('keydown', (ev) => {
|
|
371
|
-
const activeElement = root.activeElement;
|
|
372
|
-
if (!activeElement || !activeElement.classList.contains('calendar-day')) {
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
const parts = getPartsFromCalendarDay(activeElement);
|
|
376
|
-
let partsToFocus;
|
|
377
|
-
switch (ev.key) {
|
|
378
|
-
case 'ArrowDown':
|
|
379
|
-
ev.preventDefault();
|
|
380
|
-
partsToFocus = getNextWeek(parts);
|
|
381
|
-
break;
|
|
382
|
-
case 'ArrowUp':
|
|
383
|
-
ev.preventDefault();
|
|
384
|
-
partsToFocus = getPreviousWeek(parts);
|
|
385
|
-
break;
|
|
386
|
-
case 'ArrowRight':
|
|
387
|
-
ev.preventDefault();
|
|
388
|
-
partsToFocus = getNextDay(parts);
|
|
389
|
-
break;
|
|
390
|
-
case 'ArrowLeft':
|
|
391
|
-
ev.preventDefault();
|
|
392
|
-
partsToFocus = getPreviousDay(parts);
|
|
393
|
-
break;
|
|
394
|
-
case 'Home':
|
|
395
|
-
ev.preventDefault();
|
|
396
|
-
partsToFocus = getStartOfWeek(parts);
|
|
397
|
-
break;
|
|
398
|
-
case 'End':
|
|
399
|
-
ev.preventDefault();
|
|
400
|
-
partsToFocus = getEndOfWeek(parts);
|
|
401
|
-
break;
|
|
402
|
-
case 'PageUp':
|
|
403
|
-
ev.preventDefault();
|
|
404
|
-
partsToFocus = ev.shiftKey ? getPreviousYear(parts) : getPreviousMonth(parts);
|
|
405
|
-
break;
|
|
406
|
-
case 'PageDown':
|
|
407
|
-
ev.preventDefault();
|
|
408
|
-
partsToFocus = ev.shiftKey ? getNextYear(parts) : getNextMonth(parts);
|
|
409
|
-
break;
|
|
410
|
-
/**
|
|
411
|
-
* Do not preventDefault here
|
|
412
|
-
* as we do not want to override other
|
|
413
|
-
* browser defaults such as pressing Enter/Space
|
|
414
|
-
* to select a day.
|
|
415
|
-
*/
|
|
416
|
-
default:
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* If the day we want to move focus to is
|
|
421
|
-
* disabled, do not do anything.
|
|
422
|
-
*/
|
|
423
|
-
if (isDayDisabled(partsToFocus, this.minParts, this.maxParts)) {
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), partsToFocus));
|
|
427
|
-
/**
|
|
428
|
-
* Give view a chance to re-render
|
|
429
|
-
* then move focus to the new working day
|
|
430
|
-
*/
|
|
431
|
-
requestAnimationFrame(() => this.focusWorkingDay(currentMonth));
|
|
432
|
-
});
|
|
433
|
-
};
|
|
434
|
-
this.focusWorkingDay = (currentMonth) => {
|
|
435
|
-
/**
|
|
436
|
-
* Get the number of padding days so
|
|
437
|
-
* we know how much to offset our next selector by
|
|
438
|
-
* to grab the correct calendar-day element.
|
|
439
|
-
*/
|
|
440
|
-
const padding = currentMonth.querySelectorAll('.calendar-day-padding');
|
|
441
|
-
const { day } = this.workingParts;
|
|
442
|
-
if (day === null) {
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Get the calendar day element
|
|
447
|
-
* and focus it.
|
|
448
|
-
*/
|
|
449
|
-
const dayEl = currentMonth.querySelector(`.calendar-day-wrapper:nth-of-type(${padding.length + day}) .calendar-day`);
|
|
450
|
-
if (dayEl) {
|
|
451
|
-
dayEl.focus();
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
this.processMinParts = () => {
|
|
455
|
-
const { min, defaultParts } = this;
|
|
456
|
-
if (min === undefined) {
|
|
457
|
-
this.minParts = undefined;
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
this.minParts = parseMinParts(min, defaultParts);
|
|
461
|
-
};
|
|
462
|
-
this.processMaxParts = () => {
|
|
463
|
-
const { max, defaultParts } = this;
|
|
464
|
-
if (max === undefined) {
|
|
465
|
-
this.maxParts = undefined;
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
this.maxParts = parseMaxParts(max, defaultParts);
|
|
469
|
-
};
|
|
470
|
-
this.initializeCalendarListener = () => {
|
|
471
|
-
const calendarBodyRef = this.calendarBodyRef;
|
|
472
|
-
if (!calendarBodyRef) {
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* For performance reasons, we only render 3
|
|
477
|
-
* months at a time: The current month, the previous
|
|
478
|
-
* month, and the next month. We have a scroll listener
|
|
479
|
-
* on the calendar body to append/prepend new months.
|
|
480
|
-
*
|
|
481
|
-
* We can do this because Stencil is smart enough to not
|
|
482
|
-
* re-create the .calendar-month containers, but rather
|
|
483
|
-
* update the content within those containers.
|
|
484
|
-
*
|
|
485
|
-
* As an added bonus, WebKit has some troubles with
|
|
486
|
-
* scroll-snap-stop: always, so not rendering all of
|
|
487
|
-
* the months in a row allows us to mostly sidestep
|
|
488
|
-
* that issue.
|
|
489
|
-
*/
|
|
490
|
-
const months = calendarBodyRef.querySelectorAll('.calendar-month');
|
|
491
|
-
const startMonth = months[0];
|
|
492
|
-
const workingMonth = months[1];
|
|
493
|
-
const endMonth = months[2];
|
|
494
|
-
const mode = getIonMode(this);
|
|
495
|
-
const needsiOSRubberBandFix = mode === 'ios' && typeof navigator !== 'undefined' && navigator.maxTouchPoints > 1;
|
|
496
|
-
/**
|
|
497
|
-
* Before setting up the scroll listener,
|
|
498
|
-
* scroll the middle month into view.
|
|
499
|
-
* scrollIntoView() will scroll entire page
|
|
500
|
-
* if element is not in viewport. Use scrollLeft instead.
|
|
501
|
-
*/
|
|
502
|
-
writeTask(() => {
|
|
503
|
-
calendarBodyRef.scrollLeft = startMonth.clientWidth * (isRTL(this.el) ? -1 : 1);
|
|
504
|
-
const getChangedMonth = (parts) => {
|
|
505
|
-
const box = calendarBodyRef.getBoundingClientRect();
|
|
506
|
-
/**
|
|
507
|
-
* If the current scroll position is all the way to the left
|
|
508
|
-
* then we have scrolled to the previous month.
|
|
509
|
-
* Otherwise, assume that we have scrolled to the next
|
|
510
|
-
* month. We have a tolerance of 2px to account for
|
|
511
|
-
* sub pixel rendering.
|
|
512
|
-
*
|
|
513
|
-
* Check below the next line ensures that we did not
|
|
514
|
-
* swipe and abort (i.e. we swiped but we are still on the current month).
|
|
515
|
-
*/
|
|
516
|
-
const month = calendarBodyRef.scrollLeft <= 2 ? startMonth : endMonth;
|
|
517
|
-
/**
|
|
518
|
-
* The edge of the month must be lined up with
|
|
519
|
-
* the edge of the calendar body in order for
|
|
520
|
-
* the component to update. Otherwise, it
|
|
521
|
-
* may be the case that the user has paused their
|
|
522
|
-
* swipe or the browser has not finished snapping yet.
|
|
523
|
-
* Rather than check if the x values are equal,
|
|
524
|
-
* we give it a tolerance of 2px to account for
|
|
525
|
-
* sub pixel rendering.
|
|
526
|
-
*/
|
|
527
|
-
const monthBox = month.getBoundingClientRect();
|
|
528
|
-
if (Math.abs(monthBox.x - box.x) > 2)
|
|
529
|
-
return;
|
|
530
|
-
/**
|
|
531
|
-
* If we're force-rendering a month, assume we've
|
|
532
|
-
* scrolled to that and return it.
|
|
533
|
-
*
|
|
534
|
-
* If forceRenderDate is ever used in a context where the
|
|
535
|
-
* forced month is not immediately auto-scrolled to, this
|
|
536
|
-
* should be updated to also check whether `month` has the
|
|
537
|
-
* same month and year as the forced date.
|
|
538
|
-
*/
|
|
539
|
-
const { forceRenderDate } = this;
|
|
540
|
-
if (forceRenderDate !== undefined) {
|
|
541
|
-
return { month: forceRenderDate.month, year: forceRenderDate.year, day: forceRenderDate.day };
|
|
542
|
-
}
|
|
543
|
-
/**
|
|
544
|
-
* From here, we can determine if the start
|
|
545
|
-
* month or the end month was scrolled into view.
|
|
546
|
-
* If no month was changed, then we can return from
|
|
547
|
-
* the scroll callback early.
|
|
548
|
-
*/
|
|
549
|
-
if (month === startMonth) {
|
|
550
|
-
return getPreviousMonth(parts);
|
|
551
|
-
}
|
|
552
|
-
else if (month === endMonth) {
|
|
553
|
-
return getNextMonth(parts);
|
|
554
|
-
}
|
|
555
|
-
else {
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
};
|
|
559
|
-
const updateActiveMonth = () => {
|
|
560
|
-
if (needsiOSRubberBandFix) {
|
|
561
|
-
calendarBodyRef.style.removeProperty('pointer-events');
|
|
562
|
-
appliediOSRubberBandFix = false;
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* If the month did not change
|
|
566
|
-
* then we can return early.
|
|
567
|
-
*/
|
|
568
|
-
const newDate = getChangedMonth(this.workingParts);
|
|
569
|
-
if (!newDate)
|
|
570
|
-
return;
|
|
571
|
-
const { month, day, year } = newDate;
|
|
572
|
-
if (isMonthDisabled({ month, year, day: null }, {
|
|
573
|
-
minParts: Object.assign(Object.assign({}, this.minParts), { day: null }),
|
|
574
|
-
maxParts: Object.assign(Object.assign({}, this.maxParts), { day: null }),
|
|
575
|
-
})) {
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
/**
|
|
579
|
-
* Prevent scrolling for other browsers
|
|
580
|
-
* to give the DOM time to update and the container
|
|
581
|
-
* time to properly snap.
|
|
582
|
-
*/
|
|
583
|
-
calendarBodyRef.style.setProperty('overflow', 'hidden');
|
|
584
|
-
/**
|
|
585
|
-
* Use a writeTask here to ensure
|
|
586
|
-
* that the state is updated and the
|
|
587
|
-
* correct month is scrolled into view
|
|
588
|
-
* in the same frame. This is not
|
|
589
|
-
* typically a problem on newer devices
|
|
590
|
-
* but older/slower device may have a flicker
|
|
591
|
-
* if we did not do this.
|
|
592
|
-
*/
|
|
593
|
-
writeTask(() => {
|
|
594
|
-
this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), { month, day: day, year }));
|
|
595
|
-
calendarBodyRef.scrollLeft = workingMonth.clientWidth * (isRTL(this.el) ? -1 : 1);
|
|
596
|
-
calendarBodyRef.style.removeProperty('overflow');
|
|
597
|
-
if (this.resolveForceDateScrolling) {
|
|
598
|
-
this.resolveForceDateScrolling();
|
|
599
|
-
}
|
|
600
|
-
});
|
|
601
|
-
};
|
|
602
|
-
/**
|
|
603
|
-
* When the container finishes scrolling we
|
|
604
|
-
* need to update the DOM with the selected month.
|
|
605
|
-
*/
|
|
606
|
-
let scrollTimeout;
|
|
607
|
-
/**
|
|
608
|
-
* We do not want to attempt to set pointer-events
|
|
609
|
-
* multiple times within a single swipe gesture as
|
|
610
|
-
* that adds unnecessary work to the main thread.
|
|
611
|
-
*/
|
|
612
|
-
let appliediOSRubberBandFix = false;
|
|
613
|
-
const scrollCallback = () => {
|
|
614
|
-
if (scrollTimeout) {
|
|
615
|
-
clearTimeout(scrollTimeout);
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
* On iOS it is possible to quickly rubber band
|
|
619
|
-
* the scroll area before the scroll timeout has fired.
|
|
620
|
-
* This results in users reaching the end of the scrollable
|
|
621
|
-
* container before the DOM has updated.
|
|
622
|
-
* By setting `pointer-events: none` we can ensure that
|
|
623
|
-
* subsequent swipes do not happen while the container
|
|
624
|
-
* is snapping.
|
|
625
|
-
*/
|
|
626
|
-
if (!appliediOSRubberBandFix && needsiOSRubberBandFix) {
|
|
627
|
-
calendarBodyRef.style.setProperty('pointer-events', 'none');
|
|
628
|
-
appliediOSRubberBandFix = true;
|
|
629
|
-
}
|
|
630
|
-
// Wait ~3 frames
|
|
631
|
-
scrollTimeout = setTimeout(updateActiveMonth, 50);
|
|
632
|
-
};
|
|
633
|
-
calendarBodyRef.addEventListener('scroll', scrollCallback);
|
|
634
|
-
this.destroyCalendarListener = () => {
|
|
635
|
-
calendarBodyRef.removeEventListener('scroll', scrollCallback);
|
|
636
|
-
};
|
|
637
|
-
});
|
|
638
|
-
};
|
|
639
|
-
/**
|
|
640
|
-
* Clean up all listeners except for the overlay
|
|
641
|
-
* listener. This is so that we can re-create the listeners
|
|
642
|
-
* if the datetime has been hidden/presented by a modal or popover.
|
|
643
|
-
*/
|
|
644
|
-
this.destroyInteractionListeners = () => {
|
|
645
|
-
const { destroyCalendarListener, destroyKeyboardMO } = this;
|
|
646
|
-
if (destroyCalendarListener !== undefined) {
|
|
647
|
-
destroyCalendarListener();
|
|
648
|
-
}
|
|
649
|
-
if (destroyKeyboardMO !== undefined) {
|
|
650
|
-
destroyKeyboardMO();
|
|
651
|
-
}
|
|
652
|
-
};
|
|
653
|
-
this.processValue = (value) => {
|
|
654
|
-
const hasValue = value !== null && value !== undefined && (!Array.isArray(value) || value.length > 0);
|
|
655
|
-
const valueToProcess = hasValue ? parseDate(value) : this.defaultParts;
|
|
656
|
-
const { minParts, maxParts, workingParts, el } = this;
|
|
657
|
-
this.warnIfIncorrectValueUsage();
|
|
658
|
-
/**
|
|
659
|
-
* Return early if the value wasn't parsed correctly, such as
|
|
660
|
-
* if an improperly formatted date string was provided.
|
|
661
|
-
*/
|
|
662
|
-
if (!valueToProcess) {
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
/**
|
|
666
|
-
* Datetime should only warn of out of bounds values
|
|
667
|
-
* if set by the user. If the `value` is undefined,
|
|
668
|
-
* we will default to today's date which may be out
|
|
669
|
-
* of bounds. In this case, the warning makes it look
|
|
670
|
-
* like the developer did something wrong which is
|
|
671
|
-
* not true.
|
|
672
|
-
*/
|
|
673
|
-
if (hasValue) {
|
|
674
|
-
warnIfValueOutOfBounds(valueToProcess, minParts, maxParts);
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* If there are multiple values, pick an arbitrary one to clamp to. This way,
|
|
678
|
-
* if the values are across months, we always show at least one of them. Note
|
|
679
|
-
* that the values don't necessarily have to be in order.
|
|
680
|
-
*/
|
|
681
|
-
const singleValue = Array.isArray(valueToProcess) ? valueToProcess[0] : valueToProcess;
|
|
682
|
-
const targetValue = clampDate(singleValue, minParts, maxParts);
|
|
683
|
-
const { month, day, year, hour, minute } = targetValue;
|
|
684
|
-
const ampm = parseAmPm(hour);
|
|
685
|
-
/**
|
|
686
|
-
* Since `activeParts` indicates a value that
|
|
687
|
-
* been explicitly selected either by the
|
|
688
|
-
* user or the app, only update `activeParts`
|
|
689
|
-
* if the `value` property is set.
|
|
690
|
-
*/
|
|
691
|
-
if (hasValue) {
|
|
692
|
-
if (Array.isArray(valueToProcess)) {
|
|
693
|
-
this.activeParts = [...valueToProcess];
|
|
694
|
-
}
|
|
695
|
-
else {
|
|
696
|
-
this.activeParts = {
|
|
697
|
-
month,
|
|
698
|
-
day,
|
|
699
|
-
year,
|
|
700
|
-
hour,
|
|
701
|
-
minute,
|
|
702
|
-
ampm,
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
else {
|
|
707
|
-
/**
|
|
708
|
-
* Reset the active parts if the value is not set.
|
|
709
|
-
* This will clear the selected calendar day when
|
|
710
|
-
* performing a clear action or using the reset() method.
|
|
711
|
-
*/
|
|
712
|
-
this.activeParts = [];
|
|
713
|
-
}
|
|
714
|
-
/**
|
|
715
|
-
* Only animate if:
|
|
716
|
-
* 1. We're using grid style (wheel style pickers should just jump to new value)
|
|
717
|
-
* 2. The month and/or year actually changed, and both are defined (otherwise there's nothing to animate to)
|
|
718
|
-
* 3. The calendar body is visible (prevents animation when in collapsed datetime-button, for example)
|
|
719
|
-
* 4. The month/year picker is not open (since you wouldn't see the animation anyway)
|
|
720
|
-
*/
|
|
721
|
-
const didChangeMonth = (month !== undefined && month !== workingParts.month) || (year !== undefined && year !== workingParts.year);
|
|
722
|
-
const bodyIsVisible = el.classList.contains('datetime-ready');
|
|
723
|
-
const { isGridStyle, showMonthAndYear } = this;
|
|
724
|
-
let areAllSelectedDatesInSameMonth = true;
|
|
725
|
-
if (Array.isArray(valueToProcess)) {
|
|
726
|
-
const firstMonth = valueToProcess[0].month;
|
|
727
|
-
for (const date of valueToProcess) {
|
|
728
|
-
if (date.month !== firstMonth) {
|
|
729
|
-
areAllSelectedDatesInSameMonth = false;
|
|
730
|
-
break;
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* If there is more than one date selected
|
|
736
|
-
* and the dates aren't all in the same month,
|
|
737
|
-
* then we should neither animate to the date
|
|
738
|
-
* nor update the working parts because we do
|
|
739
|
-
* not know which date the user wants to view.
|
|
740
|
-
*/
|
|
741
|
-
if (areAllSelectedDatesInSameMonth) {
|
|
742
|
-
if (isGridStyle && didChangeMonth && bodyIsVisible && !showMonthAndYear) {
|
|
743
|
-
this.animateToDate(targetValue);
|
|
744
|
-
}
|
|
745
|
-
else {
|
|
746
|
-
/**
|
|
747
|
-
* We only need to do this if we didn't just animate to a new month,
|
|
748
|
-
* since that calls prevMonth/nextMonth which calls setWorkingParts for us.
|
|
749
|
-
*/
|
|
750
|
-
this.setWorkingParts({
|
|
751
|
-
month,
|
|
752
|
-
day,
|
|
753
|
-
year,
|
|
754
|
-
hour,
|
|
755
|
-
minute,
|
|
756
|
-
ampm,
|
|
757
|
-
});
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
};
|
|
761
|
-
this.animateToDate = async (targetValue) => {
|
|
762
|
-
const { workingParts } = this;
|
|
763
|
-
/**
|
|
764
|
-
* Tell other render functions that we need to force the
|
|
765
|
-
* target month to appear in place of the actual next/prev month.
|
|
766
|
-
* Because this is a State variable, a rerender will be triggered
|
|
767
|
-
* automatically, updating the rendered months.
|
|
768
|
-
*/
|
|
769
|
-
this.forceRenderDate = targetValue;
|
|
770
|
-
/**
|
|
771
|
-
* Flag that we've started scrolling to the forced date.
|
|
772
|
-
* The resolve function will be called by the datetime's
|
|
773
|
-
* scroll listener when it's done updating everything.
|
|
774
|
-
* This is a replacement for making prev/nextMonth async,
|
|
775
|
-
* since the logic we're waiting on is in a listener.
|
|
776
|
-
*/
|
|
777
|
-
const forceDateScrollingPromise = new Promise((resolve) => {
|
|
778
|
-
this.resolveForceDateScrolling = resolve;
|
|
779
|
-
});
|
|
780
|
-
/**
|
|
781
|
-
* Animate smoothly to the forced month. This will also update
|
|
782
|
-
* workingParts and correct the surrounding months for us.
|
|
783
|
-
*/
|
|
784
|
-
const targetMonthIsBefore = isBefore(targetValue, workingParts);
|
|
785
|
-
targetMonthIsBefore ? this.prevMonth() : this.nextMonth();
|
|
786
|
-
await forceDateScrollingPromise;
|
|
787
|
-
this.resolveForceDateScrolling = undefined;
|
|
788
|
-
this.forceRenderDate = undefined;
|
|
789
|
-
};
|
|
790
|
-
this.onFocus = () => {
|
|
791
|
-
this.ionFocus.emit();
|
|
792
|
-
};
|
|
793
|
-
this.onBlur = () => {
|
|
794
|
-
this.ionBlur.emit();
|
|
795
|
-
};
|
|
796
|
-
this.hasValue = () => {
|
|
797
|
-
return this.value != null;
|
|
798
|
-
};
|
|
799
|
-
this.nextMonth = () => {
|
|
800
|
-
const calendarBodyRef = this.calendarBodyRef;
|
|
801
|
-
if (!calendarBodyRef) {
|
|
802
|
-
return;
|
|
803
|
-
}
|
|
804
|
-
const nextMonth = calendarBodyRef.querySelector('.calendar-month:last-of-type');
|
|
805
|
-
if (!nextMonth) {
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
const left = nextMonth.offsetWidth * 2;
|
|
809
|
-
calendarBodyRef.scrollTo({
|
|
810
|
-
top: 0,
|
|
811
|
-
left: left * (isRTL(this.el) ? -1 : 1),
|
|
812
|
-
behavior: 'smooth',
|
|
813
|
-
});
|
|
814
|
-
};
|
|
815
|
-
this.prevMonth = () => {
|
|
816
|
-
const calendarBodyRef = this.calendarBodyRef;
|
|
817
|
-
if (!calendarBodyRef) {
|
|
818
|
-
return;
|
|
819
|
-
}
|
|
820
|
-
const prevMonth = calendarBodyRef.querySelector('.calendar-month:first-of-type');
|
|
821
|
-
if (!prevMonth) {
|
|
822
|
-
return;
|
|
823
|
-
}
|
|
824
|
-
calendarBodyRef.scrollTo({
|
|
825
|
-
top: 0,
|
|
826
|
-
left: 0,
|
|
827
|
-
behavior: 'smooth',
|
|
828
|
-
});
|
|
829
|
-
};
|
|
830
|
-
this.toggleMonthAndYearView = () => {
|
|
831
|
-
this.showMonthAndYear = !this.showMonthAndYear;
|
|
832
|
-
};
|
|
833
|
-
this.showMonthAndYear = false;
|
|
834
|
-
this.activeParts = [];
|
|
835
|
-
this.workingParts = {
|
|
836
|
-
month: 5,
|
|
837
|
-
day: 28,
|
|
838
|
-
year: 2021,
|
|
839
|
-
hour: 13,
|
|
840
|
-
minute: 52,
|
|
841
|
-
ampm: 'pm',
|
|
842
|
-
};
|
|
843
|
-
this.isTimePopoverOpen = false;
|
|
844
|
-
this.forceRenderDate = undefined;
|
|
845
|
-
this.color = 'primary';
|
|
846
|
-
this.name = this.inputId;
|
|
847
|
-
this.disabled = false;
|
|
848
|
-
this.formatOptions = undefined;
|
|
849
|
-
this.readonly = false;
|
|
850
|
-
this.isDateEnabled = undefined;
|
|
851
|
-
this.min = undefined;
|
|
852
|
-
this.max = undefined;
|
|
853
|
-
this.presentation = 'date-time';
|
|
854
|
-
this.cancelText = 'Cancel';
|
|
855
|
-
this.doneText = 'Done';
|
|
856
|
-
this.clearText = 'Clear';
|
|
857
|
-
this.yearValues = undefined;
|
|
858
|
-
this.monthValues = undefined;
|
|
859
|
-
this.dayValues = undefined;
|
|
860
|
-
this.hourValues = undefined;
|
|
861
|
-
this.minuteValues = undefined;
|
|
862
|
-
this.locale = 'default';
|
|
863
|
-
this.firstDayOfWeek = 0;
|
|
864
|
-
this.titleSelectedDatesFormatter = undefined;
|
|
865
|
-
this.multiple = false;
|
|
866
|
-
this.highlightedDates = undefined;
|
|
867
|
-
this.value = undefined;
|
|
868
|
-
this.showDefaultTitle = false;
|
|
869
|
-
this.showDefaultButtons = false;
|
|
870
|
-
this.showClearButton = false;
|
|
871
|
-
this.showDefaultTimeLabel = true;
|
|
872
|
-
this.hourCycle = undefined;
|
|
873
|
-
this.size = 'fixed';
|
|
874
|
-
this.preferWheel = false;
|
|
875
|
-
}
|
|
876
|
-
formatOptionsChanged() {
|
|
877
|
-
const { el, formatOptions, presentation } = this;
|
|
878
|
-
checkForPresentationFormatMismatch(el, presentation, formatOptions);
|
|
879
|
-
warnIfTimeZoneProvided(el, formatOptions);
|
|
880
|
-
}
|
|
881
|
-
disabledChanged() {
|
|
882
|
-
this.emitStyle();
|
|
883
|
-
}
|
|
884
|
-
minChanged() {
|
|
885
|
-
this.processMinParts();
|
|
886
|
-
}
|
|
887
|
-
maxChanged() {
|
|
888
|
-
this.processMaxParts();
|
|
889
|
-
}
|
|
890
|
-
presentationChanged() {
|
|
891
|
-
const { el, formatOptions, presentation } = this;
|
|
892
|
-
checkForPresentationFormatMismatch(el, presentation, formatOptions);
|
|
893
|
-
}
|
|
894
|
-
get isGridStyle() {
|
|
895
|
-
const { presentation, preferWheel } = this;
|
|
896
|
-
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
897
|
-
return hasDatePresentation && !preferWheel;
|
|
898
|
-
}
|
|
899
|
-
yearValuesChanged() {
|
|
900
|
-
this.parsedYearValues = convertToArrayOfNumbers(this.yearValues);
|
|
901
|
-
}
|
|
902
|
-
monthValuesChanged() {
|
|
903
|
-
this.parsedMonthValues = convertToArrayOfNumbers(this.monthValues);
|
|
904
|
-
}
|
|
905
|
-
dayValuesChanged() {
|
|
906
|
-
this.parsedDayValues = convertToArrayOfNumbers(this.dayValues);
|
|
907
|
-
}
|
|
908
|
-
hourValuesChanged() {
|
|
909
|
-
this.parsedHourValues = convertToArrayOfNumbers(this.hourValues);
|
|
910
|
-
}
|
|
911
|
-
minuteValuesChanged() {
|
|
912
|
-
this.parsedMinuteValues = convertToArrayOfNumbers(this.minuteValues);
|
|
913
|
-
}
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
this.setValue = (value) => {
|
|
260
|
+
this.value = value;
|
|
261
|
+
this.ionChange.emit({ value });
|
|
262
|
+
};
|
|
914
263
|
/**
|
|
915
|
-
*
|
|
264
|
+
* Returns the DatetimePart interface
|
|
265
|
+
* to use when rendering an initial set of
|
|
266
|
+
* data. This should be used when rendering an
|
|
267
|
+
* interface in an environment where the `value`
|
|
268
|
+
* may not be set. This function works
|
|
269
|
+
* by returning the first selected date and then
|
|
270
|
+
* falling back to defaultParts if no active date
|
|
271
|
+
* is selected.
|
|
916
272
|
*/
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
273
|
+
this.getActivePartsWithFallback = () => {
|
|
274
|
+
var _a;
|
|
275
|
+
const { defaultParts } = this;
|
|
276
|
+
return (_a = this.getActivePart()) !== null && _a !== void 0 ? _a : defaultParts;
|
|
277
|
+
};
|
|
278
|
+
this.getActivePart = () => {
|
|
279
|
+
const { activeParts } = this;
|
|
280
|
+
return Array.isArray(activeParts) ? activeParts[0] : activeParts;
|
|
281
|
+
};
|
|
282
|
+
this.closeParentOverlay = () => {
|
|
283
|
+
const popoverOrModal = this.el.closest('ion-modal, ion-popover');
|
|
284
|
+
if (popoverOrModal) {
|
|
285
|
+
popoverOrModal.dismiss();
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
this.setWorkingParts = (parts) => {
|
|
289
|
+
this.workingParts = Object.assign({}, parts);
|
|
290
|
+
};
|
|
291
|
+
this.setActiveParts = (parts, removeDate = false) => {
|
|
292
|
+
/** if the datetime component is in readonly mode,
|
|
293
|
+
* allow browsing of the calendar without changing
|
|
294
|
+
* the set value
|
|
295
|
+
*/
|
|
296
|
+
if (this.readonly) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const { multiple, minParts, maxParts, activeParts } = this;
|
|
300
|
+
/**
|
|
301
|
+
* When setting the active parts, it is possible
|
|
302
|
+
* to set invalid data. For example,
|
|
303
|
+
* when updating January 31 to February,
|
|
304
|
+
* February 31 does not exist. As a result
|
|
305
|
+
* we need to validate the active parts and
|
|
306
|
+
* ensure that we are only setting valid dates.
|
|
307
|
+
* Additionally, we need to update the working parts
|
|
308
|
+
* too in the event that the validated parts are different.
|
|
309
|
+
*/
|
|
310
|
+
const validatedParts = validateParts(parts, minParts, maxParts);
|
|
311
|
+
this.setWorkingParts(validatedParts);
|
|
312
|
+
if (multiple) {
|
|
313
|
+
const activePartsArray = Array.isArray(activeParts) ? activeParts : [activeParts];
|
|
314
|
+
if (removeDate) {
|
|
315
|
+
this.activeParts = activePartsArray.filter((p) => !isSameDay(p, validatedParts));
|
|
921
316
|
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
317
|
+
else {
|
|
318
|
+
this.activeParts = [...activePartsArray, validatedParts];
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
this.activeParts = Object.assign({}, validatedParts);
|
|
323
|
+
}
|
|
324
|
+
const hasSlottedButtons = this.el.querySelector('[slot="buttons"]') !== null;
|
|
325
|
+
if (hasSlottedButtons || this.showDefaultButtons) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
this.confirm();
|
|
329
|
+
};
|
|
330
|
+
this.initializeKeyboardListeners = () => {
|
|
331
|
+
const calendarBodyRef = this.calendarBodyRef;
|
|
332
|
+
if (!calendarBodyRef) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
const root = this.el.shadowRoot;
|
|
336
|
+
/**
|
|
337
|
+
* Get a reference to the month
|
|
338
|
+
* element we are currently viewing.
|
|
339
|
+
*/
|
|
340
|
+
const currentMonth = calendarBodyRef.querySelector('.calendar-month:nth-of-type(2)');
|
|
341
|
+
/**
|
|
342
|
+
* When focusing the calendar body, we want to pass focus
|
|
343
|
+
* to the working day, but other days should
|
|
344
|
+
* only be accessible using the arrow keys. Pressing
|
|
345
|
+
* Tab should jump between bodies of selectable content.
|
|
346
|
+
*/
|
|
347
|
+
const checkCalendarBodyFocus = (ev) => {
|
|
348
|
+
var _a;
|
|
349
|
+
const record = ev[0];
|
|
932
350
|
/**
|
|
933
|
-
*
|
|
351
|
+
* If calendar body was already focused
|
|
352
|
+
* when this fired or if the calendar body
|
|
353
|
+
* if not currently focused, we should not re-focus
|
|
354
|
+
* the inner day.
|
|
934
355
|
*/
|
|
935
|
-
if (
|
|
936
|
-
|
|
937
|
-
if (activePartsIsArray && activeParts.length === 0) {
|
|
938
|
-
if (preferWheel) {
|
|
939
|
-
/**
|
|
940
|
-
* If the datetime is using a wheel picker, but the
|
|
941
|
-
* active parts are empty, then the user has confirmed the
|
|
942
|
-
* initial value (working parts) presented to them.
|
|
943
|
-
*/
|
|
944
|
-
this.setValue(convertDataToISO(workingParts));
|
|
945
|
-
}
|
|
946
|
-
else {
|
|
947
|
-
this.setValue(undefined);
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
else {
|
|
951
|
-
this.setValue(convertDataToISO(activeParts));
|
|
952
|
-
}
|
|
356
|
+
if (((_a = record.oldValue) === null || _a === void 0 ? void 0 : _a.includes('ion-focused')) || !calendarBodyRef.classList.contains('ion-focused')) {
|
|
357
|
+
return;
|
|
953
358
|
}
|
|
954
|
-
|
|
955
|
-
|
|
359
|
+
this.focusWorkingDay(currentMonth);
|
|
360
|
+
};
|
|
361
|
+
const mo = new MutationObserver(checkCalendarBodyFocus);
|
|
362
|
+
mo.observe(calendarBodyRef, { attributeFilter: ['class'], attributeOldValue: true });
|
|
363
|
+
this.destroyKeyboardMO = () => {
|
|
364
|
+
mo === null || mo === void 0 ? void 0 : mo.disconnect();
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* We must use keydown not keyup as we want
|
|
368
|
+
* to prevent scrolling when using the arrow keys.
|
|
369
|
+
*/
|
|
370
|
+
calendarBodyRef.addEventListener('keydown', (ev) => {
|
|
371
|
+
const activeElement = root.activeElement;
|
|
372
|
+
if (!activeElement || !activeElement.classList.contains('calendar-day')) {
|
|
373
|
+
return;
|
|
956
374
|
}
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
375
|
+
const parts = getPartsFromCalendarDay(activeElement);
|
|
376
|
+
let partsToFocus;
|
|
377
|
+
switch (ev.key) {
|
|
378
|
+
case 'ArrowDown':
|
|
379
|
+
ev.preventDefault();
|
|
380
|
+
partsToFocus = getNextWeek(parts);
|
|
381
|
+
break;
|
|
382
|
+
case 'ArrowUp':
|
|
383
|
+
ev.preventDefault();
|
|
384
|
+
partsToFocus = getPreviousWeek(parts);
|
|
385
|
+
break;
|
|
386
|
+
case 'ArrowRight':
|
|
387
|
+
ev.preventDefault();
|
|
388
|
+
partsToFocus = getNextDay(parts);
|
|
389
|
+
break;
|
|
390
|
+
case 'ArrowLeft':
|
|
391
|
+
ev.preventDefault();
|
|
392
|
+
partsToFocus = getPreviousDay(parts);
|
|
393
|
+
break;
|
|
394
|
+
case 'Home':
|
|
395
|
+
ev.preventDefault();
|
|
396
|
+
partsToFocus = getStartOfWeek(parts);
|
|
397
|
+
break;
|
|
398
|
+
case 'End':
|
|
399
|
+
ev.preventDefault();
|
|
400
|
+
partsToFocus = getEndOfWeek(parts);
|
|
401
|
+
break;
|
|
402
|
+
case 'PageUp':
|
|
403
|
+
ev.preventDefault();
|
|
404
|
+
partsToFocus = ev.shiftKey ? getPreviousYear(parts) : getPreviousMonth(parts);
|
|
405
|
+
break;
|
|
406
|
+
case 'PageDown':
|
|
407
|
+
ev.preventDefault();
|
|
408
|
+
partsToFocus = ev.shiftKey ? getNextYear(parts) : getNextMonth(parts);
|
|
409
|
+
break;
|
|
410
|
+
/**
|
|
411
|
+
* Do not preventDefault here
|
|
412
|
+
* as we do not want to override other
|
|
413
|
+
* browser defaults such as pressing Enter/Space
|
|
414
|
+
* to select a day.
|
|
415
|
+
*/
|
|
416
|
+
default:
|
|
417
|
+
return;
|
|
976
418
|
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
this.clearFocusVisible = startFocusVisible(this.el).destroy;
|
|
984
|
-
}
|
|
985
|
-
disconnectedCallback() {
|
|
986
|
-
if (this.clearFocusVisible) {
|
|
987
|
-
this.clearFocusVisible();
|
|
988
|
-
this.clearFocusVisible = undefined;
|
|
419
|
+
/**
|
|
420
|
+
* If the day we want to move focus to is
|
|
421
|
+
* disabled, do not do anything.
|
|
422
|
+
*/
|
|
423
|
+
if (isDayDisabled(partsToFocus, this.minParts, this.maxParts)) {
|
|
424
|
+
return;
|
|
989
425
|
}
|
|
990
|
-
|
|
991
|
-
initializeListeners() {
|
|
992
|
-
this.initializeCalendarListener();
|
|
993
|
-
this.initializeKeyboardListeners();
|
|
994
|
-
}
|
|
995
|
-
componentDidLoad() {
|
|
996
|
-
const { el, intersectionTrackerRef } = this;
|
|
426
|
+
this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), partsToFocus));
|
|
997
427
|
/**
|
|
998
|
-
*
|
|
999
|
-
*
|
|
1000
|
-
* into view. As a result, we will need to wait for the datetime to become
|
|
1001
|
-
* visible if used inside of a modal or a popover otherwise the scrollable
|
|
1002
|
-
* areas will not have the correct values snapped into place.
|
|
428
|
+
* Give view a chance to re-render
|
|
429
|
+
* then move focus to the new working day
|
|
1003
430
|
*/
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
431
|
+
requestAnimationFrame(() => this.focusWorkingDay(currentMonth));
|
|
432
|
+
});
|
|
433
|
+
};
|
|
434
|
+
this.focusWorkingDay = (currentMonth) => {
|
|
435
|
+
/**
|
|
436
|
+
* Get the number of padding days so
|
|
437
|
+
* we know how much to offset our next selector by
|
|
438
|
+
* to grab the correct calendar-day element.
|
|
439
|
+
*/
|
|
440
|
+
const padding = currentMonth.querySelectorAll('.calendar-day-padding');
|
|
441
|
+
const { day } = this.workingParts;
|
|
442
|
+
if (day === null) {
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Get the calendar day element
|
|
447
|
+
* and focus it.
|
|
448
|
+
*/
|
|
449
|
+
const dayEl = currentMonth.querySelector(`.calendar-day-wrapper:nth-of-type(${padding.length + day}) .calendar-day`);
|
|
450
|
+
if (dayEl) {
|
|
451
|
+
dayEl.focus();
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
this.processMinParts = () => {
|
|
455
|
+
const { min, defaultParts } = this;
|
|
456
|
+
if (min === undefined) {
|
|
457
|
+
this.minParts = undefined;
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
this.minParts = parseMinParts(min, defaultParts);
|
|
461
|
+
};
|
|
462
|
+
this.processMaxParts = () => {
|
|
463
|
+
const { max, defaultParts } = this;
|
|
464
|
+
if (max === undefined) {
|
|
465
|
+
this.maxParts = undefined;
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
this.maxParts = parseMaxParts(max, defaultParts);
|
|
469
|
+
};
|
|
470
|
+
this.initializeCalendarListener = () => {
|
|
471
|
+
const calendarBodyRef = this.calendarBodyRef;
|
|
472
|
+
if (!calendarBodyRef) {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* For performance reasons, we only render 3
|
|
477
|
+
* months at a time: The current month, the previous
|
|
478
|
+
* month, and the next month. We have a scroll listener
|
|
479
|
+
* on the calendar body to append/prepend new months.
|
|
480
|
+
*
|
|
481
|
+
* We can do this because Stencil is smart enough to not
|
|
482
|
+
* re-create the .calendar-month containers, but rather
|
|
483
|
+
* update the content within those containers.
|
|
484
|
+
*
|
|
485
|
+
* As an added bonus, WebKit has some troubles with
|
|
486
|
+
* scroll-snap-stop: always, so not rendering all of
|
|
487
|
+
* the months in a row allows us to mostly sidestep
|
|
488
|
+
* that issue.
|
|
489
|
+
*/
|
|
490
|
+
const months = calendarBodyRef.querySelectorAll('.calendar-month');
|
|
491
|
+
const startMonth = months[0];
|
|
492
|
+
const workingMonth = months[1];
|
|
493
|
+
const endMonth = months[2];
|
|
494
|
+
const mode = getIonMode(this);
|
|
495
|
+
const needsiOSRubberBandFix = mode === 'ios' && typeof navigator !== 'undefined' && navigator.maxTouchPoints > 1;
|
|
496
|
+
/**
|
|
497
|
+
* Before setting up the scroll listener,
|
|
498
|
+
* scroll the middle month into view.
|
|
499
|
+
* scrollIntoView() will scroll entire page
|
|
500
|
+
* if element is not in viewport. Use scrollLeft instead.
|
|
501
|
+
*/
|
|
502
|
+
writeTask(() => {
|
|
503
|
+
calendarBodyRef.scrollLeft = startMonth.clientWidth * (isRTL(this.el) ? -1 : 1);
|
|
504
|
+
const getChangedMonth = (parts) => {
|
|
505
|
+
const box = calendarBodyRef.getBoundingClientRect();
|
|
506
|
+
/**
|
|
507
|
+
* If the current scroll position is all the way to the left
|
|
508
|
+
* then we have scrolled to the previous month.
|
|
509
|
+
* Otherwise, assume that we have scrolled to the next
|
|
510
|
+
* month. We have a tolerance of 2px to account for
|
|
511
|
+
* sub pixel rendering.
|
|
512
|
+
*
|
|
513
|
+
* Check below the next line ensures that we did not
|
|
514
|
+
* swipe and abort (i.e. we swiped but we are still on the current month).
|
|
515
|
+
*/
|
|
516
|
+
const month = calendarBodyRef.scrollLeft <= 2 ? startMonth : endMonth;
|
|
517
|
+
/**
|
|
518
|
+
* The edge of the month must be lined up with
|
|
519
|
+
* the edge of the calendar body in order for
|
|
520
|
+
* the component to update. Otherwise, it
|
|
521
|
+
* may be the case that the user has paused their
|
|
522
|
+
* swipe or the browser has not finished snapping yet.
|
|
523
|
+
* Rather than check if the x values are equal,
|
|
524
|
+
* we give it a tolerance of 2px to account for
|
|
525
|
+
* sub pixel rendering.
|
|
526
|
+
*/
|
|
527
|
+
const monthBox = month.getBoundingClientRect();
|
|
528
|
+
if (Math.abs(monthBox.x - box.x) > 2)
|
|
529
|
+
return;
|
|
530
|
+
/**
|
|
531
|
+
* If we're force-rendering a month, assume we've
|
|
532
|
+
* scrolled to that and return it.
|
|
533
|
+
*
|
|
534
|
+
* If forceRenderDate is ever used in a context where the
|
|
535
|
+
* forced month is not immediately auto-scrolled to, this
|
|
536
|
+
* should be updated to also check whether `month` has the
|
|
537
|
+
* same month and year as the forced date.
|
|
538
|
+
*/
|
|
539
|
+
const { forceRenderDate } = this;
|
|
540
|
+
if (forceRenderDate !== undefined) {
|
|
541
|
+
return { month: forceRenderDate.month, year: forceRenderDate.year, day: forceRenderDate.day };
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* From here, we can determine if the start
|
|
545
|
+
* month or the end month was scrolled into view.
|
|
546
|
+
* If no month was changed, then we can return from
|
|
547
|
+
* the scroll callback early.
|
|
548
|
+
*/
|
|
549
|
+
if (month === startMonth) {
|
|
550
|
+
return getPreviousMonth(parts);
|
|
551
|
+
}
|
|
552
|
+
else if (month === endMonth) {
|
|
553
|
+
return getNextMonth(parts);
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
const updateActiveMonth = () => {
|
|
560
|
+
if (needsiOSRubberBandFix) {
|
|
561
|
+
calendarBodyRef.style.removeProperty('pointer-events');
|
|
562
|
+
appliediOSRubberBandFix = false;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* If the month did not change
|
|
566
|
+
* then we can return early.
|
|
567
|
+
*/
|
|
568
|
+
const newDate = getChangedMonth(this.workingParts);
|
|
569
|
+
if (!newDate)
|
|
570
|
+
return;
|
|
571
|
+
const { month, day, year } = newDate;
|
|
572
|
+
if (isMonthDisabled({ month, year, day: null }, {
|
|
573
|
+
minParts: Object.assign(Object.assign({}, this.minParts), { day: null }),
|
|
574
|
+
maxParts: Object.assign(Object.assign({}, this.maxParts), { day: null }),
|
|
575
|
+
})) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Prevent scrolling for other browsers
|
|
580
|
+
* to give the DOM time to update and the container
|
|
581
|
+
* time to properly snap.
|
|
582
|
+
*/
|
|
583
|
+
calendarBodyRef.style.setProperty('overflow', 'hidden');
|
|
584
|
+
/**
|
|
585
|
+
* Use a writeTask here to ensure
|
|
586
|
+
* that the state is updated and the
|
|
587
|
+
* correct month is scrolled into view
|
|
588
|
+
* in the same frame. This is not
|
|
589
|
+
* typically a problem on newer devices
|
|
590
|
+
* but older/slower device may have a flicker
|
|
591
|
+
* if we did not do this.
|
|
592
|
+
*/
|
|
593
|
+
writeTask(() => {
|
|
594
|
+
this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), { month, day: day, year }));
|
|
595
|
+
calendarBodyRef.scrollLeft = workingMonth.clientWidth * (isRTL(this.el) ? -1 : 1);
|
|
596
|
+
calendarBodyRef.style.removeProperty('overflow');
|
|
597
|
+
if (this.resolveForceDateScrolling) {
|
|
598
|
+
this.resolveForceDateScrolling();
|
|
1008
599
|
}
|
|
1009
|
-
|
|
1010
|
-
/**
|
|
1011
|
-
* TODO FW-2793: Datetime needs a frame to ensure that it
|
|
1012
|
-
* can properly scroll contents into view. As a result
|
|
1013
|
-
* we hide the scrollable content until after that frame
|
|
1014
|
-
* so users do not see the content quickly shifting. The downside
|
|
1015
|
-
* is that the content will pop into view a frame after. Maybe there
|
|
1016
|
-
* is a better way to handle this?
|
|
1017
|
-
*/
|
|
1018
|
-
writeTask(() => {
|
|
1019
|
-
this.el.classList.add('datetime-ready');
|
|
1020
|
-
});
|
|
600
|
+
});
|
|
1021
601
|
};
|
|
1022
|
-
const visibleIO = new IntersectionObserver(visibleCallback, { threshold: 0.01, root: el });
|
|
1023
602
|
/**
|
|
1024
|
-
*
|
|
1025
|
-
*
|
|
1026
|
-
* could cause the datetime to start at a visibility of 0, erroneously
|
|
1027
|
-
* triggering the `hiddenIO` observer below.
|
|
603
|
+
* When the container finishes scrolling we
|
|
604
|
+
* need to update the DOM with the selected month.
|
|
1028
605
|
*/
|
|
1029
|
-
|
|
606
|
+
let scrollTimeout;
|
|
1030
607
|
/**
|
|
1031
|
-
* We
|
|
1032
|
-
*
|
|
1033
|
-
*
|
|
1034
|
-
* the scroll areas have scroll widths/heights of 0px, so any snapping
|
|
1035
|
-
* we did originally has been lost.
|
|
608
|
+
* We do not want to attempt to set pointer-events
|
|
609
|
+
* multiple times within a single swipe gesture as
|
|
610
|
+
* that adds unnecessary work to the main thread.
|
|
1036
611
|
*/
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
612
|
+
let appliediOSRubberBandFix = false;
|
|
613
|
+
const scrollCallback = () => {
|
|
614
|
+
if (scrollTimeout) {
|
|
615
|
+
clearTimeout(scrollTimeout);
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* On iOS it is possible to quickly rubber band
|
|
619
|
+
* the scroll area before the scroll timeout has fired.
|
|
620
|
+
* This results in users reaching the end of the scrollable
|
|
621
|
+
* container before the DOM has updated.
|
|
622
|
+
* By setting `pointer-events: none` we can ensure that
|
|
623
|
+
* subsequent swipes do not happen while the container
|
|
624
|
+
* is snapping.
|
|
625
|
+
*/
|
|
626
|
+
if (!appliediOSRubberBandFix && needsiOSRubberBandFix) {
|
|
627
|
+
calendarBodyRef.style.setProperty('pointer-events', 'none');
|
|
628
|
+
appliediOSRubberBandFix = true;
|
|
629
|
+
}
|
|
630
|
+
// Wait ~3 frames
|
|
631
|
+
scrollTimeout = setTimeout(updateActiveMonth, 50);
|
|
1054
632
|
};
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
* the shadow dom boundary. We need to
|
|
1062
|
-
* stop propagation on these events otherwise
|
|
1063
|
-
* developers will see 2 ionFocus or 2 ionBlur
|
|
1064
|
-
* events at a time.
|
|
1065
|
-
*/
|
|
1066
|
-
const root = getElementRoot(this.el);
|
|
1067
|
-
root.addEventListener('ionFocus', (ev) => ev.stopPropagation());
|
|
1068
|
-
root.addEventListener('ionBlur', (ev) => ev.stopPropagation());
|
|
1069
|
-
}
|
|
633
|
+
calendarBodyRef.addEventListener('scroll', scrollCallback);
|
|
634
|
+
this.destroyCalendarListener = () => {
|
|
635
|
+
calendarBodyRef.removeEventListener('scroll', scrollCallback);
|
|
636
|
+
};
|
|
637
|
+
});
|
|
638
|
+
};
|
|
1070
639
|
/**
|
|
1071
|
-
*
|
|
1072
|
-
* so we
|
|
640
|
+
* Clean up all listeners except for the overlay
|
|
641
|
+
* listener. This is so that we can re-create the listeners
|
|
642
|
+
* if the datetime has been hidden/presented by a modal or popover.
|
|
1073
643
|
*/
|
|
1074
|
-
|
|
1075
|
-
|
|
644
|
+
this.destroyInteractionListeners = () => {
|
|
645
|
+
const { destroyCalendarListener, destroyKeyboardMO } = this;
|
|
646
|
+
if (destroyCalendarListener !== undefined) {
|
|
647
|
+
destroyCalendarListener();
|
|
648
|
+
}
|
|
649
|
+
if (destroyKeyboardMO !== undefined) {
|
|
650
|
+
destroyKeyboardMO();
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
this.processValue = (value) => {
|
|
654
|
+
const hasValue = value !== null && value !== undefined && (!Array.isArray(value) || value.length > 0);
|
|
655
|
+
const valueToProcess = hasValue ? parseDate(value) : this.defaultParts;
|
|
656
|
+
const { minParts, maxParts, workingParts, el } = this;
|
|
657
|
+
this.warnIfIncorrectValueUsage();
|
|
658
|
+
/**
|
|
659
|
+
* Return early if the value wasn't parsed correctly, such as
|
|
660
|
+
* if an improperly formatted date string was provided.
|
|
661
|
+
*/
|
|
662
|
+
if (!valueToProcess) {
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Datetime should only warn of out of bounds values
|
|
667
|
+
* if set by the user. If the `value` is undefined,
|
|
668
|
+
* we will default to today's date which may be out
|
|
669
|
+
* of bounds. In this case, the warning makes it look
|
|
670
|
+
* like the developer did something wrong which is
|
|
671
|
+
* not true.
|
|
672
|
+
*/
|
|
673
|
+
if (hasValue) {
|
|
674
|
+
warnIfValueOutOfBounds(valueToProcess, minParts, maxParts);
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* If there are multiple values, pick an arbitrary one to clamp to. This way,
|
|
678
|
+
* if the values are across months, we always show at least one of them. Note
|
|
679
|
+
* that the values don't necessarily have to be in order.
|
|
680
|
+
*/
|
|
681
|
+
const singleValue = Array.isArray(valueToProcess) ? valueToProcess[0] : valueToProcess;
|
|
682
|
+
const targetValue = clampDate(singleValue, minParts, maxParts);
|
|
683
|
+
const { month, day, year, hour, minute } = targetValue;
|
|
684
|
+
const ampm = parseAmPm(hour);
|
|
685
|
+
/**
|
|
686
|
+
* Since `activeParts` indicates a value that
|
|
687
|
+
* been explicitly selected either by the
|
|
688
|
+
* user or the app, only update `activeParts`
|
|
689
|
+
* if the `value` property is set.
|
|
690
|
+
*/
|
|
691
|
+
if (hasValue) {
|
|
692
|
+
if (Array.isArray(valueToProcess)) {
|
|
693
|
+
this.activeParts = [...valueToProcess];
|
|
694
|
+
}
|
|
695
|
+
else {
|
|
696
|
+
this.activeParts = {
|
|
697
|
+
month,
|
|
698
|
+
day,
|
|
699
|
+
year,
|
|
700
|
+
hour,
|
|
701
|
+
minute,
|
|
702
|
+
ampm,
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
else {
|
|
1076
707
|
/**
|
|
1077
|
-
*
|
|
1078
|
-
*
|
|
1079
|
-
*
|
|
1080
|
-
* to the disabled month so that users cannot scroll to it.
|
|
1081
|
-
* This triggers a bug in WebKit where the scroll position is reset.
|
|
1082
|
-
* Since the month change logic is handled by a scroll listener,
|
|
1083
|
-
* this causes the month to change leading to `scroll-snap-align`
|
|
1084
|
-
* changing again, thus changing the scroll position again and causing
|
|
1085
|
-
* an infinite loop.
|
|
1086
|
-
* This issue only applies to the calendar grid, so we can disable
|
|
1087
|
-
* it if the calendar grid is not being used.
|
|
708
|
+
* Reset the active parts if the value is not set.
|
|
709
|
+
* This will clear the selected calendar day when
|
|
710
|
+
* performing a clear action or using the reset() method.
|
|
1088
711
|
*/
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
712
|
+
this.activeParts = [];
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Only animate if:
|
|
716
|
+
* 1. We're using grid style (wheel style pickers should just jump to new value)
|
|
717
|
+
* 2. The month and/or year actually changed, and both are defined (otherwise there's nothing to animate to)
|
|
718
|
+
* 3. The calendar body is visible (prevents animation when in collapsed datetime-button, for example)
|
|
719
|
+
* 4. The month/year picker is not open (since you wouldn't see the animation anyway)
|
|
720
|
+
*/
|
|
721
|
+
const didChangeMonth = (month !== undefined && month !== workingParts.month) || (year !== undefined && year !== workingParts.year);
|
|
722
|
+
const bodyIsVisible = el.classList.contains('datetime-ready');
|
|
723
|
+
const { isGridStyle, showMonthAndYear } = this;
|
|
724
|
+
let areAllSelectedDatesInSameMonth = true;
|
|
725
|
+
if (Array.isArray(valueToProcess)) {
|
|
726
|
+
const firstMonth = valueToProcess[0].month;
|
|
727
|
+
for (const date of valueToProcess) {
|
|
728
|
+
if (date.month !== firstMonth) {
|
|
729
|
+
areAllSelectedDatesInSameMonth = false;
|
|
730
|
+
break;
|
|
731
|
+
}
|
|
1108
732
|
}
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* If there is more than one date selected
|
|
736
|
+
* and the dates aren't all in the same month,
|
|
737
|
+
* then we should neither animate to the date
|
|
738
|
+
* nor update the working parts because we do
|
|
739
|
+
* not know which date the user wants to view.
|
|
740
|
+
*/
|
|
741
|
+
if (areAllSelectedDatesInSameMonth) {
|
|
742
|
+
if (isGridStyle && didChangeMonth && bodyIsVisible && !showMonthAndYear) {
|
|
743
|
+
this.animateToDate(targetValue);
|
|
1112
744
|
}
|
|
1113
|
-
|
|
1114
|
-
|
|
745
|
+
else {
|
|
746
|
+
/**
|
|
747
|
+
* We only need to do this if we didn't just animate to a new month,
|
|
748
|
+
* since that calls prevMonth/nextMonth which calls setWorkingParts for us.
|
|
749
|
+
*/
|
|
750
|
+
this.setWorkingParts({
|
|
751
|
+
month,
|
|
752
|
+
day,
|
|
753
|
+
year,
|
|
754
|
+
hour,
|
|
755
|
+
minute,
|
|
756
|
+
ampm,
|
|
757
|
+
});
|
|
1115
758
|
}
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
this.animateToDate = async (targetValue) => {
|
|
762
|
+
const { workingParts } = this;
|
|
763
|
+
/**
|
|
764
|
+
* Tell other render functions that we need to force the
|
|
765
|
+
* target month to appear in place of the actual next/prev month.
|
|
766
|
+
* Because this is a State variable, a rerender will be triggered
|
|
767
|
+
* automatically, updating the rendered months.
|
|
768
|
+
*/
|
|
769
|
+
this.forceRenderDate = targetValue;
|
|
770
|
+
/**
|
|
771
|
+
* Flag that we've started scrolling to the forced date.
|
|
772
|
+
* The resolve function will be called by the datetime's
|
|
773
|
+
* scroll listener when it's done updating everything.
|
|
774
|
+
* This is a replacement for making prev/nextMonth async,
|
|
775
|
+
* since the logic we're waiting on is in a listener.
|
|
776
|
+
*/
|
|
777
|
+
const forceDateScrollingPromise = new Promise((resolve) => {
|
|
778
|
+
this.resolveForceDateScrolling = resolve;
|
|
779
|
+
});
|
|
780
|
+
/**
|
|
781
|
+
* Animate smoothly to the forced month. This will also update
|
|
782
|
+
* workingParts and correct the surrounding months for us.
|
|
783
|
+
*/
|
|
784
|
+
const targetMonthIsBefore = isBefore(targetValue, workingParts);
|
|
785
|
+
targetMonthIsBefore ? this.prevMonth() : this.nextMonth();
|
|
786
|
+
await forceDateScrollingPromise;
|
|
787
|
+
this.resolveForceDateScrolling = undefined;
|
|
788
|
+
this.forceRenderDate = undefined;
|
|
789
|
+
};
|
|
790
|
+
this.onFocus = () => {
|
|
791
|
+
this.ionFocus.emit();
|
|
792
|
+
};
|
|
793
|
+
this.onBlur = () => {
|
|
794
|
+
this.ionBlur.emit();
|
|
795
|
+
};
|
|
796
|
+
this.hasValue = () => {
|
|
797
|
+
return this.value != null;
|
|
798
|
+
};
|
|
799
|
+
this.nextMonth = () => {
|
|
800
|
+
const calendarBodyRef = this.calendarBodyRef;
|
|
801
|
+
if (!calendarBodyRef) {
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
const nextMonth = calendarBodyRef.querySelector('.calendar-month:last-of-type');
|
|
805
|
+
if (!nextMonth) {
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
const left = nextMonth.offsetWidth * 2;
|
|
809
|
+
calendarBodyRef.scrollTo({
|
|
810
|
+
top: 0,
|
|
811
|
+
left: left * (isRTL(this.el) ? -1 : 1),
|
|
812
|
+
behavior: 'smooth',
|
|
813
|
+
});
|
|
814
|
+
};
|
|
815
|
+
this.prevMonth = () => {
|
|
816
|
+
const calendarBodyRef = this.calendarBodyRef;
|
|
817
|
+
if (!calendarBodyRef) {
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
820
|
+
const prevMonth = calendarBodyRef.querySelector('.calendar-month:first-of-type');
|
|
821
|
+
if (!prevMonth) {
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
calendarBodyRef.scrollTo({
|
|
825
|
+
top: 0,
|
|
826
|
+
left: 0,
|
|
827
|
+
behavior: 'smooth',
|
|
828
|
+
});
|
|
829
|
+
};
|
|
830
|
+
this.toggleMonthAndYearView = () => {
|
|
831
|
+
this.showMonthAndYear = !this.showMonthAndYear;
|
|
832
|
+
};
|
|
833
|
+
this.showMonthAndYear = false;
|
|
834
|
+
this.activeParts = [];
|
|
835
|
+
this.workingParts = {
|
|
836
|
+
month: 5,
|
|
837
|
+
day: 28,
|
|
838
|
+
year: 2021,
|
|
839
|
+
hour: 13,
|
|
840
|
+
minute: 52,
|
|
841
|
+
ampm: 'pm',
|
|
842
|
+
};
|
|
843
|
+
this.isTimePopoverOpen = false;
|
|
844
|
+
this.forceRenderDate = undefined;
|
|
845
|
+
this.color = 'primary';
|
|
846
|
+
this.name = this.inputId;
|
|
847
|
+
this.disabled = false;
|
|
848
|
+
this.formatOptions = undefined;
|
|
849
|
+
this.readonly = false;
|
|
850
|
+
this.isDateEnabled = undefined;
|
|
851
|
+
this.min = undefined;
|
|
852
|
+
this.max = undefined;
|
|
853
|
+
this.presentation = 'date-time';
|
|
854
|
+
this.cancelText = 'Cancel';
|
|
855
|
+
this.doneText = 'Done';
|
|
856
|
+
this.clearText = 'Clear';
|
|
857
|
+
this.yearValues = undefined;
|
|
858
|
+
this.monthValues = undefined;
|
|
859
|
+
this.dayValues = undefined;
|
|
860
|
+
this.hourValues = undefined;
|
|
861
|
+
this.minuteValues = undefined;
|
|
862
|
+
this.locale = 'default';
|
|
863
|
+
this.firstDayOfWeek = 0;
|
|
864
|
+
this.titleSelectedDatesFormatter = undefined;
|
|
865
|
+
this.multiple = false;
|
|
866
|
+
this.highlightedDates = undefined;
|
|
867
|
+
this.value = undefined;
|
|
868
|
+
this.showDefaultTitle = false;
|
|
869
|
+
this.showDefaultButtons = false;
|
|
870
|
+
this.showClearButton = false;
|
|
871
|
+
this.showDefaultTimeLabel = true;
|
|
872
|
+
this.hourCycle = undefined;
|
|
873
|
+
this.size = 'fixed';
|
|
874
|
+
this.preferWheel = false;
|
|
875
|
+
}
|
|
876
|
+
formatOptionsChanged() {
|
|
877
|
+
const { el, formatOptions, presentation } = this;
|
|
878
|
+
checkForPresentationFormatMismatch(el, presentation, formatOptions);
|
|
879
|
+
warnIfTimeZoneProvided(el, formatOptions);
|
|
880
|
+
}
|
|
881
|
+
disabledChanged() {
|
|
882
|
+
this.emitStyle();
|
|
883
|
+
}
|
|
884
|
+
minChanged() {
|
|
885
|
+
this.processMinParts();
|
|
886
|
+
}
|
|
887
|
+
maxChanged() {
|
|
888
|
+
this.processMaxParts();
|
|
889
|
+
}
|
|
890
|
+
presentationChanged() {
|
|
891
|
+
const { el, formatOptions, presentation } = this;
|
|
892
|
+
checkForPresentationFormatMismatch(el, presentation, formatOptions);
|
|
893
|
+
}
|
|
894
|
+
get isGridStyle() {
|
|
895
|
+
const { presentation, preferWheel } = this;
|
|
896
|
+
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
897
|
+
return hasDatePresentation && !preferWheel;
|
|
898
|
+
}
|
|
899
|
+
yearValuesChanged() {
|
|
900
|
+
this.parsedYearValues = convertToArrayOfNumbers(this.yearValues);
|
|
901
|
+
}
|
|
902
|
+
monthValuesChanged() {
|
|
903
|
+
this.parsedMonthValues = convertToArrayOfNumbers(this.monthValues);
|
|
904
|
+
}
|
|
905
|
+
dayValuesChanged() {
|
|
906
|
+
this.parsedDayValues = convertToArrayOfNumbers(this.dayValues);
|
|
907
|
+
}
|
|
908
|
+
hourValuesChanged() {
|
|
909
|
+
this.parsedHourValues = convertToArrayOfNumbers(this.hourValues);
|
|
910
|
+
}
|
|
911
|
+
minuteValuesChanged() {
|
|
912
|
+
this.parsedMinuteValues = convertToArrayOfNumbers(this.minuteValues);
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Update the datetime value when the value changes
|
|
916
|
+
*/
|
|
917
|
+
async valueChanged() {
|
|
918
|
+
const { value } = this;
|
|
919
|
+
if (this.hasValue()) {
|
|
920
|
+
this.processValue(value);
|
|
1128
921
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
922
|
+
this.emitStyle();
|
|
923
|
+
this.ionValueChange.emit({ value });
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Confirms the selected datetime value, updates the
|
|
927
|
+
* `value` property, and optionally closes the popover
|
|
928
|
+
* or modal that the datetime was presented in.
|
|
929
|
+
*/
|
|
930
|
+
async confirm(closeOverlay = false) {
|
|
931
|
+
const { isCalendarPicker, activeParts, preferWheel, workingParts } = this;
|
|
932
|
+
/**
|
|
933
|
+
* We only update the value if the presentation is not a calendar picker.
|
|
934
|
+
*/
|
|
935
|
+
if (activeParts !== undefined || !isCalendarPicker) {
|
|
936
|
+
const activePartsIsArray = Array.isArray(activeParts);
|
|
937
|
+
if (activePartsIsArray && activeParts.length === 0) {
|
|
938
|
+
if (preferWheel) {
|
|
939
|
+
/**
|
|
940
|
+
* If the datetime is using a wheel picker, but the
|
|
941
|
+
* active parts are empty, then the user has confirmed the
|
|
942
|
+
* initial value (working parts) presented to them.
|
|
943
|
+
*/
|
|
944
|
+
this.setValue(convertDataToISO(workingParts));
|
|
1146
945
|
}
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
warnIfTimeZoneProvided(el, formatOptions);
|
|
946
|
+
else {
|
|
947
|
+
this.setValue(undefined);
|
|
1150
948
|
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
949
|
+
}
|
|
950
|
+
else {
|
|
951
|
+
this.setValue(convertDataToISO(activeParts));
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
if (closeOverlay) {
|
|
955
|
+
this.closeParentOverlay();
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Resets the internal state of the datetime but does not update the value.
|
|
960
|
+
* Passing a valid ISO-8601 string will reset the state of the component to the provided date.
|
|
961
|
+
* If no value is provided, the internal state will be reset to the clamped value of the min, max and today.
|
|
962
|
+
*/
|
|
963
|
+
async reset(startDate) {
|
|
964
|
+
this.processValue(startDate);
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* Emits the ionCancel event and
|
|
968
|
+
* optionally closes the popover
|
|
969
|
+
* or modal that the datetime was
|
|
970
|
+
* presented in.
|
|
971
|
+
*/
|
|
972
|
+
async cancel(closeOverlay = false) {
|
|
973
|
+
this.ionCancel.emit();
|
|
974
|
+
if (closeOverlay) {
|
|
975
|
+
this.closeParentOverlay();
|
|
1171
976
|
}
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
977
|
+
}
|
|
978
|
+
get isCalendarPicker() {
|
|
979
|
+
const { presentation } = this;
|
|
980
|
+
return presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
981
|
+
}
|
|
982
|
+
connectedCallback() {
|
|
983
|
+
this.clearFocusVisible = startFocusVisible(this.el).destroy;
|
|
984
|
+
}
|
|
985
|
+
disconnectedCallback() {
|
|
986
|
+
if (this.clearFocusVisible) {
|
|
987
|
+
this.clearFocusVisible();
|
|
988
|
+
this.clearFocusVisible = undefined;
|
|
1178
989
|
}
|
|
990
|
+
}
|
|
991
|
+
initializeListeners() {
|
|
992
|
+
this.initializeCalendarListener();
|
|
993
|
+
this.initializeKeyboardListeners();
|
|
994
|
+
}
|
|
995
|
+
componentDidLoad() {
|
|
996
|
+
const { el, intersectionTrackerRef } = this;
|
|
1179
997
|
/**
|
|
1180
|
-
*
|
|
1181
|
-
*
|
|
1182
|
-
*
|
|
998
|
+
* If a scrollable element is hidden using `display: none`,
|
|
999
|
+
* it will not have a scroll height meaning we cannot scroll elements
|
|
1000
|
+
* into view. As a result, we will need to wait for the datetime to become
|
|
1001
|
+
* visible if used inside of a modal or a popover otherwise the scrollable
|
|
1002
|
+
* areas will not have the correct values snapped into place.
|
|
1183
1003
|
*/
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1004
|
+
const visibleCallback = (entries) => {
|
|
1005
|
+
const ev = entries[0];
|
|
1006
|
+
if (!ev.isIntersecting) {
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
this.initializeListeners();
|
|
1010
|
+
/**
|
|
1011
|
+
* TODO FW-2793: Datetime needs a frame to ensure that it
|
|
1012
|
+
* can properly scroll contents into view. As a result
|
|
1013
|
+
* we hide the scrollable content until after that frame
|
|
1014
|
+
* so users do not see the content quickly shifting. The downside
|
|
1015
|
+
* is that the content will pop into view a frame after. Maybe there
|
|
1016
|
+
* is a better way to handle this?
|
|
1017
|
+
*/
|
|
1018
|
+
writeTask(() => {
|
|
1019
|
+
this.el.classList.add('datetime-ready');
|
|
1020
|
+
});
|
|
1021
|
+
};
|
|
1022
|
+
const visibleIO = new IntersectionObserver(visibleCallback, { threshold: 0.01, root: el });
|
|
1023
|
+
/**
|
|
1024
|
+
* Use raf to avoid a race condition between the component loading and
|
|
1025
|
+
* its display animation starting (such as when shown in a modal). This
|
|
1026
|
+
* could cause the datetime to start at a visibility of 0, erroneously
|
|
1027
|
+
* triggering the `hiddenIO` observer below.
|
|
1028
|
+
*/
|
|
1029
|
+
raf(() => visibleIO === null || visibleIO === void 0 ? void 0 : visibleIO.observe(intersectionTrackerRef));
|
|
1030
|
+
/**
|
|
1031
|
+
* We need to clean up listeners when the datetime is hidden
|
|
1032
|
+
* in a popover/modal so that we can properly scroll containers
|
|
1033
|
+
* back into view if they are re-presented. When the datetime is hidden
|
|
1034
|
+
* the scroll areas have scroll widths/heights of 0px, so any snapping
|
|
1035
|
+
* we did originally has been lost.
|
|
1036
|
+
*/
|
|
1037
|
+
const hiddenCallback = (entries) => {
|
|
1038
|
+
const ev = entries[0];
|
|
1039
|
+
if (ev.isIntersecting) {
|
|
1040
|
+
return;
|
|
1041
|
+
}
|
|
1042
|
+
this.destroyInteractionListeners();
|
|
1043
|
+
/**
|
|
1044
|
+
* When datetime is hidden, we need to make sure that
|
|
1045
|
+
* the month/year picker is closed. Otherwise,
|
|
1046
|
+
* it will be open when the datetime re-appears
|
|
1047
|
+
* and the scroll area of the calendar grid will be 0.
|
|
1048
|
+
* As a result, the wrong month will be shown.
|
|
1049
|
+
*/
|
|
1050
|
+
this.showMonthAndYear = false;
|
|
1051
|
+
writeTask(() => {
|
|
1052
|
+
this.el.classList.remove('datetime-ready');
|
|
1053
|
+
});
|
|
1054
|
+
};
|
|
1055
|
+
const hiddenIO = new IntersectionObserver(hiddenCallback, { threshold: 0, root: el });
|
|
1056
|
+
raf(() => hiddenIO === null || hiddenIO === void 0 ? void 0 : hiddenIO.observe(intersectionTrackerRef));
|
|
1057
|
+
/**
|
|
1058
|
+
* Datetime uses Ionic components that emit
|
|
1059
|
+
* ionFocus and ionBlur. These events are
|
|
1060
|
+
* composed meaning they will cross
|
|
1061
|
+
* the shadow dom boundary. We need to
|
|
1062
|
+
* stop propagation on these events otherwise
|
|
1063
|
+
* developers will see 2 ionFocus or 2 ionBlur
|
|
1064
|
+
* events at a time.
|
|
1065
|
+
*/
|
|
1066
|
+
const root = getElementRoot(this.el);
|
|
1067
|
+
root.addEventListener('ionFocus', (ev) => ev.stopPropagation());
|
|
1068
|
+
root.addEventListener('ionBlur', (ev) => ev.stopPropagation());
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* When the presentation is changed, all calendar content is recreated,
|
|
1072
|
+
* so we need to re-init behavior with the new elements.
|
|
1073
|
+
*/
|
|
1074
|
+
componentDidRender() {
|
|
1075
|
+
const { presentation, prevPresentation, calendarBodyRef, minParts, preferWheel, forceRenderDate } = this;
|
|
1076
|
+
/**
|
|
1077
|
+
* TODO(FW-2165)
|
|
1078
|
+
* Remove this when https://bugs.webkit.org/show_bug.cgi?id=235960 is fixed.
|
|
1079
|
+
* When using `min`, we add `scroll-snap-align: none`
|
|
1080
|
+
* to the disabled month so that users cannot scroll to it.
|
|
1081
|
+
* This triggers a bug in WebKit where the scroll position is reset.
|
|
1082
|
+
* Since the month change logic is handled by a scroll listener,
|
|
1083
|
+
* this causes the month to change leading to `scroll-snap-align`
|
|
1084
|
+
* changing again, thus changing the scroll position again and causing
|
|
1085
|
+
* an infinite loop.
|
|
1086
|
+
* This issue only applies to the calendar grid, so we can disable
|
|
1087
|
+
* it if the calendar grid is not being used.
|
|
1088
|
+
*/
|
|
1089
|
+
const hasCalendarGrid = !preferWheel && ['date-time', 'time-date', 'date'].includes(presentation);
|
|
1090
|
+
if (minParts !== undefined && hasCalendarGrid && calendarBodyRef) {
|
|
1091
|
+
const workingMonth = calendarBodyRef.querySelector('.calendar-month:nth-of-type(1)');
|
|
1092
|
+
/**
|
|
1093
|
+
* We need to make sure the datetime is not in the process
|
|
1094
|
+
* of scrolling to a new datetime value if the value
|
|
1095
|
+
* is updated programmatically.
|
|
1096
|
+
* Otherwise, the datetime will appear to not scroll at all because
|
|
1097
|
+
* we are resetting the scroll position to the center of the view.
|
|
1098
|
+
* Prior to the datetime's value being updated programmatically,
|
|
1099
|
+
* the calendarBodyRef is scrolled such that the middle month is centered
|
|
1100
|
+
* in the view. The below code updates the scroll position so the middle
|
|
1101
|
+
* month is also centered in the view. Since the scroll position did not change,
|
|
1102
|
+
* the scroll callback in this file does not fire,
|
|
1103
|
+
* and the resolveForceDateScrolling promise never resolves.
|
|
1104
|
+
*/
|
|
1105
|
+
if (workingMonth && forceRenderDate === undefined) {
|
|
1106
|
+
calendarBodyRef.scrollLeft = workingMonth.clientWidth * (isRTL(this.el) ? -1 : 1);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
if (prevPresentation === null) {
|
|
1110
|
+
this.prevPresentation = presentation;
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1113
|
+
if (presentation === prevPresentation) {
|
|
1114
|
+
return;
|
|
1211
1115
|
}
|
|
1116
|
+
this.prevPresentation = presentation;
|
|
1117
|
+
this.destroyInteractionListeners();
|
|
1118
|
+
this.initializeListeners();
|
|
1212
1119
|
/**
|
|
1213
|
-
*
|
|
1120
|
+
* The month/year picker from the date interface
|
|
1121
|
+
* should be closed as it is not available in non-date
|
|
1122
|
+
* interfaces.
|
|
1214
1123
|
*/
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1124
|
+
this.showMonthAndYear = false;
|
|
1125
|
+
raf(() => {
|
|
1126
|
+
this.ionRender.emit();
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
componentWillLoad() {
|
|
1130
|
+
const { el, formatOptions, highlightedDates, multiple, presentation, preferWheel } = this;
|
|
1131
|
+
if (multiple) {
|
|
1132
|
+
if (presentation !== 'date') {
|
|
1133
|
+
printIonWarning('Multiple date selection is only supported for presentation="date".', el);
|
|
1134
|
+
}
|
|
1135
|
+
if (preferWheel) {
|
|
1136
|
+
printIonWarning('Multiple date selection is not supported with preferWheel="true".', el);
|
|
1137
|
+
}
|
|
1229
1138
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1139
|
+
if (highlightedDates !== undefined) {
|
|
1140
|
+
if (presentation !== 'date' && presentation !== 'date-time' && presentation !== 'time-date') {
|
|
1141
|
+
printIonWarning('The highlightedDates property is only supported with the date, date-time, and time-date presentations.', el);
|
|
1142
|
+
}
|
|
1143
|
+
if (preferWheel) {
|
|
1144
|
+
printIonWarning('The highlightedDates property is not supported with preferWheel="true".', el);
|
|
1145
|
+
}
|
|
1234
1146
|
}
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
/**
|
|
1239
|
-
* By default, generate a range of 3 months:
|
|
1240
|
-
* Previous month, current month, and next month
|
|
1241
|
-
*/
|
|
1242
|
-
const monthsToRender = generateMonths(workingParts);
|
|
1243
|
-
const lastMonth = monthsToRender[monthsToRender.length - 1];
|
|
1244
|
-
/**
|
|
1245
|
-
* Ensure that users can select the entire window of dates.
|
|
1246
|
-
*/
|
|
1247
|
-
monthsToRender[0].day = 1;
|
|
1248
|
-
lastMonth.day = getNumDaysInMonth(lastMonth.month, lastMonth.year);
|
|
1249
|
-
/**
|
|
1250
|
-
* Narrow the dates rendered based on min/max dates (if any).
|
|
1251
|
-
* The `min` date is used if the min is after the generated min month.
|
|
1252
|
-
* The `max` date is used if the max is before the generated max month.
|
|
1253
|
-
* This ensures that the sliding window always stays at 3 months
|
|
1254
|
-
* but still allows future dates to be lazily rendered based on any min/max
|
|
1255
|
-
* constraints.
|
|
1256
|
-
*/
|
|
1257
|
-
const min = minParts !== undefined && isAfter(minParts, monthsToRender[0]) ? minParts : monthsToRender[0];
|
|
1258
|
-
const max = maxParts !== undefined && isBefore(maxParts, lastMonth) ? maxParts : lastMonth;
|
|
1259
|
-
const result = getCombinedDateColumnData(locale, todayParts, min, max, this.parsedDayValues, this.parsedMonthValues);
|
|
1260
|
-
let items = result.items;
|
|
1261
|
-
const parts = result.parts;
|
|
1262
|
-
if (isDateEnabled) {
|
|
1263
|
-
items = items.map((itemObject, index) => {
|
|
1264
|
-
const referenceParts = parts[index];
|
|
1265
|
-
let disabled;
|
|
1266
|
-
try {
|
|
1267
|
-
/**
|
|
1268
|
-
* The `isDateEnabled` implementation is try-catch wrapped
|
|
1269
|
-
* to prevent exceptions in the user's function from
|
|
1270
|
-
* interrupting the calendar rendering.
|
|
1271
|
-
*/
|
|
1272
|
-
disabled = !isDateEnabled(convertDataToISO(referenceParts));
|
|
1273
|
-
}
|
|
1274
|
-
catch (e) {
|
|
1275
|
-
printIonError('Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', e);
|
|
1276
|
-
}
|
|
1277
|
-
return Object.assign(Object.assign({}, itemObject), { disabled });
|
|
1278
|
-
});
|
|
1279
|
-
}
|
|
1280
|
-
/**
|
|
1281
|
-
* If we have selected a day already, then default the column
|
|
1282
|
-
* to that value. Otherwise, set it to the default date.
|
|
1283
|
-
*/
|
|
1284
|
-
const todayString = workingParts.day !== null
|
|
1285
|
-
? `${workingParts.year}-${workingParts.month}-${workingParts.day}`
|
|
1286
|
-
: `${defaultParts.year}-${defaultParts.month}-${defaultParts.day}`;
|
|
1287
|
-
return (h("ion-picker-column-internal", { class: "date-column", color: this.color, disabled: disabled, items: items, value: todayString, onIonChange: (ev) => {
|
|
1288
|
-
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1289
|
-
// Due to a Safari 14 issue we need to destroy
|
|
1290
|
-
// the scroll listener before we update state
|
|
1291
|
-
// and trigger a re-render.
|
|
1292
|
-
if (this.destroyCalendarListener) {
|
|
1293
|
-
this.destroyCalendarListener();
|
|
1294
|
-
}
|
|
1295
|
-
const { value } = ev.detail;
|
|
1296
|
-
const findPart = parts.find(({ month, day, year }) => value === `${year}-${month}-${day}`);
|
|
1297
|
-
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), findPart));
|
|
1298
|
-
this.setActiveParts(Object.assign(Object.assign({}, activePart), findPart));
|
|
1299
|
-
// We can re-attach the scroll listener after
|
|
1300
|
-
// the working parts have been updated.
|
|
1301
|
-
this.initializeCalendarListener();
|
|
1302
|
-
ev.stopPropagation();
|
|
1303
|
-
} }));
|
|
1147
|
+
if (formatOptions) {
|
|
1148
|
+
checkForPresentationFormatMismatch(el, presentation, formatOptions);
|
|
1149
|
+
warnIfTimeZoneProvided(el, formatOptions);
|
|
1304
1150
|
}
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
renderArray = [
|
|
1350
|
-
this.renderMonthPickerColumn(months),
|
|
1351
|
-
this.renderDayPickerColumn(days),
|
|
1352
|
-
this.renderYearPickerColumn(years),
|
|
1353
|
-
];
|
|
1354
|
-
}
|
|
1355
|
-
else {
|
|
1356
|
-
renderArray = [
|
|
1357
|
-
this.renderDayPickerColumn(days),
|
|
1358
|
-
this.renderMonthPickerColumn(months),
|
|
1359
|
-
this.renderYearPickerColumn(years),
|
|
1360
|
-
];
|
|
1361
|
-
}
|
|
1362
|
-
return renderArray;
|
|
1151
|
+
const hourValues = (this.parsedHourValues = convertToArrayOfNumbers(this.hourValues));
|
|
1152
|
+
const minuteValues = (this.parsedMinuteValues = convertToArrayOfNumbers(this.minuteValues));
|
|
1153
|
+
const monthValues = (this.parsedMonthValues = convertToArrayOfNumbers(this.monthValues));
|
|
1154
|
+
const yearValues = (this.parsedYearValues = convertToArrayOfNumbers(this.yearValues));
|
|
1155
|
+
const dayValues = (this.parsedDayValues = convertToArrayOfNumbers(this.dayValues));
|
|
1156
|
+
const todayParts = (this.todayParts = parseDate(getToday()));
|
|
1157
|
+
this.processMinParts();
|
|
1158
|
+
this.processMaxParts();
|
|
1159
|
+
this.defaultParts = getClosestValidDate({
|
|
1160
|
+
refParts: todayParts,
|
|
1161
|
+
monthValues,
|
|
1162
|
+
dayValues,
|
|
1163
|
+
yearValues,
|
|
1164
|
+
hourValues,
|
|
1165
|
+
minuteValues,
|
|
1166
|
+
minParts: this.minParts,
|
|
1167
|
+
maxParts: this.maxParts,
|
|
1168
|
+
});
|
|
1169
|
+
this.processValue(this.value);
|
|
1170
|
+
this.emitStyle();
|
|
1171
|
+
}
|
|
1172
|
+
emitStyle() {
|
|
1173
|
+
this.ionStyle.emit({
|
|
1174
|
+
interactive: true,
|
|
1175
|
+
datetime: true,
|
|
1176
|
+
'interactive-disabled': this.disabled,
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Universal render methods
|
|
1181
|
+
* These are pieces of datetime that
|
|
1182
|
+
* are rendered independently of presentation.
|
|
1183
|
+
*/
|
|
1184
|
+
renderFooter() {
|
|
1185
|
+
const { disabled, readonly, showDefaultButtons, showClearButton } = this;
|
|
1186
|
+
/**
|
|
1187
|
+
* The cancel, clear, and confirm buttons
|
|
1188
|
+
* should not be interactive if the datetime
|
|
1189
|
+
* is disabled or readonly.
|
|
1190
|
+
*/
|
|
1191
|
+
const isButtonDisabled = disabled || readonly;
|
|
1192
|
+
const hasSlottedButtons = this.el.querySelector('[slot="buttons"]') !== null;
|
|
1193
|
+
if (!hasSlottedButtons && !showDefaultButtons && !showClearButton) {
|
|
1194
|
+
return;
|
|
1363
1195
|
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1196
|
+
const clearButtonClick = () => {
|
|
1197
|
+
this.reset();
|
|
1198
|
+
this.setValue(undefined);
|
|
1199
|
+
};
|
|
1200
|
+
/**
|
|
1201
|
+
* By default we render two buttons:
|
|
1202
|
+
* Cancel - Dismisses the datetime and
|
|
1203
|
+
* does not update the `value` prop.
|
|
1204
|
+
* OK - Dismisses the datetime and
|
|
1205
|
+
* updates the `value` prop.
|
|
1206
|
+
*/
|
|
1207
|
+
return (h("div", { class: "datetime-footer" }, h("div", { class: "datetime-buttons" }, h("div", { class: {
|
|
1208
|
+
['datetime-action-buttons']: true,
|
|
1209
|
+
['has-clear-button']: this.showClearButton,
|
|
1210
|
+
} }, h("slot", { name: "buttons" }, h("ion-buttons", null, showDefaultButtons && (h("ion-button", { id: "cancel-button", color: this.color, onClick: () => this.cancel(true), disabled: isButtonDisabled }, this.cancelText)), h("div", { class: "datetime-action-buttons-container" }, showClearButton && (h("ion-button", { id: "clear-button", color: this.color, onClick: () => clearButtonClick(), disabled: isButtonDisabled }, this.clearText)), showDefaultButtons && (h("ion-button", { id: "confirm-button", color: this.color, onClick: () => this.confirm(true), disabled: isButtonDisabled }, this.doneText)))))))));
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* Wheel picker render methods
|
|
1214
|
+
*/
|
|
1215
|
+
renderWheelPicker(forcePresentation = this.presentation) {
|
|
1216
|
+
/**
|
|
1217
|
+
* If presentation="time-date" we switch the
|
|
1218
|
+
* order of the render array here instead of
|
|
1219
|
+
* manually reordering each date/time picker
|
|
1220
|
+
* column with CSS. This allows for additional
|
|
1221
|
+
* flexibility if we need to render subsets
|
|
1222
|
+
* of the date/time data or do additional ordering
|
|
1223
|
+
* within the child render functions.
|
|
1224
|
+
*/
|
|
1225
|
+
const renderArray = forcePresentation === 'time-date'
|
|
1226
|
+
? [this.renderTimePickerColumns(forcePresentation), this.renderDatePickerColumns(forcePresentation)]
|
|
1227
|
+
: [this.renderDatePickerColumns(forcePresentation), this.renderTimePickerColumns(forcePresentation)];
|
|
1228
|
+
return h("ion-picker-internal", null, renderArray);
|
|
1229
|
+
}
|
|
1230
|
+
renderDatePickerColumns(forcePresentation) {
|
|
1231
|
+
return forcePresentation === 'date-time' || forcePresentation === 'time-date'
|
|
1232
|
+
? this.renderCombinedDatePickerColumn()
|
|
1233
|
+
: this.renderIndividualDatePickerColumns(forcePresentation);
|
|
1234
|
+
}
|
|
1235
|
+
renderCombinedDatePickerColumn() {
|
|
1236
|
+
const { defaultParts, disabled, workingParts, locale, minParts, maxParts, todayParts, isDateEnabled } = this;
|
|
1237
|
+
const activePart = this.getActivePartsWithFallback();
|
|
1238
|
+
/**
|
|
1239
|
+
* By default, generate a range of 3 months:
|
|
1240
|
+
* Previous month, current month, and next month
|
|
1241
|
+
*/
|
|
1242
|
+
const monthsToRender = generateMonths(workingParts);
|
|
1243
|
+
const lastMonth = monthsToRender[monthsToRender.length - 1];
|
|
1244
|
+
/**
|
|
1245
|
+
* Ensure that users can select the entire window of dates.
|
|
1246
|
+
*/
|
|
1247
|
+
monthsToRender[0].day = 1;
|
|
1248
|
+
lastMonth.day = getNumDaysInMonth(lastMonth.month, lastMonth.year);
|
|
1249
|
+
/**
|
|
1250
|
+
* Narrow the dates rendered based on min/max dates (if any).
|
|
1251
|
+
* The `min` date is used if the min is after the generated min month.
|
|
1252
|
+
* The `max` date is used if the max is before the generated max month.
|
|
1253
|
+
* This ensures that the sliding window always stays at 3 months
|
|
1254
|
+
* but still allows future dates to be lazily rendered based on any min/max
|
|
1255
|
+
* constraints.
|
|
1256
|
+
*/
|
|
1257
|
+
const min = minParts !== undefined && isAfter(minParts, monthsToRender[0]) ? minParts : monthsToRender[0];
|
|
1258
|
+
const max = maxParts !== undefined && isBefore(maxParts, lastMonth) ? maxParts : lastMonth;
|
|
1259
|
+
const result = getCombinedDateColumnData(locale, todayParts, min, max, this.parsedDayValues, this.parsedMonthValues);
|
|
1260
|
+
let items = result.items;
|
|
1261
|
+
const parts = result.parts;
|
|
1262
|
+
if (isDateEnabled) {
|
|
1263
|
+
items = items.map((itemObject, index) => {
|
|
1264
|
+
const referenceParts = parts[index];
|
|
1265
|
+
let disabled;
|
|
1266
|
+
try {
|
|
1267
|
+
/**
|
|
1268
|
+
* The `isDateEnabled` implementation is try-catch wrapped
|
|
1269
|
+
* to prevent exceptions in the user's function from
|
|
1270
|
+
* interrupting the calendar rendering.
|
|
1271
|
+
*/
|
|
1272
|
+
disabled = !isDateEnabled(convertDataToISO(referenceParts));
|
|
1368
1273
|
}
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
return (h("ion-picker-column-internal", { class: "day-column", color: this.color, disabled: disabled, items: days, value: (_a = (workingParts.day !== null ? workingParts.day : this.defaultParts.day)) !== null && _a !== void 0 ? _a : undefined, onIonChange: (ev) => {
|
|
1372
|
-
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1373
|
-
// Due to a Safari 14 issue we need to destroy
|
|
1374
|
-
// the scroll listener before we update state
|
|
1375
|
-
// and trigger a re-render.
|
|
1376
|
-
if (this.destroyCalendarListener) {
|
|
1377
|
-
this.destroyCalendarListener();
|
|
1378
|
-
}
|
|
1379
|
-
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { day: ev.detail.value }));
|
|
1380
|
-
this.setActiveParts(Object.assign(Object.assign({}, activePart), { day: ev.detail.value }));
|
|
1381
|
-
// We can re-attach the scroll listener after
|
|
1382
|
-
// the working parts have been updated.
|
|
1383
|
-
this.initializeCalendarListener();
|
|
1384
|
-
ev.stopPropagation();
|
|
1385
|
-
} }));
|
|
1386
|
-
}
|
|
1387
|
-
renderMonthPickerColumn(months) {
|
|
1388
|
-
if (months.length === 0) {
|
|
1389
|
-
return [];
|
|
1274
|
+
catch (e) {
|
|
1275
|
+
printIonError('Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', e);
|
|
1390
1276
|
}
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
return (h("ion-picker-column-internal", { class: "month-column", color: this.color, disabled: disabled, items: months, value: workingParts.month, onIonChange: (ev) => {
|
|
1394
|
-
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1395
|
-
// Due to a Safari 14 issue we need to destroy
|
|
1396
|
-
// the scroll listener before we update state
|
|
1397
|
-
// and trigger a re-render.
|
|
1398
|
-
if (this.destroyCalendarListener) {
|
|
1399
|
-
this.destroyCalendarListener();
|
|
1400
|
-
}
|
|
1401
|
-
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { month: ev.detail.value }));
|
|
1402
|
-
this.setActiveParts(Object.assign(Object.assign({}, activePart), { month: ev.detail.value }));
|
|
1403
|
-
// We can re-attach the scroll listener after
|
|
1404
|
-
// the working parts have been updated.
|
|
1405
|
-
this.initializeCalendarListener();
|
|
1406
|
-
ev.stopPropagation();
|
|
1407
|
-
} }));
|
|
1277
|
+
return Object.assign(Object.assign({}, itemObject), { disabled });
|
|
1278
|
+
});
|
|
1408
1279
|
}
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1280
|
+
/**
|
|
1281
|
+
* If we have selected a day already, then default the column
|
|
1282
|
+
* to that value. Otherwise, set it to the default date.
|
|
1283
|
+
*/
|
|
1284
|
+
const todayString = workingParts.day !== null
|
|
1285
|
+
? `${workingParts.year}-${workingParts.month}-${workingParts.day}`
|
|
1286
|
+
: `${defaultParts.year}-${defaultParts.month}-${defaultParts.day}`;
|
|
1287
|
+
return (h("ion-picker-column-internal", { class: "date-column", color: this.color, disabled: disabled, items: items, value: todayString, onIonChange: (ev) => {
|
|
1288
|
+
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1289
|
+
// Due to a Safari 14 issue we need to destroy
|
|
1290
|
+
// the scroll listener before we update state
|
|
1291
|
+
// and trigger a re-render.
|
|
1292
|
+
if (this.destroyCalendarListener) {
|
|
1293
|
+
this.destroyCalendarListener();
|
|
1412
1294
|
}
|
|
1413
|
-
const {
|
|
1414
|
-
const
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1295
|
+
const { value } = ev.detail;
|
|
1296
|
+
const findPart = parts.find(({ month, day, year }) => value === `${year}-${month}-${day}`);
|
|
1297
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), findPart));
|
|
1298
|
+
this.setActiveParts(Object.assign(Object.assign({}, activePart), findPart));
|
|
1299
|
+
// We can re-attach the scroll listener after
|
|
1300
|
+
// the working parts have been updated.
|
|
1301
|
+
this.initializeCalendarListener();
|
|
1302
|
+
ev.stopPropagation();
|
|
1303
|
+
} }));
|
|
1304
|
+
}
|
|
1305
|
+
renderIndividualDatePickerColumns(forcePresentation) {
|
|
1306
|
+
const { workingParts, isDateEnabled } = this;
|
|
1307
|
+
const shouldRenderMonths = forcePresentation !== 'year' && forcePresentation !== 'time';
|
|
1308
|
+
const months = shouldRenderMonths
|
|
1309
|
+
? getMonthColumnData(this.locale, workingParts, this.minParts, this.maxParts, this.parsedMonthValues)
|
|
1310
|
+
: [];
|
|
1311
|
+
const shouldRenderDays = forcePresentation === 'date';
|
|
1312
|
+
let days = shouldRenderDays
|
|
1313
|
+
? getDayColumnData(this.locale, workingParts, this.minParts, this.maxParts, this.parsedDayValues)
|
|
1314
|
+
: [];
|
|
1315
|
+
if (isDateEnabled) {
|
|
1316
|
+
days = days.map((dayObject) => {
|
|
1317
|
+
const { value } = dayObject;
|
|
1318
|
+
const valueNum = typeof value === 'string' ? parseInt(value) : value;
|
|
1319
|
+
const referenceParts = {
|
|
1320
|
+
month: workingParts.month,
|
|
1321
|
+
day: valueNum,
|
|
1322
|
+
year: workingParts.year,
|
|
1323
|
+
};
|
|
1324
|
+
let disabled;
|
|
1325
|
+
try {
|
|
1326
|
+
/**
|
|
1327
|
+
* The `isDateEnabled` implementation is try-catch wrapped
|
|
1328
|
+
* to prevent exceptions in the user's function from
|
|
1329
|
+
* interrupting the calendar rendering.
|
|
1330
|
+
*/
|
|
1331
|
+
disabled = !isDateEnabled(convertDataToISO(referenceParts));
|
|
1434
1332
|
}
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
* then we should show all times. If the
|
|
1438
|
-
* user has selected a date (even if it has
|
|
1439
|
-
* not been confirmed yet), we should apply
|
|
1440
|
-
* the max and min restrictions so that the
|
|
1441
|
-
* time picker shows values that are
|
|
1442
|
-
* appropriate for the selected date.
|
|
1443
|
-
*/
|
|
1444
|
-
const activePart = this.getActivePart();
|
|
1445
|
-
const userHasSelectedDate = activePart !== undefined;
|
|
1446
|
-
const { hoursData, minutesData, dayPeriodData } = getTimeColumnsData(this.locale, this.workingParts, this.hourCycle, userHasSelectedDate ? this.minParts : undefined, userHasSelectedDate ? this.maxParts : undefined, this.parsedHourValues, this.parsedMinuteValues);
|
|
1447
|
-
return [
|
|
1448
|
-
this.renderHourPickerColumn(hoursData),
|
|
1449
|
-
this.renderMinutePickerColumn(minutesData),
|
|
1450
|
-
this.renderDayPeriodPickerColumn(dayPeriodData),
|
|
1451
|
-
];
|
|
1452
|
-
}
|
|
1453
|
-
renderHourPickerColumn(hoursData) {
|
|
1454
|
-
const { disabled, workingParts } = this;
|
|
1455
|
-
if (hoursData.length === 0)
|
|
1456
|
-
return [];
|
|
1457
|
-
const activePart = this.getActivePartsWithFallback();
|
|
1458
|
-
return (h("ion-picker-column-internal", { color: this.color, disabled: disabled, value: activePart.hour, items: hoursData, numericInput: true, onIonChange: (ev) => {
|
|
1459
|
-
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
|
|
1460
|
-
this.setActiveParts(Object.assign(Object.assign({}, activePart), { hour: ev.detail.value }));
|
|
1461
|
-
ev.stopPropagation();
|
|
1462
|
-
} }));
|
|
1463
|
-
}
|
|
1464
|
-
renderMinutePickerColumn(minutesData) {
|
|
1465
|
-
const { disabled, workingParts } = this;
|
|
1466
|
-
if (minutesData.length === 0)
|
|
1467
|
-
return [];
|
|
1468
|
-
const activePart = this.getActivePartsWithFallback();
|
|
1469
|
-
return (h("ion-picker-column-internal", { color: this.color, disabled: disabled, value: activePart.minute, items: minutesData, numericInput: true, onIonChange: (ev) => {
|
|
1470
|
-
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
|
|
1471
|
-
this.setActiveParts(Object.assign(Object.assign({}, activePart), { minute: ev.detail.value }));
|
|
1472
|
-
ev.stopPropagation();
|
|
1473
|
-
} }));
|
|
1474
|
-
}
|
|
1475
|
-
renderDayPeriodPickerColumn(dayPeriodData) {
|
|
1476
|
-
const { disabled, workingParts } = this;
|
|
1477
|
-
if (dayPeriodData.length === 0) {
|
|
1478
|
-
return [];
|
|
1333
|
+
catch (e) {
|
|
1334
|
+
printIonError('Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', e);
|
|
1479
1335
|
}
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
return (h("ion-picker-column-internal", { style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, items: dayPeriodData, onIonChange: (ev) => {
|
|
1483
|
-
const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
|
|
1484
|
-
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
|
|
1485
|
-
this.setActiveParts(Object.assign(Object.assign({}, activePart), { ampm: ev.detail.value, hour }));
|
|
1486
|
-
ev.stopPropagation();
|
|
1487
|
-
} }));
|
|
1488
|
-
}
|
|
1489
|
-
renderWheelView(forcePresentation) {
|
|
1490
|
-
const { locale } = this;
|
|
1491
|
-
const showMonthFirst = isMonthFirstLocale(locale);
|
|
1492
|
-
const columnOrder = showMonthFirst ? 'month-first' : 'year-first';
|
|
1493
|
-
return (h("div", { class: {
|
|
1494
|
-
[`wheel-order-${columnOrder}`]: true,
|
|
1495
|
-
} }, this.renderWheelPicker(forcePresentation)));
|
|
1336
|
+
return Object.assign(Object.assign({}, dayObject), { disabled });
|
|
1337
|
+
});
|
|
1496
1338
|
}
|
|
1339
|
+
const shouldRenderYears = forcePresentation !== 'month' && forcePresentation !== 'time';
|
|
1340
|
+
const years = shouldRenderYears
|
|
1341
|
+
? getYearColumnData(this.locale, this.defaultParts, this.minParts, this.maxParts, this.parsedYearValues)
|
|
1342
|
+
: [];
|
|
1497
1343
|
/**
|
|
1498
|
-
*
|
|
1344
|
+
* Certain locales show the day before the month.
|
|
1499
1345
|
*/
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
return (h("div", { class: "calendar-header" }, h("div", { class: "calendar-action-buttons" }, h("div", { class: "calendar-month-year" }, h("ion-item", { part: "month-year-button", ref: (el) => (this.monthYearToggleItemRef = el), button: true, "aria-label": "Show year picker", detail: false, lines: "none", disabled: disabled, onClick: () => {
|
|
1509
|
-
var _a;
|
|
1510
|
-
this.toggleMonthAndYearView();
|
|
1511
|
-
/**
|
|
1512
|
-
* TODO: FW-3547
|
|
1513
|
-
*
|
|
1514
|
-
* Currently there is not a way to set the aria-label on the inner button
|
|
1515
|
-
* on the `ion-item` and have it be reactive to changes. This is a workaround
|
|
1516
|
-
* until we either refactor `ion-item` to a button or Stencil adds a way to
|
|
1517
|
-
* have reactive props for built-in properties, such as `aria-label`.
|
|
1518
|
-
*/
|
|
1519
|
-
const { monthYearToggleItemRef } = this;
|
|
1520
|
-
if (monthYearToggleItemRef) {
|
|
1521
|
-
const btn = (_a = monthYearToggleItemRef.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.item-native');
|
|
1522
|
-
if (btn) {
|
|
1523
|
-
const monthYearAriaLabel = this.showMonthAndYear ? 'Hide year picker' : 'Show year picker';
|
|
1524
|
-
btn.setAttribute('aria-label', monthYearAriaLabel);
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
} }, h("ion-label", null, getMonthAndYear(this.locale, this.workingParts), h("ion-icon", { "aria-hidden": "true", icon: this.showMonthAndYear ? expandedIcon : collapsedIcon, lazy: false, flipRtl: true })))), h("div", { class: "calendar-next-prev" }, h("ion-buttons", null, h("ion-button", { "aria-label": "Previous month", disabled: prevMonthDisabled, onClick: () => this.prevMonth() }, h("ion-icon", { dir: hostDir, "aria-hidden": "true", slot: "icon-only", icon: chevronBack, lazy: false, flipRtl: true })), h("ion-button", { "aria-label": "Next month", disabled: nextMonthDisabled, onClick: () => this.nextMonth() }, h("ion-icon", { dir: hostDir, "aria-hidden": "true", slot: "icon-only", icon: chevronForward, lazy: false, flipRtl: true }))))), h("div", { class: "calendar-days-of-week", "aria-hidden": "true" }, getDaysOfWeek(this.locale, mode, this.firstDayOfWeek % 7).map((d) => {
|
|
1528
|
-
return h("div", { class: "day-of-week" }, d);
|
|
1529
|
-
}))));
|
|
1346
|
+
const showMonthFirst = isMonthFirstLocale(this.locale, { month: 'numeric', day: 'numeric' });
|
|
1347
|
+
let renderArray = [];
|
|
1348
|
+
if (showMonthFirst) {
|
|
1349
|
+
renderArray = [
|
|
1350
|
+
this.renderMonthPickerColumn(months),
|
|
1351
|
+
this.renderDayPickerColumn(days),
|
|
1352
|
+
this.renderYearPickerColumn(years),
|
|
1353
|
+
];
|
|
1530
1354
|
}
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
const swipeDisabled = disabled ||
|
|
1538
|
-
isMonthDisabled({
|
|
1539
|
-
month,
|
|
1540
|
-
year,
|
|
1541
|
-
day: null,
|
|
1542
|
-
}, {
|
|
1543
|
-
// The day is not used when checking if a month is disabled.
|
|
1544
|
-
// Users should be able to access the min or max month, even if the
|
|
1545
|
-
// min/max date is out of bounds (e.g. min is set to Feb 15, Feb should not be disabled).
|
|
1546
|
-
minParts: Object.assign(Object.assign({}, this.minParts), { day: null }),
|
|
1547
|
-
maxParts: Object.assign(Object.assign({}, this.maxParts), { day: null }),
|
|
1548
|
-
});
|
|
1549
|
-
// The working month should never have swipe disabled.
|
|
1550
|
-
// Otherwise the CSS scroll snap will not work and the user
|
|
1551
|
-
// can free-scroll the calendar.
|
|
1552
|
-
const isWorkingMonth = this.workingParts.month === month && this.workingParts.year === year;
|
|
1553
|
-
const activePart = this.getActivePartsWithFallback();
|
|
1554
|
-
return (h("div", { "aria-hidden": !isWorkingMonth ? 'true' : null, class: {
|
|
1555
|
-
'calendar-month': true,
|
|
1556
|
-
// Prevents scroll snap swipe gestures for months outside of the min/max bounds
|
|
1557
|
-
'calendar-month-disabled': !isWorkingMonth && swipeDisabled,
|
|
1558
|
-
} }, h("div", { class: "calendar-month-grid" }, getDaysOfMonth(month, year, this.firstDayOfWeek % 7).map((dateObject, index) => {
|
|
1559
|
-
const { day, dayOfWeek } = dateObject;
|
|
1560
|
-
const { el, highlightedDates, isDateEnabled, multiple } = this;
|
|
1561
|
-
const referenceParts = { month, day, year };
|
|
1562
|
-
const isCalendarPadding = day === null;
|
|
1563
|
-
const { isActive, isToday, ariaLabel, ariaSelected, disabled: isDayDisabled, text, } = getCalendarDayState(this.locale, referenceParts, this.activeParts, this.todayParts, this.minParts, this.maxParts, this.parsedDayValues);
|
|
1564
|
-
const dateIsoString = convertDataToISO(referenceParts);
|
|
1565
|
-
let isCalDayDisabled = isCalMonthDisabled || isDayDisabled;
|
|
1566
|
-
if (!isCalDayDisabled && isDateEnabled !== undefined) {
|
|
1567
|
-
try {
|
|
1568
|
-
/**
|
|
1569
|
-
* The `isDateEnabled` implementation is try-catch wrapped
|
|
1570
|
-
* to prevent exceptions in the user's function from
|
|
1571
|
-
* interrupting the calendar rendering.
|
|
1572
|
-
*/
|
|
1573
|
-
isCalDayDisabled = !isDateEnabled(dateIsoString);
|
|
1574
|
-
}
|
|
1575
|
-
catch (e) {
|
|
1576
|
-
printIonError('Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', el, e);
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
|
-
/**
|
|
1580
|
-
* Some days are constrained through max & min or allowed dates
|
|
1581
|
-
* and also disabled because the component is readonly or disabled.
|
|
1582
|
-
* These need to be displayed differently.
|
|
1583
|
-
*/
|
|
1584
|
-
const isCalDayConstrained = isCalDayDisabled && isDatetimeDisabled;
|
|
1585
|
-
const isButtonDisabled = isCalDayDisabled || isDatetimeDisabled;
|
|
1586
|
-
let dateStyle = undefined;
|
|
1587
|
-
/**
|
|
1588
|
-
* Custom highlight styles should not override the style for selected dates,
|
|
1589
|
-
* nor apply to "filler days" at the start of the grid.
|
|
1590
|
-
*/
|
|
1591
|
-
if (highlightedDates !== undefined && !isActive && day !== null) {
|
|
1592
|
-
dateStyle = getHighlightStyles(highlightedDates, dateIsoString, el);
|
|
1593
|
-
}
|
|
1594
|
-
let dateParts = undefined;
|
|
1595
|
-
// "Filler days" at the beginning of the grid should not get the calendar day
|
|
1596
|
-
// CSS parts added to them
|
|
1597
|
-
if (!isCalendarPadding) {
|
|
1598
|
-
dateParts = `calendar-day${isActive ? ' active' : ''}${isToday ? ' today' : ''}${isCalDayDisabled ? ' disabled' : ''}`;
|
|
1599
|
-
}
|
|
1600
|
-
return (h("div", { class: "calendar-day-wrapper" }, h("button", {
|
|
1601
|
-
// We need to use !important for the inline styles here because
|
|
1602
|
-
// otherwise the CSS shadow parts will override these styles.
|
|
1603
|
-
// See https://github.com/WICG/webcomponents/issues/847
|
|
1604
|
-
// Both the CSS shadow parts and highlightedDates styles are
|
|
1605
|
-
// provided by the developer, but highlightedDates styles should
|
|
1606
|
-
// always take priority.
|
|
1607
|
-
ref: (el) => {
|
|
1608
|
-
if (el) {
|
|
1609
|
-
el.style.setProperty('color', `${dateStyle ? dateStyle.textColor : ''}`, 'important');
|
|
1610
|
-
el.style.setProperty('background-color', `${dateStyle ? dateStyle.backgroundColor : ''}`, 'important');
|
|
1611
|
-
}
|
|
1612
|
-
}, tabindex: "-1", "data-day": day, "data-month": month, "data-year": year, "data-index": index, "data-day-of-week": dayOfWeek, disabled: isButtonDisabled, class: {
|
|
1613
|
-
'calendar-day-padding': isCalendarPadding,
|
|
1614
|
-
'calendar-day': true,
|
|
1615
|
-
'calendar-day-active': isActive,
|
|
1616
|
-
'calendar-day-constrained': isCalDayConstrained,
|
|
1617
|
-
'calendar-day-today': isToday,
|
|
1618
|
-
}, part: dateParts, "aria-hidden": isCalendarPadding ? 'true' : null, "aria-selected": ariaSelected, "aria-label": ariaLabel, onClick: () => {
|
|
1619
|
-
if (isCalendarPadding) {
|
|
1620
|
-
return;
|
|
1621
|
-
}
|
|
1622
|
-
this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), { month,
|
|
1623
|
-
day,
|
|
1624
|
-
year }));
|
|
1625
|
-
// multiple only needs date info, so we can wipe out other fields like time
|
|
1626
|
-
if (multiple) {
|
|
1627
|
-
this.setActiveParts({
|
|
1628
|
-
month,
|
|
1629
|
-
day,
|
|
1630
|
-
year,
|
|
1631
|
-
}, isActive);
|
|
1632
|
-
}
|
|
1633
|
-
else {
|
|
1634
|
-
this.setActiveParts(Object.assign(Object.assign({}, activePart), { month,
|
|
1635
|
-
day,
|
|
1636
|
-
year }));
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
}, text)));
|
|
1640
|
-
}))));
|
|
1355
|
+
else {
|
|
1356
|
+
renderArray = [
|
|
1357
|
+
this.renderDayPickerColumn(days),
|
|
1358
|
+
this.renderMonthPickerColumn(months),
|
|
1359
|
+
this.renderYearPickerColumn(years),
|
|
1360
|
+
];
|
|
1641
1361
|
}
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1362
|
+
return renderArray;
|
|
1363
|
+
}
|
|
1364
|
+
renderDayPickerColumn(days) {
|
|
1365
|
+
var _a;
|
|
1366
|
+
if (days.length === 0) {
|
|
1367
|
+
return [];
|
|
1646
1368
|
}
|
|
1647
|
-
|
|
1648
|
-
|
|
1369
|
+
const { disabled, workingParts } = this;
|
|
1370
|
+
const activePart = this.getActivePartsWithFallback();
|
|
1371
|
+
return (h("ion-picker-column-internal", { class: "day-column", color: this.color, disabled: disabled, items: days, value: (_a = (workingParts.day !== null ? workingParts.day : this.defaultParts.day)) !== null && _a !== void 0 ? _a : undefined, onIonChange: (ev) => {
|
|
1372
|
+
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1373
|
+
// Due to a Safari 14 issue we need to destroy
|
|
1374
|
+
// the scroll listener before we update state
|
|
1375
|
+
// and trigger a re-render.
|
|
1376
|
+
if (this.destroyCalendarListener) {
|
|
1377
|
+
this.destroyCalendarListener();
|
|
1378
|
+
}
|
|
1379
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { day: ev.detail.value }));
|
|
1380
|
+
this.setActiveParts(Object.assign(Object.assign({}, activePart), { day: ev.detail.value }));
|
|
1381
|
+
// We can re-attach the scroll listener after
|
|
1382
|
+
// the working parts have been updated.
|
|
1383
|
+
this.initializeCalendarListener();
|
|
1384
|
+
ev.stopPropagation();
|
|
1385
|
+
} }));
|
|
1386
|
+
}
|
|
1387
|
+
renderMonthPickerColumn(months) {
|
|
1388
|
+
if (months.length === 0) {
|
|
1389
|
+
return [];
|
|
1649
1390
|
}
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1391
|
+
const { disabled, workingParts } = this;
|
|
1392
|
+
const activePart = this.getActivePartsWithFallback();
|
|
1393
|
+
return (h("ion-picker-column-internal", { class: "month-column", color: this.color, disabled: disabled, items: months, value: workingParts.month, onIonChange: (ev) => {
|
|
1394
|
+
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1395
|
+
// Due to a Safari 14 issue we need to destroy
|
|
1396
|
+
// the scroll listener before we update state
|
|
1397
|
+
// and trigger a re-render.
|
|
1398
|
+
if (this.destroyCalendarListener) {
|
|
1399
|
+
this.destroyCalendarListener();
|
|
1654
1400
|
}
|
|
1655
|
-
|
|
1401
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { month: ev.detail.value }));
|
|
1402
|
+
this.setActiveParts(Object.assign(Object.assign({}, activePart), { month: ev.detail.value }));
|
|
1403
|
+
// We can re-attach the scroll listener after
|
|
1404
|
+
// the working parts have been updated.
|
|
1405
|
+
this.initializeCalendarListener();
|
|
1406
|
+
ev.stopPropagation();
|
|
1407
|
+
} }));
|
|
1408
|
+
}
|
|
1409
|
+
renderYearPickerColumn(years) {
|
|
1410
|
+
if (years.length === 0) {
|
|
1411
|
+
return [];
|
|
1656
1412
|
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
} }, getLocalizedTime(locale, activePart, computedHourCycle, formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time)),
|
|
1679
|
-
h("ion-popover", { alignment: "center", translucent: true, overlayIndex: 1, arrow: false, onWillPresent: (ev) => {
|
|
1680
|
-
/**
|
|
1681
|
-
* Intersection Observers do not consistently fire between Blink and Webkit
|
|
1682
|
-
* when toggling the visibility of the popover and trying to scroll the picker
|
|
1683
|
-
* column to the correct time value.
|
|
1684
|
-
*
|
|
1685
|
-
* This will correctly scroll the element position to the correct time value,
|
|
1686
|
-
* before the popover is fully presented.
|
|
1687
|
-
*/
|
|
1688
|
-
const cols = ev.target.querySelectorAll('ion-picker-column-internal');
|
|
1689
|
-
// TODO (FW-615): Potentially remove this when intersection observers are fixed in picker column
|
|
1690
|
-
cols.forEach((col) => col.scrollActiveItemIntoView());
|
|
1691
|
-
}, style: {
|
|
1692
|
-
'--offset-y': '-10px',
|
|
1693
|
-
'--min-width': 'fit-content',
|
|
1694
|
-
},
|
|
1695
|
-
// Allow native browser keyboard events to support up/down/home/end key
|
|
1696
|
-
// navigation within the time picker.
|
|
1697
|
-
keyboardEvents: true, ref: (el) => (this.popoverRef = el) }, this.renderWheelPicker('time')),
|
|
1698
|
-
];
|
|
1413
|
+
const { disabled, workingParts } = this;
|
|
1414
|
+
const activePart = this.getActivePartsWithFallback();
|
|
1415
|
+
return (h("ion-picker-column-internal", { class: "year-column", color: this.color, disabled: disabled, items: years, value: workingParts.year, onIonChange: (ev) => {
|
|
1416
|
+
// TODO(FW-1823) Remove this when iOS 14 support is dropped.
|
|
1417
|
+
// Due to a Safari 14 issue we need to destroy
|
|
1418
|
+
// the scroll listener before we update state
|
|
1419
|
+
// and trigger a re-render.
|
|
1420
|
+
if (this.destroyCalendarListener) {
|
|
1421
|
+
this.destroyCalendarListener();
|
|
1422
|
+
}
|
|
1423
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { year: ev.detail.value }));
|
|
1424
|
+
this.setActiveParts(Object.assign(Object.assign({}, activePart), { year: ev.detail.value }));
|
|
1425
|
+
// We can re-attach the scroll listener after
|
|
1426
|
+
// the working parts have been updated.
|
|
1427
|
+
this.initializeCalendarListener();
|
|
1428
|
+
ev.stopPropagation();
|
|
1429
|
+
} }));
|
|
1430
|
+
}
|
|
1431
|
+
renderTimePickerColumns(forcePresentation) {
|
|
1432
|
+
if (['date', 'month', 'month-year', 'year'].includes(forcePresentation)) {
|
|
1433
|
+
return [];
|
|
1699
1434
|
}
|
|
1700
|
-
|
|
1435
|
+
/**
|
|
1436
|
+
* If a user has not selected a date,
|
|
1437
|
+
* then we should show all times. If the
|
|
1438
|
+
* user has selected a date (even if it has
|
|
1439
|
+
* not been confirmed yet), we should apply
|
|
1440
|
+
* the max and min restrictions so that the
|
|
1441
|
+
* time picker shows values that are
|
|
1442
|
+
* appropriate for the selected date.
|
|
1443
|
+
*/
|
|
1444
|
+
const activePart = this.getActivePart();
|
|
1445
|
+
const userHasSelectedDate = activePart !== undefined;
|
|
1446
|
+
const { hoursData, minutesData, dayPeriodData } = getTimeColumnsData(this.locale, this.workingParts, this.hourCycle, userHasSelectedDate ? this.minParts : undefined, userHasSelectedDate ? this.maxParts : undefined, this.parsedHourValues, this.parsedMinuteValues);
|
|
1447
|
+
return [
|
|
1448
|
+
this.renderHourPickerColumn(hoursData),
|
|
1449
|
+
this.renderMinutePickerColumn(minutesData),
|
|
1450
|
+
this.renderDayPeriodPickerColumn(dayPeriodData),
|
|
1451
|
+
];
|
|
1452
|
+
}
|
|
1453
|
+
renderHourPickerColumn(hoursData) {
|
|
1454
|
+
const { disabled, workingParts } = this;
|
|
1455
|
+
if (hoursData.length === 0)
|
|
1456
|
+
return [];
|
|
1457
|
+
const activePart = this.getActivePartsWithFallback();
|
|
1458
|
+
return (h("ion-picker-column-internal", { color: this.color, disabled: disabled, value: activePart.hour, items: hoursData, numericInput: true, onIonChange: (ev) => {
|
|
1459
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
|
|
1460
|
+
this.setActiveParts(Object.assign(Object.assign({}, activePart), { hour: ev.detail.value }));
|
|
1461
|
+
ev.stopPropagation();
|
|
1462
|
+
} }));
|
|
1463
|
+
}
|
|
1464
|
+
renderMinutePickerColumn(minutesData) {
|
|
1465
|
+
const { disabled, workingParts } = this;
|
|
1466
|
+
if (minutesData.length === 0)
|
|
1467
|
+
return [];
|
|
1468
|
+
const activePart = this.getActivePartsWithFallback();
|
|
1469
|
+
return (h("ion-picker-column-internal", { color: this.color, disabled: disabled, value: activePart.minute, items: minutesData, numericInput: true, onIonChange: (ev) => {
|
|
1470
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
|
|
1471
|
+
this.setActiveParts(Object.assign(Object.assign({}, activePart), { minute: ev.detail.value }));
|
|
1472
|
+
ev.stopPropagation();
|
|
1473
|
+
} }));
|
|
1474
|
+
}
|
|
1475
|
+
renderDayPeriodPickerColumn(dayPeriodData) {
|
|
1476
|
+
const { disabled, workingParts } = this;
|
|
1477
|
+
if (dayPeriodData.length === 0) {
|
|
1478
|
+
return [];
|
|
1479
|
+
}
|
|
1480
|
+
const activePart = this.getActivePartsWithFallback();
|
|
1481
|
+
const isDayPeriodRTL = isLocaleDayPeriodRTL(this.locale);
|
|
1482
|
+
return (h("ion-picker-column-internal", { style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, items: dayPeriodData, onIonChange: (ev) => {
|
|
1483
|
+
const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
|
|
1484
|
+
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
|
|
1485
|
+
this.setActiveParts(Object.assign(Object.assign({}, activePart), { ampm: ev.detail.value, hour }));
|
|
1486
|
+
ev.stopPropagation();
|
|
1487
|
+
} }));
|
|
1488
|
+
}
|
|
1489
|
+
renderWheelView(forcePresentation) {
|
|
1490
|
+
const { locale } = this;
|
|
1491
|
+
const showMonthFirst = isMonthFirstLocale(locale);
|
|
1492
|
+
const columnOrder = showMonthFirst ? 'month-first' : 'year-first';
|
|
1493
|
+
return (h("div", { class: {
|
|
1494
|
+
[`wheel-order-${columnOrder}`]: true,
|
|
1495
|
+
} }, this.renderWheelPicker(forcePresentation)));
|
|
1496
|
+
}
|
|
1497
|
+
/**
|
|
1498
|
+
* Grid Render Methods
|
|
1499
|
+
*/
|
|
1500
|
+
renderCalendarHeader(mode) {
|
|
1501
|
+
const { disabled } = this;
|
|
1502
|
+
const expandedIcon = mode === 'ios' ? chevronDown : caretUpSharp;
|
|
1503
|
+
const collapsedIcon = mode === 'ios' ? chevronForward : caretDownSharp;
|
|
1504
|
+
const prevMonthDisabled = disabled || isPrevMonthDisabled(this.workingParts, this.minParts, this.maxParts);
|
|
1505
|
+
const nextMonthDisabled = disabled || isNextMonthDisabled(this.workingParts, this.maxParts);
|
|
1506
|
+
// don't use the inheritAttributes util because it removes dir from the host, and we still need that
|
|
1507
|
+
const hostDir = this.el.getAttribute('dir') || undefined;
|
|
1508
|
+
return (h("div", { class: "calendar-header" }, h("div", { class: "calendar-action-buttons" }, h("div", { class: "calendar-month-year" }, h("ion-item", { part: "month-year-button", ref: (el) => (this.monthYearToggleItemRef = el), button: true, "aria-label": "Show year picker", detail: false, lines: "none", disabled: disabled, onClick: () => {
|
|
1701
1509
|
var _a;
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1510
|
+
this.toggleMonthAndYearView();
|
|
1511
|
+
/**
|
|
1512
|
+
* TODO: FW-3547
|
|
1513
|
+
*
|
|
1514
|
+
* Currently there is not a way to set the aria-label on the inner button
|
|
1515
|
+
* on the `ion-item` and have it be reactive to changes. This is a workaround
|
|
1516
|
+
* until we either refactor `ion-item` to a button or Stencil adds a way to
|
|
1517
|
+
* have reactive props for built-in properties, such as `aria-label`.
|
|
1518
|
+
*/
|
|
1519
|
+
const { monthYearToggleItemRef } = this;
|
|
1520
|
+
if (monthYearToggleItemRef) {
|
|
1521
|
+
const btn = (_a = monthYearToggleItemRef.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.item-native');
|
|
1522
|
+
if (btn) {
|
|
1523
|
+
const monthYearAriaLabel = this.showMonthAndYear ? 'Hide year picker' : 'Show year picker';
|
|
1524
|
+
btn.setAttribute('aria-label', monthYearAriaLabel);
|
|
1525
|
+
}
|
|
1715
1526
|
}
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1527
|
+
} }, h("ion-label", null, getMonthAndYear(this.locale, this.workingParts), h("ion-icon", { "aria-hidden": "true", icon: this.showMonthAndYear ? expandedIcon : collapsedIcon, lazy: false, flipRtl: true })))), h("div", { class: "calendar-next-prev" }, h("ion-buttons", null, h("ion-button", { "aria-label": "Previous month", disabled: prevMonthDisabled, onClick: () => this.prevMonth() }, h("ion-icon", { dir: hostDir, "aria-hidden": "true", slot: "icon-only", icon: chevronBack, lazy: false, flipRtl: true })), h("ion-button", { "aria-label": "Next month", disabled: nextMonthDisabled, onClick: () => this.nextMonth() }, h("ion-icon", { dir: hostDir, "aria-hidden": "true", slot: "icon-only", icon: chevronForward, lazy: false, flipRtl: true }))))), h("div", { class: "calendar-days-of-week", "aria-hidden": "true" }, getDaysOfWeek(this.locale, mode, this.firstDayOfWeek % 7).map((d) => {
|
|
1528
|
+
return h("div", { class: "day-of-week" }, d);
|
|
1529
|
+
}))));
|
|
1530
|
+
}
|
|
1531
|
+
renderMonth(month, year) {
|
|
1532
|
+
const { disabled, readonly } = this;
|
|
1533
|
+
const yearAllowed = this.parsedYearValues === undefined || this.parsedYearValues.includes(year);
|
|
1534
|
+
const monthAllowed = this.parsedMonthValues === undefined || this.parsedMonthValues.includes(month);
|
|
1535
|
+
const isCalMonthDisabled = !yearAllowed || !monthAllowed;
|
|
1536
|
+
const isDatetimeDisabled = disabled || readonly;
|
|
1537
|
+
const swipeDisabled = disabled ||
|
|
1538
|
+
isMonthDisabled({
|
|
1539
|
+
month,
|
|
1540
|
+
year,
|
|
1541
|
+
day: null,
|
|
1542
|
+
}, {
|
|
1543
|
+
// The day is not used when checking if a month is disabled.
|
|
1544
|
+
// Users should be able to access the min or max month, even if the
|
|
1545
|
+
// min/max date is out of bounds (e.g. min is set to Feb 15, Feb should not be disabled).
|
|
1546
|
+
minParts: Object.assign(Object.assign({}, this.minParts), { day: null }),
|
|
1547
|
+
maxParts: Object.assign(Object.assign({}, this.maxParts), { day: null }),
|
|
1548
|
+
});
|
|
1549
|
+
// The working month should never have swipe disabled.
|
|
1550
|
+
// Otherwise the CSS scroll snap will not work and the user
|
|
1551
|
+
// can free-scroll the calendar.
|
|
1552
|
+
const isWorkingMonth = this.workingParts.month === month && this.workingParts.year === year;
|
|
1553
|
+
const activePart = this.getActivePartsWithFallback();
|
|
1554
|
+
return (h("div", { "aria-hidden": !isWorkingMonth ? 'true' : null, class: {
|
|
1555
|
+
'calendar-month': true,
|
|
1556
|
+
// Prevents scroll snap swipe gestures for months outside of the min/max bounds
|
|
1557
|
+
'calendar-month-disabled': !isWorkingMonth && swipeDisabled,
|
|
1558
|
+
} }, h("div", { class: "calendar-month-grid" }, getDaysOfMonth(month, year, this.firstDayOfWeek % 7).map((dateObject, index) => {
|
|
1559
|
+
const { day, dayOfWeek } = dateObject;
|
|
1560
|
+
const { el, highlightedDates, isDateEnabled, multiple } = this;
|
|
1561
|
+
const referenceParts = { month, day, year };
|
|
1562
|
+
const isCalendarPadding = day === null;
|
|
1563
|
+
const { isActive, isToday, ariaLabel, ariaSelected, disabled: isDayDisabled, text, } = getCalendarDayState(this.locale, referenceParts, this.activeParts, this.todayParts, this.minParts, this.maxParts, this.parsedDayValues);
|
|
1564
|
+
const dateIsoString = convertDataToISO(referenceParts);
|
|
1565
|
+
let isCalDayDisabled = isCalMonthDisabled || isDayDisabled;
|
|
1566
|
+
if (!isCalDayDisabled && isDateEnabled !== undefined) {
|
|
1567
|
+
try {
|
|
1568
|
+
/**
|
|
1569
|
+
* The `isDateEnabled` implementation is try-catch wrapped
|
|
1570
|
+
* to prevent exceptions in the user's function from
|
|
1571
|
+
* interrupting the calendar rendering.
|
|
1572
|
+
*/
|
|
1573
|
+
isCalDayDisabled = !isDateEnabled(dateIsoString);
|
|
1719
1574
|
}
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1575
|
+
catch (e) {
|
|
1576
|
+
printIonError('Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', el, e);
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
/**
|
|
1580
|
+
* Some days are constrained through max & min or allowed dates
|
|
1581
|
+
* and also disabled because the component is readonly or disabled.
|
|
1582
|
+
* These need to be displayed differently.
|
|
1583
|
+
*/
|
|
1584
|
+
const isCalDayConstrained = isCalDayDisabled && isDatetimeDisabled;
|
|
1585
|
+
const isButtonDisabled = isCalDayDisabled || isDatetimeDisabled;
|
|
1586
|
+
let dateStyle = undefined;
|
|
1587
|
+
/**
|
|
1588
|
+
* Custom highlight styles should not override the style for selected dates,
|
|
1589
|
+
* nor apply to "filler days" at the start of the grid.
|
|
1590
|
+
*/
|
|
1591
|
+
if (highlightedDates !== undefined && !isActive && day !== null) {
|
|
1592
|
+
dateStyle = getHighlightStyles(highlightedDates, dateIsoString, el);
|
|
1593
|
+
}
|
|
1594
|
+
let dateParts = undefined;
|
|
1595
|
+
// "Filler days" at the beginning of the grid should not get the calendar day
|
|
1596
|
+
// CSS parts added to them
|
|
1597
|
+
if (!isCalendarPadding) {
|
|
1598
|
+
dateParts = `calendar-day${isActive ? ' active' : ''}${isToday ? ' today' : ''}${isCalDayDisabled ? ' disabled' : ''}`;
|
|
1599
|
+
}
|
|
1600
|
+
return (h("div", { class: "calendar-day-wrapper" }, h("button", {
|
|
1601
|
+
// We need to use !important for the inline styles here because
|
|
1602
|
+
// otherwise the CSS shadow parts will override these styles.
|
|
1603
|
+
// See https://github.com/WICG/webcomponents/issues/847
|
|
1604
|
+
// Both the CSS shadow parts and highlightedDates styles are
|
|
1605
|
+
// provided by the developer, but highlightedDates styles should
|
|
1606
|
+
// always take priority.
|
|
1607
|
+
ref: (el) => {
|
|
1608
|
+
if (el) {
|
|
1609
|
+
el.style.setProperty('color', `${dateStyle ? dateStyle.textColor : ''}`, 'important');
|
|
1610
|
+
el.style.setProperty('background-color', `${dateStyle ? dateStyle.backgroundColor : ''}`, 'important');
|
|
1611
|
+
}
|
|
1612
|
+
}, tabindex: "-1", "data-day": day, "data-month": month, "data-year": year, "data-index": index, "data-day-of-week": dayOfWeek, disabled: isButtonDisabled, class: {
|
|
1613
|
+
'calendar-day-padding': isCalendarPadding,
|
|
1614
|
+
'calendar-day': true,
|
|
1615
|
+
'calendar-day-active': isActive,
|
|
1616
|
+
'calendar-day-constrained': isCalDayConstrained,
|
|
1617
|
+
'calendar-day-today': isToday,
|
|
1618
|
+
}, part: dateParts, "aria-hidden": isCalendarPadding ? 'true' : null, "aria-selected": ariaSelected, "aria-label": ariaLabel, onClick: () => {
|
|
1619
|
+
if (isCalendarPadding) {
|
|
1725
1620
|
return;
|
|
1621
|
+
}
|
|
1622
|
+
this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), { month,
|
|
1623
|
+
day,
|
|
1624
|
+
year }));
|
|
1625
|
+
// multiple only needs date info, so we can wipe out other fields like time
|
|
1626
|
+
if (multiple) {
|
|
1627
|
+
this.setActiveParts({
|
|
1628
|
+
month,
|
|
1629
|
+
day,
|
|
1630
|
+
year,
|
|
1631
|
+
}, isActive);
|
|
1632
|
+
}
|
|
1633
|
+
else {
|
|
1634
|
+
this.setActiveParts(Object.assign(Object.assign({}, activePart), { month,
|
|
1635
|
+
day,
|
|
1636
|
+
year }));
|
|
1637
|
+
}
|
|
1726
1638
|
}
|
|
1727
|
-
|
|
1639
|
+
}, text)));
|
|
1640
|
+
}))));
|
|
1641
|
+
}
|
|
1642
|
+
renderCalendarBody() {
|
|
1643
|
+
return (h("div", { class: "calendar-body ion-focusable", ref: (el) => (this.calendarBodyRef = el), tabindex: "0" }, generateMonths(this.workingParts, this.forceRenderDate).map(({ month, year }) => {
|
|
1644
|
+
return this.renderMonth(month, year);
|
|
1645
|
+
})));
|
|
1646
|
+
}
|
|
1647
|
+
renderCalendar(mode) {
|
|
1648
|
+
return (h("div", { class: "datetime-calendar", key: "datetime-calendar" }, this.renderCalendarHeader(mode), this.renderCalendarBody()));
|
|
1649
|
+
}
|
|
1650
|
+
renderTimeLabel() {
|
|
1651
|
+
const hasSlottedTimeLabel = this.el.querySelector('[slot="time-label"]') !== null;
|
|
1652
|
+
if (!hasSlottedTimeLabel && !this.showDefaultTimeLabel) {
|
|
1653
|
+
return;
|
|
1728
1654
|
}
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1655
|
+
return h("slot", { name: "time-label" }, "Time");
|
|
1656
|
+
}
|
|
1657
|
+
renderTimeOverlay() {
|
|
1658
|
+
const { disabled, hourCycle, isTimePopoverOpen, locale, formatOptions } = this;
|
|
1659
|
+
const computedHourCycle = getHourCycle(locale, hourCycle);
|
|
1660
|
+
const activePart = this.getActivePartsWithFallback();
|
|
1661
|
+
return [
|
|
1662
|
+
h("div", { class: "time-header" }, this.renderTimeLabel()),
|
|
1663
|
+
h("button", { class: {
|
|
1664
|
+
'time-body': true,
|
|
1665
|
+
'time-body-active': isTimePopoverOpen,
|
|
1666
|
+
}, part: `time-button${isTimePopoverOpen ? ' active' : ''}`, "aria-expanded": "false", "aria-haspopup": "true", disabled: disabled, onClick: async (ev) => {
|
|
1667
|
+
const { popoverRef } = this;
|
|
1668
|
+
if (popoverRef) {
|
|
1669
|
+
this.isTimePopoverOpen = true;
|
|
1670
|
+
popoverRef.present(new CustomEvent('ionShadowTarget', {
|
|
1671
|
+
detail: {
|
|
1672
|
+
ionShadowTarget: ev.target,
|
|
1673
|
+
},
|
|
1674
|
+
}));
|
|
1675
|
+
await popoverRef.onWillDismiss();
|
|
1676
|
+
this.isTimePopoverOpen = false;
|
|
1677
|
+
}
|
|
1678
|
+
} }, getLocalizedTime(locale, activePart, computedHourCycle, formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time)),
|
|
1679
|
+
h("ion-popover", { alignment: "center", translucent: true, overlayIndex: 1, arrow: false, onWillPresent: (ev) => {
|
|
1680
|
+
/**
|
|
1681
|
+
* Intersection Observers do not consistently fire between Blink and Webkit
|
|
1682
|
+
* when toggling the visibility of the popover and trying to scroll the picker
|
|
1683
|
+
* column to the correct time value.
|
|
1684
|
+
*
|
|
1685
|
+
* This will correctly scroll the element position to the correct time value,
|
|
1686
|
+
* before the popover is fully presented.
|
|
1687
|
+
*/
|
|
1688
|
+
const cols = ev.target.querySelectorAll('ion-picker-column-internal');
|
|
1689
|
+
// TODO (FW-615): Potentially remove this when intersection observers are fixed in picker column
|
|
1690
|
+
cols.forEach((col) => col.scrollActiveItemIntoView());
|
|
1691
|
+
}, style: {
|
|
1692
|
+
'--offset-y': '-10px',
|
|
1693
|
+
'--min-width': 'fit-content',
|
|
1694
|
+
},
|
|
1695
|
+
// Allow native browser keyboard events to support up/down/home/end key
|
|
1696
|
+
// navigation within the time picker.
|
|
1697
|
+
keyboardEvents: true, ref: (el) => (this.popoverRef = el) }, this.renderWheelPicker('time')),
|
|
1698
|
+
];
|
|
1699
|
+
}
|
|
1700
|
+
getHeaderSelectedDateText() {
|
|
1701
|
+
var _a;
|
|
1702
|
+
const { activeParts, formatOptions, multiple, titleSelectedDatesFormatter } = this;
|
|
1703
|
+
const isArray = Array.isArray(activeParts);
|
|
1704
|
+
let headerText;
|
|
1705
|
+
if (multiple && isArray && activeParts.length !== 1) {
|
|
1706
|
+
headerText = `${activeParts.length} days`; // default/fallback for multiple selection
|
|
1707
|
+
if (titleSelectedDatesFormatter !== undefined) {
|
|
1708
|
+
try {
|
|
1709
|
+
headerText = titleSelectedDatesFormatter(convertDataToISO(activeParts));
|
|
1710
|
+
}
|
|
1711
|
+
catch (e) {
|
|
1712
|
+
printIonError('Exception in provided `titleSelectedDatesFormatter`: ', e);
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1740
1715
|
}
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
* The .datetime-year class has additional
|
|
1745
|
-
* styles that let us show/hide the
|
|
1746
|
-
* picker when the user clicks on the
|
|
1747
|
-
* toggle in the calendar header.
|
|
1748
|
-
*/
|
|
1749
|
-
renderCalendarViewMonthYearPicker() {
|
|
1750
|
-
return h("div", { class: "datetime-year" }, this.renderWheelView('month-year'));
|
|
1716
|
+
else {
|
|
1717
|
+
// for exactly 1 day selected (multiple set or not), show a formatted version of that
|
|
1718
|
+
headerText = getLocalizedDateTime(this.locale, this.getActivePartsWithFallback(), (_a = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) !== null && _a !== void 0 ? _a : { weekday: 'short', month: 'short', day: 'numeric' });
|
|
1751
1719
|
}
|
|
1720
|
+
return headerText;
|
|
1721
|
+
}
|
|
1722
|
+
renderHeader(showExpandedHeader = true) {
|
|
1723
|
+
const hasSlottedTitle = this.el.querySelector('[slot="title"]') !== null;
|
|
1724
|
+
if (!hasSlottedTitle && !this.showDefaultTitle) {
|
|
1725
|
+
return;
|
|
1726
|
+
}
|
|
1727
|
+
return (h("div", { class: "datetime-header" }, h("div", { class: "datetime-title" }, h("slot", { name: "title" }, "Select Date")), showExpandedHeader && h("div", { class: "datetime-selected-date" }, this.getHeaderSelectedDateText())));
|
|
1728
|
+
}
|
|
1729
|
+
/**
|
|
1730
|
+
* Render time picker inside of datetime.
|
|
1731
|
+
* Do not pass color prop to segment on
|
|
1732
|
+
* iOS mode. MD segment has been customized and
|
|
1733
|
+
* should take on the color prop, but iOS
|
|
1734
|
+
* should just be the default segment.
|
|
1735
|
+
*/
|
|
1736
|
+
renderTime() {
|
|
1737
|
+
const { presentation } = this;
|
|
1738
|
+
const timeOnlyPresentation = presentation === 'time';
|
|
1739
|
+
return (h("div", { class: "datetime-time" }, timeOnlyPresentation ? this.renderWheelPicker() : this.renderTimeOverlay()));
|
|
1740
|
+
}
|
|
1741
|
+
/**
|
|
1742
|
+
* Renders the month/year picker that is
|
|
1743
|
+
* displayed on the calendar grid.
|
|
1744
|
+
* The .datetime-year class has additional
|
|
1745
|
+
* styles that let us show/hide the
|
|
1746
|
+
* picker when the user clicks on the
|
|
1747
|
+
* toggle in the calendar header.
|
|
1748
|
+
*/
|
|
1749
|
+
renderCalendarViewMonthYearPicker() {
|
|
1750
|
+
return h("div", { class: "datetime-year" }, this.renderWheelView('month-year'));
|
|
1751
|
+
}
|
|
1752
|
+
/**
|
|
1753
|
+
* Render entry point
|
|
1754
|
+
* All presentation types are rendered from here.
|
|
1755
|
+
*/
|
|
1756
|
+
renderDatetime(mode) {
|
|
1757
|
+
const { presentation, preferWheel } = this;
|
|
1752
1758
|
/**
|
|
1753
|
-
*
|
|
1754
|
-
*
|
|
1759
|
+
* Certain presentation types have separate grid and wheel displays.
|
|
1760
|
+
* If preferWheel is true then we should show a wheel picker instead.
|
|
1755
1761
|
*/
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
* Certain presentation types have separate grid and wheel displays.
|
|
1760
|
-
* If preferWheel is true then we should show a wheel picker instead.
|
|
1761
|
-
*/
|
|
1762
|
-
const hasWheelVariant = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1763
|
-
if (preferWheel && hasWheelVariant) {
|
|
1764
|
-
return [this.renderHeader(false), this.renderWheelView(), this.renderFooter()];
|
|
1765
|
-
}
|
|
1766
|
-
switch (presentation) {
|
|
1767
|
-
case 'date-time':
|
|
1768
|
-
return [
|
|
1769
|
-
this.renderHeader(),
|
|
1770
|
-
this.renderCalendar(mode),
|
|
1771
|
-
this.renderCalendarViewMonthYearPicker(),
|
|
1772
|
-
this.renderTime(),
|
|
1773
|
-
this.renderFooter(),
|
|
1774
|
-
];
|
|
1775
|
-
case 'time-date':
|
|
1776
|
-
return [
|
|
1777
|
-
this.renderHeader(),
|
|
1778
|
-
this.renderTime(),
|
|
1779
|
-
this.renderCalendar(mode),
|
|
1780
|
-
this.renderCalendarViewMonthYearPicker(),
|
|
1781
|
-
this.renderFooter(),
|
|
1782
|
-
];
|
|
1783
|
-
case 'time':
|
|
1784
|
-
return [this.renderHeader(false), this.renderTime(), this.renderFooter()];
|
|
1785
|
-
case 'month':
|
|
1786
|
-
case 'month-year':
|
|
1787
|
-
case 'year':
|
|
1788
|
-
return [this.renderHeader(false), this.renderWheelView(), this.renderFooter()];
|
|
1789
|
-
default:
|
|
1790
|
-
return [
|
|
1791
|
-
this.renderHeader(),
|
|
1792
|
-
this.renderCalendar(mode),
|
|
1793
|
-
this.renderCalendarViewMonthYearPicker(),
|
|
1794
|
-
this.renderFooter(),
|
|
1795
|
-
];
|
|
1796
|
-
}
|
|
1762
|
+
const hasWheelVariant = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1763
|
+
if (preferWheel && hasWheelVariant) {
|
|
1764
|
+
return [this.renderHeader(false), this.renderWheelView(), this.renderFooter()];
|
|
1797
1765
|
}
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1766
|
+
switch (presentation) {
|
|
1767
|
+
case 'date-time':
|
|
1768
|
+
return [
|
|
1769
|
+
this.renderHeader(),
|
|
1770
|
+
this.renderCalendar(mode),
|
|
1771
|
+
this.renderCalendarViewMonthYearPicker(),
|
|
1772
|
+
this.renderTime(),
|
|
1773
|
+
this.renderFooter(),
|
|
1774
|
+
];
|
|
1775
|
+
case 'time-date':
|
|
1776
|
+
return [
|
|
1777
|
+
this.renderHeader(),
|
|
1778
|
+
this.renderTime(),
|
|
1779
|
+
this.renderCalendar(mode),
|
|
1780
|
+
this.renderCalendarViewMonthYearPicker(),
|
|
1781
|
+
this.renderFooter(),
|
|
1782
|
+
];
|
|
1783
|
+
case 'time':
|
|
1784
|
+
return [this.renderHeader(false), this.renderTime(), this.renderFooter()];
|
|
1785
|
+
case 'month':
|
|
1786
|
+
case 'month-year':
|
|
1787
|
+
case 'year':
|
|
1788
|
+
return [this.renderHeader(false), this.renderWheelView(), this.renderFooter()];
|
|
1789
|
+
default:
|
|
1790
|
+
return [
|
|
1791
|
+
this.renderHeader(),
|
|
1792
|
+
this.renderCalendar(mode),
|
|
1793
|
+
this.renderCalendarViewMonthYearPicker(),
|
|
1794
|
+
this.renderFooter(),
|
|
1795
|
+
];
|
|
1818
1796
|
}
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1797
|
+
}
|
|
1798
|
+
render() {
|
|
1799
|
+
const { name, value, disabled, el, color, readonly, showMonthAndYear, preferWheel, presentation, size, isGridStyle, } = this;
|
|
1800
|
+
const mode = getIonMode(this);
|
|
1801
|
+
const isMonthAndYearPresentation = presentation === 'year' || presentation === 'month' || presentation === 'month-year';
|
|
1802
|
+
const shouldShowMonthAndYear = showMonthAndYear || isMonthAndYearPresentation;
|
|
1803
|
+
const monthYearPickerOpen = showMonthAndYear && !isMonthAndYearPresentation;
|
|
1804
|
+
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1805
|
+
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
1806
|
+
renderHiddenInput(true, el, name, formatValue(value), disabled);
|
|
1807
|
+
return (h(Host, { key: '8490192beb6c5c6064ed8f2a7be2d51846f84f36', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
|
|
1808
|
+
[mode]: true,
|
|
1809
|
+
['datetime-readonly']: readonly,
|
|
1810
|
+
['datetime-disabled']: disabled,
|
|
1811
|
+
'show-month-and-year': shouldShowMonthAndYear,
|
|
1812
|
+
'month-year-picker-open': monthYearPickerOpen,
|
|
1813
|
+
[`datetime-presentation-${presentation}`]: true,
|
|
1814
|
+
[`datetime-size-${size}`]: true,
|
|
1815
|
+
[`datetime-prefer-wheel`]: hasWheelVariant,
|
|
1816
|
+
[`datetime-grid`]: isGridStyle,
|
|
1817
|
+
})) }, h("div", { key: 'a2959c07ed871f9004a2f11ab1385a5a7b5737fd', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
|
|
1818
|
+
}
|
|
1819
|
+
get el() { return getElement(this); }
|
|
1820
|
+
static get watchers() { return {
|
|
1821
|
+
"formatOptions": ["formatOptionsChanged"],
|
|
1822
|
+
"disabled": ["disabledChanged"],
|
|
1823
|
+
"min": ["minChanged"],
|
|
1824
|
+
"max": ["maxChanged"],
|
|
1825
|
+
"presentation": ["presentationChanged"],
|
|
1826
|
+
"yearValues": ["yearValuesChanged"],
|
|
1827
|
+
"monthValues": ["monthValuesChanged"],
|
|
1828
|
+
"dayValues": ["dayValuesChanged"],
|
|
1829
|
+
"hourValues": ["hourValuesChanged"],
|
|
1830
|
+
"minuteValues": ["minuteValuesChanged"],
|
|
1831
|
+
"value": ["valueChanged"]
|
|
1832
|
+
}; }
|
|
1855
1833
|
};
|
|
1856
1834
|
let datetimeIds = 0;
|
|
1857
1835
|
Datetime.style = {
|
|
1858
|
-
|
|
1859
|
-
|
|
1836
|
+
ios: datetimeIosCss,
|
|
1837
|
+
md: datetimeMdCss
|
|
1860
1838
|
};
|
|
1861
1839
|
|
|
1862
1840
|
export { Datetime as ion_datetime };
|