framework7 6.3.4 → 7.0.0-beta.3
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/accordion/accordion.js +132 -1
- package/components/accordion/accordion.umd.js +1 -0
- package/components/actions/actions-class.js +365 -0
- package/components/actions/actions-rtl.css +1 -1
- package/components/actions/actions.css +1 -1
- package/components/actions/actions.js +42 -1
- package/components/actions/actions.umd.js +1 -0
- package/components/app/app-class.d.ts +10 -10
- package/{esm/components → components}/app/app-class.js +107 -140
- package/components/app/app.less +3 -3
- package/{esm/components → components}/app/load-module.js +32 -32
- package/components/appbar/appbar.js +3 -1
- package/components/appbar/appbar.umd.js +1 -0
- package/components/area-chart/area-chart-class.js +507 -0
- package/components/area-chart/area-chart-rtl.css +1 -1
- package/components/area-chart/area-chart.css +1 -1
- package/components/area-chart/area-chart.js +47 -1
- package/components/area-chart/area-chart.umd.js +1 -0
- package/{esm/components → components}/autocomplete/autocomplete-class.js +241 -253
- package/components/autocomplete/autocomplete-rtl.css +1 -1
- package/components/autocomplete/autocomplete.css +1 -1
- package/components/autocomplete/autocomplete.js +86 -1
- package/components/autocomplete/autocomplete.umd.js +1 -0
- package/{esm/components → components}/badge/badge.js +0 -0
- package/{esm/components → components}/block/block.js +0 -0
- package/{esm/components → components}/button/button.js +0 -0
- package/{esm/components → components}/calendar/calendar-class.js +676 -643
- package/components/calendar/calendar-rtl.css +1 -1
- package/components/calendar/calendar.css +1 -1
- package/components/calendar/calendar.js +111 -1
- package/components/calendar/calendar.umd.js +1 -0
- package/components/card/card-rtl.css +1 -1
- package/components/card/card.css +1 -1
- package/components/card/card.js +592 -1
- package/components/card/card.umd.js +1 -0
- package/components/checkbox/checkbox-rtl.css +1 -1
- package/components/checkbox/checkbox.css +1 -1
- package/components/checkbox/checkbox.js +3 -1
- package/components/checkbox/checkbox.umd.js +1 -0
- package/components/chip/chip-rtl.css +1 -1
- package/components/chip/chip.css +1 -1
- package/components/chip/chip.js +3 -1
- package/components/chip/chip.umd.js +1 -0
- package/{esm/components → components}/color-picker/color-picker-class.js +336 -349
- package/components/color-picker/color-picker-rtl.css +1 -1
- package/components/color-picker/color-picker.css +1 -1
- package/components/color-picker/color-picker.js +92 -1
- package/components/color-picker/color-picker.umd.js +1 -0
- package/{esm/components → components}/color-picker/modules/alpha-slider.js +30 -19
- package/{esm/components → components}/color-picker/modules/brightness-slider.js +35 -24
- package/{esm/components → components}/color-picker/modules/current-color.js +4 -2
- package/{esm/components → components}/color-picker/modules/hex.js +27 -16
- package/{esm/components → components}/color-picker/modules/hs-spectrum.js +37 -25
- package/{esm/components → components}/color-picker/modules/hsb-sliders.js +54 -41
- package/{esm/components → components}/color-picker/modules/hue-slider.js +29 -18
- package/{esm/components → components}/color-picker/modules/initial-current-colors.js +14 -9
- package/{esm/components → components}/color-picker/modules/palette.js +14 -11
- package/{esm/components → components}/color-picker/modules/rgb-bars.js +42 -29
- package/{esm/components → components}/color-picker/modules/rgb-sliders.js +47 -34
- package/{esm/components → components}/color-picker/modules/sb-spectrum.js +38 -26
- package/{esm/components → components}/color-picker/modules/wheel.js +59 -47
- package/components/contacts-list/contacts-list-rtl.css +1 -1
- package/components/contacts-list/contacts-list.css +1 -1
- package/components/contacts-list/contacts-list.js +3 -1
- package/components/contacts-list/contacts-list.umd.js +1 -0
- package/{esm/components → components}/data-table/data-table-class.js +40 -59
- package/components/data-table/data-table-rtl.css +1 -1
- package/components/data-table/data-table.css +1 -1
- package/components/data-table/data-table.js +72 -1
- package/components/data-table/data-table.umd.js +1 -0
- package/{esm/components → components}/dialog/dialog-class.js +58 -67
- package/components/dialog/dialog-rtl.css +1 -1
- package/components/dialog/dialog.css +1 -1
- package/components/dialog/dialog.js +254 -1
- package/components/dialog/dialog.umd.js +1 -0
- package/components/elevation/elevation.js +3 -1
- package/components/elevation/elevation.umd.js +1 -0
- package/components/fab/fab.js +181 -1
- package/components/fab/fab.umd.js +1 -0
- package/components/form/form.js +347 -1
- package/components/form/form.umd.js +1 -0
- package/components/gauge/gauge-class.js +306 -0
- package/components/gauge/gauge.js +99 -1
- package/components/gauge/gauge.umd.js +1 -0
- package/components/grid/grid-rtl.css +1 -1
- package/components/grid/grid.css +1 -1
- package/components/grid/grid.js +227 -1
- package/components/grid/grid.umd.js +1 -0
- package/{esm/components → components}/icon/icon.js +0 -0
- package/components/infinite-scroll/infinite-scroll.js +110 -1
- package/components/infinite-scroll/infinite-scroll.umd.js +1 -0
- package/components/input/input-rtl.css +1 -1
- package/components/input/input.css +1 -1
- package/components/input/input.js +394 -1
- package/components/input/input.less +1 -1
- package/components/input/input.umd.js +1 -0
- package/components/lazy/lazy.js +283 -1
- package/components/lazy/lazy.umd.js +1 -0
- package/{esm/components → components}/link/link.js +0 -0
- package/{esm/components → components}/list/list.js +0 -0
- package/{esm/components → components}/list-index/list-index-class.js +113 -121
- package/components/list-index/list-index-rtl.css +1 -1
- package/components/list-index/list-index.css +1 -1
- package/components/list-index/list-index.js +73 -1
- package/components/list-index/list-index.umd.js +1 -0
- package/components/login-screen/login-screen-class.js +43 -0
- package/components/login-screen/login-screen-rtl.css +1 -1
- package/components/login-screen/login-screen.css +1 -1
- package/components/login-screen/login-screen.js +28 -1
- package/components/login-screen/login-screen.less +1 -1
- package/components/login-screen/login-screen.umd.js +1 -0
- package/components/menu/menu.js +79 -1
- package/components/menu/menu.umd.js +1 -0
- package/{esm/components → components}/messagebar/messagebar-class.js +124 -152
- package/components/messagebar/messagebar-rtl.css +1 -1
- package/components/messagebar/messagebar.css +1 -1
- package/components/messagebar/messagebar.js +74 -1
- package/components/messagebar/messagebar.umd.js +1 -0
- package/{esm/components → components}/messages/messages-class.js +162 -242
- package/components/messages/messages-rtl.css +1 -1
- package/components/messages/messages.css +1 -1
- package/components/messages/messages.js +73 -1
- package/components/messages/messages.umd.js +1 -0
- package/{esm/components → components}/modal/custom-modal-class.js +16 -29
- package/{esm/components → components}/modal/modal-class.js +68 -83
- package/{esm/components → components}/modal/modal.js +8 -5
- package/{esm/components → components}/navbar/navbar.js +166 -171
- package/components/notification/notification-aurora.less +1 -1
- package/{esm/components → components}/notification/notification-class.js +65 -78
- package/components/notification/notification-ios.less +1 -1
- package/components/notification/notification-rtl.css +1 -1
- package/components/notification/notification.css +1 -1
- package/components/notification/notification.js +35 -1
- package/components/notification/notification.umd.js +1 -0
- package/components/page/page-vars.less +1 -1
- package/{esm/components → components}/page/page.js +0 -0
- package/{esm/components → components}/panel/panel-class.js +183 -214
- package/components/panel/panel-rtl.css +1 -1
- package/components/panel/panel.css +1 -1
- package/components/panel/panel.js +190 -1
- package/components/panel/panel.umd.js +1 -0
- package/{esm/components → components}/panel/resizable-panel.js +30 -28
- package/{esm/components → components}/panel/swipe-panel.js +46 -44
- package/{esm/components → components}/photo-browser/photo-browser-class.js +206 -234
- package/components/photo-browser/photo-browser.js +73 -1
- package/components/photo-browser/photo-browser.umd.js +1 -0
- package/{esm/components → components}/picker/picker-class.js +233 -233
- package/{esm/components → components}/picker/picker-column.js +70 -72
- package/components/picker/picker-rtl.css +1 -1
- package/components/picker/picker.css +1 -1
- package/components/picker/picker.js +64 -1
- package/components/picker/picker.umd.js +1 -0
- package/components/pie-chart/pie-chart-class.js +264 -0
- package/components/pie-chart/pie-chart.js +35 -1
- package/components/pie-chart/pie-chart.umd.js +1 -0
- package/{esm/components → components}/popover/popover-class.js +72 -97
- package/components/popover/popover-rtl.css +1 -1
- package/components/popover/popover.css +1 -1
- package/components/popover/popover.js +76 -1
- package/components/popover/popover.umd.js +1 -0
- package/{esm/components → components}/popup/popup-class.js +66 -81
- package/components/popup/popup-rtl.css +1 -1
- package/components/popup/popup.css +1 -1
- package/components/popup/popup.js +41 -1
- package/components/popup/popup.less +21 -21
- package/components/popup/popup.umd.js +1 -0
- package/components/preloader/preloader.js +115 -1
- package/components/preloader/preloader.umd.js +1 -0
- package/components/progressbar/progressbar-rtl.css +1 -1
- package/components/progressbar/progressbar.css +1 -1
- package/components/progressbar/progressbar.js +166 -1
- package/components/progressbar/progressbar.umd.js +1 -0
- package/{esm/components → components}/pull-to-refresh/pull-to-refresh-class.js +101 -118
- package/components/pull-to-refresh/pull-to-refresh.js +70 -1
- package/components/pull-to-refresh/pull-to-refresh.umd.js +1 -0
- package/components/radio/radio-rtl.css +1 -1
- package/components/radio/radio.css +1 -1
- package/components/radio/radio.js +3 -1
- package/components/radio/radio.umd.js +1 -0
- package/{esm/components → components}/range/range-class.js +191 -192
- package/components/range/range-rtl.css +1 -1
- package/components/range/range.css +1 -1
- package/components/range/range.js +79 -1
- package/components/range/range.umd.js +1 -0
- package/components/searchbar/remove-diacritics.js +275 -0
- package/{esm/components → components}/searchbar/searchbar-class.js +129 -146
- package/components/searchbar/searchbar-rtl.css +1 -1
- package/components/searchbar/searchbar.css +1 -1
- package/components/searchbar/searchbar.js +121 -1
- package/components/searchbar/searchbar.less +1 -1
- package/components/searchbar/searchbar.umd.js +1 -0
- package/{esm/components → components}/sheet/sheet-class.js +87 -106
- package/components/sheet/sheet-rtl.css +1 -1
- package/components/sheet/sheet.css +1 -1
- package/components/sheet/sheet.js +68 -1
- package/components/sheet/sheet.less +16 -16
- package/components/sheet/sheet.umd.js +1 -0
- package/components/skeleton/skeleton-rtl.css +1 -1
- package/components/skeleton/skeleton-vars.less +1 -1
- package/components/skeleton/skeleton.css +1 -1
- package/components/skeleton/skeleton.js +3 -1
- package/components/skeleton/skeleton.less +1 -1
- package/components/skeleton/skeleton.umd.js +1 -0
- package/{esm/components → components}/smart-select/smart-select-class.js +284 -296
- package/components/smart-select/smart-select.js +149 -1
- package/components/smart-select/smart-select.umd.js +1 -0
- package/components/sortable/sortable-rtl.css +1 -1
- package/components/sortable/sortable.css +1 -1
- package/components/sortable/sortable.js +293 -1
- package/components/sortable/sortable.umd.js +1 -0
- package/{esm/components → components}/statusbar/statusbar.js +48 -41
- package/{esm/components → components}/stepper/stepper-class.js +104 -115
- package/components/stepper/stepper-rtl.css +1 -1
- package/components/stepper/stepper.css +1 -1
- package/components/stepper/stepper.js +86 -1
- package/components/stepper/stepper.umd.js +1 -0
- package/{esm/components → components}/subnavbar/subnavbar.js +3 -2
- package/components/swipeout/swipeout-rtl.css +1 -1
- package/components/swipeout/swipeout.css +1 -1
- package/components/swipeout/swipeout.js +597 -1
- package/components/swipeout/swipeout.umd.js +1 -0
- package/components/swiper/swiper-rtl.css +1 -1
- package/components/swiper/swiper.css +1 -1
- package/components/swiper/swiper.js +191 -1
- package/components/swiper/swiper.less +1 -1
- package/components/swiper/swiper.umd.js +1 -0
- package/components/tabs/tabs.js +272 -1
- package/components/tabs/tabs.umd.js +1 -0
- package/{esm/components → components}/text-editor/text-editor-class.js +170 -182
- package/components/text-editor/text-editor-rtl.css +1 -1
- package/components/text-editor/text-editor.css +1 -1
- package/components/text-editor/text-editor.js +89 -1
- package/components/text-editor/text-editor.umd.js +1 -0
- package/components/timeline/timeline-rtl.css +1 -1
- package/components/timeline/timeline.css +1 -1
- package/components/timeline/timeline.js +3 -1
- package/components/timeline/timeline.umd.js +1 -0
- package/components/toast/toast-class.js +119 -0
- package/components/toast/toast.js +43 -1
- package/components/toast/toast.umd.js +1 -0
- package/{esm/components → components}/toggle/toggle-class.js +46 -63
- package/components/toggle/toggle-rtl.css +1 -1
- package/components/toggle/toggle.css +1 -1
- package/components/toggle/toggle.js +65 -1
- package/components/toggle/toggle.umd.js +1 -0
- package/{esm/components → components}/toolbar/toolbar.js +63 -59
- package/{esm/components → components}/tooltip/tooltip-class.js +95 -106
- package/components/tooltip/tooltip.js +144 -1
- package/components/tooltip/tooltip.umd.js +1 -0
- package/components/touch-ripple/touch-ripple-class.js +98 -0
- package/components/touch-ripple/touch-ripple-vars.less +1 -1
- package/components/touch-ripple/touch-ripple.js +18 -0
- package/components/treeview/treeview-rtl.css +1 -1
- package/components/treeview/treeview.css +1 -1
- package/components/treeview/treeview.js +83 -1
- package/components/treeview/treeview.umd.js +1 -0
- package/components/typography/typography.js +3 -1
- package/components/typography/typography.umd.js +1 -0
- package/{esm/components → components}/view/resizable-view.js +23 -21
- package/{esm/components → components}/view/view-class.js +48 -67
- package/{esm/components → components}/view/view.js +37 -28
- package/{esm/components → components}/virtual-list/virtual-list-class.js +153 -170
- package/components/virtual-list/virtual-list.js +19 -1
- package/components/virtual-list/virtual-list.umd.js +1 -0
- package/framework7-bundle-rtl.css +268 -852
- package/framework7-bundle-rtl.min.css +3 -3
- package/framework7-bundle.css +268 -852
- package/{esm/framework7-bundle.js → framework7-bundle.esm.js} +2 -2
- package/framework7-bundle.js +30782 -31429
- package/framework7-bundle.js.map +1 -1
- package/framework7-bundle.less +2 -2
- package/framework7-bundle.min.css +3 -3
- package/framework7-bundle.min.js +3 -3
- package/framework7-bundle.min.js.map +1 -1
- package/{esm/framework7-lite-bundle.js → framework7-lite-bundle.esm.js} +2 -2
- package/{esm/framework7-lite.js → framework7-lite.esm.js} +2 -2
- package/framework7-rtl.css +52 -56
- package/framework7-rtl.min.css +3 -3
- package/{types/types.d.ts → framework7-types.d.ts} +0 -0
- package/framework7.css +52 -56
- package/framework7.d.ts +81 -81
- package/{esm/framework7.js → framework7.esm.js} +2 -2
- package/framework7.js +3386 -4049
- package/framework7.js.map +1 -1
- package/framework7.less +2 -2
- package/framework7.min.css +3 -3
- package/framework7.min.js +3 -3
- package/framework7.min.js.map +1 -1
- package/less/mixins.less +2 -2
- package/{esm/modules → modules}/clicks/clicks.js +17 -16
- package/modules/component/$h.js +14 -0
- package/modules/component/$jsx.js +18 -0
- package/modules/component/component-class.js +382 -0
- package/modules/component/component.d.ts +2 -0
- package/{esm/modules → modules}/component/component.js +23 -17
- package/{esm/modules → modules}/component/custom-components.js +0 -0
- package/{esm/modules → modules}/component/eventslisteners.js +14 -18
- package/modules/component/parse-component.js +80 -0
- package/{esm/modules → modules}/component/patch.js +1 -1
- package/{esm/modules → modules}/component/snabbdom/h.js +0 -0
- package/{esm/modules → modules}/component/snabbdom/helpers/attachto.js +0 -0
- package/{esm/modules → modules}/component/snabbdom/hooks.js +0 -0
- package/{esm/modules → modules}/component/snabbdom/htmldomapi.js +0 -0
- package/{esm/modules → modules}/component/snabbdom/is.js +0 -0
- package/{esm/modules → modules}/component/snabbdom/modules/attributes.js +0 -0
- package/{esm/modules → modules}/component/snabbdom/modules/class.js +0 -0
- package/{esm/modules → modules}/component/snabbdom/modules/dataset.js +0 -0
- package/{esm/modules → modules}/component/snabbdom/modules/eventlisteners.js +0 -0
- package/{esm/modules → modules}/component/snabbdom/modules/hero.js +1 -1
- package/{esm/modules → modules}/component/snabbdom/modules/module.js +0 -0
- package/{esm/modules → modules}/component/snabbdom/modules/props.js +0 -0
- package/{esm/modules → modules}/component/snabbdom/modules/style.js +1 -1
- package/{esm/modules → modules}/component/snabbdom/snabbdom.bundle.js +0 -0
- package/{esm/modules → modules}/component/snabbdom/snabbdom.js +6 -18
- package/{esm/modules → modules}/component/snabbdom/thunk.js +0 -0
- package/{esm/modules → modules}/component/snabbdom/tovnode.js +0 -0
- package/{esm/modules → modules}/component/snabbdom/vnode.js +0 -0
- package/{esm/modules → modules}/component/vdom.js +106 -130
- package/{esm/modules → modules}/demo-module.js +15 -7
- package/{esm/modules → modules}/device/device.js +12 -11
- package/{esm/modules → modules}/history/history.js +2 -1
- package/{esm/modules → modules}/request/request.js +2 -2
- package/modules/resize/resize.js +65 -0
- package/{esm/modules → modules}/router/app-router-check.js +1 -1
- package/{esm/modules → modules}/router/async-component.js +3 -3
- package/{esm/modules → modules}/router/back.js +117 -117
- package/{esm/modules → modules}/router/clear-previous-history.js +8 -8
- package/modules/router/component-loader.js +174 -0
- package/{esm/modules → modules}/router/modal.js +49 -49
- package/{esm/modules → modules}/router/navigate.js +140 -221
- package/{esm/modules → modules}/router/process-route-queue.js +20 -17
- package/{esm/modules → modules}/router/redirect.js +7 -11
- package/{esm/modules → modules}/router/router-class.js +411 -432
- package/{esm/modules → modules}/router/router.js +5 -3
- package/{esm/modules → modules}/router/swipe-back.js +143 -177
- package/{esm/modules → modules}/router/tab.js +46 -46
- package/{esm/modules → modules}/service-worker/service-worker.js +41 -37
- package/modules/store/create-store.js +149 -0
- package/{esm/modules → modules}/store/store.js +2 -2
- package/{esm/modules → modules}/support/support.js +1 -1
- package/{esm/modules → modules}/touch/touch.js +71 -70
- package/{esm/modules → modules}/utils/utils.js +2 -2
- package/package.json +252 -11
- package/shared/$jsx.js +22 -0
- package/shared/class.js +143 -0
- package/shared/constructor-methods.js +42 -0
- package/{esm/shared → shared}/dom7.js +2 -1
- package/shared/events-class.js +100 -0
- package/{types/shared → shared}/get-device.d.ts +0 -0
- package/{esm/shared → shared}/get-device.js +32 -37
- package/{types/shared → shared}/get-support.d.ts +0 -0
- package/{esm/shared → shared}/get-support.js +7 -6
- package/{esm/shared → shared}/history.js +61 -47
- package/shared/modal-methods.js +90 -0
- package/{types/shared → shared}/request.d.ts +0 -0
- package/shared/request.js +474 -0
- package/{types/shared → shared}/utils.d.ts +0 -0
- package/{esm/shared → shared}/utils.js +125 -162
- package/bundle/package.json +0 -8
- package/cjs/components/accordion/accordion.js +0 -136
- package/cjs/components/actions/actions-class.js +0 -383
- package/cjs/components/actions/actions.js +0 -58
- package/cjs/components/app/app-class.js +0 -378
- package/cjs/components/app/load-module.js +0 -155
- package/cjs/components/appbar/appbar.js +0 -8
- package/cjs/components/area-chart/area-chart-class.js +0 -526
- package/cjs/components/area-chart/area-chart.js +0 -56
- package/cjs/components/autocomplete/autocomplete-class.js +0 -975
- package/cjs/components/autocomplete/autocomplete.js +0 -93
- package/cjs/components/badge/badge.js +0 -8
- package/cjs/components/block/block.js +0 -8
- package/cjs/components/button/button.js +0 -8
- package/cjs/components/calendar/calendar-class.js +0 -2078
- package/cjs/components/calendar/calendar.js +0 -124
- package/cjs/components/card/card.js +0 -625
- package/cjs/components/checkbox/checkbox.js +0 -8
- package/cjs/components/chip/chip.js +0 -8
- package/cjs/components/color-picker/color-picker-class.js +0 -1022
- package/cjs/components/color-picker/color-picker.js +0 -105
- package/cjs/components/color-picker/modules/alpha-slider.js +0 -101
- package/cjs/components/color-picker/modules/brightness-slider.js +0 -86
- package/cjs/components/color-picker/modules/current-color.js +0 -23
- package/cjs/components/color-picker/modules/hex.js +0 -81
- package/cjs/components/color-picker/modules/hs-spectrum.js +0 -137
- package/cjs/components/color-picker/modules/hsb-sliders.js +0 -206
- package/cjs/components/color-picker/modules/hue-slider.js +0 -78
- package/cjs/components/color-picker/modules/initial-current-colors.js +0 -54
- package/cjs/components/color-picker/modules/palette.js +0 -61
- package/cjs/components/color-picker/modules/rgb-bars.js +0 -196
- package/cjs/components/color-picker/modules/rgb-sliders.js +0 -198
- package/cjs/components/color-picker/modules/sb-spectrum.js +0 -137
- package/cjs/components/color-picker/modules/wheel.js +0 -198
- package/cjs/components/contacts-list/contacts-list.js +0 -8
- package/cjs/components/data-table/data-table-class.js +0 -188
- package/cjs/components/data-table/data-table.js +0 -75
- package/cjs/components/dialog/dialog-class.js +0 -250
- package/cjs/components/dialog/dialog.js +0 -297
- package/cjs/components/elevation/elevation.js +0 -8
- package/cjs/components/fab/fab.js +0 -195
- package/cjs/components/form/form.js +0 -341
- package/cjs/components/gauge/gauge-class.js +0 -332
- package/cjs/components/gauge/gauge.js +0 -103
- package/cjs/components/grid/grid.js +0 -233
- package/cjs/components/icon/icon.js +0 -8
- package/cjs/components/infinite-scroll/infinite-scroll.js +0 -111
- package/cjs/components/input/input.js +0 -396
- package/cjs/components/lazy/lazy.js +0 -283
- package/cjs/components/link/link.js +0 -8
- package/cjs/components/list/list.js +0 -8
- package/cjs/components/list-index/list-index-class.js +0 -405
- package/cjs/components/list-index/list-index.js +0 -77
- package/cjs/components/login-screen/login-screen-class.js +0 -68
- package/cjs/components/login-screen/login-screen.js +0 -44
- package/cjs/components/menu/menu.js +0 -92
- package/cjs/components/messagebar/messagebar-class.js +0 -446
- package/cjs/components/messagebar/messagebar.js +0 -78
- package/cjs/components/messages/messages-class.js +0 -633
- package/cjs/components/messages/messages.js +0 -76
- package/cjs/components/modal/custom-modal-class.js +0 -99
- package/cjs/components/modal/modal-class.js +0 -277
- package/cjs/components/modal/modal.js +0 -32
- package/cjs/components/navbar/navbar.js +0 -833
- package/cjs/components/notification/notification-class.js +0 -269
- package/cjs/components/notification/notification.js +0 -44
- package/cjs/components/page/page.js +0 -8
- package/cjs/components/panel/panel-class.js +0 -660
- package/cjs/components/panel/panel.js +0 -219
- package/cjs/components/panel/resizable-panel.js +0 -197
- package/cjs/components/panel/swipe-panel.js +0 -363
- package/cjs/components/photo-browser/photo-browser-class.js +0 -781
- package/cjs/components/photo-browser/photo-browser.js +0 -78
- package/cjs/components/picker/picker-class.js +0 -704
- package/cjs/components/picker/picker-column.js +0 -389
- package/cjs/components/picker/picker.js +0 -77
- package/cjs/components/pie-chart/pie-chart-class.js +0 -290
- package/cjs/components/pie-chart/pie-chart.js +0 -44
- package/cjs/components/popover/popover-class.js +0 -365
- package/cjs/components/popover/popover.js +0 -93
- package/cjs/components/popup/popup-class.js +0 -416
- package/cjs/components/popup/popup.js +0 -57
- package/cjs/components/preloader/preloader.js +0 -111
- package/cjs/components/progressbar/progressbar.js +0 -185
- package/cjs/components/pull-to-refresh/pull-to-refresh-class.js +0 -627
- package/cjs/components/pull-to-refresh/pull-to-refresh.js +0 -74
- package/cjs/components/radio/radio.js +0 -8
- package/cjs/components/range/range-class.js +0 -674
- package/cjs/components/range/range.js +0 -93
- package/cjs/components/searchbar/remove-diacritics.js +0 -283
- package/cjs/components/searchbar/searchbar-class.js +0 -739
- package/cjs/components/searchbar/searchbar.js +0 -141
- package/cjs/components/sheet/sheet-class.js +0 -583
- package/cjs/components/sheet/sheet.js +0 -83
- package/cjs/components/skeleton/skeleton.js +0 -8
- package/cjs/components/smart-select/smart-select-class.js +0 -1005
- package/cjs/components/smart-select/smart-select.js +0 -151
- package/cjs/components/sortable/sortable.js +0 -322
- package/cjs/components/statusbar/statusbar.js +0 -226
- package/cjs/components/stepper/stepper-class.js +0 -497
- package/cjs/components/stepper/stepper.js +0 -96
- package/cjs/components/subnavbar/subnavbar.js +0 -28
- package/cjs/components/swipeout/swipeout.js +0 -618
- package/cjs/components/swiper/swiper.js +0 -189
- package/cjs/components/tabs/tabs.js +0 -296
- package/cjs/components/text-editor/text-editor-class.js +0 -627
- package/cjs/components/text-editor/text-editor.js +0 -93
- package/cjs/components/timeline/timeline.js +0 -8
- package/cjs/components/toast/toast-class.js +0 -142
- package/cjs/components/toast/toast.js +0 -51
- package/cjs/components/toggle/toggle-class.js +0 -213
- package/cjs/components/toggle/toggle.js +0 -72
- package/cjs/components/toolbar/toolbar.js +0 -234
- package/cjs/components/tooltip/tooltip-class.js +0 -409
- package/cjs/components/tooltip/tooltip.js +0 -146
- package/cjs/components/touch-ripple/touch-ripple-class.js +0 -110
- package/cjs/components/touch-ripple/touch-ripple.js +0 -34
- package/cjs/components/treeview/treeview.js +0 -88
- package/cjs/components/typography/typography.js +0 -8
- package/cjs/components/view/resizable-view.js +0 -155
- package/cjs/components/view/view-class.js +0 -251
- package/cjs/components/view/view.js +0 -196
- package/cjs/components/virtual-list/virtual-list-class.js +0 -654
- package/cjs/components/virtual-list/virtual-list.js +0 -27
- package/cjs/framework7-bundle.js +0 -208
- package/cjs/framework7-lite-bundle.js +0 -191
- package/cjs/framework7-lite.js +0 -87
- package/cjs/framework7.js +0 -98
- package/cjs/modules/clicks/clicks.js +0 -115
- package/cjs/modules/component/$h.js +0 -31
- package/cjs/modules/component/$jsx.js +0 -31
- package/cjs/modules/component/component-class.js +0 -415
- package/cjs/modules/component/component.js +0 -58
- package/cjs/modules/component/custom-components.js +0 -6
- package/cjs/modules/component/eventslisteners.js +0 -90
- package/cjs/modules/component/parse-component.js +0 -80
- package/cjs/modules/component/patch.js +0 -21
- package/cjs/modules/component/snabbdom/h.js +0 -72
- package/cjs/modules/component/snabbdom/helpers/attachto.js +0 -62
- package/cjs/modules/component/snabbdom/hooks.js +0 -1
- package/cjs/modules/component/snabbdom/htmldomapi.js +0 -90
- package/cjs/modules/component/snabbdom/is.js +0 -11
- package/cjs/modules/component/snabbdom/modules/attributes.js +0 -61
- package/cjs/modules/component/snabbdom/modules/class.js +0 -38
- package/cjs/modules/component/snabbdom/modules/dataset.js +0 -47
- package/cjs/modules/component/snabbdom/modules/eventlisteners.js +0 -106
- package/cjs/modules/component/snabbdom/modules/hero.js +0 -193
- package/cjs/modules/component/snabbdom/modules/module.js +0 -1
- package/cjs/modules/component/snabbdom/modules/props.js +0 -40
- package/cjs/modules/component/snabbdom/modules/style.js +0 -116
- package/cjs/modules/component/snabbdom/snabbdom.bundle.js +0 -33
- package/cjs/modules/component/snabbdom/snabbdom.js +0 -374
- package/cjs/modules/component/snabbdom/thunk.js +0 -66
- package/cjs/modules/component/snabbdom/tovnode.js +0 -57
- package/cjs/modules/component/snabbdom/vnode.js +0 -20
- package/cjs/modules/component/vdom.js +0 -393
- package/cjs/modules/demo-module.js +0 -49
- package/cjs/modules/device/device.js +0 -56
- package/cjs/modules/history/history.js +0 -21
- package/cjs/modules/request/request.js +0 -20
- package/cjs/modules/resize/resize.js +0 -72
- package/cjs/modules/router/app-router-check.js +0 -10
- package/cjs/modules/router/async-component.js +0 -33
- package/cjs/modules/router/back.js +0 -899
- package/cjs/modules/router/clear-previous-history.js +0 -50
- package/cjs/modules/router/component-loader.js +0 -140
- package/cjs/modules/router/modal.js +0 -254
- package/cjs/modules/router/navigate.js +0 -1054
- package/cjs/modules/router/process-route-queue.js +0 -80
- package/cjs/modules/router/redirect.js +0 -52
- package/cjs/modules/router/router-class.js +0 -1500
- package/cjs/modules/router/router.js +0 -36
- package/cjs/modules/router/swipe-back.js +0 -735
- package/cjs/modules/router/tab.js +0 -264
- package/cjs/modules/service-worker/service-worker.js +0 -101
- package/cjs/modules/store/create-store.js +0 -169
- package/cjs/modules/store/store.js +0 -21
- package/cjs/modules/support/support.js +0 -14
- package/cjs/modules/touch/touch.js +0 -585
- package/cjs/modules/utils/utils.js +0 -21
- package/cjs/shared/$jsx.js +0 -39
- package/cjs/shared/class.js +0 -206
- package/cjs/shared/constructor-methods.js +0 -73
- package/cjs/shared/dom7.js +0 -17
- package/cjs/shared/events-class.js +0 -125
- package/cjs/shared/get-device.js +0 -157
- package/cjs/shared/get-support.js +0 -44
- package/cjs/shared/history.js +0 -185
- package/cjs/shared/modal-methods.js +0 -105
- package/cjs/shared/request.js +0 -552
- package/cjs/shared/utils.js +0 -472
- package/components/accordion/package.json +0 -9
- package/components/actions/package.json +0 -9
- package/components/app/package.json +0 -9
- package/components/appbar/package.json +0 -9
- package/components/area-chart/package.json +0 -9
- package/components/autocomplete/package.json +0 -9
- package/components/badge/package.json +0 -9
- package/components/block/package.json +0 -9
- package/components/button/package.json +0 -9
- package/components/calendar/package.json +0 -9
- package/components/card/package.json +0 -9
- package/components/checkbox/package.json +0 -9
- package/components/chip/package.json +0 -9
- package/components/color-picker/package.json +0 -9
- package/components/contacts-list/package.json +0 -9
- package/components/data-table/package.json +0 -9
- package/components/dialog/package.json +0 -9
- package/components/elevation/package.json +0 -9
- package/components/fab/package.json +0 -9
- package/components/form/package.json +0 -9
- package/components/gauge/package.json +0 -9
- package/components/grid/package.json +0 -9
- package/components/icon/package.json +0 -9
- package/components/infinite-scroll/package.json +0 -9
- package/components/input/package.json +0 -9
- package/components/lazy/package.json +0 -9
- package/components/link/package.json +0 -9
- package/components/list/package.json +0 -9
- package/components/list-index/package.json +0 -9
- package/components/login-screen/package.json +0 -9
- package/components/menu/package.json +0 -9
- package/components/messagebar/package.json +0 -9
- package/components/messages/package.json +0 -9
- package/components/modal/package.json +0 -9
- package/components/navbar/package.json +0 -9
- package/components/notification/package.json +0 -9
- package/components/page/package.json +0 -9
- package/components/panel/package.json +0 -9
- package/components/photo-browser/package.json +0 -9
- package/components/picker/package.json +0 -9
- package/components/pie-chart/package.json +0 -9
- package/components/popover/package.json +0 -9
- package/components/popup/package.json +0 -9
- package/components/preloader/package.json +0 -9
- package/components/progressbar/package.json +0 -9
- package/components/pull-to-refresh/package.json +0 -9
- package/components/radio/package.json +0 -9
- package/components/range/package.json +0 -9
- package/components/searchbar/package.json +0 -9
- package/components/sheet/package.json +0 -9
- package/components/skeleton/package.json +0 -9
- package/components/smart-select/package.json +0 -9
- package/components/sortable/package.json +0 -9
- package/components/statusbar/package.json +0 -9
- package/components/stepper/package.json +0 -9
- package/components/subnavbar/package.json +0 -9
- package/components/swipeout/package.json +0 -9
- package/components/swiper/package.json +0 -9
- package/components/tabs/package.json +0 -9
- package/components/text-editor/package.json +0 -9
- package/components/timeline/package.json +0 -9
- package/components/toast/package.json +0 -9
- package/components/toggle/package.json +0 -9
- package/components/toolbar/package.json +0 -9
- package/components/tooltip/package.json +0 -9
- package/components/touch-ripple/package.json +0 -9
- package/components/treeview/package.json +0 -9
- package/components/typography/package.json +0 -9
- package/components/view/package.json +0 -9
- package/components/virtual-list/package.json +0 -9
- package/core/package.json +0 -8
- package/esm/components/accordion/accordion.js +0 -126
- package/esm/components/actions/actions-class.js +0 -373
- package/esm/components/actions/actions.js +0 -48
- package/esm/components/appbar/appbar.js +0 -3
- package/esm/components/area-chart/area-chart-class.js +0 -517
- package/esm/components/area-chart/area-chart.js +0 -45
- package/esm/components/autocomplete/autocomplete.js +0 -82
- package/esm/components/calendar/calendar.js +0 -113
- package/esm/components/card/card.js +0 -612
- package/esm/components/checkbox/checkbox.js +0 -3
- package/esm/components/chip/chip.js +0 -3
- package/esm/components/color-picker/color-picker.js +0 -94
- package/esm/components/contacts-list/contacts-list.js +0 -3
- package/esm/components/data-table/data-table.js +0 -64
- package/esm/components/dialog/dialog.js +0 -286
- package/esm/components/elevation/elevation.js +0 -3
- package/esm/components/fab/fab.js +0 -185
- package/esm/components/form/form.js +0 -330
- package/esm/components/gauge/gauge-class.js +0 -323
- package/esm/components/gauge/gauge.js +0 -91
- package/esm/components/grid/grid.js +0 -223
- package/esm/components/infinite-scroll/infinite-scroll.js +0 -101
- package/esm/components/input/input.js +0 -384
- package/esm/components/lazy/lazy.js +0 -271
- package/esm/components/list-index/list-index.js +0 -65
- package/esm/components/login-screen/login-screen-class.js +0 -58
- package/esm/components/login-screen/login-screen.js +0 -34
- package/esm/components/menu/menu.js +0 -82
- package/esm/components/messagebar/messagebar.js +0 -66
- package/esm/components/messages/messages.js +0 -65
- package/esm/components/notification/notification.js +0 -33
- package/esm/components/panel/panel.js +0 -208
- package/esm/components/photo-browser/photo-browser.js +0 -68
- package/esm/components/picker/picker.js +0 -66
- package/esm/components/pie-chart/pie-chart-class.js +0 -281
- package/esm/components/pie-chart/pie-chart.js +0 -33
- package/esm/components/popover/popover.js +0 -81
- package/esm/components/popup/popup.js +0 -47
- package/esm/components/preloader/preloader.js +0 -101
- package/esm/components/progressbar/progressbar.js +0 -175
- package/esm/components/pull-to-refresh/pull-to-refresh.js +0 -62
- package/esm/components/radio/radio.js +0 -3
- package/esm/components/range/range.js +0 -81
- package/esm/components/searchbar/remove-diacritics.js +0 -277
- package/esm/components/searchbar/searchbar.js +0 -129
- package/esm/components/sheet/sheet.js +0 -71
- package/esm/components/skeleton/skeleton.js +0 -3
- package/esm/components/smart-select/smart-select.js +0 -139
- package/esm/components/sortable/sortable.js +0 -310
- package/esm/components/stepper/stepper.js +0 -84
- package/esm/components/swipeout/swipeout.js +0 -606
- package/esm/components/swiper/swiper.js +0 -177
- package/esm/components/tabs/tabs.js +0 -286
- package/esm/components/text-editor/text-editor.js +0 -81
- package/esm/components/timeline/timeline.js +0 -3
- package/esm/components/toast/toast-class.js +0 -132
- package/esm/components/toast/toast.js +0 -40
- package/esm/components/toggle/toggle.js +0 -61
- package/esm/components/tooltip/tooltip.js +0 -135
- package/esm/components/touch-ripple/touch-ripple-class.js +0 -103
- package/esm/components/touch-ripple/touch-ripple.js +0 -25
- package/esm/components/treeview/treeview.js +0 -78
- package/esm/components/typography/typography.js +0 -3
- package/esm/components/virtual-list/virtual-list.js +0 -17
- package/esm/modules/component/$h.js +0 -20
- package/esm/modules/component/$jsx.js +0 -24
- package/esm/modules/component/component-class.js +0 -402
- package/esm/modules/component/parse-component.js +0 -70
- package/esm/modules/resize/resize.js +0 -64
- package/esm/modules/router/component-loader.js +0 -133
- package/esm/modules/store/create-store.js +0 -164
- package/esm/shared/$jsx.js +0 -33
- package/esm/shared/class.js +0 -197
- package/esm/shared/constructor-methods.js +0 -65
- package/esm/shared/events-class.js +0 -119
- package/esm/shared/modal-methods.js +0 -95
- package/esm/shared/request.js +0 -545
- package/lite/package.json +0 -8
- package/lite-bundle/package.json +0 -8
- package/modules/clicks/package.json +0 -9
- package/modules/component/package.json +0 -9
- package/modules/device/package.json +0 -9
- package/modules/history/package.json +0 -9
- package/modules/request/package.json +0 -9
- package/modules/resize/package.json +0 -9
- package/modules/router/package.json +0 -9
- package/modules/service-worker/package.json +0 -9
- package/modules/store/package.json +0 -9
- package/modules/support/package.json +0 -9
- package/modules/touch/package.json +0 -9
- package/modules/utils/package.json +0 -9
- package/types/components/accordion/accordion.d.ts +0 -55
- package/types/components/actions/actions.d.ts +0 -158
- package/types/components/app/app-class.d.ts +0 -196
- package/types/components/appbar/appbar.d.ts +0 -10
- package/types/components/area-chart/area-chart.d.ts +0 -124
- package/types/components/autocomplete/autocomplete.d.ts +0 -191
- package/types/components/badge/badge.d.ts +0 -10
- package/types/components/block/block.d.ts +0 -10
- package/types/components/button/button.d.ts +0 -10
- package/types/components/calendar/calendar.d.ts +0 -304
- package/types/components/card/card.d.ts +0 -65
- package/types/components/checkbox/checkbox.d.ts +0 -10
- package/types/components/chip/chip.d.ts +0 -10
- package/types/components/color-picker/color-picker.d.ts +0 -229
- package/types/components/contacts-list/contacts-list.d.ts +0 -10
- package/types/components/data-table/data-table.d.ts +0 -57
- package/types/components/dialog/dialog.d.ts +0 -241
- package/types/components/elevation/elevation.d.ts +0 -10
- package/types/components/fab/fab.d.ts +0 -28
- package/types/components/form/form.d.ts +0 -60
- package/types/components/gauge/gauge.d.ts +0 -96
- package/types/components/grid/grid.d.ts +0 -17
- package/types/components/icon/icon.d.ts +0 -10
- package/types/components/infinite-scroll/infinite-scroll.d.ts +0 -23
- package/types/components/input/input.d.ts +0 -56
- package/types/components/lazy/lazy.d.ts +0 -53
- package/types/components/link/link.d.ts +0 -10
- package/types/components/list/list.d.ts +0 -10
- package/types/components/list-index/list-index.d.ts +0 -99
- package/types/components/login-screen/login-screen.d.ts +0 -95
- package/types/components/menu/menu.d.ts +0 -28
- package/types/components/messagebar/messagebar.d.ts +0 -161
- package/types/components/messages/messages.d.ts +0 -158
- package/types/components/modal/modal.d.ts +0 -78
- package/types/components/navbar/navbar.d.ts +0 -75
- package/types/components/notification/notification.d.ts +0 -118
- package/types/components/page/page.d.ts +0 -10
- package/types/components/panel/panel.d.ts +0 -194
- package/types/components/photo-browser/photo-browser.d.ts +0 -194
- package/types/components/picker/picker.d.ts +0 -216
- package/types/components/pie-chart/pie-chart.d.ts +0 -95
- package/types/components/popover/popover.d.ts +0 -127
- package/types/components/popup/popup.d.ts +0 -135
- package/types/components/preloader/preloader.d.ts +0 -18
- package/types/components/progressbar/progressbar.d.ts +0 -27
- package/types/components/pull-to-refresh/pull-to-refresh.d.ts +0 -99
- package/types/components/radio/radio.d.ts +0 -10
- package/types/components/range/range.d.ts +0 -121
- package/types/components/searchbar/searchbar.d.ts +0 -157
- package/types/components/sheet/sheet.d.ts +0 -149
- package/types/components/skeleton/skeleton.d.ts +0 -10
- package/types/components/smart-select/smart-select.d.ts +0 -199
- package/types/components/sortable/sortable.d.ts +0 -46
- package/types/components/statusbar/statusbar.d.ts +0 -50
- package/types/components/stepper/stepper.d.ts +0 -117
- package/types/components/subnavbar/subnavbar.d.ts +0 -11
- package/types/components/swipeout/swipeout.d.ts +0 -68
- package/types/components/swiper/swiper.d.ts +0 -21
- package/types/components/tabs/tabs.d.ts +0 -39
- package/types/components/text-editor/text-editor.d.ts +0 -162
- package/types/components/timeline/timeline.d.ts +0 -10
- package/types/components/toast/toast.d.ts +0 -117
- package/types/components/toggle/toggle.d.ts +0 -69
- package/types/components/toolbar/toolbar.d.ts +0 -43
- package/types/components/tooltip/tooltip.d.ts +0 -101
- package/types/components/touch-ripple/touch-ripple.d.ts +0 -21
- package/types/components/treeview/treeview.d.ts +0 -38
- package/types/components/typography/typography.d.ts +0 -10
- package/types/components/view/view.d.ts +0 -205
- package/types/components/virtual-list/virtual-list.d.ts +0 -138
- package/types/modules/clicks/clicks.d.ts +0 -19
- package/types/modules/component/component.d.ts +0 -94
- package/types/modules/component/snabbdom/h.d.ts +0 -10
- package/types/modules/component/snabbdom/helpers/attachto.d.ts +0 -9
- package/types/modules/component/snabbdom/hooks.d.ts +0 -23
- package/types/modules/component/snabbdom/htmldomapi.d.ts +0 -19
- package/types/modules/component/snabbdom/is.d.ts +0 -2
- package/types/modules/component/snabbdom/modules/attributes.d.ts +0 -4
- package/types/modules/component/snabbdom/modules/class.d.ts +0 -4
- package/types/modules/component/snabbdom/modules/dataset.d.ts +0 -4
- package/types/modules/component/snabbdom/modules/eventlisteners.d.ts +0 -8
- package/types/modules/component/snabbdom/modules/hero.d.ts +0 -6
- package/types/modules/component/snabbdom/modules/module.d.ts +0 -9
- package/types/modules/component/snabbdom/modules/props.d.ts +0 -4
- package/types/modules/component/snabbdom/modules/style.d.ts +0 -7
- package/types/modules/component/snabbdom/snabbdom.bundle.d.ts +0 -5
- package/types/modules/component/snabbdom/snabbdom.d.ts +0 -6
- package/types/modules/component/snabbdom/thunk.d.ts +0 -14
- package/types/modules/component/snabbdom/tovnode.d.ts +0 -4
- package/types/modules/component/snabbdom/vnode.d.ts +0 -36
- package/types/modules/device/device.d.ts +0 -14
- package/types/modules/request/request.d.ts +0 -15
- package/types/modules/resize/resize.d.ts +0 -25
- package/types/modules/router/router.d.ts +0 -356
- package/types/modules/service-worker/service-worker.d.ts +0 -38
- package/types/modules/store/store.d.ts +0 -40
- package/types/modules/support/support.d.ts +0 -15
- package/types/modules/touch/touch.d.ts +0 -62
- package/types/modules/utils/utils.d.ts +0 -15
- package/types/package.json +0 -6
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
2
|
-
|
|
3
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
4
|
-
|
|
5
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
6
|
-
|
|
7
|
-
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
8
|
-
|
|
9
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
10
|
-
|
|
11
1
|
import { extend, nextTick, deleteProps } from '../../shared/utils';
|
|
12
2
|
import Framework7Class from '../../shared/class';
|
|
13
3
|
import $ from '../../shared/dom7';
|
|
@@ -17,53 +7,43 @@ import { getSupport } from '../../shared/get-support';
|
|
|
17
7
|
|
|
18
8
|
import $jsx from '../../shared/$jsx';
|
|
19
9
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var _this;
|
|
25
|
-
|
|
26
|
-
if (params === void 0) {
|
|
27
|
-
params = {};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
_this = _Framework7Class.call(this, params, [app]) || this;
|
|
31
|
-
|
|
32
|
-
var calendar = _assertThisInitialized(_this);
|
|
33
|
-
|
|
10
|
+
class Calendar extends Framework7Class {
|
|
11
|
+
constructor(app, params = {}) {
|
|
12
|
+
super(params, [app]);
|
|
13
|
+
const calendar = this;
|
|
34
14
|
calendar.params = extend({}, app.params.calendar, params);
|
|
35
|
-
|
|
15
|
+
let $containerEl;
|
|
36
16
|
|
|
37
17
|
if (calendar.params.containerEl) {
|
|
38
18
|
$containerEl = $(calendar.params.containerEl);
|
|
39
|
-
if ($containerEl.length === 0) return calendar
|
|
19
|
+
if ($containerEl.length === 0) return calendar;
|
|
40
20
|
}
|
|
41
21
|
|
|
42
|
-
|
|
22
|
+
let $inputEl;
|
|
43
23
|
|
|
44
24
|
if (calendar.params.inputEl) {
|
|
45
25
|
$inputEl = $(calendar.params.inputEl);
|
|
46
26
|
}
|
|
47
27
|
|
|
48
|
-
|
|
49
|
-
|
|
28
|
+
const isHorizontal = calendar.params.direction === 'horizontal';
|
|
29
|
+
let inverter = 1;
|
|
50
30
|
|
|
51
31
|
if (isHorizontal) {
|
|
52
32
|
inverter = app.rtl ? -1 : 1;
|
|
53
33
|
}
|
|
54
34
|
|
|
55
35
|
extend(calendar, {
|
|
56
|
-
app
|
|
57
|
-
$containerEl
|
|
36
|
+
app,
|
|
37
|
+
$containerEl,
|
|
58
38
|
containerEl: $containerEl && $containerEl[0],
|
|
59
39
|
inline: $containerEl && $containerEl.length > 0,
|
|
60
|
-
$inputEl
|
|
40
|
+
$inputEl,
|
|
61
41
|
inputEl: $inputEl && $inputEl[0],
|
|
62
42
|
initialized: false,
|
|
63
43
|
opened: false,
|
|
64
44
|
url: calendar.params.url,
|
|
65
|
-
isHorizontal
|
|
66
|
-
inverter
|
|
45
|
+
isHorizontal,
|
|
46
|
+
inverter,
|
|
67
47
|
animating: false,
|
|
68
48
|
allowTouchMove: true,
|
|
69
49
|
hasTimePicker: calendar.params.timePicker && !calendar.params.rangePicker && !calendar.params.multiple
|
|
@@ -78,30 +58,30 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
78
58
|
year: 'numeric'
|
|
79
59
|
});
|
|
80
60
|
calendar.timeSelectorFormatter = new Intl.DateTimeFormat(calendar.params.locale, calendar.params.timePickerFormat);
|
|
81
|
-
|
|
61
|
+
const timeFormatCheckDate = calendar.timeSelectorFormatter.format(new Date()).toLowerCase();
|
|
82
62
|
calendar.is12HoursFormat = timeFormatCheckDate.indexOf('pm') >= 0 || timeFormatCheckDate.indexOf('am') >= 0; // Auto names
|
|
83
63
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
64
|
+
let {
|
|
65
|
+
monthNames,
|
|
66
|
+
monthNamesShort,
|
|
67
|
+
dayNames,
|
|
68
|
+
dayNamesShort
|
|
69
|
+
} = calendar.params;
|
|
70
|
+
const {
|
|
71
|
+
monthNamesIntl,
|
|
72
|
+
monthNamesShortIntl,
|
|
73
|
+
dayNamesIntl,
|
|
74
|
+
dayNamesShortIntl
|
|
75
|
+
} = calendar.getIntlNames();
|
|
96
76
|
if (monthNames === 'auto') monthNames = monthNamesIntl;
|
|
97
77
|
if (monthNamesShort === 'auto') monthNamesShort = monthNamesShortIntl;
|
|
98
78
|
if (dayNames === 'auto') dayNames = dayNamesIntl;
|
|
99
79
|
if (dayNamesShort === 'auto') dayNamesShort = dayNamesShortIntl;
|
|
100
80
|
extend(calendar, {
|
|
101
|
-
monthNames
|
|
102
|
-
monthNamesShort
|
|
103
|
-
dayNames
|
|
104
|
-
dayNamesShort
|
|
81
|
+
monthNames,
|
|
82
|
+
monthNamesShort,
|
|
83
|
+
dayNames,
|
|
84
|
+
dayNamesShort
|
|
105
85
|
});
|
|
106
86
|
|
|
107
87
|
function onInputClick() {
|
|
@@ -121,7 +101,7 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
121
101
|
}
|
|
122
102
|
|
|
123
103
|
function onHtmlClick(e) {
|
|
124
|
-
|
|
104
|
+
const $targetEl = $(e.target);
|
|
125
105
|
if (calendar.destroyed || !calendar.params) return;
|
|
126
106
|
if (calendar.isPopover()) return;
|
|
127
107
|
if (!calendar.opened || calendar.closing) return;
|
|
@@ -138,7 +118,7 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
138
118
|
|
|
139
119
|
|
|
140
120
|
extend(calendar, {
|
|
141
|
-
attachInputEvents
|
|
121
|
+
attachInputEvents() {
|
|
142
122
|
calendar.$inputEl.on('click', onInputClick);
|
|
143
123
|
calendar.$inputEl.on('input:clear', onInputClear);
|
|
144
124
|
|
|
@@ -150,7 +130,8 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
150
130
|
}
|
|
151
131
|
}
|
|
152
132
|
},
|
|
153
|
-
|
|
133
|
+
|
|
134
|
+
detachInputEvents() {
|
|
154
135
|
calendar.$inputEl.off('click', onInputClick);
|
|
155
136
|
calendar.$inputEl.off('input:clear', onInputClear);
|
|
156
137
|
|
|
@@ -162,32 +143,37 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
162
143
|
}
|
|
163
144
|
}
|
|
164
145
|
},
|
|
165
|
-
|
|
146
|
+
|
|
147
|
+
attachHtmlEvents() {
|
|
166
148
|
app.on('click', onHtmlClick);
|
|
167
149
|
},
|
|
168
|
-
|
|
150
|
+
|
|
151
|
+
detachHtmlEvents() {
|
|
169
152
|
app.off('click', onHtmlClick);
|
|
170
153
|
}
|
|
154
|
+
|
|
171
155
|
});
|
|
172
156
|
|
|
173
157
|
calendar.attachCalendarEvents = function attachCalendarEvents() {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
158
|
+
let allowItemClick = true;
|
|
159
|
+
let isTouched;
|
|
160
|
+
let isMoved;
|
|
161
|
+
let touchStartX;
|
|
162
|
+
let touchStartY;
|
|
163
|
+
let touchCurrentX;
|
|
164
|
+
let touchCurrentY;
|
|
165
|
+
let touchStartTime;
|
|
166
|
+
let touchEndTime;
|
|
167
|
+
let currentTranslate;
|
|
168
|
+
let wrapperWidth;
|
|
169
|
+
let wrapperHeight;
|
|
170
|
+
let percentage;
|
|
171
|
+
let touchesDiff;
|
|
172
|
+
let isScrolling;
|
|
173
|
+
const {
|
|
174
|
+
$el,
|
|
175
|
+
$wrapperEl
|
|
176
|
+
} = calendar;
|
|
191
177
|
|
|
192
178
|
function handleTouchStart(e) {
|
|
193
179
|
if (isMoved || isTouched) return;
|
|
@@ -205,7 +191,9 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
205
191
|
|
|
206
192
|
function handleTouchMove(e) {
|
|
207
193
|
if (!isTouched) return;
|
|
208
|
-
|
|
194
|
+
const {
|
|
195
|
+
isHorizontal: isH
|
|
196
|
+
} = calendar;
|
|
209
197
|
touchCurrentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
|
|
210
198
|
touchCurrentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
|
|
211
199
|
|
|
@@ -239,7 +227,7 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
239
227
|
percentage = touchesDiff / (isH ? wrapperWidth : wrapperHeight);
|
|
240
228
|
currentTranslate = (calendar.monthsTranslate * calendar.inverter + percentage) * 100; // Transform wrapper
|
|
241
229
|
|
|
242
|
-
$wrapperEl.transform(
|
|
230
|
+
$wrapperEl.transform(`translate3d(${isH ? currentTranslate : 0}%, ${isH ? 0 : currentTranslate}%, 0)`);
|
|
243
231
|
}
|
|
244
232
|
|
|
245
233
|
function handleTouchEnd() {
|
|
@@ -268,14 +256,14 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
268
256
|
} // Allow click
|
|
269
257
|
|
|
270
258
|
|
|
271
|
-
setTimeout(
|
|
259
|
+
setTimeout(() => {
|
|
272
260
|
allowItemClick = true;
|
|
273
261
|
}, 100);
|
|
274
262
|
}
|
|
275
263
|
|
|
276
264
|
function handleDayClick(e) {
|
|
277
265
|
if (!allowItemClick) return;
|
|
278
|
-
|
|
266
|
+
let $dayEl = $(e.target).parents('.calendar-day');
|
|
279
267
|
|
|
280
268
|
if ($dayEl.length === 0 && $(e.target).hasClass('calendar-day')) {
|
|
281
269
|
$dayEl = $(e.target);
|
|
@@ -289,13 +277,13 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
289
277
|
if ($dayEl.hasClass('calendar-day-prev')) calendar.prevMonth();
|
|
290
278
|
}
|
|
291
279
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
280
|
+
const dateYear = parseInt($dayEl.attr('data-year'), 10);
|
|
281
|
+
const dateMonth = parseInt($dayEl.attr('data-month'), 10);
|
|
282
|
+
const dateDay = parseInt($dayEl.attr('data-day'), 10);
|
|
295
283
|
calendar.emit('local::dayClick calendarDayClick', calendar, $dayEl[0], dateYear, dateMonth, dateDay);
|
|
296
284
|
|
|
297
285
|
if (!$dayEl.hasClass('calendar-day-selected') || calendar.params.multiple || calendar.params.rangePicker) {
|
|
298
|
-
|
|
286
|
+
const valueToAdd = new Date(dateYear, dateMonth, dateDay, 0, 0, 0);
|
|
299
287
|
|
|
300
288
|
if (calendar.hasTimePicker) {
|
|
301
289
|
if (calendar.value && calendar.value[0]) {
|
|
@@ -336,7 +324,7 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
336
324
|
}
|
|
337
325
|
|
|
338
326
|
function onMonthSelectorItemClick() {
|
|
339
|
-
|
|
327
|
+
const $clickedEl = $(this);
|
|
340
328
|
|
|
341
329
|
if ($clickedEl.hasClass('calendar-month-picker-item-current')) {
|
|
342
330
|
$el.find('.calendar-month-picker').remove();
|
|
@@ -344,27 +332,27 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
344
332
|
}
|
|
345
333
|
|
|
346
334
|
$el.find('.calendar-month-picker-item-current').add($clickedEl).toggleClass('calendar-month-picker-item-current');
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
335
|
+
const index = $clickedEl.index();
|
|
336
|
+
const localeMonthIndex = parseInt(calendar.$el.find('.calendar-month-current').attr('data-locale-month'), 10);
|
|
337
|
+
const monthIndex = calendar.currentMonth;
|
|
338
|
+
const diff = localeMonthIndex - monthIndex;
|
|
339
|
+
const diffIndex = index - diff;
|
|
352
340
|
calendar.setYearMonth(calendar.currentYear, diffIndex, 0);
|
|
353
|
-
setTimeout(
|
|
341
|
+
setTimeout(() => {
|
|
354
342
|
$el.find('.calendar-month-picker').remove();
|
|
355
343
|
}, 200);
|
|
356
344
|
}
|
|
357
345
|
|
|
358
346
|
function onYearSelectorClick() {
|
|
359
347
|
$el.append(calendar.renderYearPicker());
|
|
360
|
-
|
|
361
|
-
|
|
348
|
+
const $currentEl = $el.find('.calendar-year-picker-item-current');
|
|
349
|
+
const $yearPickerEl = $el.find('.calendar-year-picker');
|
|
362
350
|
if (!$currentEl || !$currentEl.length) return;
|
|
363
351
|
$yearPickerEl.scrollTop($currentEl[0].offsetTop - $yearPickerEl[0].offsetHeight / 2 + $currentEl[0].offsetHeight / 2);
|
|
364
352
|
}
|
|
365
353
|
|
|
366
354
|
function onYearSelectorItemClick() {
|
|
367
|
-
|
|
355
|
+
const $clickedEl = $(this);
|
|
368
356
|
|
|
369
357
|
if ($clickedEl.hasClass('calendar-year-picker-item-current')) {
|
|
370
358
|
$el.find('.calendar-year-picker').remove();
|
|
@@ -372,9 +360,9 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
372
360
|
}
|
|
373
361
|
|
|
374
362
|
$el.find('.calendar-year-picker-item-current').add($clickedEl).toggleClass('calendar-year-picker-item-current');
|
|
375
|
-
|
|
363
|
+
const year = parseInt($clickedEl.attr('data-year'), 10);
|
|
376
364
|
calendar.setYearMonth(year, undefined, 0);
|
|
377
|
-
setTimeout(
|
|
365
|
+
setTimeout(() => {
|
|
378
366
|
$el.find('.calendar-year-picker').remove();
|
|
379
367
|
}, 200);
|
|
380
368
|
}
|
|
@@ -387,7 +375,7 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
387
375
|
calendar.closeTimePicker();
|
|
388
376
|
}
|
|
389
377
|
|
|
390
|
-
|
|
378
|
+
const passiveListener = app.touchEvents.start === 'touchstart' && getSupport().passiveListener ? {
|
|
391
379
|
passive: true,
|
|
392
380
|
capture: false
|
|
393
381
|
} : false; // Selectors clicks
|
|
@@ -453,37 +441,53 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
453
441
|
};
|
|
454
442
|
|
|
455
443
|
calendar.init();
|
|
456
|
-
return calendar
|
|
444
|
+
return calendar;
|
|
457
445
|
}
|
|
458
446
|
|
|
459
|
-
|
|
447
|
+
get view() {
|
|
448
|
+
const {
|
|
449
|
+
$inputEl,
|
|
450
|
+
app,
|
|
451
|
+
params
|
|
452
|
+
} = this;
|
|
453
|
+
let view;
|
|
454
|
+
|
|
455
|
+
if (params.view) {
|
|
456
|
+
view = params.view;
|
|
457
|
+
} else if ($inputEl) {
|
|
458
|
+
view = $inputEl.parents('.view').length && $inputEl.parents('.view')[0].f7View;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
if (!view) view = app.views.main;
|
|
462
|
+
return view;
|
|
463
|
+
}
|
|
460
464
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
465
|
+
getIntlNames() {
|
|
466
|
+
const calendar = this;
|
|
467
|
+
const locale = calendar.params.locale;
|
|
468
|
+
const monthNamesIntl = [];
|
|
469
|
+
const monthNamesShortIntl = [];
|
|
470
|
+
const dayNamesIntl = [];
|
|
471
|
+
const dayNamesShortIntl = [];
|
|
472
|
+
const formatterMonthNames = new Intl.DateTimeFormat(locale, {
|
|
469
473
|
month: 'long'
|
|
470
474
|
});
|
|
471
|
-
|
|
475
|
+
const formatterMonthNamesShort = new Intl.DateTimeFormat(locale, {
|
|
472
476
|
month: 'short'
|
|
473
477
|
});
|
|
474
|
-
|
|
478
|
+
const formatterDayNames = new Intl.DateTimeFormat(locale, {
|
|
475
479
|
weekday: 'long'
|
|
476
480
|
});
|
|
477
|
-
|
|
481
|
+
const formatterDayNamesShort = new Intl.DateTimeFormat(locale, {
|
|
478
482
|
weekday: 'short'
|
|
479
483
|
});
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
484
|
+
let year;
|
|
485
|
+
let yearStarted;
|
|
486
|
+
let yearEnded;
|
|
483
487
|
|
|
484
|
-
for (
|
|
485
|
-
|
|
486
|
-
|
|
488
|
+
for (let i = 0; i < 24; i += 1) {
|
|
489
|
+
const date = new Date().setMonth(i, 1);
|
|
490
|
+
const currentYear = calendar.yearFormatter.format(date);
|
|
487
491
|
|
|
488
492
|
if (year && currentYear !== year) {
|
|
489
493
|
if (yearStarted) yearEnded = true;
|
|
@@ -501,59 +505,58 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
501
505
|
}
|
|
502
506
|
}
|
|
503
507
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
for (var _i = 0; _i < 7; _i += 1) {
|
|
507
|
-
var _date = new Date().getTime() + (_i - weekDay) * 24 * 60 * 60 * 1000;
|
|
508
|
+
const weekDay = new Date().getDay();
|
|
508
509
|
|
|
509
|
-
|
|
510
|
-
|
|
510
|
+
for (let i = 0; i < 7; i += 1) {
|
|
511
|
+
const date = new Date().getTime() + (i - weekDay) * 24 * 60 * 60 * 1000;
|
|
512
|
+
dayNamesIntl.push(formatterDayNames.format(date));
|
|
513
|
+
dayNamesShortIntl.push(formatterDayNamesShort.format(date));
|
|
511
514
|
}
|
|
512
515
|
|
|
513
516
|
return {
|
|
514
|
-
monthNamesIntl
|
|
515
|
-
monthNamesShortIntl
|
|
516
|
-
dayNamesIntl
|
|
517
|
-
dayNamesShortIntl
|
|
517
|
+
monthNamesIntl,
|
|
518
|
+
monthNamesShortIntl,
|
|
519
|
+
dayNamesIntl,
|
|
520
|
+
dayNamesShortIntl
|
|
518
521
|
};
|
|
519
|
-
}
|
|
522
|
+
}
|
|
520
523
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
+
normalizeDate(date) {
|
|
525
|
+
const calendar = this;
|
|
526
|
+
const d = new Date(date);
|
|
524
527
|
|
|
525
528
|
if (calendar.hasTimePicker) {
|
|
526
529
|
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes());
|
|
527
530
|
}
|
|
528
531
|
|
|
529
532
|
return new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
530
|
-
}
|
|
533
|
+
}
|
|
531
534
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
+
normalizeValues(values) {
|
|
536
|
+
const calendar = this;
|
|
537
|
+
let newValues = [];
|
|
535
538
|
|
|
536
539
|
if (values && Array.isArray(values)) {
|
|
537
|
-
newValues = values.map(
|
|
538
|
-
return calendar.normalizeDate(val);
|
|
539
|
-
});
|
|
540
|
+
newValues = values.map(val => calendar.normalizeDate(val));
|
|
540
541
|
}
|
|
541
542
|
|
|
542
543
|
return newValues;
|
|
543
|
-
}
|
|
544
|
+
}
|
|
544
545
|
|
|
545
|
-
|
|
546
|
-
|
|
546
|
+
initInput() {
|
|
547
|
+
const calendar = this;
|
|
547
548
|
if (!calendar.$inputEl) return;
|
|
548
549
|
if (calendar.params.inputReadOnly) calendar.$inputEl.prop('readOnly', true);
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
isPopover() {
|
|
553
|
+
const calendar = this;
|
|
554
|
+
const {
|
|
555
|
+
app,
|
|
556
|
+
modal,
|
|
557
|
+
params
|
|
558
|
+
} = calendar;
|
|
559
|
+
const device = getDevice();
|
|
557
560
|
if (params.openIn === 'sheet') return false;
|
|
558
561
|
if (modal && modal.type !== 'popover') return false;
|
|
559
562
|
|
|
@@ -574,30 +577,33 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
574
577
|
}
|
|
575
578
|
|
|
576
579
|
return false;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
formatDate(d) {
|
|
583
|
+
const calendar = this;
|
|
584
|
+
const date = new Date(d);
|
|
585
|
+
const year = date.getFullYear();
|
|
586
|
+
const month = date.getMonth();
|
|
587
|
+
const month1 = month + 1;
|
|
588
|
+
const day = date.getDate();
|
|
589
|
+
const weekDay = date.getDay();
|
|
590
|
+
const {
|
|
591
|
+
monthNames,
|
|
592
|
+
monthNamesShort,
|
|
593
|
+
dayNames,
|
|
594
|
+
dayNamesShort
|
|
595
|
+
} = calendar;
|
|
596
|
+
const {
|
|
597
|
+
dateFormat,
|
|
598
|
+
locale
|
|
599
|
+
} = calendar.params;
|
|
594
600
|
|
|
595
601
|
function twoDigits(number) {
|
|
596
|
-
return number < 10 ?
|
|
602
|
+
return number < 10 ? `0${number}` : number;
|
|
597
603
|
}
|
|
598
604
|
|
|
599
605
|
if (typeof dateFormat === 'string') {
|
|
600
|
-
|
|
606
|
+
const tokens = {
|
|
601
607
|
yyyy: year,
|
|
602
608
|
yy: String(year).substring(2),
|
|
603
609
|
mm: twoDigits(month1),
|
|
@@ -611,13 +617,13 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
611
617
|
};
|
|
612
618
|
|
|
613
619
|
if (calendar.params.timePicker) {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
620
|
+
const hours = date.getHours();
|
|
621
|
+
const minutes = date.getMinutes();
|
|
622
|
+
const seconds = date.getSeconds();
|
|
623
|
+
let hours12 = hours;
|
|
618
624
|
if (hours > 12) hours12 = hours - 12;
|
|
619
625
|
if (hours === 0) hours12 = 12;
|
|
620
|
-
|
|
626
|
+
const a = hours >= 12 && hours !== 0 ? 'pm' : 'am';
|
|
621
627
|
Object.assign(tokens, {
|
|
622
628
|
HH: twoDigits(hours),
|
|
623
629
|
H: hours,
|
|
@@ -627,15 +633,13 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
627
633
|
s: seconds,
|
|
628
634
|
':mm': twoDigits(minutes),
|
|
629
635
|
':m': minutes,
|
|
630
|
-
a
|
|
636
|
+
a,
|
|
631
637
|
A: a.toUpperCase()
|
|
632
638
|
});
|
|
633
639
|
}
|
|
634
640
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
}).join('|'), 'g');
|
|
638
|
-
return dateFormat.replace(regexp, function (token) {
|
|
641
|
+
const regexp = new RegExp(Object.keys(tokens).map(t => `(${t})`).join('|'), 'g');
|
|
642
|
+
return dateFormat.replace(regexp, token => {
|
|
639
643
|
if (token in tokens) return tokens[token];
|
|
640
644
|
return token;
|
|
641
645
|
});
|
|
@@ -646,36 +650,37 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
646
650
|
} // Intl Object
|
|
647
651
|
|
|
648
652
|
|
|
649
|
-
|
|
653
|
+
const formatter = new Intl.DateTimeFormat(locale, dateFormat);
|
|
650
654
|
return formatter.format(date);
|
|
651
|
-
}
|
|
655
|
+
}
|
|
652
656
|
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
657
|
+
formatValue() {
|
|
658
|
+
const calendar = this;
|
|
659
|
+
const {
|
|
660
|
+
value
|
|
661
|
+
} = calendar;
|
|
656
662
|
|
|
657
663
|
if (calendar.params.formatValue) {
|
|
658
664
|
return calendar.params.formatValue.call(calendar, value);
|
|
659
665
|
}
|
|
660
666
|
|
|
661
|
-
return value.map(
|
|
662
|
-
|
|
663
|
-
}).join(calendar.params.rangePicker ? ' - ' : ', ');
|
|
664
|
-
};
|
|
667
|
+
return value.map(v => calendar.formatDate(v)).join(calendar.params.rangePicker ? ' - ' : ', ');
|
|
668
|
+
}
|
|
665
669
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
670
|
+
addValue(newValue) {
|
|
671
|
+
const calendar = this;
|
|
672
|
+
const {
|
|
673
|
+
multiple,
|
|
674
|
+
rangePicker,
|
|
675
|
+
rangePickerMinDays,
|
|
676
|
+
rangePickerMaxDays
|
|
677
|
+
} = calendar.params;
|
|
673
678
|
|
|
674
679
|
if (multiple) {
|
|
675
680
|
if (!calendar.value) calendar.value = [];
|
|
676
|
-
|
|
681
|
+
let inValuesIndex;
|
|
677
682
|
|
|
678
|
-
for (
|
|
683
|
+
for (let i = 0; i < calendar.value.length; i += 1) {
|
|
679
684
|
if (new Date(newValue).getTime() === new Date(calendar.value[i]).getTime()) {
|
|
680
685
|
inValuesIndex = i;
|
|
681
686
|
}
|
|
@@ -696,23 +701,21 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
696
701
|
}
|
|
697
702
|
|
|
698
703
|
if (calendar.value.length === 0 || Math.abs(calendar.value[0].getTime() - newValue.getTime()) >= (rangePickerMinDays - 1) * 60 * 60 * 24 * 1000 && (rangePickerMaxDays === 0 || Math.abs(calendar.value[0].getTime() - newValue.getTime()) <= (rangePickerMaxDays - 1) * 60 * 60 * 24 * 1000)) calendar.value.push(newValue);else calendar.value = [];
|
|
699
|
-
calendar.value.sort(
|
|
700
|
-
return a - b;
|
|
701
|
-
});
|
|
704
|
+
calendar.value.sort((a, b) => a - b);
|
|
702
705
|
calendar.updateValue();
|
|
703
706
|
} else {
|
|
704
707
|
calendar.value = [newValue];
|
|
705
708
|
calendar.updateValue();
|
|
706
709
|
}
|
|
707
|
-
}
|
|
710
|
+
}
|
|
708
711
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
+
setValue(values) {
|
|
713
|
+
const calendar = this;
|
|
714
|
+
const currentValue = calendar.value;
|
|
712
715
|
|
|
713
716
|
if (Array.isArray(currentValue) && Array.isArray(values) && currentValue.length === values.length) {
|
|
714
|
-
|
|
715
|
-
currentValue.forEach(
|
|
717
|
+
let equal = true;
|
|
718
|
+
currentValue.forEach((v, index) => {
|
|
716
719
|
if (v !== values[index]) equal = false;
|
|
717
720
|
});
|
|
718
721
|
if (equal) return;
|
|
@@ -720,33 +723,35 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
720
723
|
|
|
721
724
|
calendar.value = values;
|
|
722
725
|
calendar.updateValue();
|
|
723
|
-
}
|
|
726
|
+
}
|
|
724
727
|
|
|
725
|
-
|
|
726
|
-
|
|
728
|
+
getValue() {
|
|
729
|
+
const calendar = this;
|
|
727
730
|
return calendar.value;
|
|
728
|
-
}
|
|
731
|
+
}
|
|
729
732
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
733
|
+
updateValue(onlyHeader) {
|
|
734
|
+
const calendar = this;
|
|
735
|
+
const {
|
|
736
|
+
$el,
|
|
737
|
+
$wrapperEl,
|
|
738
|
+
$inputEl,
|
|
739
|
+
value,
|
|
740
|
+
params
|
|
741
|
+
} = calendar;
|
|
742
|
+
let i;
|
|
738
743
|
|
|
739
744
|
if ($el && $el.length > 0) {
|
|
740
745
|
$wrapperEl.find('.calendar-day-selected').removeClass('calendar-day-selected calendar-day-selected-range calendar-day-selected-left calendar-day-selected-right');
|
|
741
|
-
|
|
746
|
+
let valueDate;
|
|
742
747
|
|
|
743
748
|
if (params.rangePicker && value.length === 2) {
|
|
744
|
-
|
|
745
|
-
|
|
749
|
+
const leftDate = new Date(value[0]).getTime();
|
|
750
|
+
const rightDate = new Date(value[1]).getTime();
|
|
746
751
|
|
|
747
752
|
for (i = leftDate; i <= rightDate; i += 24 * 60 * 60 * 1000) {
|
|
748
753
|
valueDate = new Date(i);
|
|
749
|
-
|
|
754
|
+
let addClass = 'calendar-day-selected';
|
|
750
755
|
|
|
751
756
|
if (leftDate !== rightDate) {
|
|
752
757
|
if (i !== leftDate && i !== rightDate) {
|
|
@@ -762,17 +767,17 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
762
767
|
}
|
|
763
768
|
}
|
|
764
769
|
|
|
765
|
-
$wrapperEl.find(
|
|
770
|
+
$wrapperEl.find(`.calendar-day[data-date="${valueDate.getFullYear()}-${valueDate.getMonth()}-${valueDate.getDate()}"]`).addClass(addClass);
|
|
766
771
|
}
|
|
767
772
|
|
|
768
773
|
valueDate = new Date(leftDate);
|
|
769
|
-
$wrapperEl.find(
|
|
774
|
+
$wrapperEl.find(`.calendar-day[data-date="${valueDate.getFullYear()}-${valueDate.getMonth()}-${valueDate.getDate()}"]`).removeClass('calendar-day-selected-range').addClass('calendar-day-selected calendar-day-selected-left');
|
|
770
775
|
valueDate = new Date(rightDate);
|
|
771
|
-
$wrapperEl.find(
|
|
776
|
+
$wrapperEl.find(`.calendar-day[data-date="${valueDate.getFullYear()}-${valueDate.getMonth()}-${valueDate.getDate()}"]`).removeClass('calendar-day-selected-range').addClass('calendar-day-selected calendar-day-selected-right');
|
|
772
777
|
} else {
|
|
773
778
|
for (i = 0; i < calendar.value.length; i += 1) {
|
|
774
779
|
valueDate = new Date(value[i]);
|
|
775
|
-
$wrapperEl.find(
|
|
780
|
+
$wrapperEl.find(`.calendar-day[data-date="${valueDate.getFullYear()}-${valueDate.getMonth()}-${valueDate.getDate()}"]`).addClass('calendar-day-selected');
|
|
776
781
|
}
|
|
777
782
|
}
|
|
778
783
|
}
|
|
@@ -786,7 +791,7 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
786
791
|
}
|
|
787
792
|
|
|
788
793
|
if ($inputEl && $inputEl.length || params.header) {
|
|
789
|
-
|
|
794
|
+
const inputValue = calendar.formatValue(value);
|
|
790
795
|
|
|
791
796
|
if (params.header && $el && $el.length) {
|
|
792
797
|
$el.find('.calendar-selected-date').text(inputValue);
|
|
@@ -797,15 +802,17 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
797
802
|
$inputEl.trigger('change');
|
|
798
803
|
}
|
|
799
804
|
}
|
|
800
|
-
}
|
|
805
|
+
}
|
|
801
806
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
807
|
+
updateCurrentMonthYear(dir) {
|
|
808
|
+
const calendar = this;
|
|
809
|
+
const {
|
|
810
|
+
$months,
|
|
811
|
+
$el,
|
|
812
|
+
monthNames
|
|
813
|
+
} = calendar;
|
|
814
|
+
let currentLocaleMonth;
|
|
815
|
+
let currentLocaleYear;
|
|
809
816
|
|
|
810
817
|
if (typeof dir === 'undefined') {
|
|
811
818
|
calendar.currentMonth = parseInt($months.eq(1).attr('data-month'), 10);
|
|
@@ -821,49 +828,55 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
821
828
|
|
|
822
829
|
$el.find('.current-month-value').text(monthNames[currentLocaleMonth]);
|
|
823
830
|
$el.find('.current-year-value').text(currentLocaleYear);
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
update() {
|
|
834
|
+
const calendar = this;
|
|
835
|
+
const {
|
|
836
|
+
currentYear,
|
|
837
|
+
currentMonth,
|
|
838
|
+
$wrapperEl
|
|
839
|
+
} = calendar;
|
|
840
|
+
const currentDate = new Date(currentYear, currentMonth);
|
|
841
|
+
const prevMonthHtml = calendar.renderMonth(currentDate, 'prev');
|
|
842
|
+
const currentMonthHtml = calendar.renderMonth(currentDate);
|
|
843
|
+
const nextMonthHtml = calendar.renderMonth(currentDate, 'next');
|
|
844
|
+
$wrapperEl.transition(0).html(`${prevMonthHtml}${currentMonthHtml}${nextMonthHtml}`).transform('translate3d(0,0,0)');
|
|
836
845
|
calendar.$months = $wrapperEl.find('.calendar-month');
|
|
837
846
|
calendar.monthsTranslate = 0;
|
|
838
847
|
calendar.setMonthsTranslate();
|
|
839
|
-
calendar.$months.each(
|
|
848
|
+
calendar.$months.each(monthEl => {
|
|
840
849
|
calendar.emit('local::monthAdd calendarMonthAdd', monthEl);
|
|
841
850
|
});
|
|
842
|
-
}
|
|
851
|
+
}
|
|
843
852
|
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
853
|
+
onMonthChangeStart(dir) {
|
|
854
|
+
const calendar = this;
|
|
855
|
+
const {
|
|
856
|
+
$months,
|
|
857
|
+
currentYear,
|
|
858
|
+
currentMonth
|
|
859
|
+
} = calendar;
|
|
849
860
|
calendar.updateCurrentMonthYear(dir);
|
|
850
861
|
$months.removeClass('calendar-month-current calendar-month-prev calendar-month-next');
|
|
851
|
-
|
|
862
|
+
const currentIndex = dir === 'next' ? $months.length - 1 : 0;
|
|
852
863
|
$months.eq(currentIndex).addClass('calendar-month-current');
|
|
853
864
|
$months.eq(dir === 'next' ? currentIndex - 1 : currentIndex + 1).addClass(dir === 'next' ? 'calendar-month-prev' : 'calendar-month-next');
|
|
854
865
|
calendar.emit('local::monthYearChangeStart calendarMonthYearChangeStart', calendar, currentYear, currentMonth);
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
onMonthChangeEnd(dir, rebuildBoth) {
|
|
869
|
+
const calendar = this;
|
|
870
|
+
const {
|
|
871
|
+
currentYear,
|
|
872
|
+
currentMonth,
|
|
873
|
+
$wrapperEl,
|
|
874
|
+
monthsTranslate
|
|
875
|
+
} = calendar;
|
|
863
876
|
calendar.animating = false;
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
877
|
+
let nextMonthHtml;
|
|
878
|
+
let prevMonthHtml;
|
|
879
|
+
let currentMonthHtml;
|
|
867
880
|
$wrapperEl.find('.calendar-month:not(.calendar-month-prev):not(.calendar-month-current):not(.calendar-month-next)').remove();
|
|
868
881
|
|
|
869
882
|
if (typeof dir === 'undefined') {
|
|
@@ -888,18 +901,20 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
888
901
|
$wrapperEl.prepend(currentMonthHtml || prevMonthHtml);
|
|
889
902
|
}
|
|
890
903
|
|
|
891
|
-
|
|
904
|
+
const $months = $wrapperEl.find('.calendar-month');
|
|
892
905
|
calendar.$months = $months;
|
|
893
906
|
calendar.setMonthsTranslate(monthsTranslate);
|
|
894
907
|
calendar.emit('local::monthAdd calendarMonthAdd', calendar, dir === 'next' ? $months.eq($months.length - 1)[0] : $months.eq(0)[0]);
|
|
895
908
|
calendar.emit('local::monthYearChangeEnd calendarMonthYearChangeEnd', calendar, currentYear, currentMonth);
|
|
896
|
-
}
|
|
909
|
+
}
|
|
897
910
|
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
911
|
+
setMonthsTranslate(translate) {
|
|
912
|
+
const calendar = this;
|
|
913
|
+
const {
|
|
914
|
+
$months,
|
|
915
|
+
isHorizontal: isH,
|
|
916
|
+
inverter
|
|
917
|
+
} = calendar; // eslint-disable-next-line
|
|
903
918
|
|
|
904
919
|
translate = translate || calendar.monthsTranslate || 0;
|
|
905
920
|
|
|
@@ -908,20 +923,22 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
908
923
|
}
|
|
909
924
|
|
|
910
925
|
$months.removeClass('calendar-month-current calendar-month-prev calendar-month-next');
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
$months.eq(0).transform(
|
|
915
|
-
$months.eq(1).transform(
|
|
916
|
-
$months.eq(2).transform(
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
926
|
+
const prevMonthTranslate = -(translate + 1) * 100 * inverter;
|
|
927
|
+
const currentMonthTranslate = -translate * 100 * inverter;
|
|
928
|
+
const nextMonthTranslate = -(translate - 1) * 100 * inverter;
|
|
929
|
+
$months.eq(0).transform(`translate3d(${isH ? prevMonthTranslate : 0}%, ${isH ? 0 : prevMonthTranslate}%, 0)`).addClass('calendar-month-prev');
|
|
930
|
+
$months.eq(1).transform(`translate3d(${isH ? currentMonthTranslate : 0}%, ${isH ? 0 : currentMonthTranslate}%, 0)`).addClass('calendar-month-current');
|
|
931
|
+
$months.eq(2).transform(`translate3d(${isH ? nextMonthTranslate : 0}%, ${isH ? 0 : nextMonthTranslate}%, 0)`).addClass('calendar-month-next');
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
nextMonth(transition) {
|
|
935
|
+
const calendar = this;
|
|
936
|
+
const {
|
|
937
|
+
params,
|
|
938
|
+
$wrapperEl,
|
|
939
|
+
inverter,
|
|
940
|
+
isHorizontal: isH
|
|
941
|
+
} = calendar;
|
|
925
942
|
|
|
926
943
|
if (typeof transition === 'undefined' || typeof transition === 'object') {
|
|
927
944
|
transition = ''; // eslint-disable-line
|
|
@@ -929,11 +946,11 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
929
946
|
if (!params.animate) transition = 0; // eslint-disable-line
|
|
930
947
|
}
|
|
931
948
|
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
949
|
+
const nextMonth = parseInt(calendar.$months.eq(calendar.$months.length - 1).attr('data-month'), 10);
|
|
950
|
+
const nextYear = parseInt(calendar.$months.eq(calendar.$months.length - 1).attr('data-year'), 10);
|
|
951
|
+
const nextDate = new Date(nextYear, nextMonth);
|
|
952
|
+
const nextDateTime = nextDate.getTime();
|
|
953
|
+
const transitionEndCallback = !calendar.animating;
|
|
937
954
|
|
|
938
955
|
if (params.maxDate) {
|
|
939
956
|
if (nextDateTime > new Date(params.maxDate).getTime()) {
|
|
@@ -945,8 +962,8 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
945
962
|
calendar.monthsTranslate -= 1;
|
|
946
963
|
|
|
947
964
|
if (nextMonth === calendar.currentMonth) {
|
|
948
|
-
|
|
949
|
-
|
|
965
|
+
const nextMonthTranslate = -calendar.monthsTranslate * 100 * inverter;
|
|
966
|
+
const nextMonthHtml = $(calendar.renderMonth(nextDateTime, 'next')).transform(`translate3d(${isH ? nextMonthTranslate : 0}%, ${isH ? 0 : nextMonthTranslate}%, 0)`).addClass('calendar-month-next');
|
|
950
967
|
$wrapperEl.append(nextMonthHtml[0]);
|
|
951
968
|
calendar.$months = $wrapperEl.find('.calendar-month');
|
|
952
969
|
calendar.emit('local::monthAdd calendarMonthAdd', calendar.$months.eq(calendar.$months.length - 1)[0]);
|
|
@@ -954,11 +971,11 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
954
971
|
|
|
955
972
|
calendar.animating = true;
|
|
956
973
|
calendar.onMonthChangeStart('next');
|
|
957
|
-
|
|
958
|
-
$wrapperEl.transition(transition).transform(
|
|
974
|
+
const translate = calendar.monthsTranslate * 100 * inverter;
|
|
975
|
+
$wrapperEl.transition(transition).transform(`translate3d(${isH ? translate : 0}%, ${isH ? 0 : translate}%, 0)`);
|
|
959
976
|
|
|
960
977
|
if (transitionEndCallback) {
|
|
961
|
-
$wrapperEl.transitionEnd(
|
|
978
|
+
$wrapperEl.transitionEnd(() => {
|
|
962
979
|
calendar.onMonthChangeEnd('next');
|
|
963
980
|
});
|
|
964
981
|
}
|
|
@@ -966,14 +983,16 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
966
983
|
if (!params.animate) {
|
|
967
984
|
calendar.onMonthChangeEnd('next');
|
|
968
985
|
}
|
|
969
|
-
}
|
|
986
|
+
}
|
|
970
987
|
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
988
|
+
prevMonth(transition) {
|
|
989
|
+
const calendar = this;
|
|
990
|
+
const {
|
|
991
|
+
params,
|
|
992
|
+
$wrapperEl,
|
|
993
|
+
inverter,
|
|
994
|
+
isHorizontal: isH
|
|
995
|
+
} = calendar;
|
|
977
996
|
|
|
978
997
|
if (typeof transition === 'undefined' || typeof transition === 'object') {
|
|
979
998
|
transition = ''; // eslint-disable-line
|
|
@@ -981,14 +1000,14 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
981
1000
|
if (!params.animate) transition = 0; // eslint-disable-line
|
|
982
1001
|
}
|
|
983
1002
|
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1003
|
+
const prevMonth = parseInt(calendar.$months.eq(0).attr('data-month'), 10);
|
|
1004
|
+
const prevYear = parseInt(calendar.$months.eq(0).attr('data-year'), 10);
|
|
1005
|
+
const prevDate = new Date(prevYear, prevMonth + 1, -1);
|
|
1006
|
+
const prevDateTime = prevDate.getTime();
|
|
1007
|
+
const transitionEndCallback = !calendar.animating;
|
|
989
1008
|
|
|
990
1009
|
if (params.minDate) {
|
|
991
|
-
|
|
1010
|
+
let minDate = new Date(params.minDate);
|
|
992
1011
|
minDate = new Date(minDate.getFullYear(), minDate.getMonth(), 1);
|
|
993
1012
|
|
|
994
1013
|
if (prevDateTime < minDate.getTime()) {
|
|
@@ -1000,8 +1019,8 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1000
1019
|
calendar.monthsTranslate += 1;
|
|
1001
1020
|
|
|
1002
1021
|
if (prevMonth === calendar.currentMonth) {
|
|
1003
|
-
|
|
1004
|
-
|
|
1022
|
+
const prevMonthTranslate = -calendar.monthsTranslate * 100 * inverter;
|
|
1023
|
+
const prevMonthHtml = $(calendar.renderMonth(prevDateTime, 'prev')).transform(`translate3d(${isH ? prevMonthTranslate : 0}%, ${isH ? 0 : prevMonthTranslate}%, 0)`).addClass('calendar-month-prev');
|
|
1005
1024
|
$wrapperEl.prepend(prevMonthHtml[0]);
|
|
1006
1025
|
calendar.$months = $wrapperEl.find('.calendar-month');
|
|
1007
1026
|
calendar.emit('local::monthAdd calendarMonthAdd', calendar.$months.eq(0)[0]);
|
|
@@ -1009,11 +1028,11 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1009
1028
|
|
|
1010
1029
|
calendar.animating = true;
|
|
1011
1030
|
calendar.onMonthChangeStart('prev');
|
|
1012
|
-
|
|
1013
|
-
$wrapperEl.transition(transition).transform(
|
|
1031
|
+
const translate = calendar.monthsTranslate * 100 * inverter;
|
|
1032
|
+
$wrapperEl.transition(transition).transform(`translate3d(${isH ? translate : 0}%, ${isH ? 0 : translate}%, 0)`);
|
|
1014
1033
|
|
|
1015
1034
|
if (transitionEndCallback) {
|
|
1016
|
-
$wrapperEl.transitionEnd(
|
|
1035
|
+
$wrapperEl.transitionEnd(() => {
|
|
1017
1036
|
calendar.onMonthChangeEnd('prev');
|
|
1018
1037
|
});
|
|
1019
1038
|
}
|
|
@@ -1021,29 +1040,29 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1021
1040
|
if (!params.animate) {
|
|
1022
1041
|
calendar.onMonthChangeEnd('prev');
|
|
1023
1042
|
}
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
_proto.resetMonth = function resetMonth(transition) {
|
|
1027
|
-
if (transition === void 0) {
|
|
1028
|
-
transition = '';
|
|
1029
|
-
}
|
|
1043
|
+
}
|
|
1030
1044
|
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1045
|
+
resetMonth(transition = '') {
|
|
1046
|
+
const calendar = this;
|
|
1047
|
+
const {
|
|
1048
|
+
$wrapperEl,
|
|
1049
|
+
inverter,
|
|
1050
|
+
isHorizontal: isH,
|
|
1051
|
+
monthsTranslate
|
|
1052
|
+
} = calendar;
|
|
1053
|
+
const translate = monthsTranslate * 100 * inverter;
|
|
1054
|
+
$wrapperEl.transition(transition).transform(`translate3d(${isH ? translate : 0}%, ${isH ? 0 : translate}%, 0)`);
|
|
1038
1055
|
} // eslint-disable-next-line
|
|
1039
|
-
;
|
|
1040
1056
|
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1057
|
+
|
|
1058
|
+
setYearMonth(year, month, transition) {
|
|
1059
|
+
const calendar = this;
|
|
1060
|
+
const {
|
|
1061
|
+
params,
|
|
1062
|
+
isHorizontal: isH,
|
|
1063
|
+
$wrapperEl,
|
|
1064
|
+
inverter
|
|
1065
|
+
} = calendar; // eslint-disable-next-line
|
|
1047
1066
|
|
|
1048
1067
|
if (typeof year === 'undefined') year = calendar.currentYear; // eslint-disable-next-line
|
|
1049
1068
|
|
|
@@ -1056,7 +1075,7 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1056
1075
|
if (!params.animate) transition = 0;
|
|
1057
1076
|
}
|
|
1058
1077
|
|
|
1059
|
-
|
|
1078
|
+
let targetDate;
|
|
1060
1079
|
|
|
1061
1080
|
if (year < calendar.currentYear) {
|
|
1062
1081
|
targetDate = new Date(year, month + 1, -1).getTime();
|
|
@@ -1069,7 +1088,7 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1069
1088
|
}
|
|
1070
1089
|
|
|
1071
1090
|
if (params.minDate) {
|
|
1072
|
-
|
|
1091
|
+
let minDate = new Date(params.minDate);
|
|
1073
1092
|
minDate = new Date(minDate.getFullYear(), minDate.getMonth(), 1);
|
|
1074
1093
|
|
|
1075
1094
|
if (targetDate < minDate.getTime()) {
|
|
@@ -1077,13 +1096,13 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1077
1096
|
}
|
|
1078
1097
|
}
|
|
1079
1098
|
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1099
|
+
const currentDate = new Date(calendar.currentYear, calendar.currentMonth).getTime();
|
|
1100
|
+
const dir = targetDate > currentDate ? 'next' : 'prev';
|
|
1101
|
+
const newMonthHTML = calendar.renderMonth(new Date(year, month));
|
|
1083
1102
|
calendar.monthsTranslate = calendar.monthsTranslate || 0;
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1103
|
+
const prevTranslate = calendar.monthsTranslate;
|
|
1104
|
+
let monthTranslate;
|
|
1105
|
+
const transitionEndCallback = !calendar.animating && transition !== 0;
|
|
1087
1106
|
|
|
1088
1107
|
if (targetDate > currentDate) {
|
|
1089
1108
|
// To next
|
|
@@ -1092,7 +1111,7 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1092
1111
|
$wrapperEl.append(newMonthHTML);
|
|
1093
1112
|
calendar.$months = $wrapperEl.find('.calendar-month');
|
|
1094
1113
|
monthTranslate = -(prevTranslate - 1) * 100 * inverter;
|
|
1095
|
-
calendar.$months.eq(calendar.$months.length - 1).transform(
|
|
1114
|
+
calendar.$months.eq(calendar.$months.length - 1).transform(`translate3d(${isH ? monthTranslate : 0}%, ${isH ? 0 : monthTranslate}%, 0)`).addClass('calendar-month-next');
|
|
1096
1115
|
} else {
|
|
1097
1116
|
// To prev
|
|
1098
1117
|
calendar.monthsTranslate += 1;
|
|
@@ -1100,17 +1119,17 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1100
1119
|
$wrapperEl.prepend(newMonthHTML);
|
|
1101
1120
|
calendar.$months = $wrapperEl.find('.calendar-month');
|
|
1102
1121
|
monthTranslate = -(prevTranslate + 1) * 100 * inverter;
|
|
1103
|
-
calendar.$months.eq(0).transform(
|
|
1122
|
+
calendar.$months.eq(0).transform(`translate3d(${isH ? monthTranslate : 0}%, ${isH ? 0 : monthTranslate}%, 0)`).addClass('calendar-month-prev');
|
|
1104
1123
|
}
|
|
1105
1124
|
|
|
1106
1125
|
calendar.emit('local::monthAdd calendarMonthAdd', dir === 'next' ? calendar.$months.eq(calendar.$months.length - 1)[0] : calendar.$months.eq(0)[0]);
|
|
1107
1126
|
calendar.animating = true;
|
|
1108
1127
|
calendar.onMonthChangeStart(dir);
|
|
1109
|
-
|
|
1110
|
-
$wrapperEl.transition(transition).transform(
|
|
1128
|
+
const wrapperTranslate = calendar.monthsTranslate * 100 * inverter;
|
|
1129
|
+
$wrapperEl.transition(transition).transform(`translate3d(${isH ? wrapperTranslate : 0}%, ${isH ? 0 : wrapperTranslate}%, 0)`);
|
|
1111
1130
|
|
|
1112
1131
|
if (transitionEndCallback) {
|
|
1113
|
-
$wrapperEl.transitionEnd(
|
|
1132
|
+
$wrapperEl.transitionEnd(() => {
|
|
1114
1133
|
calendar.onMonthChangeEnd(dir, true);
|
|
1115
1134
|
});
|
|
1116
1135
|
}
|
|
@@ -1118,22 +1137,22 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1118
1137
|
if (!params.animate || transition === 0) {
|
|
1119
1138
|
calendar.onMonthChangeEnd(dir, true);
|
|
1120
1139
|
}
|
|
1121
|
-
}
|
|
1140
|
+
}
|
|
1122
1141
|
|
|
1123
|
-
|
|
1124
|
-
|
|
1142
|
+
nextYear() {
|
|
1143
|
+
const calendar = this;
|
|
1125
1144
|
calendar.setYearMonth(calendar.currentYear + 1);
|
|
1126
|
-
}
|
|
1145
|
+
}
|
|
1127
1146
|
|
|
1128
|
-
|
|
1129
|
-
|
|
1147
|
+
prevYear() {
|
|
1148
|
+
const calendar = this;
|
|
1130
1149
|
calendar.setYearMonth(calendar.currentYear - 1);
|
|
1131
1150
|
} // eslint-disable-next-line
|
|
1132
|
-
;
|
|
1133
1151
|
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1152
|
+
|
|
1153
|
+
dateInRange(dayDate, range) {
|
|
1154
|
+
let match = false;
|
|
1155
|
+
let i;
|
|
1137
1156
|
if (!range) return false;
|
|
1138
1157
|
|
|
1139
1158
|
if (Array.isArray(range)) {
|
|
@@ -1182,15 +1201,15 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1182
1201
|
|
|
1183
1202
|
return match;
|
|
1184
1203
|
} // eslint-disable-next-line
|
|
1185
|
-
;
|
|
1186
1204
|
|
|
1187
|
-
|
|
1188
|
-
|
|
1205
|
+
|
|
1206
|
+
daysInMonth(date) {
|
|
1207
|
+
const d = new Date(date);
|
|
1189
1208
|
return new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate();
|
|
1190
|
-
}
|
|
1209
|
+
}
|
|
1191
1210
|
|
|
1192
|
-
|
|
1193
|
-
|
|
1211
|
+
renderMonths(date) {
|
|
1212
|
+
const calendar = this;
|
|
1194
1213
|
|
|
1195
1214
|
if (calendar.params.renderMonths) {
|
|
1196
1215
|
return calendar.params.renderMonths.call(calendar, date);
|
|
@@ -1199,23 +1218,25 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1199
1218
|
return $jsx("div", {
|
|
1200
1219
|
class: "calendar-months-wrapper"
|
|
1201
1220
|
}, calendar.renderMonth(date, 'prev'), calendar.renderMonth(date), calendar.renderMonth(date, 'next'));
|
|
1202
|
-
}
|
|
1221
|
+
}
|
|
1203
1222
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1223
|
+
renderMonth(d, offset) {
|
|
1224
|
+
const calendar = this;
|
|
1225
|
+
const {
|
|
1226
|
+
params,
|
|
1227
|
+
value
|
|
1228
|
+
} = calendar;
|
|
1208
1229
|
|
|
1209
1230
|
if (params.renderMonth) {
|
|
1210
1231
|
return params.renderMonth.call(calendar, d, offset);
|
|
1211
1232
|
}
|
|
1212
1233
|
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1234
|
+
let date = new Date(d);
|
|
1235
|
+
let year = date.getFullYear();
|
|
1236
|
+
let month = date.getMonth();
|
|
1237
|
+
let localeMonth = calendar.monthNames.indexOf(calendar.monthFormatter.format(date));
|
|
1217
1238
|
if (localeMonth < 0) localeMonth = month;
|
|
1218
|
-
|
|
1239
|
+
let localeYear = calendar.yearFormatter.format(date);
|
|
1219
1240
|
|
|
1220
1241
|
if (offset === 'next') {
|
|
1221
1242
|
if (month === 11) date = new Date(year + 1, 0);else date = new Date(year, month + 1, 1);
|
|
@@ -1233,43 +1254,43 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1233
1254
|
localeYear = calendar.yearFormatter.format(date);
|
|
1234
1255
|
}
|
|
1235
1256
|
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1257
|
+
const currentValues = [];
|
|
1258
|
+
const today = new Date().setHours(0, 0, 0, 0);
|
|
1259
|
+
const minDate = params.minDate ? new Date(params.minDate).getTime() : null;
|
|
1260
|
+
const maxDate = params.maxDate ? new Date(params.maxDate).getTime() : null;
|
|
1261
|
+
const rows = 6;
|
|
1262
|
+
const cols = 7;
|
|
1263
|
+
const daysInPrevMonth = calendar.daysInMonth(new Date(date.getFullYear(), date.getMonth()).getTime() - 10 * 24 * 60 * 60 * 1000);
|
|
1264
|
+
const daysInMonth = calendar.daysInMonth(date);
|
|
1265
|
+
const minDayNumber = params.firstDay === 6 ? 0 : 1;
|
|
1266
|
+
let monthHtml = '';
|
|
1267
|
+
let dayIndex = 0 + (params.firstDay - 1);
|
|
1268
|
+
let disabled;
|
|
1269
|
+
let hasEvents;
|
|
1270
|
+
let firstDayOfMonthIndex = new Date(date.getFullYear(), date.getMonth()).getDay();
|
|
1250
1271
|
if (firstDayOfMonthIndex === 0) firstDayOfMonthIndex = 7;
|
|
1251
1272
|
|
|
1252
1273
|
if (value && value.length) {
|
|
1253
|
-
for (
|
|
1274
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
1254
1275
|
currentValues.push(new Date(value[i]).setHours(0, 0, 0, 0));
|
|
1255
1276
|
}
|
|
1256
1277
|
}
|
|
1257
1278
|
|
|
1258
|
-
for (
|
|
1259
|
-
|
|
1279
|
+
for (let row = 1; row <= rows; row += 1) {
|
|
1280
|
+
let rowHtml = '';
|
|
1260
1281
|
|
|
1261
|
-
|
|
1282
|
+
for (let col = 1; col <= cols; col += 1) {
|
|
1262
1283
|
dayIndex += 1;
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1284
|
+
let dayDate;
|
|
1285
|
+
let dayNumber = dayIndex - firstDayOfMonthIndex;
|
|
1286
|
+
let addClass = '';
|
|
1266
1287
|
|
|
1267
1288
|
if (row === 1 && col === 1 && dayNumber > minDayNumber && params.firstDay !== 1) {
|
|
1268
1289
|
dayIndex -= 7;
|
|
1269
1290
|
dayNumber = dayIndex - firstDayOfMonthIndex;
|
|
1270
1291
|
}
|
|
1271
1292
|
|
|
1272
|
-
|
|
1293
|
+
const weekDayIndex = col - 1 + params.firstDay > 6 ? col - 1 - 7 + params.firstDay : col - 1 + params.firstDay;
|
|
1273
1294
|
|
|
1274
1295
|
if (dayNumber < 0) {
|
|
1275
1296
|
dayNumber = daysInPrevMonth + dayNumber + 1;
|
|
@@ -1316,7 +1337,7 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1316
1337
|
} // Events
|
|
1317
1338
|
|
|
1318
1339
|
|
|
1319
|
-
|
|
1340
|
+
let eventsHtml = '';
|
|
1320
1341
|
hasEvents = false;
|
|
1321
1342
|
|
|
1322
1343
|
if (params.events) {
|
|
@@ -1328,29 +1349,37 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1328
1349
|
if (hasEvents) {
|
|
1329
1350
|
addClass += ' calendar-day-has-events'; // prettier-ignore
|
|
1330
1351
|
|
|
1331
|
-
eventsHtml =
|
|
1352
|
+
eventsHtml = `
|
|
1353
|
+
<span class="calendar-day-events">
|
|
1354
|
+
<span class="calendar-day-event"></span>
|
|
1355
|
+
</span>
|
|
1356
|
+
`;
|
|
1332
1357
|
|
|
1333
1358
|
if (Array.isArray(params.events)) {
|
|
1334
|
-
|
|
1335
|
-
params.events.forEach(
|
|
1336
|
-
|
|
1359
|
+
const eventDots = [];
|
|
1360
|
+
params.events.forEach(ev => {
|
|
1361
|
+
const color = ev.color || '';
|
|
1337
1362
|
|
|
1338
1363
|
if (eventDots.indexOf(color) < 0 && calendar.dateInRange(dayDate, ev)) {
|
|
1339
1364
|
eventDots.push(color);
|
|
1340
1365
|
}
|
|
1341
1366
|
}); // prettier-ignore
|
|
1342
1367
|
|
|
1343
|
-
eventsHtml =
|
|
1344
|
-
|
|
1345
|
-
|
|
1368
|
+
eventsHtml = `
|
|
1369
|
+
<span class="calendar-day-events">
|
|
1370
|
+
${eventDots.map(color => `
|
|
1371
|
+
<span class="calendar-day-event" style="${color ? `background-color: ${color}` : ''}"></span>
|
|
1372
|
+
`.trim()).join('')}
|
|
1373
|
+
</span>
|
|
1374
|
+
`;
|
|
1346
1375
|
}
|
|
1347
1376
|
} // Custom Ranges
|
|
1348
1377
|
|
|
1349
1378
|
|
|
1350
1379
|
if (params.rangesClasses) {
|
|
1351
|
-
for (
|
|
1380
|
+
for (let k = 0; k < params.rangesClasses.length; k += 1) {
|
|
1352
1381
|
if (calendar.dateInRange(dayDate, params.rangesClasses[k].range)) {
|
|
1353
|
-
addClass +=
|
|
1382
|
+
addClass += ` ${params.rangesClasses[k].cssClass}`;
|
|
1354
1383
|
}
|
|
1355
1384
|
}
|
|
1356
1385
|
} // Disabled
|
|
@@ -1373,47 +1402,48 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1373
1402
|
}
|
|
1374
1403
|
|
|
1375
1404
|
dayDate = new Date(dayDate);
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
rowHtml +=
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
_loop(col);
|
|
1405
|
+
const dayYear = dayDate.getFullYear();
|
|
1406
|
+
const dayMonth = dayDate.getMonth();
|
|
1407
|
+
const dayNumberDisplay = calendar.dayFormatter.format(dayDate); // prettier-ignore
|
|
1408
|
+
|
|
1409
|
+
rowHtml += `
|
|
1410
|
+
<div data-year="${dayYear}" data-month="${dayMonth}" data-day="${dayNumber}" class="calendar-day${addClass}" data-date="${dayYear}-${dayMonth}-${dayNumber}">
|
|
1411
|
+
<span class="calendar-day-number">${dayNumberDisplay}${eventsHtml}</span>
|
|
1412
|
+
</div>`.trim();
|
|
1385
1413
|
}
|
|
1386
1414
|
|
|
1387
|
-
monthHtml +=
|
|
1415
|
+
monthHtml += `<div class="calendar-row">${rowHtml}</div>`;
|
|
1388
1416
|
}
|
|
1389
1417
|
|
|
1390
|
-
monthHtml =
|
|
1418
|
+
monthHtml = `<div class="calendar-month" data-year="${year}" data-month="${month}" data-locale-year="${localeYear}" data-locale-month="${localeMonth}">${monthHtml}</div>`;
|
|
1391
1419
|
return monthHtml;
|
|
1392
|
-
}
|
|
1420
|
+
}
|
|
1393
1421
|
|
|
1394
|
-
|
|
1395
|
-
|
|
1422
|
+
renderWeekHeader() {
|
|
1423
|
+
const calendar = this;
|
|
1396
1424
|
|
|
1397
1425
|
if (calendar.params.renderWeekHeader) {
|
|
1398
1426
|
return calendar.params.renderWeekHeader.call(calendar);
|
|
1399
1427
|
}
|
|
1400
1428
|
|
|
1401
|
-
|
|
1402
|
-
|
|
1429
|
+
const {
|
|
1430
|
+
params
|
|
1431
|
+
} = calendar;
|
|
1432
|
+
let weekDaysHtml = '';
|
|
1403
1433
|
|
|
1404
|
-
for (
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
weekDaysHtml +=
|
|
1434
|
+
for (let i = 0; i < 7; i += 1) {
|
|
1435
|
+
const dayIndex = i + params.firstDay > 6 ? i - 7 + params.firstDay : i + params.firstDay;
|
|
1436
|
+
const dayName = calendar.dayNamesShort[dayIndex];
|
|
1437
|
+
weekDaysHtml += `<div class="calendar-week-day">${dayName}</div>`;
|
|
1408
1438
|
}
|
|
1409
1439
|
|
|
1410
1440
|
return $jsx("div", {
|
|
1411
1441
|
class: "calendar-week-header"
|
|
1412
1442
|
}, weekDaysHtml);
|
|
1413
|
-
}
|
|
1443
|
+
}
|
|
1414
1444
|
|
|
1415
|
-
|
|
1416
|
-
|
|
1445
|
+
renderMonthSelector() {
|
|
1446
|
+
const calendar = this;
|
|
1417
1447
|
|
|
1418
1448
|
if (calendar.params.renderMonthSelector) {
|
|
1419
1449
|
return calendar.params.renderMonthSelector.call(calendar);
|
|
@@ -1434,22 +1464,20 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1434
1464
|
}, $jsx("i", {
|
|
1435
1465
|
class: "icon icon-next"
|
|
1436
1466
|
})));
|
|
1437
|
-
}
|
|
1467
|
+
}
|
|
1438
1468
|
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1469
|
+
renderMonthPicker() {
|
|
1470
|
+
const calendar = this;
|
|
1471
|
+
const localeMonth = parseInt(calendar.$el.find('.calendar-month-current').attr('data-locale-month'), 10);
|
|
1442
1472
|
return $jsx("div", {
|
|
1443
1473
|
class: "calendar-month-picker"
|
|
1444
|
-
}, calendar.monthNames.map(
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
}));
|
|
1449
|
-
};
|
|
1474
|
+
}, calendar.monthNames.map((m, index) => $jsx("div", {
|
|
1475
|
+
class: `calendar-month-picker-item ${localeMonth === index ? 'calendar-month-picker-item-current' : ''}`
|
|
1476
|
+
}, $jsx("span", null, m))));
|
|
1477
|
+
}
|
|
1450
1478
|
|
|
1451
|
-
|
|
1452
|
-
|
|
1479
|
+
renderYearSelector() {
|
|
1480
|
+
const calendar = this;
|
|
1453
1481
|
|
|
1454
1482
|
if (calendar.params.renderYearSelector) {
|
|
1455
1483
|
return calendar.params.renderYearSelector.call(calendar);
|
|
@@ -1470,54 +1498,52 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1470
1498
|
}, $jsx("i", {
|
|
1471
1499
|
class: "icon icon-next"
|
|
1472
1500
|
})));
|
|
1473
|
-
}
|
|
1501
|
+
}
|
|
1474
1502
|
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1503
|
+
renderYearPicker() {
|
|
1504
|
+
const calendar = this;
|
|
1505
|
+
const currentYear = calendar.currentYear;
|
|
1506
|
+
let yearMin = calendar.params.yearPickerMin || new Date().getFullYear() - 100;
|
|
1479
1507
|
|
|
1480
1508
|
if (calendar.params.minDate) {
|
|
1481
1509
|
yearMin = Math.max(yearMin, new Date(calendar.params.minDate).getFullYear());
|
|
1482
1510
|
}
|
|
1483
1511
|
|
|
1484
|
-
|
|
1512
|
+
let yearMax = calendar.params.yearPickerMax || new Date().getFullYear() + 100;
|
|
1485
1513
|
|
|
1486
1514
|
if (calendar.params.maxDate) {
|
|
1487
1515
|
yearMax = Math.min(yearMax, new Date(calendar.params.maxDate).getFullYear());
|
|
1488
1516
|
}
|
|
1489
1517
|
|
|
1490
|
-
|
|
1518
|
+
const years = [];
|
|
1491
1519
|
|
|
1492
|
-
for (
|
|
1520
|
+
for (let i = yearMin; i <= yearMax; i += 1) {
|
|
1493
1521
|
years.push(i);
|
|
1494
1522
|
}
|
|
1495
1523
|
|
|
1496
1524
|
return $jsx("div", {
|
|
1497
1525
|
class: "calendar-year-picker"
|
|
1498
|
-
}, years.map(
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
}, $jsx("span", null, calendar.yearFormatter.format(new Date().setFullYear(year))));
|
|
1503
|
-
}));
|
|
1526
|
+
}, years.map(year => $jsx("div", {
|
|
1527
|
+
"data-year": year,
|
|
1528
|
+
class: `calendar-year-picker-item ${year === currentYear ? 'calendar-year-picker-item-current' : ''}`
|
|
1529
|
+
}, $jsx("span", null, calendar.yearFormatter.format(new Date().setFullYear(year))))));
|
|
1504
1530
|
} // eslint-disable-next-line
|
|
1505
|
-
;
|
|
1506
1531
|
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1532
|
+
|
|
1533
|
+
renderTimeSelector() {
|
|
1534
|
+
const calendar = this;
|
|
1535
|
+
const value = calendar.value && calendar.value[0];
|
|
1536
|
+
let timeString;
|
|
1511
1537
|
if (value) timeString = calendar.timeSelectorFormatter.format(value);
|
|
1512
1538
|
return $jsx("div", {
|
|
1513
1539
|
class: "calendar-time-selector"
|
|
1514
1540
|
}, $jsx("a", {
|
|
1515
1541
|
class: "link"
|
|
1516
1542
|
}, timeString || calendar.params.timePickerPlaceholder));
|
|
1517
|
-
}
|
|
1543
|
+
}
|
|
1518
1544
|
|
|
1519
|
-
|
|
1520
|
-
|
|
1545
|
+
renderHeader() {
|
|
1546
|
+
const calendar = this;
|
|
1521
1547
|
|
|
1522
1548
|
if (calendar.params.renderHeader) {
|
|
1523
1549
|
return calendar.params.renderHeader.call(calendar);
|
|
@@ -1528,11 +1554,11 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1528
1554
|
}, $jsx("div", {
|
|
1529
1555
|
class: "calendar-selected-date"
|
|
1530
1556
|
}, calendar.params.headerPlaceholder));
|
|
1531
|
-
}
|
|
1557
|
+
}
|
|
1532
1558
|
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1559
|
+
renderFooter() {
|
|
1560
|
+
const calendar = this;
|
|
1561
|
+
const app = calendar.app;
|
|
1536
1562
|
|
|
1537
1563
|
if (calendar.params.renderFooter) {
|
|
1538
1564
|
return calendar.params.renderFooter.call(calendar);
|
|
@@ -1541,12 +1567,12 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1541
1567
|
return $jsx("div", {
|
|
1542
1568
|
class: "calendar-footer"
|
|
1543
1569
|
}, $jsx("a", {
|
|
1544
|
-
class:
|
|
1570
|
+
class: `${app.theme === 'md' ? 'button' : 'link'} calendar-close sheet-close popover-close`
|
|
1545
1571
|
}, calendar.params.toolbarCloseText));
|
|
1546
|
-
}
|
|
1572
|
+
}
|
|
1547
1573
|
|
|
1548
|
-
|
|
1549
|
-
|
|
1574
|
+
renderToolbar() {
|
|
1575
|
+
const calendar = this;
|
|
1550
1576
|
|
|
1551
1577
|
if (calendar.params.renderToolbar) {
|
|
1552
1578
|
return calendar.params.renderToolbar.call(calendar, calendar);
|
|
@@ -1559,95 +1585,109 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1559
1585
|
class: "toolbar-inner"
|
|
1560
1586
|
}, calendar.params.monthSelector ? calendar.renderMonthSelector() : '', calendar.params.yearSelector ? calendar.renderYearSelector() : ''));
|
|
1561
1587
|
} // eslint-disable-next-line
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1588
|
+
|
|
1589
|
+
|
|
1590
|
+
renderInline() {
|
|
1591
|
+
const calendar = this;
|
|
1592
|
+
const {
|
|
1593
|
+
cssClass,
|
|
1594
|
+
toolbar,
|
|
1595
|
+
header,
|
|
1596
|
+
footer,
|
|
1597
|
+
rangePicker,
|
|
1598
|
+
weekHeader
|
|
1599
|
+
} = calendar.params;
|
|
1600
|
+
const {
|
|
1601
|
+
value,
|
|
1602
|
+
hasTimePicker
|
|
1603
|
+
} = calendar;
|
|
1604
|
+
const date = value && value.length ? value[0] : new Date().setHours(0, 0, 0);
|
|
1576
1605
|
return $jsx("div", {
|
|
1577
|
-
class:
|
|
1606
|
+
class: `calendar calendar-inline ${rangePicker ? 'calendar-range' : ''} ${cssClass || ''}`
|
|
1578
1607
|
}, header && calendar.renderHeader(), toolbar && calendar.renderToolbar(), weekHeader && calendar.renderWeekHeader(), $jsx("div", {
|
|
1579
1608
|
class: "calendar-months"
|
|
1580
1609
|
}, calendar.renderMonths(date)), hasTimePicker && calendar.renderTimeSelector(), footer && calendar.renderFooter());
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
renderCustomModal() {
|
|
1613
|
+
const calendar = this;
|
|
1614
|
+
const {
|
|
1615
|
+
cssClass,
|
|
1616
|
+
toolbar,
|
|
1617
|
+
header,
|
|
1618
|
+
footer,
|
|
1619
|
+
rangePicker,
|
|
1620
|
+
weekHeader
|
|
1621
|
+
} = calendar.params;
|
|
1622
|
+
const {
|
|
1623
|
+
value,
|
|
1624
|
+
hasTimePicker
|
|
1625
|
+
} = calendar;
|
|
1626
|
+
const date = value && value.length ? value[0] : new Date().setHours(0, 0, 0);
|
|
1595
1627
|
return $jsx("div", {
|
|
1596
|
-
class:
|
|
1628
|
+
class: `calendar calendar-modal ${rangePicker ? 'calendar-range' : ''} ${cssClass || ''}`
|
|
1597
1629
|
}, header && calendar.renderHeader(), toolbar && calendar.renderToolbar(), weekHeader && calendar.renderWeekHeader(), $jsx("div", {
|
|
1598
1630
|
class: "calendar-months"
|
|
1599
1631
|
}, calendar.renderMonths(date)), hasTimePicker && calendar.renderTimeSelector(), footer && calendar.renderFooter());
|
|
1600
|
-
}
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
renderSheet() {
|
|
1635
|
+
const calendar = this;
|
|
1636
|
+
const {
|
|
1637
|
+
cssClass,
|
|
1638
|
+
toolbar,
|
|
1639
|
+
header,
|
|
1640
|
+
footer,
|
|
1641
|
+
rangePicker,
|
|
1642
|
+
weekHeader
|
|
1643
|
+
} = calendar.params;
|
|
1644
|
+
const {
|
|
1645
|
+
value,
|
|
1646
|
+
hasTimePicker
|
|
1647
|
+
} = calendar;
|
|
1648
|
+
const date = value && value.length ? value[0] : new Date().setHours(0, 0, 0);
|
|
1614
1649
|
return $jsx("div", {
|
|
1615
|
-
class:
|
|
1650
|
+
class: `sheet-modal calendar calendar-sheet ${rangePicker ? 'calendar-range' : ''} ${cssClass || ''}`
|
|
1616
1651
|
}, header && calendar.renderHeader(), toolbar && calendar.renderToolbar(), weekHeader && calendar.renderWeekHeader(), $jsx("div", {
|
|
1617
1652
|
class: "sheet-modal-inner calendar-months"
|
|
1618
1653
|
}, calendar.renderMonths(date)), hasTimePicker && calendar.renderTimeSelector(), footer && calendar.renderFooter());
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
renderPopover() {
|
|
1657
|
+
const calendar = this;
|
|
1658
|
+
const {
|
|
1659
|
+
cssClass,
|
|
1660
|
+
toolbar,
|
|
1661
|
+
header,
|
|
1662
|
+
footer,
|
|
1663
|
+
rangePicker,
|
|
1664
|
+
weekHeader
|
|
1665
|
+
} = calendar.params;
|
|
1666
|
+
const {
|
|
1667
|
+
value,
|
|
1668
|
+
hasTimePicker
|
|
1669
|
+
} = calendar;
|
|
1670
|
+
const date = value && value.length ? value[0] : new Date().setHours(0, 0, 0);
|
|
1633
1671
|
return $jsx("div", {
|
|
1634
1672
|
class: "popover calendar-popover"
|
|
1635
1673
|
}, $jsx("div", {
|
|
1636
1674
|
class: "popover-inner"
|
|
1637
1675
|
}, $jsx("div", {
|
|
1638
|
-
class:
|
|
1676
|
+
class: `calendar ${rangePicker ? 'calendar-range' : ''} ${cssClass || ''}`
|
|
1639
1677
|
}, header && calendar.renderHeader(), toolbar && calendar.renderToolbar(), weekHeader && calendar.renderWeekHeader(), $jsx("div", {
|
|
1640
1678
|
class: "calendar-months"
|
|
1641
1679
|
}, calendar.renderMonths(date)), hasTimePicker && calendar.renderTimeSelector(), footer && calendar.renderFooter())));
|
|
1642
|
-
}
|
|
1680
|
+
}
|
|
1643
1681
|
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1682
|
+
render() {
|
|
1683
|
+
const calendar = this;
|
|
1684
|
+
const {
|
|
1685
|
+
params
|
|
1686
|
+
} = calendar;
|
|
1647
1687
|
if (params.render) return params.render.call(calendar);
|
|
1648
1688
|
|
|
1649
1689
|
if (!calendar.inline) {
|
|
1650
|
-
|
|
1690
|
+
let modalType = params.openIn;
|
|
1651
1691
|
if (modalType === 'auto') modalType = calendar.isPopover() ? 'popover' : 'sheet';
|
|
1652
1692
|
if (modalType === 'popover') return calendar.renderPopover();
|
|
1653
1693
|
if (modalType === 'sheet') return calendar.renderSheet();
|
|
@@ -1655,29 +1695,31 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1655
1695
|
}
|
|
1656
1696
|
|
|
1657
1697
|
return calendar.renderInline();
|
|
1658
|
-
}
|
|
1698
|
+
}
|
|
1659
1699
|
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1700
|
+
openTimePicker() {
|
|
1701
|
+
const calendar = this;
|
|
1702
|
+
const {
|
|
1703
|
+
$el,
|
|
1704
|
+
app,
|
|
1705
|
+
is12HoursFormat
|
|
1706
|
+
} = calendar;
|
|
1665
1707
|
if (!$el || !$el.length) return;
|
|
1666
1708
|
$el.append('<div class="calendar-time-picker"></div>');
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1709
|
+
const hoursArr = [];
|
|
1710
|
+
const minutesArr = [];
|
|
1711
|
+
const hoursMin = is12HoursFormat ? 1 : 0;
|
|
1712
|
+
const hoursMax = is12HoursFormat ? 12 : 23;
|
|
1671
1713
|
|
|
1672
|
-
for (
|
|
1714
|
+
for (let i = hoursMin; i <= hoursMax; i += 1) {
|
|
1673
1715
|
hoursArr.push(i);
|
|
1674
1716
|
}
|
|
1675
1717
|
|
|
1676
|
-
for (
|
|
1677
|
-
minutesArr.push(
|
|
1718
|
+
for (let i = 0; i <= 59; i += 1) {
|
|
1719
|
+
minutesArr.push(i);
|
|
1678
1720
|
}
|
|
1679
1721
|
|
|
1680
|
-
|
|
1722
|
+
let value;
|
|
1681
1723
|
|
|
1682
1724
|
if (calendar.value && calendar.value.length) {
|
|
1683
1725
|
value = [calendar.value[0].getHours(), calendar.value[0].getMinutes()];
|
|
@@ -1693,7 +1735,7 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1693
1735
|
|
|
1694
1736
|
calendar.timePickerInstance = app.picker.create({
|
|
1695
1737
|
containerEl: $el.find('.calendar-time-picker'),
|
|
1696
|
-
value
|
|
1738
|
+
value,
|
|
1697
1739
|
toolbar: true,
|
|
1698
1740
|
rotateEffect: false,
|
|
1699
1741
|
toolbarCloseText: calendar.params.toolbarCloseText,
|
|
@@ -1704,25 +1746,25 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1704
1746
|
content: ':'
|
|
1705
1747
|
}, {
|
|
1706
1748
|
values: minutesArr,
|
|
1707
|
-
displayValues: minutesArr.map(
|
|
1708
|
-
|
|
1709
|
-
})
|
|
1710
|
-
}].concat(is12HoursFormat ? [{
|
|
1749
|
+
displayValues: minutesArr.map(m => m < 10 ? `0${m}` : m)
|
|
1750
|
+
}, ...(is12HoursFormat ? [{
|
|
1711
1751
|
values: ['AM', 'PM']
|
|
1712
|
-
}] : [])
|
|
1752
|
+
}] : [])]
|
|
1713
1753
|
});
|
|
1714
1754
|
calendar.timePickerInstance.$el.find('.toolbar a').removeClass('sheet-close popover-close').addClass('calendar-time-picker-close');
|
|
1715
|
-
}
|
|
1755
|
+
}
|
|
1716
1756
|
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1757
|
+
closeTimePicker() {
|
|
1758
|
+
const calendar = this;
|
|
1759
|
+
const {
|
|
1760
|
+
is12HoursFormat
|
|
1761
|
+
} = calendar;
|
|
1720
1762
|
|
|
1721
1763
|
if (calendar.timePickerInstance) {
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1764
|
+
const timePickerValue = calendar.timePickerInstance.value;
|
|
1765
|
+
let hours = parseInt(timePickerValue[0], 10);
|
|
1766
|
+
const minutes = parseInt(timePickerValue[1], 10);
|
|
1767
|
+
const period = calendar.timePickerInstance.value[2];
|
|
1726
1768
|
|
|
1727
1769
|
if (is12HoursFormat) {
|
|
1728
1770
|
if (period === 'AM' && hours === 12) {
|
|
@@ -1732,7 +1774,7 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1732
1774
|
}
|
|
1733
1775
|
}
|
|
1734
1776
|
|
|
1735
|
-
|
|
1777
|
+
let value = calendar.value && calendar.value.length && calendar.value[0];
|
|
1736
1778
|
|
|
1737
1779
|
if (!value) {
|
|
1738
1780
|
value = new Date();
|
|
@@ -1751,23 +1793,25 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1751
1793
|
if (calendar.$el && calendar.$el.length) {
|
|
1752
1794
|
calendar.$el.find('.calendar-time-picker').remove();
|
|
1753
1795
|
}
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
onOpen() {
|
|
1799
|
+
const calendar = this;
|
|
1800
|
+
const {
|
|
1801
|
+
initialized,
|
|
1802
|
+
$el,
|
|
1803
|
+
app,
|
|
1804
|
+
$inputEl,
|
|
1805
|
+
inline,
|
|
1806
|
+
value,
|
|
1807
|
+
params
|
|
1808
|
+
} = calendar;
|
|
1765
1809
|
calendar.closing = false;
|
|
1766
1810
|
calendar.opened = true;
|
|
1767
1811
|
calendar.opening = true; // Init main events
|
|
1768
1812
|
|
|
1769
1813
|
calendar.attachCalendarEvents();
|
|
1770
|
-
|
|
1814
|
+
const updateValue = !value && params.value; // Set value
|
|
1771
1815
|
|
|
1772
1816
|
if (!initialized) {
|
|
1773
1817
|
if (value) calendar.setValue(value, 0);else if (params.value) {
|
|
@@ -1792,7 +1836,7 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1792
1836
|
}
|
|
1793
1837
|
|
|
1794
1838
|
calendar.initialized = true;
|
|
1795
|
-
calendar.$months.each(
|
|
1839
|
+
calendar.$months.each(monthEl => {
|
|
1796
1840
|
calendar.emit('local::monthAdd calendarMonthAdd', monthEl);
|
|
1797
1841
|
}); // Trigger events
|
|
1798
1842
|
|
|
@@ -1805,10 +1849,10 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1805
1849
|
}
|
|
1806
1850
|
|
|
1807
1851
|
calendar.emit('local::open calendarOpen', calendar);
|
|
1808
|
-
}
|
|
1852
|
+
}
|
|
1809
1853
|
|
|
1810
|
-
|
|
1811
|
-
|
|
1854
|
+
onOpened() {
|
|
1855
|
+
const calendar = this;
|
|
1812
1856
|
calendar.opening = false;
|
|
1813
1857
|
|
|
1814
1858
|
if (calendar.$el) {
|
|
@@ -1820,11 +1864,11 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1820
1864
|
}
|
|
1821
1865
|
|
|
1822
1866
|
calendar.emit('local::opened calendarOpened', calendar);
|
|
1823
|
-
}
|
|
1867
|
+
}
|
|
1824
1868
|
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1869
|
+
onClose() {
|
|
1870
|
+
const calendar = this;
|
|
1871
|
+
const app = calendar.app;
|
|
1828
1872
|
calendar.opening = false;
|
|
1829
1873
|
calendar.closing = true;
|
|
1830
1874
|
|
|
@@ -1832,8 +1876,8 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1832
1876
|
if (app.theme === 'md') {
|
|
1833
1877
|
calendar.$inputEl.trigger('blur');
|
|
1834
1878
|
} else {
|
|
1835
|
-
|
|
1836
|
-
|
|
1879
|
+
const validate = calendar.$inputEl.attr('validate');
|
|
1880
|
+
const required = calendar.$inputEl.attr('required');
|
|
1837
1881
|
|
|
1838
1882
|
if (validate && required) {
|
|
1839
1883
|
app.input.validate(calendar.$inputEl);
|
|
@@ -1854,15 +1898,15 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1854
1898
|
}
|
|
1855
1899
|
|
|
1856
1900
|
calendar.emit('local::close calendarClose', calendar);
|
|
1857
|
-
}
|
|
1901
|
+
}
|
|
1858
1902
|
|
|
1859
|
-
|
|
1860
|
-
|
|
1903
|
+
onClosed() {
|
|
1904
|
+
const calendar = this;
|
|
1861
1905
|
calendar.opened = false;
|
|
1862
1906
|
calendar.closing = false;
|
|
1863
1907
|
|
|
1864
1908
|
if (!calendar.inline) {
|
|
1865
|
-
nextTick(
|
|
1909
|
+
nextTick(() => {
|
|
1866
1910
|
if (calendar.modal && calendar.modal.el && calendar.modal.destroy) {
|
|
1867
1911
|
if (!calendar.params.routableModals) {
|
|
1868
1912
|
calendar.modal.destroy();
|
|
@@ -1887,15 +1931,17 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1887
1931
|
}
|
|
1888
1932
|
|
|
1889
1933
|
calendar.emit('local::closed calendarClosed', calendar);
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
open() {
|
|
1937
|
+
const calendar = this;
|
|
1938
|
+
const {
|
|
1939
|
+
app,
|
|
1940
|
+
opened,
|
|
1941
|
+
inline,
|
|
1942
|
+
$inputEl,
|
|
1943
|
+
params
|
|
1944
|
+
} = calendar;
|
|
1899
1945
|
if (opened) return;
|
|
1900
1946
|
|
|
1901
1947
|
if (inline) {
|
|
@@ -1909,22 +1955,22 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1909
1955
|
return;
|
|
1910
1956
|
}
|
|
1911
1957
|
|
|
1912
|
-
|
|
1958
|
+
let modalType = params.openIn;
|
|
1913
1959
|
|
|
1914
1960
|
if (modalType === 'auto') {
|
|
1915
1961
|
modalType = calendar.isPopover() ? 'popover' : 'sheet';
|
|
1916
1962
|
}
|
|
1917
1963
|
|
|
1918
|
-
|
|
1919
|
-
|
|
1964
|
+
const modalContent = calendar.render();
|
|
1965
|
+
const modalParams = {
|
|
1920
1966
|
targetEl: $inputEl,
|
|
1921
1967
|
scrollToEl: params.scrollToInput ? $inputEl : undefined,
|
|
1922
1968
|
content: modalContent,
|
|
1923
1969
|
backdrop: params.backdrop === true || modalType === 'popover' && app.params.popover.backdrop !== false && params.backdrop !== false,
|
|
1924
1970
|
closeByBackdropClick: params.closeByBackdropClick,
|
|
1925
1971
|
on: {
|
|
1926
|
-
open
|
|
1927
|
-
|
|
1972
|
+
open() {
|
|
1973
|
+
const modal = this;
|
|
1928
1974
|
calendar.modal = modal;
|
|
1929
1975
|
calendar.$el = modalType === 'popover' ? modal.$el.find('.calendar') : modal.$el;
|
|
1930
1976
|
calendar.$wrapperEl = calendar.$el.find('.calendar-months-wrapper');
|
|
@@ -1932,22 +1978,26 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1932
1978
|
calendar.$el[0].f7Calendar = calendar;
|
|
1933
1979
|
|
|
1934
1980
|
if (modalType === 'customModal') {
|
|
1935
|
-
$(calendar.$el).find('.calendar-close').once('click',
|
|
1981
|
+
$(calendar.$el).find('.calendar-close').once('click', () => {
|
|
1936
1982
|
calendar.close();
|
|
1937
1983
|
});
|
|
1938
1984
|
}
|
|
1939
1985
|
|
|
1940
1986
|
calendar.onOpen();
|
|
1941
1987
|
},
|
|
1942
|
-
|
|
1988
|
+
|
|
1989
|
+
opened() {
|
|
1943
1990
|
calendar.onOpened();
|
|
1944
1991
|
},
|
|
1945
|
-
|
|
1992
|
+
|
|
1993
|
+
close() {
|
|
1946
1994
|
calendar.onClose();
|
|
1947
1995
|
},
|
|
1948
|
-
|
|
1996
|
+
|
|
1997
|
+
closed() {
|
|
1949
1998
|
calendar.onClosed();
|
|
1950
1999
|
}
|
|
2000
|
+
|
|
1951
2001
|
}
|
|
1952
2002
|
};
|
|
1953
2003
|
|
|
@@ -1957,24 +2007,25 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1957
2007
|
}
|
|
1958
2008
|
|
|
1959
2009
|
if (params.routableModals && calendar.view) {
|
|
1960
|
-
var _route;
|
|
1961
|
-
|
|
1962
2010
|
calendar.view.router.navigate({
|
|
1963
2011
|
url: calendar.url,
|
|
1964
|
-
route:
|
|
1965
|
-
path: calendar.url
|
|
1966
|
-
|
|
2012
|
+
route: {
|
|
2013
|
+
path: calendar.url,
|
|
2014
|
+
[modalType]: modalParams
|
|
2015
|
+
}
|
|
1967
2016
|
});
|
|
1968
2017
|
} else {
|
|
1969
2018
|
calendar.modal = app[modalType].create(modalParams);
|
|
1970
2019
|
calendar.modal.open();
|
|
1971
2020
|
}
|
|
1972
|
-
}
|
|
2021
|
+
}
|
|
1973
2022
|
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
2023
|
+
close() {
|
|
2024
|
+
const calendar = this;
|
|
2025
|
+
const {
|
|
2026
|
+
opened,
|
|
2027
|
+
inline
|
|
2028
|
+
} = calendar;
|
|
1978
2029
|
if (!opened) return;
|
|
1979
2030
|
|
|
1980
2031
|
if (inline) {
|
|
@@ -1988,10 +2039,10 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
1988
2039
|
} else {
|
|
1989
2040
|
calendar.modal.close();
|
|
1990
2041
|
}
|
|
1991
|
-
}
|
|
2042
|
+
}
|
|
1992
2043
|
|
|
1993
|
-
|
|
1994
|
-
|
|
2044
|
+
init() {
|
|
2045
|
+
const calendar = this;
|
|
1995
2046
|
calendar.initInput();
|
|
1996
2047
|
|
|
1997
2048
|
if (calendar.inline) {
|
|
@@ -2014,12 +2065,14 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
2014
2065
|
}
|
|
2015
2066
|
|
|
2016
2067
|
calendar.emit('local::init calendarInit', calendar);
|
|
2017
|
-
}
|
|
2068
|
+
}
|
|
2018
2069
|
|
|
2019
|
-
|
|
2020
|
-
|
|
2070
|
+
destroy() {
|
|
2071
|
+
const calendar = this;
|
|
2021
2072
|
if (calendar.destroyed) return;
|
|
2022
|
-
|
|
2073
|
+
const {
|
|
2074
|
+
$el
|
|
2075
|
+
} = calendar;
|
|
2023
2076
|
calendar.emit('local::beforeDestroy calendarBeforeDestroy', calendar);
|
|
2024
2077
|
if ($el) $el.trigger('calendar:beforedestroy');
|
|
2025
2078
|
calendar.close(); // Detach Events
|
|
@@ -2040,28 +2093,8 @@ var Calendar = /*#__PURE__*/function (_Framework7Class) {
|
|
|
2040
2093
|
if ($el && $el.length) delete calendar.$el[0].f7Calendar;
|
|
2041
2094
|
deleteProps(calendar);
|
|
2042
2095
|
calendar.destroyed = true;
|
|
2043
|
-
}
|
|
2044
|
-
|
|
2045
|
-
_createClass(Calendar, [{
|
|
2046
|
-
key: "view",
|
|
2047
|
-
get: function get() {
|
|
2048
|
-
var $inputEl = this.$inputEl,
|
|
2049
|
-
app = this.app,
|
|
2050
|
-
params = this.params;
|
|
2051
|
-
var view;
|
|
2052
|
-
|
|
2053
|
-
if (params.view) {
|
|
2054
|
-
view = params.view;
|
|
2055
|
-
} else if ($inputEl) {
|
|
2056
|
-
view = $inputEl.parents('.view').length && $inputEl.parents('.view')[0].f7View;
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
|
-
if (!view) view = app.views.main;
|
|
2060
|
-
return view;
|
|
2061
|
-
}
|
|
2062
|
-
}]);
|
|
2096
|
+
}
|
|
2063
2097
|
|
|
2064
|
-
|
|
2065
|
-
}(Framework7Class);
|
|
2098
|
+
}
|
|
2066
2099
|
|
|
2067
2100
|
export default Calendar;
|