@ionic/core 8.8.14-dev.11783984044.10eaba06 → 8.8.14-dev.11784037956.17449639
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/components/index.js +1 -1
- package/components/ion-action-sheet.js +1 -1
- package/components/ion-alert.js +1 -1
- package/components/ion-back-button.js +1 -1
- package/components/ion-button.js +1 -1
- package/components/ion-card.js +1 -1
- package/components/ion-chip.js +1 -1
- package/components/ion-datetime-button.js +1 -1
- package/components/ion-datetime.js +1 -1
- package/components/ion-fab-button.js +1 -1
- package/components/ion-img.js +1 -1
- package/components/ion-infinite-scroll-content.js +1 -1
- package/components/ion-input-password-toggle.js +1 -1
- package/components/ion-input.js +1 -1
- package/components/ion-item-option.js +1 -1
- package/components/ion-item.js +1 -1
- package/components/ion-loading.js +1 -1
- package/components/ion-menu-button.js +1 -1
- package/components/ion-menu.js +1 -1
- package/components/ion-modal.js +1 -1
- package/components/ion-picker-legacy-column.d.ts +11 -0
- package/components/ion-picker-legacy-column.js +4 -0
- package/components/ion-picker-legacy.d.ts +11 -0
- package/components/ion-picker-legacy.js +4 -0
- package/components/ion-popover.js +1 -1
- package/components/ion-progress-bar.js +1 -1
- package/components/ion-radio.js +1 -1
- package/components/ion-range.js +1 -1
- package/components/ion-refresher-content.js +1 -1
- package/components/ion-refresher.js +1 -1
- package/components/ion-reorder-group.js +1 -1
- package/components/ion-reorder.js +1 -1
- package/components/ion-ripple-effect.js +1 -1
- package/components/ion-router-link.js +1 -1
- package/components/ion-router-outlet.js +1 -1
- package/components/ion-row.js +1 -1
- package/components/ion-searchbar.js +1 -1
- package/components/ion-segment-button.js +1 -1
- package/components/ion-segment-content.js +1 -1
- package/components/ion-segment-view.js +1 -1
- package/components/ion-segment.js +1 -1
- package/components/ion-select-modal.js +1 -1
- package/components/ion-select-option.js +1 -1
- package/components/ion-select-popover.js +1 -1
- package/components/ion-select.js +1 -1
- package/components/ion-skeleton-text.js +1 -1
- package/components/ion-spinner.js +1 -1
- package/components/ion-split-pane.js +1 -1
- package/components/ion-tab-bar.js +1 -1
- package/components/ion-tab-button.js +1 -1
- package/components/ion-tab.js +1 -1
- package/components/ion-tabs.js +1 -1
- package/components/ion-text.js +1 -1
- package/components/ion-textarea.js +1 -1
- package/components/ion-thumbnail.js +1 -1
- package/components/ion-title.js +1 -1
- package/components/ion-toast.js +1 -1
- package/components/ion-toggle.js +1 -1
- package/components/ion-toolbar.js +1 -1
- package/components/{p-DpV-p5Xs.js → p-5bE_Wz4Y.js} +1 -1
- package/components/p-B1BWKArA.js +4 -0
- package/components/p-B4PlLGHT.js +4 -0
- package/components/{p-r0aq7dpt.js → p-B60hm8Qv.js} +1 -1
- package/components/p-BFsEcwW9.js +4 -0
- package/components/{p-Buf_7zcy.js → p-BHrrc-3d.js} +1 -1
- package/components/{p-XJWMAP8m.js → p-BLmJ0zRm.js} +1 -1
- package/components/{p-DhkITZ-y.js → p-BSEgsdFI.js} +1 -1
- package/components/p-CFRyvUvJ.js +4 -0
- package/components/p-CU5rbWAW.js +4 -0
- package/components/{p-Dz74mwlk.js → p-Cfx4M1Bn.js} +1 -1
- package/components/p-CgLiHbz0.js +4 -0
- package/components/p-MLyEeL3Q.js +4 -0
- package/components/p-PgMVWD8U.js +4 -0
- package/components/p-k_E4tX5Z.js +4 -0
- package/components/{p-wk2QqrAo.js → p-rCa2eL0j.js} +1 -1
- package/dist/cjs/config-xninhj0J.js +201 -0
- package/dist/cjs/index.cjs.js +6 -6
- package/dist/cjs/ion-action-sheet.cjs.entry.js +7 -27
- package/dist/cjs/ion-alert.cjs.entry.js +25 -64
- package/dist/cjs/ion-app_8.cjs.entry.js +9 -23
- package/dist/cjs/ion-avatar_3.cjs.entry.js +1 -1
- package/dist/cjs/ion-col_3.cjs.entry.js +1 -1
- package/dist/cjs/{ion-datetime.cjs.entry.js → ion-datetime_3.cjs.entry.js} +639 -1
- package/dist/cjs/ion-img.cjs.entry.js +1 -3
- package/dist/cjs/ion-infinite-scroll_2.cjs.entry.js +2 -3
- package/dist/cjs/ion-input.cjs.entry.js +4 -4
- package/dist/cjs/ion-item_8.cjs.entry.js +2 -2
- package/dist/cjs/ion-loading.cjs.entry.js +5 -10
- package/dist/cjs/ion-menu_3.cjs.entry.js +1 -1
- package/dist/cjs/ion-modal.cjs.entry.js +33 -23
- package/dist/cjs/ion-popover.cjs.entry.js +5 -9
- package/dist/cjs/ion-progress-bar.cjs.entry.js +1 -1
- package/dist/cjs/ion-radio_2.cjs.entry.js +3 -3
- package/dist/cjs/ion-range.cjs.entry.js +3 -3
- package/dist/cjs/ion-refresher_2.cjs.entry.js +5 -6
- package/dist/cjs/ion-reorder_2.cjs.entry.js +2 -2
- package/dist/cjs/ion-ripple-effect.cjs.entry.js +1 -1
- package/dist/cjs/ion-route_4.cjs.entry.js +2 -2
- package/dist/cjs/ion-searchbar.cjs.entry.js +5 -5
- package/dist/cjs/ion-segment-content.cjs.entry.js +1 -1
- package/dist/cjs/ion-segment-view.cjs.entry.js +2 -2
- package/dist/cjs/ion-segment_2.cjs.entry.js +4 -4
- package/dist/cjs/ion-select-modal.cjs.entry.js +30 -84
- package/dist/cjs/ion-select_3.cjs.entry.js +49 -407
- package/dist/cjs/ion-spinner.cjs.entry.js +1 -1
- package/dist/cjs/ion-split-pane.cjs.entry.js +2 -2
- package/dist/cjs/ion-tab-bar_2.cjs.entry.js +4 -4
- package/dist/cjs/ion-tab_2.cjs.entry.js +3 -3
- package/dist/cjs/ion-text.cjs.entry.js +2 -2
- package/dist/cjs/ion-textarea.cjs.entry.js +2 -2
- package/dist/cjs/ion-toast.cjs.entry.js +5 -6
- package/dist/cjs/ion-toggle.cjs.entry.js +3 -3
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{overlays-DSmSrd_4.js → overlays-B9UiYZ4R.js} +30 -27
- package/dist/collection/collection-manifest.json +10 -6
- package/dist/collection/components/action-sheet/action-sheet.ios.css +2 -229
- package/dist/collection/components/action-sheet/action-sheet.js +5 -24
- package/dist/collection/components/action-sheet/action-sheet.md.css +2 -175
- package/dist/collection/components/alert/alert.ios.css +10 -280
- package/dist/collection/components/alert/alert.js +21 -59
- package/dist/collection/components/alert/alert.md.css +20 -269
- package/dist/collection/components/img/img.js +1 -6
- package/dist/collection/components/input/input.js +8 -8
- package/dist/collection/components/loading/loading.js +3 -7
- package/dist/collection/components/modal/gestures/sheet.js +8 -0
- package/dist/collection/components/modal/gestures/swipe-to-close.js +8 -0
- package/dist/collection/components/modal/modal.ios.css +8 -0
- package/dist/collection/components/modal/modal.js +17 -23
- package/dist/collection/components/modal/modal.md.css +8 -0
- package/dist/collection/components/picker-legacy/animations/ios.enter.js +27 -0
- package/dist/collection/components/picker-legacy/animations/ios.leave.js +23 -0
- package/dist/collection/components/picker-legacy/picker-interface.js +1 -0
- package/dist/collection/components/picker-legacy/picker.ios.css +300 -0
- package/dist/collection/components/picker-legacy/picker.js +890 -0
- package/dist/collection/components/picker-legacy/picker.md.css +287 -0
- package/dist/collection/components/picker-legacy-column/picker-column.ios.css +231 -0
- package/dist/collection/components/picker-legacy-column/picker-column.js +422 -0
- package/dist/collection/components/picker-legacy-column/picker-column.md.css +222 -0
- package/dist/collection/components/picker-legacy-column/test/test.utils.js +43 -0
- package/dist/collection/components/popover/popover.ios.css +0 -15
- package/dist/collection/components/popover/popover.js +3 -7
- package/dist/collection/components/popover/popover.md.css +0 -15
- package/dist/collection/components/progress-bar/progress-bar.js +1 -1
- package/dist/collection/components/radio/radio.js +4 -4
- package/dist/collection/components/range/range.js +3 -3
- package/dist/collection/components/refresher/refresher.js +1 -1
- package/dist/collection/components/refresher-content/refresher-content.js +1 -1
- package/dist/collection/components/reorder/reorder.js +1 -1
- package/dist/collection/components/reorder-group/reorder-group.js +1 -1
- package/dist/collection/components/ripple-effect/ripple-effect.js +1 -1
- package/dist/collection/components/router-link/router-link.js +2 -2
- package/dist/collection/components/router-outlet/router-outlet.js +5 -38
- package/dist/collection/components/row/row.js +1 -1
- package/dist/collection/components/searchbar/searchbar.js +9 -9
- package/dist/collection/components/segment/segment.js +2 -2
- package/dist/collection/components/segment-button/segment-button.js +2 -2
- package/dist/collection/components/segment-content/segment-content.js +1 -1
- package/dist/collection/components/segment-view/segment-view.js +2 -2
- package/dist/collection/components/select/select.ios.css +0 -33
- package/dist/collection/components/select/select.js +16 -323
- package/dist/collection/components/select/select.md.css +0 -33
- package/dist/collection/components/select-modal/select-modal.ios.css +0 -219
- package/dist/collection/components/select-modal/select-modal.js +26 -79
- package/dist/collection/components/select-modal/select-modal.md.css +0 -165
- package/dist/collection/components/select-option/select-option.js +3 -67
- package/dist/collection/components/select-popover/select-popover.ios.css +0 -219
- package/dist/collection/components/select-popover/select-popover.js +26 -78
- package/dist/collection/components/select-popover/select-popover.md.css +0 -165
- package/dist/collection/components/skeleton-text/skeleton-text.js +2 -2
- package/dist/collection/components/spinner/spinner.js +1 -1
- package/dist/collection/components/split-pane/split-pane.js +2 -2
- package/dist/collection/components/tab/tab.js +2 -2
- package/dist/collection/components/tab-bar/tab-bar.js +2 -2
- package/dist/collection/components/tab-button/tab-button.js +2 -2
- package/dist/collection/components/tabs/tabs.js +1 -1
- package/dist/collection/components/text/text.js +2 -2
- package/dist/collection/components/textarea/textarea.js +2 -2
- package/dist/collection/components/thumbnail/thumbnail.js +1 -1
- package/dist/collection/components/title/title.js +2 -2
- package/dist/collection/components/toast/toast.js +2 -2
- package/dist/collection/components/toggle/toggle.js +3 -3
- package/dist/collection/components/toolbar/toolbar.js +2 -2
- package/dist/collection/index.js +1 -1
- package/dist/collection/utils/overlays.js +29 -26
- package/dist/collection/utils/sanitization/index.js +18 -274
- package/dist/docs.json +1177 -485
- package/dist/esm/config-DQCONYYp.js +195 -0
- package/dist/esm/{index-AlrZKoWR.js → index-DV3sJJW8.js} +1 -1
- package/dist/esm/index.js +2 -3
- package/dist/esm/ion-accordion_2.entry.js +1 -1
- package/dist/esm/ion-action-sheet.entry.js +7 -27
- package/dist/esm/ion-alert.entry.js +24 -63
- package/dist/esm/ion-app_8.entry.js +9 -23
- package/dist/esm/ion-avatar_3.entry.js +1 -1
- package/dist/esm/ion-back-button.entry.js +1 -1
- package/dist/esm/ion-breadcrumb_2.entry.js +1 -1
- package/dist/esm/ion-col_3.entry.js +1 -1
- package/dist/esm/{ion-datetime.entry.js → ion-datetime_3.entry.js} +641 -5
- package/dist/esm/ion-fab_3.entry.js +1 -1
- package/dist/esm/ion-img.entry.js +2 -4
- package/dist/esm/ion-infinite-scroll_2.entry.js +1 -2
- package/dist/esm/ion-input-password-toggle.entry.js +1 -1
- package/dist/esm/ion-input.entry.js +5 -5
- package/dist/esm/ion-item_8.entry.js +3 -3
- package/dist/esm/ion-loading.entry.js +4 -9
- package/dist/esm/ion-menu_3.entry.js +2 -2
- package/dist/esm/ion-modal.entry.js +33 -23
- package/dist/esm/ion-popover.entry.js +5 -9
- package/dist/esm/ion-progress-bar.entry.js +1 -1
- package/dist/esm/ion-radio_2.entry.js +3 -3
- package/dist/esm/ion-range.entry.js +3 -3
- package/dist/esm/ion-refresher_2.entry.js +4 -5
- package/dist/esm/ion-reorder_2.entry.js +3 -3
- package/dist/esm/ion-ripple-effect.entry.js +1 -1
- package/dist/esm/ion-route_4.entry.js +2 -2
- package/dist/esm/ion-searchbar.entry.js +6 -6
- package/dist/esm/ion-segment-content.entry.js +1 -1
- package/dist/esm/ion-segment-view.entry.js +2 -2
- package/dist/esm/ion-segment_2.entry.js +4 -4
- package/dist/esm/ion-select-modal.entry.js +30 -84
- package/dist/esm/ion-select_3.entry.js +52 -410
- package/dist/esm/ion-spinner.entry.js +1 -1
- package/dist/esm/ion-split-pane.entry.js +2 -2
- package/dist/esm/ion-tab-bar_2.entry.js +4 -4
- package/dist/esm/ion-tab_2.entry.js +3 -3
- package/dist/esm/ion-text.entry.js +2 -2
- package/dist/esm/ion-textarea.entry.js +2 -2
- package/dist/esm/ion-toast.entry.js +4 -5
- package/dist/esm/ion-toggle.entry.js +4 -4
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{overlays-DLNOHWNc.js → overlays-Bmfhux69.js} +31 -28
- package/dist/html.html-data.json +79 -51
- package/dist/ionic/index.esm.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-01f81ea5.entry.js +4 -0
- package/dist/ionic/p-02473803.entry.js +4 -0
- package/dist/ionic/{p-fe4aa1db.entry.js → p-0fa9c382.entry.js} +1 -1
- package/dist/ionic/p-20b1a044.entry.js +4 -0
- package/dist/ionic/p-21eb76d5.entry.js +4 -0
- package/dist/ionic/p-27d30585.entry.js +4 -0
- package/dist/ionic/p-2bb2cb18.entry.js +4 -0
- package/dist/ionic/p-2f529a55.entry.js +4 -0
- package/dist/ionic/{p-80b44b3c.entry.js → p-3353c229.entry.js} +1 -1
- package/dist/ionic/{p-a7628bc7.entry.js → p-37e720da.entry.js} +1 -1
- package/dist/ionic/{p-9177f4ac.entry.js → p-390ca786.entry.js} +1 -1
- package/dist/ionic/{p-259d0d98.entry.js → p-3a126bca.entry.js} +1 -1
- package/dist/ionic/{p-4502a274.entry.js → p-3a7d1e91.entry.js} +1 -1
- package/dist/ionic/{p-627fabd9.entry.js → p-3ae5f277.entry.js} +1 -1
- package/dist/ionic/{p-a5213260.entry.js → p-4858af1f.entry.js} +1 -1
- package/dist/ionic/p-485fda23.entry.js +4 -0
- package/dist/ionic/p-48fa7fb1.entry.js +4 -0
- package/dist/ionic/p-4baa5b82.entry.js +4 -0
- package/dist/ionic/p-4d9181c7.entry.js +4 -0
- package/dist/ionic/p-50e1194a.entry.js +4 -0
- package/dist/ionic/p-532eb373.entry.js +4 -0
- package/dist/ionic/{p-76e92a84.entry.js → p-5d1da0a2.entry.js} +1 -1
- package/dist/ionic/{p-d2c7f046.entry.js → p-75dc25ba.entry.js} +1 -1
- package/dist/ionic/{p-b9ac1fe0.entry.js → p-84d5ce05.entry.js} +1 -1
- package/dist/ionic/{p-51cd1643.entry.js → p-874b4bd8.entry.js} +1 -1
- package/dist/ionic/{p-ef93ca92.entry.js → p-8eb8ee76.entry.js} +1 -1
- package/dist/ionic/{p-14095ba5.entry.js → p-8fce95d5.entry.js} +1 -1
- package/dist/ionic/{p-db1b6738.entry.js → p-9a65ac7f.entry.js} +1 -1
- package/dist/ionic/{p-7a37b3ce.entry.js → p-9f1103ce.entry.js} +1 -1
- package/dist/ionic/p-B0zdMdR0.js +4 -0
- package/dist/ionic/{p-AlrZKoWR.js → p-DV3sJJW8.js} +1 -1
- package/dist/ionic/p-DzWaWHGc.js +4 -0
- package/dist/ionic/p-a21add2f.entry.js +4 -0
- package/dist/ionic/p-ab60b48a.entry.js +4 -0
- package/dist/ionic/{p-d8387b99.entry.js → p-c4d8641b.entry.js} +1 -1
- package/dist/ionic/{p-c93553d2.entry.js → p-cf91e738.entry.js} +1 -1
- package/dist/ionic/{p-629e4703.entry.js → p-e0be05c5.entry.js} +1 -1
- package/dist/ionic/p-ec090e0a.entry.js +4 -0
- package/dist/ionic/{p-b1599fca.entry.js → p-ef4c3bee.entry.js} +1 -1
- package/dist/ionic/p-f994dc44.entry.js +4 -0
- package/dist/ionic/{p-341032b3.entry.js → p-fabcce6c.entry.js} +1 -1
- package/dist/ionic/p-fd76f647.entry.js +4 -0
- package/dist/ionic/p-fda60562.entry.js +4 -0
- package/dist/types/components/img/img.d.ts +0 -2
- package/dist/types/components/input/input.d.ts +1 -1
- package/dist/types/components/modal/modal.d.ts +4 -11
- package/dist/types/components/picker-legacy/animations/ios.enter.d.ts +5 -0
- package/dist/types/components/picker-legacy/animations/ios.leave.d.ts +5 -0
- package/dist/types/components/picker-legacy/picker-interface.d.ts +52 -0
- package/dist/types/components/picker-legacy/picker.d.ts +158 -0
- package/dist/types/components/picker-legacy-column/picker-column.d.ts +46 -0
- package/dist/types/components/picker-legacy-column/test/test.utils.d.ts +9 -0
- package/dist/types/components/router-outlet/router-outlet.d.ts +0 -7
- package/dist/types/components/searchbar/searchbar.d.ts +1 -1
- package/dist/types/components/select/select-interface.d.ts +0 -31
- package/dist/types/components/select/select.d.ts +0 -18
- package/dist/types/components/select-option/select-option.d.ts +1 -42
- package/dist/types/components.d.ts +288 -72
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interface.d.ts +1 -0
- package/dist/types/utils/config.d.ts +8 -0
- package/dist/types/utils/overlays.d.ts +9 -11
- package/dist/types/utils/sanitization/index.d.ts +2 -58
- package/hydrate/index.js +1188 -1407
- package/hydrate/index.mjs +1188 -1407
- package/package.json +5 -37
- package/components/p-279dFMvg.js +0 -4
- package/components/p-BSQPZ79H.js +0 -4
- package/components/p-BwKpO3Is.js +0 -4
- package/components/p-C-Rx1zny.js +0 -4
- package/components/p-CHzfYZbv.js +0 -4
- package/components/p-D4h1H_hh.js +0 -4
- package/components/p-LMGfIvTf.js +0 -4
- package/components/p-_lHSumhG.js +0 -4
- package/components/p-j9Da6cYO.js +0 -4
- package/components/p-jOtMJMv8.js +0 -4
- package/components/p-uTR_dEqg.js +0 -4
- package/dist/cjs/config-DWdFbSNK.js +0 -35
- package/dist/cjs/index-Cueg3U4w.js +0 -429
- package/dist/cjs/overlay-control-label-D2sdL2O8.js +0 -50
- package/dist/cjs/select-option-render-DTF50t5r.js +0 -124
- package/dist/collection/utils/overlay-control-label.js +0 -45
- package/dist/collection/utils/select-option-render.js +0 -119
- package/dist/esm/config-BwKpO3Is.js +0 -31
- package/dist/esm/index-DQSkZyOJ.js +0 -424
- package/dist/esm/overlay-control-label-BSQPZ79H.js +0 -47
- package/dist/esm/select-option-render-B8nWZRnd.js +0 -122
- package/dist/ionic/p-038eb991.entry.js +0 -4
- package/dist/ionic/p-4621c387.entry.js +0 -4
- package/dist/ionic/p-4ace7762.entry.js +0 -4
- package/dist/ionic/p-4bb3eb60.entry.js +0 -4
- package/dist/ionic/p-4e9ec5c5.entry.js +0 -4
- package/dist/ionic/p-5c3ec490.entry.js +0 -4
- package/dist/ionic/p-5d1ac2c7.entry.js +0 -4
- package/dist/ionic/p-700795f6.entry.js +0 -4
- package/dist/ionic/p-79a36078.entry.js +0 -4
- package/dist/ionic/p-913b218a.entry.js +0 -4
- package/dist/ionic/p-BDtODLZ4.js +0 -4
- package/dist/ionic/p-BSQPZ79H.js +0 -4
- package/dist/ionic/p-BwKpO3Is.js +0 -4
- package/dist/ionic/p-Cg5-OQYy.js +0 -4
- package/dist/ionic/p-DCOvXkOm.js +0 -4
- package/dist/ionic/p-a9a33367.entry.js +0 -4
- package/dist/ionic/p-ad728198.entry.js +0 -4
- package/dist/ionic/p-bfc8c629.entry.js +0 -4
- package/dist/ionic/p-c08e666a.entry.js +0 -4
- package/dist/ionic/p-ce7992c4.entry.js +0 -4
- package/dist/ionic/p-ed797c72.entry.js +0 -4
- package/dist/ionic/p-f09f9642.entry.js +0 -4
- package/dist/ionic/p-f1c06f82.entry.js +0 -4
- package/dist/ionic/p-f718fccb.entry.js +0 -4
- package/dist/types/utils/overlay-control-label.d.ts +0 -32
- package/dist/types/utils/select-option-render.d.ts +0 -53
|
@@ -3,17 +3,21 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { j as printIonError, f as printIonWarning, r as registerInstance, c as createEvent, w as writeTask, e as config, h, d as Host, g as getElement } from './index-tcQvqkiX.js';
|
|
5
5
|
import { startFocusVisible } from './focus-visible-BmVRXR1y.js';
|
|
6
|
-
import { r as raf, g as getElementRoot, a as renderHiddenInput } from './helpers-HEqiOzXb.js';
|
|
7
|
-
import { F as FOCUS_TRAP_DISABLE_CLASS } from './overlays-
|
|
6
|
+
import { r as raf, g as getElementRoot, a as renderHiddenInput, e as clamp } from './helpers-HEqiOzXb.js';
|
|
7
|
+
import { F as FOCUS_TRAP_DISABLE_CLASS, d as createDelegateController, e as createTriggerController, B as BACKDROP, i as isCancel, j as prepareOverlay, k as setOverlayId, f as present, g as dismiss, h as eventMethod, s as safeCall } from './overlays-Bmfhux69.js';
|
|
8
8
|
import { i as isRTL } from './dir-C53feagD.js';
|
|
9
|
-
import { c as createColorClasses } from './theme-DiVJyqlX.js';
|
|
10
|
-
import {
|
|
9
|
+
import { c as createColorClasses, g as getClassMap } from './theme-DiVJyqlX.js';
|
|
10
|
+
import { l as chevronDown, o as caretUpSharp, p as chevronForward, q as caretDownSharp, c as chevronBack } from './index-DV3sJJW8.js';
|
|
11
11
|
import { b as getIonMode } from './ionic-global-Cp_eT4sZ.js';
|
|
12
12
|
import { r as removeDateTzOffset, g as getNextMonth, a as getPreviousMonth, i as isSameDay, b as getTodayLabel, c as getYear, d as getHourCycle, e as getInternalHourValue, f as getFormattedHour, h as addTimePadding, j as getLocalizedDayPeriod, k as isBefore, l as isAfter, m as is24Hour, n as getNumDaysInMonth, o as getDay, p as generateDayAriaLabel, v as validateParts, q as getPartsFromCalendarDay, s as getNextYear, t as getPreviousYear, u as getEndOfWeek, w as getStartOfWeek, x as getPreviousDay, y as getNextDay, z as getPreviousWeek, A as getNextWeek, B as parseMinParts, C as parseMaxParts, D as parseDate, E as warnIfValueOutOfBounds, F as parseAmPm, G as clampDate, H as convertToArrayOfNumbers, I as convertDataToISO, J as getClosestValidDate, K as isMonthFirstLocale, L as isLocaleDayPeriodRTL, M as calculateHourFromAMPM, N as getMonthAndYear, O as getLocalizedTime, P as getLocalizedDateTime, Q as formatValue } from './format-CAmvpAez.js';
|
|
13
|
+
import { c as createLockController } from './lock-controller-B-hirT0v.js';
|
|
14
|
+
import { c as createAnimation } from './animation-DLJpuoEz.js';
|
|
15
|
+
import { a as hapticSelectionChanged, h as hapticSelectionEnd, b as hapticSelectionStart } from './haptic-DzAMWJuk.js';
|
|
13
16
|
import './index-ZjP4CjeZ.js';
|
|
14
17
|
import './hardware-back-button-B93Gru0Y.js';
|
|
15
18
|
import './framework-delegate-FnPGymXL.js';
|
|
16
19
|
import './gesture-controller-BTEOs1at.js';
|
|
20
|
+
import './capacitor-CFERIeaU.js';
|
|
17
21
|
|
|
18
22
|
/**
|
|
19
23
|
* Returns the current date as
|
|
@@ -2521,4 +2525,636 @@ Datetime.style = {
|
|
|
2521
2525
|
md: datetimeMdCss()
|
|
2522
2526
|
};
|
|
2523
2527
|
|
|
2524
|
-
|
|
2528
|
+
/**
|
|
2529
|
+
* iOS Picker Enter Animation
|
|
2530
|
+
*/
|
|
2531
|
+
const iosEnterAnimation = (baseEl) => {
|
|
2532
|
+
const baseAnimation = createAnimation();
|
|
2533
|
+
const backdropAnimation = createAnimation();
|
|
2534
|
+
const wrapperAnimation = createAnimation();
|
|
2535
|
+
backdropAnimation
|
|
2536
|
+
.addElement(baseEl.querySelector('ion-backdrop'))
|
|
2537
|
+
.fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
|
|
2538
|
+
.beforeStyles({
|
|
2539
|
+
'pointer-events': 'none',
|
|
2540
|
+
})
|
|
2541
|
+
.afterClearStyles(['pointer-events']);
|
|
2542
|
+
wrapperAnimation
|
|
2543
|
+
.addElement(baseEl.querySelector('.picker-wrapper'))
|
|
2544
|
+
.fromTo('transform', 'translateY(100%)', 'translateY(0%)');
|
|
2545
|
+
return baseAnimation
|
|
2546
|
+
.addElement(baseEl)
|
|
2547
|
+
.easing('cubic-bezier(.36,.66,.04,1)')
|
|
2548
|
+
.duration(400)
|
|
2549
|
+
.addAnimation([backdropAnimation, wrapperAnimation]);
|
|
2550
|
+
};
|
|
2551
|
+
|
|
2552
|
+
/**
|
|
2553
|
+
* iOS Picker Leave Animation
|
|
2554
|
+
*/
|
|
2555
|
+
const iosLeaveAnimation = (baseEl) => {
|
|
2556
|
+
const baseAnimation = createAnimation();
|
|
2557
|
+
const backdropAnimation = createAnimation();
|
|
2558
|
+
const wrapperAnimation = createAnimation();
|
|
2559
|
+
backdropAnimation
|
|
2560
|
+
.addElement(baseEl.querySelector('ion-backdrop'))
|
|
2561
|
+
.fromTo('opacity', 'var(--backdrop-opacity)', 0.01);
|
|
2562
|
+
wrapperAnimation
|
|
2563
|
+
.addElement(baseEl.querySelector('.picker-wrapper'))
|
|
2564
|
+
.fromTo('transform', 'translateY(0%)', 'translateY(100%)');
|
|
2565
|
+
return baseAnimation
|
|
2566
|
+
.addElement(baseEl)
|
|
2567
|
+
.easing('cubic-bezier(.36,.66,.04,1)')
|
|
2568
|
+
.duration(400)
|
|
2569
|
+
.addAnimation([backdropAnimation, wrapperAnimation]);
|
|
2570
|
+
};
|
|
2571
|
+
|
|
2572
|
+
const pickerIosCss = () => `.sc-ion-picker-legacy-ios-h{--border-radius:0;--border-style:solid;--min-width:auto;--width:100%;--max-width:500px;--min-height:auto;--max-height:auto;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;top:0;display:block;position:absolute;width:100%;height:100%;outline:none;font-family:var(--ion-font-family, inherit);contain:strict;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1001}.sc-ion-picker-legacy-ios-h{inset-inline-start:0}.overlay-hidden.sc-ion-picker-legacy-ios-h{display:none}.picker-wrapper.sc-ion-picker-legacy-ios{border-radius:var(--border-radius);left:0;right:0;bottom:0;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:auto;margin-bottom:auto;-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0);display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:column;flex-direction:column;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;overflow:hidden;z-index:10}.picker-toolbar.sc-ion-picker-legacy-ios{width:100%;background:transparent;contain:strict;z-index:1}.picker-button.sc-ion-picker-legacy-ios{border:0;font-family:inherit}.picker-button.sc-ion-picker-legacy-ios:active,.picker-button.sc-ion-picker-legacy-ios:focus{outline:none}.picker-columns.sc-ion-picker-legacy-ios{display:-ms-flexbox;display:flex;position:relative;-ms-flex-pack:center;justify-content:center;margin-bottom:var(--ion-safe-area-bottom, 0);contain:strict;overflow:hidden}.picker-above-highlight.sc-ion-picker-legacy-ios,.picker-below-highlight.sc-ion-picker-legacy-ios{display:none;pointer-events:none}.sc-ion-picker-legacy-ios-h{--background:var(--ion-background-color, #fff);--border-width:1px 0 0;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, var(--ion-background-color-step-250, #c8c7cc))));--height:260px;--backdrop-opacity:var(--ion-backdrop-opacity, 0.26);color:var(--ion-item-color, var(--ion-text-color, #000))}.picker-toolbar.sc-ion-picker-legacy-ios{display:-ms-flexbox;display:flex;height:44px;border-bottom:0.55px solid var(--border-color)}.picker-toolbar-button.sc-ion-picker-legacy-ios{-ms-flex:1;flex:1;text-align:end}.picker-toolbar-button.sc-ion-picker-legacy-ios:last-child .picker-button.sc-ion-picker-legacy-ios{font-weight:600}.picker-toolbar-button.sc-ion-picker-legacy-ios:first-child{font-weight:normal;text-align:start}.picker-button.sc-ion-picker-legacy-ios,.picker-button.ion-activated.sc-ion-picker-legacy-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:1em;padding-inline-start:1em;-webkit-padding-end:1em;padding-inline-end:1em;padding-top:0;padding-bottom:0;height:44px;background:transparent;color:var(--ion-color-primary, #0054e9);font-size:16px}.picker-columns.sc-ion-picker-legacy-ios{height:215px;-webkit-perspective:1000px;perspective:1000px}.picker-above-highlight.sc-ion-picker-legacy-ios{top:0;-webkit-transform:translate3d(0, 0, 90px);transform:translate3d(0, 0, 90px);display:block;position:absolute;width:100%;height:81px;border-bottom:1px solid var(--border-color);background:-webkit-gradient(linear, left top, left bottom, color-stop(20%, var(--background, var(--ion-background-color, #fff))), to(rgba(var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255)), 0.8)));background:linear-gradient(to bottom, var(--background, var(--ion-background-color, #fff)) 20%, rgba(var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255)), 0.8) 100%);z-index:10}.picker-above-highlight.sc-ion-picker-legacy-ios{inset-inline-start:0}.picker-below-highlight.sc-ion-picker-legacy-ios{top:115px;-webkit-transform:translate3d(0, 0, 90px);transform:translate3d(0, 0, 90px);display:block;position:absolute;width:100%;height:119px;border-top:1px solid var(--border-color);background:-webkit-gradient(linear, left bottom, left top, color-stop(30%, var(--background, var(--ion-background-color, #fff))), to(rgba(var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255)), 0.8)));background:linear-gradient(to top, var(--background, var(--ion-background-color, #fff)) 30%, rgba(var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255)), 0.8) 100%);z-index:11}.picker-below-highlight.sc-ion-picker-legacy-ios{inset-inline-start:0}`;
|
|
2573
|
+
|
|
2574
|
+
const pickerMdCss = () => `.sc-ion-picker-legacy-md-h{--border-radius:0;--border-style:solid;--min-width:auto;--width:100%;--max-width:500px;--min-height:auto;--max-height:auto;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;top:0;display:block;position:absolute;width:100%;height:100%;outline:none;font-family:var(--ion-font-family, inherit);contain:strict;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1001}.sc-ion-picker-legacy-md-h{inset-inline-start:0}.overlay-hidden.sc-ion-picker-legacy-md-h{display:none}.picker-wrapper.sc-ion-picker-legacy-md{border-radius:var(--border-radius);left:0;right:0;bottom:0;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:auto;margin-bottom:auto;-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0);display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:column;flex-direction:column;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;overflow:hidden;z-index:10}.picker-toolbar.sc-ion-picker-legacy-md{width:100%;background:transparent;contain:strict;z-index:1}.picker-button.sc-ion-picker-legacy-md{border:0;font-family:inherit}.picker-button.sc-ion-picker-legacy-md:active,.picker-button.sc-ion-picker-legacy-md:focus{outline:none}.picker-columns.sc-ion-picker-legacy-md{display:-ms-flexbox;display:flex;position:relative;-ms-flex-pack:center;justify-content:center;margin-bottom:var(--ion-safe-area-bottom, 0);contain:strict;overflow:hidden}.picker-above-highlight.sc-ion-picker-legacy-md,.picker-below-highlight.sc-ion-picker-legacy-md{display:none;pointer-events:none}.sc-ion-picker-legacy-md-h{--background:var(--ion-background-color, #fff);--border-width:0.55px 0 0;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))));--height:260px;--backdrop-opacity:var(--ion-backdrop-opacity, 0.26);color:var(--ion-item-color, var(--ion-text-color, #000))}.picker-toolbar.sc-ion-picker-legacy-md{display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:flex-end;height:44px}.picker-button.sc-ion-picker-legacy-md,.picker-button.ion-activated.sc-ion-picker-legacy-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:1.1em;padding-inline-start:1.1em;-webkit-padding-end:1.1em;padding-inline-end:1.1em;padding-top:0;padding-bottom:0;height:44px;background:transparent;color:var(--ion-color-primary, #0054e9);font-size:14px;font-weight:500;text-transform:uppercase;-webkit-box-shadow:none;box-shadow:none}.picker-columns.sc-ion-picker-legacy-md{height:216px;-webkit-perspective:1800px;perspective:1800px}.picker-above-highlight.sc-ion-picker-legacy-md{top:0;-webkit-transform:translate3d(0, 0, 90px);transform:translate3d(0, 0, 90px);position:absolute;width:100%;height:81px;border-bottom:1px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))));background:-webkit-gradient(linear, left top, left bottom, color-stop(20%, var(--ion-background-color, #fff)), to(rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8)));background:linear-gradient(to bottom, var(--ion-background-color, #fff) 20%, rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8) 100%);z-index:10}.picker-above-highlight.sc-ion-picker-legacy-md{inset-inline-start:0}.picker-below-highlight.sc-ion-picker-legacy-md{top:115px;-webkit-transform:translate3d(0, 0, 90px);transform:translate3d(0, 0, 90px);position:absolute;width:100%;height:119px;border-top:1px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))));background:-webkit-gradient(linear, left bottom, left top, color-stop(30%, var(--ion-background-color, #fff)), to(rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8)));background:linear-gradient(to top, var(--ion-background-color, #fff) 30%, rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8) 100%);z-index:11}.picker-below-highlight.sc-ion-picker-legacy-md{inset-inline-start:0}`;
|
|
2575
|
+
|
|
2576
|
+
const Picker = class {
|
|
2577
|
+
constructor(hostRef) {
|
|
2578
|
+
registerInstance(this, hostRef);
|
|
2579
|
+
this.didPresent = createEvent(this, "ionPickerDidPresent", 7);
|
|
2580
|
+
this.willPresent = createEvent(this, "ionPickerWillPresent", 7);
|
|
2581
|
+
this.willDismiss = createEvent(this, "ionPickerWillDismiss", 7);
|
|
2582
|
+
this.didDismiss = createEvent(this, "ionPickerDidDismiss", 7);
|
|
2583
|
+
this.didPresentShorthand = createEvent(this, "didPresent", 7);
|
|
2584
|
+
this.willPresentShorthand = createEvent(this, "willPresent", 7);
|
|
2585
|
+
this.willDismissShorthand = createEvent(this, "willDismiss", 7);
|
|
2586
|
+
this.didDismissShorthand = createEvent(this, "didDismiss", 7);
|
|
2587
|
+
this.delegateController = createDelegateController(this);
|
|
2588
|
+
this.lockController = createLockController();
|
|
2589
|
+
this.triggerController = createTriggerController();
|
|
2590
|
+
this.presented = false;
|
|
2591
|
+
/** @internal */
|
|
2592
|
+
this.hasController = false;
|
|
2593
|
+
/**
|
|
2594
|
+
* If `true`, the keyboard will be automatically dismissed when the overlay is presented.
|
|
2595
|
+
*/
|
|
2596
|
+
this.keyboardClose = true;
|
|
2597
|
+
/**
|
|
2598
|
+
* Array of buttons to be displayed at the top of the picker.
|
|
2599
|
+
*/
|
|
2600
|
+
this.buttons = [];
|
|
2601
|
+
/**
|
|
2602
|
+
* Array of columns to be displayed in the picker.
|
|
2603
|
+
*/
|
|
2604
|
+
this.columns = [];
|
|
2605
|
+
/**
|
|
2606
|
+
* Number of milliseconds to wait before dismissing the picker.
|
|
2607
|
+
*/
|
|
2608
|
+
this.duration = 0;
|
|
2609
|
+
/**
|
|
2610
|
+
* If `true`, a backdrop will be displayed behind the picker.
|
|
2611
|
+
*/
|
|
2612
|
+
this.showBackdrop = true;
|
|
2613
|
+
/**
|
|
2614
|
+
* If `true`, the picker will be dismissed when the backdrop is clicked.
|
|
2615
|
+
*/
|
|
2616
|
+
this.backdropDismiss = true;
|
|
2617
|
+
/**
|
|
2618
|
+
* If `true`, the picker will animate.
|
|
2619
|
+
*/
|
|
2620
|
+
this.animated = true;
|
|
2621
|
+
/**
|
|
2622
|
+
* If `true`, the picker will open. If `false`, the picker will close.
|
|
2623
|
+
* Use this if you need finer grained control over presentation, otherwise
|
|
2624
|
+
* just use the pickerController or the `trigger` property.
|
|
2625
|
+
* Note: `isOpen` will not automatically be set back to `false` when
|
|
2626
|
+
* the picker dismisses. You will need to do that in your code.
|
|
2627
|
+
*/
|
|
2628
|
+
this.isOpen = false;
|
|
2629
|
+
this.onBackdropTap = () => {
|
|
2630
|
+
this.dismiss(undefined, BACKDROP);
|
|
2631
|
+
};
|
|
2632
|
+
this.dispatchCancelHandler = (ev) => {
|
|
2633
|
+
const role = ev.detail.role;
|
|
2634
|
+
if (isCancel(role)) {
|
|
2635
|
+
const cancelButton = this.buttons.find((b) => b.role === 'cancel');
|
|
2636
|
+
this.callButtonHandler(cancelButton);
|
|
2637
|
+
}
|
|
2638
|
+
};
|
|
2639
|
+
}
|
|
2640
|
+
onIsOpenChange(newValue, oldValue) {
|
|
2641
|
+
if (newValue === true && oldValue === false) {
|
|
2642
|
+
this.present();
|
|
2643
|
+
}
|
|
2644
|
+
else if (newValue === false && oldValue === true) {
|
|
2645
|
+
this.dismiss();
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
triggerChanged() {
|
|
2649
|
+
const { trigger, el, triggerController } = this;
|
|
2650
|
+
if (trigger) {
|
|
2651
|
+
triggerController.addClickListener(el, trigger);
|
|
2652
|
+
}
|
|
2653
|
+
}
|
|
2654
|
+
connectedCallback() {
|
|
2655
|
+
prepareOverlay(this.el);
|
|
2656
|
+
this.triggerChanged();
|
|
2657
|
+
}
|
|
2658
|
+
disconnectedCallback() {
|
|
2659
|
+
this.triggerController.removeClickListener();
|
|
2660
|
+
}
|
|
2661
|
+
componentWillLoad() {
|
|
2662
|
+
var _a;
|
|
2663
|
+
if (!((_a = this.htmlAttributes) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
2664
|
+
setOverlayId(this.el);
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
componentDidLoad() {
|
|
2668
|
+
printIonWarning('[ion-picker-legacy] - ion-picker-legacy and ion-picker-legacy-column have been deprecated in favor of new versions of the ion-picker and ion-picker-column components. These new components display inline with your page content allowing for more presentation flexibility than before.', this.el);
|
|
2669
|
+
/**
|
|
2670
|
+
* If picker was rendered with isOpen="true"
|
|
2671
|
+
* then we should open picker immediately.
|
|
2672
|
+
*/
|
|
2673
|
+
if (this.isOpen === true) {
|
|
2674
|
+
raf(() => this.present());
|
|
2675
|
+
}
|
|
2676
|
+
/**
|
|
2677
|
+
* When binding values in frameworks such as Angular
|
|
2678
|
+
* it is possible for the value to be set after the Web Component
|
|
2679
|
+
* initializes but before the value watcher is set up in Stencil.
|
|
2680
|
+
* As a result, the watcher callback may not be fired.
|
|
2681
|
+
* We work around this by manually calling the watcher
|
|
2682
|
+
* callback when the component has loaded and the watcher
|
|
2683
|
+
* is configured.
|
|
2684
|
+
*/
|
|
2685
|
+
this.triggerChanged();
|
|
2686
|
+
}
|
|
2687
|
+
/**
|
|
2688
|
+
* Present the picker overlay after it has been created.
|
|
2689
|
+
*/
|
|
2690
|
+
async present() {
|
|
2691
|
+
const unlock = await this.lockController.lock();
|
|
2692
|
+
await this.delegateController.attachViewToDom();
|
|
2693
|
+
await present(this, 'pickerEnter', iosEnterAnimation, iosEnterAnimation, undefined);
|
|
2694
|
+
if (this.duration > 0) {
|
|
2695
|
+
this.durationTimeout = setTimeout(() => this.dismiss(), this.duration);
|
|
2696
|
+
}
|
|
2697
|
+
unlock();
|
|
2698
|
+
}
|
|
2699
|
+
/**
|
|
2700
|
+
* Dismiss the picker overlay after it has been presented.
|
|
2701
|
+
*
|
|
2702
|
+
* @param data Any data to emit in the dismiss events.
|
|
2703
|
+
* @param role The role of the element that is dismissing the picker.
|
|
2704
|
+
* This can be useful in a button handler for determining which button was
|
|
2705
|
+
* clicked to dismiss the picker.
|
|
2706
|
+
* Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
|
|
2707
|
+
*/
|
|
2708
|
+
async dismiss(data, role) {
|
|
2709
|
+
const unlock = await this.lockController.lock();
|
|
2710
|
+
if (this.durationTimeout) {
|
|
2711
|
+
clearTimeout(this.durationTimeout);
|
|
2712
|
+
}
|
|
2713
|
+
const dismissed = await dismiss(this, data, role, 'pickerLeave', iosLeaveAnimation, iosLeaveAnimation);
|
|
2714
|
+
if (dismissed) {
|
|
2715
|
+
this.delegateController.removeViewFromDom();
|
|
2716
|
+
}
|
|
2717
|
+
unlock();
|
|
2718
|
+
return dismissed;
|
|
2719
|
+
}
|
|
2720
|
+
/**
|
|
2721
|
+
* Returns a promise that resolves when the picker did dismiss.
|
|
2722
|
+
*/
|
|
2723
|
+
onDidDismiss() {
|
|
2724
|
+
return eventMethod(this.el, 'ionPickerDidDismiss');
|
|
2725
|
+
}
|
|
2726
|
+
/**
|
|
2727
|
+
* Returns a promise that resolves when the picker will dismiss.
|
|
2728
|
+
*/
|
|
2729
|
+
onWillDismiss() {
|
|
2730
|
+
return eventMethod(this.el, 'ionPickerWillDismiss');
|
|
2731
|
+
}
|
|
2732
|
+
/**
|
|
2733
|
+
* Get the column that matches the specified name.
|
|
2734
|
+
*
|
|
2735
|
+
* @param name The name of the column.
|
|
2736
|
+
*/
|
|
2737
|
+
getColumn(name) {
|
|
2738
|
+
return Promise.resolve(this.columns.find((column) => column.name === name));
|
|
2739
|
+
}
|
|
2740
|
+
async buttonClick(button) {
|
|
2741
|
+
const role = button.role;
|
|
2742
|
+
if (isCancel(role)) {
|
|
2743
|
+
return this.dismiss(undefined, role);
|
|
2744
|
+
}
|
|
2745
|
+
const shouldDismiss = await this.callButtonHandler(button);
|
|
2746
|
+
if (shouldDismiss) {
|
|
2747
|
+
return this.dismiss(this.getSelected(), button.role);
|
|
2748
|
+
}
|
|
2749
|
+
return Promise.resolve();
|
|
2750
|
+
}
|
|
2751
|
+
async callButtonHandler(button) {
|
|
2752
|
+
if (button) {
|
|
2753
|
+
// a handler has been provided, execute it
|
|
2754
|
+
// pass the handler the values from the inputs
|
|
2755
|
+
const rtn = await safeCall(button.handler, this.getSelected());
|
|
2756
|
+
if (rtn === false) {
|
|
2757
|
+
// if the return value of the handler is false then do not dismiss
|
|
2758
|
+
return false;
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
return true;
|
|
2762
|
+
}
|
|
2763
|
+
getSelected() {
|
|
2764
|
+
const selected = {};
|
|
2765
|
+
this.columns.forEach((col, index) => {
|
|
2766
|
+
const selectedColumn = col.selectedIndex !== undefined ? col.options[col.selectedIndex] : undefined;
|
|
2767
|
+
selected[col.name] = {
|
|
2768
|
+
text: selectedColumn ? selectedColumn.text : undefined,
|
|
2769
|
+
value: selectedColumn ? selectedColumn.value : undefined,
|
|
2770
|
+
columnIndex: index,
|
|
2771
|
+
};
|
|
2772
|
+
});
|
|
2773
|
+
return selected;
|
|
2774
|
+
}
|
|
2775
|
+
render() {
|
|
2776
|
+
const { htmlAttributes } = this;
|
|
2777
|
+
const mode = getIonMode(this);
|
|
2778
|
+
return (h(Host, Object.assign({ key: '80f66d33780d8a1352d24be9cb63a0cc03d01ab5', "aria-modal": "true", tabindex: "-1" }, htmlAttributes, { style: {
|
|
2779
|
+
zIndex: `${20000 + this.overlayIndex}`,
|
|
2780
|
+
}, class: Object.assign({ [mode]: true,
|
|
2781
|
+
// Used internally for styling
|
|
2782
|
+
[`picker-${mode}`]: true, 'overlay-hidden': true }, getClassMap(this.cssClass)), onIonBackdropTap: this.onBackdropTap, onIonPickerWillDismiss: this.dispatchCancelHandler }), h("ion-backdrop", { key: '97fb8e10ba08b197610cb8c0cdea61103883d55f', visible: this.showBackdrop, tappable: this.backdropDismiss }), h("div", { key: 'b3969cb6fbf7153623d14e3ca1493d3370efb211', tabindex: "0", "aria-hidden": "true" }), h("div", { key: '299268483c3727e698d9135bfdf40349a7050ac1', class: "picker-wrapper ion-overlay-wrapper", role: "dialog" }, h("div", { key: '95394de3ef691899b7dbf416f56fd3e86bbdce3f', class: "picker-toolbar" }, this.buttons.map((b) => (h("div", { class: buttonWrapperClass(b) }, h("button", { type: "button", onClick: () => this.buttonClick(b), class: buttonClass(b) }, b.text))))), h("div", { key: '05f18bb8d00dc0e22f691b7e41f90f729a6c66d7', class: "picker-columns" }, h("div", { key: '4a8fdf224effc0af67fd413e2e6aca8a78d1cf43', class: "picker-above-highlight" }), this.presented && this.columns.map((c) => h("ion-picker-legacy-column", { col: c })), h("div", { key: 'e50a31db45e3f39e9d0fed36a21be9257eec09bf', class: "picker-below-highlight" }))), h("div", { key: '5a78cb2176ac807ea0c195c6b76cd0e8eef9d4c0', tabindex: "0", "aria-hidden": "true" })));
|
|
2783
|
+
}
|
|
2784
|
+
get el() { return getElement(this); }
|
|
2785
|
+
static get watchers() { return {
|
|
2786
|
+
"isOpen": [{
|
|
2787
|
+
"onIsOpenChange": 0
|
|
2788
|
+
}],
|
|
2789
|
+
"trigger": [{
|
|
2790
|
+
"triggerChanged": 0
|
|
2791
|
+
}]
|
|
2792
|
+
}; }
|
|
2793
|
+
};
|
|
2794
|
+
const buttonWrapperClass = (button) => {
|
|
2795
|
+
return {
|
|
2796
|
+
[`picker-toolbar-${button.role}`]: button.role !== undefined,
|
|
2797
|
+
'picker-toolbar-button': true,
|
|
2798
|
+
};
|
|
2799
|
+
};
|
|
2800
|
+
const buttonClass = (button) => {
|
|
2801
|
+
return Object.assign({ 'picker-button': true, 'ion-activatable': true }, getClassMap(button.cssClass));
|
|
2802
|
+
};
|
|
2803
|
+
Picker.style = {
|
|
2804
|
+
ios: pickerIosCss(),
|
|
2805
|
+
md: pickerMdCss()
|
|
2806
|
+
};
|
|
2807
|
+
|
|
2808
|
+
const pickerColumnIosCss = () => `.picker-col{display:-ms-flexbox;display:flex;position:relative;-ms-flex:1;flex:1;-ms-flex-pack:center;justify-content:center;height:100%;-webkit-box-sizing:content-box;box-sizing:content-box;contain:content}.picker-opts{position:relative;-ms-flex:1;flex:1;max-width:100%}.picker-opt{top:0;display:block;position:absolute;width:100%;border:0;text-align:center;text-overflow:ellipsis;white-space:nowrap;contain:strict;overflow:hidden;will-change:transform}.picker-opt{inset-inline-start:0}.picker-opt.picker-opt-disabled{pointer-events:none}.picker-opt-disabled{opacity:0}.picker-opts-left{-ms-flex-pack:start;justify-content:flex-start}.picker-opts-right{-ms-flex-pack:end;justify-content:flex-end}.picker-opt:active,.picker-opt:focus{outline:none}.picker-prefix{position:relative;-ms-flex:1;flex:1;text-align:end;white-space:nowrap}.picker-suffix{position:relative;-ms-flex:1;flex:1;text-align:start;white-space:nowrap}.picker-col{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:0;padding-bottom:0;-webkit-transform-style:preserve-3d;transform-style:preserve-3d}.picker-prefix,.picker-suffix,.picker-opts{top:77px;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;color:inherit;font-size:20px;line-height:42px;pointer-events:none}.picker-opt{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-transform-origin:center center;transform-origin:center center;height:46px;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out;background:transparent;color:inherit;font-size:20px;line-height:42px;-webkit-backface-visibility:hidden;backface-visibility:hidden;pointer-events:auto}:host-context([dir=rtl]) .picker-opt{-webkit-transform-origin:calc(100% - center) center;transform-origin:calc(100% - center) center}[dir=rtl] .picker-opt{-webkit-transform-origin:calc(100% - center) center;transform-origin:calc(100% - center) center}@supports selector(:dir(rtl)){.picker-opt:dir(rtl){-webkit-transform-origin:calc(100% - center) center;transform-origin:calc(100% - center) center}}`;
|
|
2809
|
+
|
|
2810
|
+
const pickerColumnMdCss = () => `.picker-col{display:-ms-flexbox;display:flex;position:relative;-ms-flex:1;flex:1;-ms-flex-pack:center;justify-content:center;height:100%;-webkit-box-sizing:content-box;box-sizing:content-box;contain:content}.picker-opts{position:relative;-ms-flex:1;flex:1;max-width:100%}.picker-opt{top:0;display:block;position:absolute;width:100%;border:0;text-align:center;text-overflow:ellipsis;white-space:nowrap;contain:strict;overflow:hidden;will-change:transform}.picker-opt{inset-inline-start:0}.picker-opt.picker-opt-disabled{pointer-events:none}.picker-opt-disabled{opacity:0}.picker-opts-left{-ms-flex-pack:start;justify-content:flex-start}.picker-opts-right{-ms-flex-pack:end;justify-content:flex-end}.picker-opt:active,.picker-opt:focus{outline:none}.picker-prefix{position:relative;-ms-flex:1;flex:1;text-align:end;white-space:nowrap}.picker-suffix{position:relative;-ms-flex:1;flex:1;text-align:start;white-space:nowrap}.picker-col{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:0;padding-bottom:0;-webkit-transform-style:preserve-3d;transform-style:preserve-3d}.picker-prefix,.picker-suffix,.picker-opts{top:77px;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;color:inherit;font-size:22px;line-height:42px;pointer-events:none}.picker-opt{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;height:43px;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out;background:transparent;color:inherit;font-size:22px;line-height:42px;-webkit-backface-visibility:hidden;backface-visibility:hidden;pointer-events:auto}.picker-prefix,.picker-suffix,.picker-opt.picker-opt-selected{color:var(--ion-color-primary, #0054e9)}`;
|
|
2811
|
+
|
|
2812
|
+
const PickerColumnCmp = class {
|
|
2813
|
+
constructor(hostRef) {
|
|
2814
|
+
registerInstance(this, hostRef);
|
|
2815
|
+
this.ionPickerColChange = createEvent(this, "ionPickerColChange", 7);
|
|
2816
|
+
this.optHeight = 0;
|
|
2817
|
+
this.rotateFactor = 0;
|
|
2818
|
+
this.scaleFactor = 1;
|
|
2819
|
+
this.velocity = 0;
|
|
2820
|
+
this.y = 0;
|
|
2821
|
+
this.noAnimate = true;
|
|
2822
|
+
// `colDidChange` is a flag that gets set when the column is changed
|
|
2823
|
+
// dynamically. When this flag is set, the column will refresh
|
|
2824
|
+
// after the component re-renders to incorporate the new column data.
|
|
2825
|
+
// This is necessary because `this.refresh` queries for the option elements,
|
|
2826
|
+
// so it needs to wait for the latest elements to be available in the DOM.
|
|
2827
|
+
// Ex: column is created with 3 options. User updates the column data
|
|
2828
|
+
// to have 5 options. The column will still think it only has 3 options.
|
|
2829
|
+
this.colDidChange = false;
|
|
2830
|
+
}
|
|
2831
|
+
colChanged() {
|
|
2832
|
+
this.colDidChange = true;
|
|
2833
|
+
}
|
|
2834
|
+
async connectedCallback() {
|
|
2835
|
+
let pickerRotateFactor = 0;
|
|
2836
|
+
let pickerScaleFactor = 0.81;
|
|
2837
|
+
const mode = getIonMode(this);
|
|
2838
|
+
if (mode === 'ios') {
|
|
2839
|
+
pickerRotateFactor = -0.46;
|
|
2840
|
+
pickerScaleFactor = 1;
|
|
2841
|
+
}
|
|
2842
|
+
this.rotateFactor = pickerRotateFactor;
|
|
2843
|
+
this.scaleFactor = pickerScaleFactor;
|
|
2844
|
+
this.gesture = (await import('./index-CfgBF1SE.js')).createGesture({
|
|
2845
|
+
el: this.el,
|
|
2846
|
+
gestureName: 'picker-swipe',
|
|
2847
|
+
gesturePriority: 100,
|
|
2848
|
+
threshold: 0,
|
|
2849
|
+
passive: false,
|
|
2850
|
+
onStart: (ev) => this.onStart(ev),
|
|
2851
|
+
onMove: (ev) => this.onMove(ev),
|
|
2852
|
+
onEnd: (ev) => this.onEnd(ev),
|
|
2853
|
+
});
|
|
2854
|
+
this.gesture.enable();
|
|
2855
|
+
// Options have not been initialized yet
|
|
2856
|
+
// Animation must be disabled through the `noAnimate` flag
|
|
2857
|
+
// Otherwise, the options will render
|
|
2858
|
+
// at the top of the column and transition down
|
|
2859
|
+
this.tmrId = setTimeout(() => {
|
|
2860
|
+
this.noAnimate = false;
|
|
2861
|
+
// After initialization, `refresh()` will be called
|
|
2862
|
+
// At this point, animation will be enabled. The options will
|
|
2863
|
+
// animate as they are being selected.
|
|
2864
|
+
this.refresh(true);
|
|
2865
|
+
}, 250);
|
|
2866
|
+
}
|
|
2867
|
+
componentDidLoad() {
|
|
2868
|
+
this.onDomChange();
|
|
2869
|
+
}
|
|
2870
|
+
componentDidUpdate() {
|
|
2871
|
+
// Options may have changed since last update.
|
|
2872
|
+
if (this.colDidChange) {
|
|
2873
|
+
// Animation must be disabled through the `onDomChange` parameter.
|
|
2874
|
+
// Otherwise, the recently added options will render
|
|
2875
|
+
// at the top of the column and transition down
|
|
2876
|
+
this.onDomChange(true, false);
|
|
2877
|
+
this.colDidChange = false;
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
disconnectedCallback() {
|
|
2881
|
+
if (this.rafId !== undefined)
|
|
2882
|
+
cancelAnimationFrame(this.rafId);
|
|
2883
|
+
if (this.tmrId)
|
|
2884
|
+
clearTimeout(this.tmrId);
|
|
2885
|
+
if (this.gesture) {
|
|
2886
|
+
this.gesture.destroy();
|
|
2887
|
+
this.gesture = undefined;
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
emitColChange() {
|
|
2891
|
+
this.ionPickerColChange.emit(this.col);
|
|
2892
|
+
}
|
|
2893
|
+
setSelected(selectedIndex, duration) {
|
|
2894
|
+
// if there is a selected index, then figure out it's y position
|
|
2895
|
+
// if there isn't a selected index, then just use the top y position
|
|
2896
|
+
const y = selectedIndex > -1 ? -(selectedIndex * this.optHeight) : 0;
|
|
2897
|
+
this.velocity = 0;
|
|
2898
|
+
// set what y position we're at
|
|
2899
|
+
if (this.rafId !== undefined)
|
|
2900
|
+
cancelAnimationFrame(this.rafId);
|
|
2901
|
+
this.update(y, duration, true);
|
|
2902
|
+
this.emitColChange();
|
|
2903
|
+
}
|
|
2904
|
+
update(y, duration, saveY) {
|
|
2905
|
+
if (!this.optsEl) {
|
|
2906
|
+
return;
|
|
2907
|
+
}
|
|
2908
|
+
// ensure we've got a good round number :)
|
|
2909
|
+
let translateY = 0;
|
|
2910
|
+
let translateZ = 0;
|
|
2911
|
+
const { col, rotateFactor } = this;
|
|
2912
|
+
const prevSelected = col.selectedIndex;
|
|
2913
|
+
const selectedIndex = (col.selectedIndex = this.indexForY(-y));
|
|
2914
|
+
const durationStr = duration === 0 ? '' : duration + 'ms';
|
|
2915
|
+
const scaleStr = `scale(${this.scaleFactor})`;
|
|
2916
|
+
const children = this.optsEl.children;
|
|
2917
|
+
for (let i = 0; i < children.length; i++) {
|
|
2918
|
+
const button = children[i];
|
|
2919
|
+
const opt = col.options[i];
|
|
2920
|
+
const optOffset = i * this.optHeight + y;
|
|
2921
|
+
let transform = '';
|
|
2922
|
+
if (rotateFactor !== 0) {
|
|
2923
|
+
const rotateX = optOffset * rotateFactor;
|
|
2924
|
+
if (Math.abs(rotateX) <= 90) {
|
|
2925
|
+
translateY = 0;
|
|
2926
|
+
translateZ = 90;
|
|
2927
|
+
transform = `rotateX(${rotateX}deg) `;
|
|
2928
|
+
}
|
|
2929
|
+
else {
|
|
2930
|
+
translateY = -9999;
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2933
|
+
else {
|
|
2934
|
+
translateZ = 0;
|
|
2935
|
+
translateY = optOffset;
|
|
2936
|
+
}
|
|
2937
|
+
const selected = selectedIndex === i;
|
|
2938
|
+
transform += `translate3d(0px,${translateY}px,${translateZ}px) `;
|
|
2939
|
+
if (this.scaleFactor !== 1 && !selected) {
|
|
2940
|
+
transform += scaleStr;
|
|
2941
|
+
}
|
|
2942
|
+
// Update transition duration
|
|
2943
|
+
if (this.noAnimate) {
|
|
2944
|
+
opt.duration = 0;
|
|
2945
|
+
button.style.transitionDuration = '';
|
|
2946
|
+
}
|
|
2947
|
+
else if (duration !== opt.duration) {
|
|
2948
|
+
opt.duration = duration;
|
|
2949
|
+
button.style.transitionDuration = durationStr;
|
|
2950
|
+
}
|
|
2951
|
+
// Update transform
|
|
2952
|
+
if (transform !== opt.transform) {
|
|
2953
|
+
opt.transform = transform;
|
|
2954
|
+
}
|
|
2955
|
+
button.style.transform = transform;
|
|
2956
|
+
/**
|
|
2957
|
+
* Ensure that the select column
|
|
2958
|
+
* item has the selected class
|
|
2959
|
+
*/
|
|
2960
|
+
opt.selected = selected;
|
|
2961
|
+
if (selected) {
|
|
2962
|
+
button.classList.add(PICKER_OPT_SELECTED);
|
|
2963
|
+
}
|
|
2964
|
+
else {
|
|
2965
|
+
button.classList.remove(PICKER_OPT_SELECTED);
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
this.col.prevSelected = prevSelected;
|
|
2969
|
+
if (saveY) {
|
|
2970
|
+
this.y = y;
|
|
2971
|
+
}
|
|
2972
|
+
if (this.lastIndex !== selectedIndex) {
|
|
2973
|
+
// have not set a last index yet
|
|
2974
|
+
hapticSelectionChanged();
|
|
2975
|
+
this.lastIndex = selectedIndex;
|
|
2976
|
+
}
|
|
2977
|
+
}
|
|
2978
|
+
decelerate() {
|
|
2979
|
+
if (this.velocity !== 0) {
|
|
2980
|
+
// still decelerating
|
|
2981
|
+
this.velocity *= DECELERATION_FRICTION;
|
|
2982
|
+
// do not let it go slower than a velocity of 1
|
|
2983
|
+
this.velocity = this.velocity > 0 ? Math.max(this.velocity, 1) : Math.min(this.velocity, -1);
|
|
2984
|
+
let y = this.y + this.velocity;
|
|
2985
|
+
if (y > this.minY) {
|
|
2986
|
+
// whoops, it's trying to scroll up farther than the options we have!
|
|
2987
|
+
y = this.minY;
|
|
2988
|
+
this.velocity = 0;
|
|
2989
|
+
}
|
|
2990
|
+
else if (y < this.maxY) {
|
|
2991
|
+
// gahh, it's trying to scroll down farther than we can!
|
|
2992
|
+
y = this.maxY;
|
|
2993
|
+
this.velocity = 0;
|
|
2994
|
+
}
|
|
2995
|
+
this.update(y, 0, true);
|
|
2996
|
+
const notLockedIn = Math.round(y) % this.optHeight !== 0 || Math.abs(this.velocity) > 1;
|
|
2997
|
+
if (notLockedIn) {
|
|
2998
|
+
// isn't locked in yet, keep decelerating until it is
|
|
2999
|
+
this.rafId = requestAnimationFrame(() => this.decelerate());
|
|
3000
|
+
}
|
|
3001
|
+
else {
|
|
3002
|
+
this.velocity = 0;
|
|
3003
|
+
this.emitColChange();
|
|
3004
|
+
hapticSelectionEnd();
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3007
|
+
else if (this.y % this.optHeight !== 0) {
|
|
3008
|
+
// needs to still get locked into a position so options line up
|
|
3009
|
+
const currentPos = Math.abs(this.y % this.optHeight);
|
|
3010
|
+
// create a velocity in the direction it needs to scroll
|
|
3011
|
+
this.velocity = currentPos > this.optHeight / 2 ? 1 : -1;
|
|
3012
|
+
this.decelerate();
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
indexForY(y) {
|
|
3016
|
+
return Math.min(Math.max(Math.abs(Math.round(y / this.optHeight)), 0), this.col.options.length - 1);
|
|
3017
|
+
}
|
|
3018
|
+
onStart(detail) {
|
|
3019
|
+
// We have to prevent default in order to block scrolling under the picker
|
|
3020
|
+
// but we DO NOT have to stop propagation, since we still want
|
|
3021
|
+
// some "click" events to capture
|
|
3022
|
+
if (detail.event.cancelable) {
|
|
3023
|
+
detail.event.preventDefault();
|
|
3024
|
+
}
|
|
3025
|
+
detail.event.stopPropagation();
|
|
3026
|
+
hapticSelectionStart();
|
|
3027
|
+
// reset everything
|
|
3028
|
+
if (this.rafId !== undefined)
|
|
3029
|
+
cancelAnimationFrame(this.rafId);
|
|
3030
|
+
const options = this.col.options;
|
|
3031
|
+
let minY = options.length - 1;
|
|
3032
|
+
let maxY = 0;
|
|
3033
|
+
for (let i = 0; i < options.length; i++) {
|
|
3034
|
+
if (!options[i].disabled) {
|
|
3035
|
+
minY = Math.min(minY, i);
|
|
3036
|
+
maxY = Math.max(maxY, i);
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
this.minY = -(minY * this.optHeight);
|
|
3040
|
+
this.maxY = -(maxY * this.optHeight);
|
|
3041
|
+
}
|
|
3042
|
+
onMove(detail) {
|
|
3043
|
+
if (detail.event.cancelable) {
|
|
3044
|
+
detail.event.preventDefault();
|
|
3045
|
+
}
|
|
3046
|
+
detail.event.stopPropagation();
|
|
3047
|
+
// update the scroll position relative to pointer start position
|
|
3048
|
+
let y = this.y + detail.deltaY;
|
|
3049
|
+
if (y > this.minY) {
|
|
3050
|
+
// scrolling up higher than scroll area
|
|
3051
|
+
y = Math.pow(y, 0.8);
|
|
3052
|
+
this.bounceFrom = y;
|
|
3053
|
+
}
|
|
3054
|
+
else if (y < this.maxY) {
|
|
3055
|
+
// scrolling down below scroll area
|
|
3056
|
+
y += Math.pow(this.maxY - y, 0.9);
|
|
3057
|
+
this.bounceFrom = y;
|
|
3058
|
+
}
|
|
3059
|
+
else {
|
|
3060
|
+
this.bounceFrom = 0;
|
|
3061
|
+
}
|
|
3062
|
+
this.update(y, 0, false);
|
|
3063
|
+
}
|
|
3064
|
+
onEnd(detail) {
|
|
3065
|
+
if (this.bounceFrom > 0) {
|
|
3066
|
+
// bounce back up
|
|
3067
|
+
this.update(this.minY, 100, true);
|
|
3068
|
+
this.emitColChange();
|
|
3069
|
+
return;
|
|
3070
|
+
}
|
|
3071
|
+
else if (this.bounceFrom < 0) {
|
|
3072
|
+
// bounce back down
|
|
3073
|
+
this.update(this.maxY, 100, true);
|
|
3074
|
+
this.emitColChange();
|
|
3075
|
+
return;
|
|
3076
|
+
}
|
|
3077
|
+
this.velocity = clamp(-MAX_PICKER_SPEED, detail.velocityY * 23, MAX_PICKER_SPEED);
|
|
3078
|
+
if (this.velocity === 0 && detail.deltaY === 0) {
|
|
3079
|
+
const opt = detail.event.target.closest('.picker-opt');
|
|
3080
|
+
if (opt === null || opt === void 0 ? void 0 : opt.hasAttribute('opt-index')) {
|
|
3081
|
+
this.setSelected(parseInt(opt.getAttribute('opt-index'), 10), TRANSITION_DURATION);
|
|
3082
|
+
}
|
|
3083
|
+
}
|
|
3084
|
+
else {
|
|
3085
|
+
this.y += detail.deltaY;
|
|
3086
|
+
if (Math.abs(detail.velocityY) < 0.05) {
|
|
3087
|
+
const isScrollingUp = detail.deltaY > 0;
|
|
3088
|
+
const optHeightFraction = (Math.abs(this.y) % this.optHeight) / this.optHeight;
|
|
3089
|
+
if (isScrollingUp && optHeightFraction > 0.5) {
|
|
3090
|
+
this.velocity = Math.abs(this.velocity) * -1;
|
|
3091
|
+
}
|
|
3092
|
+
else if (!isScrollingUp && optHeightFraction <= 0.5) {
|
|
3093
|
+
this.velocity = Math.abs(this.velocity);
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
this.decelerate();
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
refresh(forceRefresh, animated) {
|
|
3100
|
+
var _a;
|
|
3101
|
+
let min = this.col.options.length - 1;
|
|
3102
|
+
let max = 0;
|
|
3103
|
+
const options = this.col.options;
|
|
3104
|
+
for (let i = 0; i < options.length; i++) {
|
|
3105
|
+
if (!options[i].disabled) {
|
|
3106
|
+
min = Math.min(min, i);
|
|
3107
|
+
max = Math.max(max, i);
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
/**
|
|
3111
|
+
* Only update selected value if column has a
|
|
3112
|
+
* velocity of 0. If it does not, then the
|
|
3113
|
+
* column is animating might land on
|
|
3114
|
+
* a value different than the value at
|
|
3115
|
+
* selectedIndex
|
|
3116
|
+
*/
|
|
3117
|
+
if (this.velocity !== 0) {
|
|
3118
|
+
return;
|
|
3119
|
+
}
|
|
3120
|
+
const selectedIndex = clamp(min, (_a = this.col.selectedIndex) !== null && _a !== void 0 ? _a : 0, max);
|
|
3121
|
+
if (this.col.prevSelected !== selectedIndex || forceRefresh) {
|
|
3122
|
+
const y = selectedIndex * this.optHeight * -1;
|
|
3123
|
+
const duration = animated ? TRANSITION_DURATION : 0;
|
|
3124
|
+
this.velocity = 0;
|
|
3125
|
+
this.update(y, duration, true);
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3128
|
+
onDomChange(forceRefresh, animated) {
|
|
3129
|
+
const colEl = this.optsEl;
|
|
3130
|
+
if (colEl) {
|
|
3131
|
+
// DOM READ
|
|
3132
|
+
// We perfom a DOM read over a rendered item, this needs to happen after the first render or after the column has changed
|
|
3133
|
+
this.optHeight = colEl.firstElementChild ? colEl.firstElementChild.clientHeight : 0;
|
|
3134
|
+
}
|
|
3135
|
+
this.refresh(forceRefresh, animated);
|
|
3136
|
+
}
|
|
3137
|
+
render() {
|
|
3138
|
+
const col = this.col;
|
|
3139
|
+
const mode = getIonMode(this);
|
|
3140
|
+
return (h(Host, { key: '86125e95f18837dfd021db01777d72a1562d8ee3', class: Object.assign({ [mode]: true, 'picker-col': true, 'picker-opts-left': this.col.align === 'left', 'picker-opts-right': this.col.align === 'right' }, getClassMap(col.cssClass)), style: {
|
|
3141
|
+
'max-width': this.col.columnWidth,
|
|
3142
|
+
} }, col.prefix && (h("div", { key: 'b0f3d39e0bd128781066ffefb7a1e40d12a9e76d', class: "picker-prefix", style: { width: col.prefixWidth } }, col.prefix)), h("div", { key: '0b106ac4d56916eaaa7f09d1b68348b3754b7bba', class: "picker-opts", style: { maxWidth: col.optionsWidth }, ref: (el) => (this.optsEl = el) }, col.options.map((o, index) => (h("button", { "aria-label": o.ariaLabel, class: { 'picker-opt': true, 'picker-opt-disabled': !!o.disabled }, "opt-index": index }, o.text)))), col.suffix && (h("div", { key: '00ff2f9dbb4561787e5a5223327c6a2a33f8362e', class: "picker-suffix", style: { width: col.suffixWidth } }, col.suffix))));
|
|
3143
|
+
}
|
|
3144
|
+
get el() { return getElement(this); }
|
|
3145
|
+
static get watchers() { return {
|
|
3146
|
+
"col": [{
|
|
3147
|
+
"colChanged": 0
|
|
3148
|
+
}]
|
|
3149
|
+
}; }
|
|
3150
|
+
};
|
|
3151
|
+
const PICKER_OPT_SELECTED = 'picker-opt-selected';
|
|
3152
|
+
const DECELERATION_FRICTION = 0.97;
|
|
3153
|
+
const MAX_PICKER_SPEED = 90;
|
|
3154
|
+
const TRANSITION_DURATION = 150;
|
|
3155
|
+
PickerColumnCmp.style = {
|
|
3156
|
+
ios: pickerColumnIosCss(),
|
|
3157
|
+
md: pickerColumnMdCss()
|
|
3158
|
+
};
|
|
3159
|
+
|
|
3160
|
+
export { Datetime as ion_datetime, Picker as ion_picker_legacy, PickerColumnCmp as ion_picker_legacy_column };
|