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