framework7 7.1.5 → 8.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/accordion/accordion.js +2 -16
- package/components/accordion/accordion.less +0 -3
- package/components/actions/actions-class.js +13 -58
- package/components/actions/actions-ios.less +42 -0
- package/components/actions/actions-md.less +12 -0
- package/components/actions/actions-rtl.css +1 -1
- package/components/actions/actions-vars.less +17 -42
- package/components/actions/actions.css +1 -1
- package/components/actions/actions.d.ts +2 -2
- package/components/actions/actions.js +0 -4
- package/components/actions/actions.less +5 -35
- package/components/app/app-class.d.ts +14 -12
- package/components/app/app-class.js +93 -75
- package/components/app/app-ios.less +0 -2
- package/components/app/app-md.less +0 -2
- package/components/app/app-vars.less +13 -96
- package/components/app/app.less +1 -4
- package/components/app/load-module.js +17 -36
- package/components/area-chart/area-chart-class.js +8 -64
- package/components/area-chart/area-chart.js +0 -3
- package/components/area-chart/area-chart.less +0 -3
- package/components/autocomplete/autocomplete-class.js +30 -175
- package/components/autocomplete/autocomplete-ios.less +0 -8
- package/components/autocomplete/autocomplete-rtl.css +1 -1
- package/components/autocomplete/autocomplete-vars.less +8 -22
- package/components/autocomplete/autocomplete.css +1 -1
- package/components/autocomplete/autocomplete.d.ts +1 -3
- package/components/autocomplete/autocomplete.js +1 -6
- package/components/autocomplete/autocomplete.less +6 -18
- package/components/badge/badge-vars.less +3 -6
- package/components/badge/badge.less +1 -3
- package/components/block/block-vars.less +25 -52
- package/components/block/block.less +37 -12
- package/components/breadcrumbs/breadcrumbs-rtl.css +1 -1
- package/components/breadcrumbs/breadcrumbs-vars.less +31 -15
- package/components/breadcrumbs/breadcrumbs.css +1 -1
- package/components/breadcrumbs/breadcrumbs.js +0 -2
- package/components/breadcrumbs/breadcrumbs.less +4 -10
- package/components/button/button-vars.less +42 -43
- package/components/button/button.less +24 -26
- package/components/calendar/calendar-class.js +81 -401
- package/components/calendar/calendar-rtl.css +1 -1
- package/components/calendar/calendar-vars.less +32 -46
- package/components/calendar/calendar.css +1 -1
- package/components/calendar/calendar.js +6 -4
- package/components/calendar/calendar.less +10 -21
- package/components/card/card-rtl.css +1 -1
- package/components/card/card-vars.less +41 -44
- package/components/card/card.css +1 -1
- package/components/card/card.js +0 -108
- package/components/card/card.less +18 -24
- package/components/checkbox/checkbox-rtl.css +1 -1
- package/components/checkbox/checkbox-vars.less +0 -8
- package/components/checkbox/checkbox.css +1 -1
- package/components/checkbox/checkbox.less +32 -3
- package/components/chip/chip-ios.less +3 -0
- package/components/chip/chip-md.less +4 -3
- package/components/chip/chip-rtl.css +1 -1
- package/components/chip/chip-vars.less +17 -20
- package/components/chip/chip.css +1 -1
- package/components/chip/chip.less +16 -21
- package/components/color-picker/color-picker-class.js +27 -158
- 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 +0 -4
- package/components/color-picker/color-picker.less +18 -8
- package/components/color-picker/modules/alpha-slider.js +0 -12
- package/components/color-picker/modules/brightness-slider.js +0 -8
- package/components/color-picker/modules/current-color.js +0 -2
- package/components/color-picker/modules/hex.js +0 -12
- package/components/color-picker/modules/hs-spectrum.js +0 -20
- package/components/color-picker/modules/hsb-sliders.js +0 -18
- package/components/color-picker/modules/hue-slider.js +0 -7
- package/components/color-picker/modules/initial-current-colors.js +0 -7
- package/components/color-picker/modules/palette.js +2 -10
- package/components/color-picker/modules/rgb-bars.js +0 -17
- package/components/color-picker/modules/rgb-sliders.js +0 -17
- package/components/color-picker/modules/sb-spectrum.js +0 -20
- package/components/color-picker/modules/wheel.js +0 -28
- package/components/contacts-list/contacts-list-md.less +4 -3
- package/components/contacts-list/contacts-list-rtl.css +1 -1
- package/components/contacts-list/contacts-list-vars.less +3 -15
- package/components/contacts-list/contacts-list.css +1 -1
- package/components/contacts-list/contacts-list.less +0 -3
- package/components/data-table/data-table-class.js +10 -32
- package/components/data-table/data-table-rtl.css +1 -1
- package/components/data-table/data-table-vars.less +6 -39
- package/components/data-table/data-table.css +1 -1
- package/components/data-table/data-table.js +0 -8
- package/components/data-table/data-table.less +0 -3
- package/components/dialog/dialog-class.js +7 -41
- package/components/dialog/dialog-ios.less +0 -3
- package/components/dialog/dialog-md.less +9 -9
- package/components/dialog/dialog-rtl.css +1 -1
- package/components/dialog/dialog-vars.less +25 -70
- package/components/dialog/dialog.css +1 -1
- package/components/dialog/dialog.d.ts +2 -2
- package/components/dialog/dialog.js +12 -48
- package/components/dialog/dialog.less +8 -4
- package/components/fab/fab-rtl.css +1 -1
- package/components/fab/fab-vars.less +20 -14
- package/components/fab/fab.css +1 -1
- package/components/fab/fab.js +0 -21
- package/components/fab/fab.less +50 -53
- package/components/form/form.d.ts +4 -4
- package/components/form/form.js +58 -94
- package/components/form/form.less +0 -3
- package/components/gauge/gauge-class.js +4 -20
- package/components/gauge/gauge.js +0 -9
- package/components/gauge/gauge.less +0 -3
- package/components/grid/grid-rtl.css +1 -1
- package/components/grid/grid-vars.less +0 -7
- package/components/grid/grid.css +1 -1
- package/components/grid/grid.d.ts +2 -8
- package/components/grid/grid.js +1 -225
- package/components/grid/grid.less +54 -184
- package/components/icon/icon.less +0 -3
- package/components/infinite-scroll/infinite-scroll-rtl.css +1 -1
- package/components/infinite-scroll/infinite-scroll.css +1 -1
- package/components/infinite-scroll/infinite-scroll.js +0 -16
- package/components/infinite-scroll/infinite-scroll.less +0 -3
- package/components/input/input-ios.less +49 -41
- package/components/input/input-md.less +87 -19
- package/components/input/input-rtl.css +1 -1
- package/components/input/input-vars.less +26 -60
- package/components/input/input.css +1 -1
- package/components/input/input.js +8 -67
- package/components/input/input.less +67 -153
- package/components/link/link-vars.less +0 -5
- package/components/link/link.less +3 -3
- package/components/list/list-md.less +0 -7
- package/components/list/list-vars.less +59 -108
- package/components/list/list.less +122 -90
- package/components/list-index/list-index-class.js +12 -69
- package/components/list-index/list-index-rtl.css +1 -1
- package/components/list-index/list-index-vars.less +0 -7
- package/components/list-index/list-index.css +1 -1
- package/components/list-index/list-index.d.ts +1 -3
- package/components/list-index/list-index.js +0 -8
- package/components/list-index/list-index.less +4 -7
- package/components/login-screen/login-screen-class.js +4 -9
- package/components/login-screen/login-screen-rtl.css +1 -1
- package/components/login-screen/login-screen-vars.less +13 -12
- package/components/login-screen/login-screen.css +1 -1
- package/components/login-screen/login-screen.js +0 -4
- package/components/login-screen/login-screen.less +2 -8
- package/components/messagebar/messagebar-class.js +18 -79
- package/components/messagebar/messagebar-ios.less +36 -0
- package/components/messagebar/messagebar-md.less +96 -16
- package/components/messagebar/messagebar-rtl.css +1 -1
- package/components/messagebar/messagebar-vars.less +27 -50
- package/components/messagebar/messagebar.css +1 -1
- package/components/messagebar/messagebar.js +0 -8
- package/components/messagebar/messagebar.less +11 -42
- package/components/messages/messages-class.js +17 -110
- package/components/messages/messages-ios.less +9 -0
- package/components/messages/messages-md.less +63 -28
- package/components/messages/messages-rtl.css +1 -1
- package/components/messages/messages-vars.less +43 -50
- package/components/messages/messages.css +1 -1
- package/components/messages/messages.js +0 -8
- package/components/messages/messages.less +0 -11
- package/components/modal/custom-modal-class.js +4 -14
- package/components/modal/modal-class.js +19 -55
- package/components/modal/modal.js +0 -3
- package/components/navbar/navbar-ios.less +3 -39
- package/components/navbar/navbar-md.less +12 -0
- package/components/navbar/navbar-vars.less +20 -49
- package/components/navbar/navbar.d.ts +0 -2
- package/components/navbar/navbar.js +37 -166
- package/components/navbar/navbar.less +4 -26
- package/components/notification/notification-class.js +4 -39
- package/components/notification/notification-md.less +18 -8
- package/components/notification/notification-rtl.css +1 -1
- package/components/notification/notification-vars.less +15 -54
- package/components/notification/notification.css +1 -1
- package/components/notification/notification.js +0 -2
- package/components/notification/notification.less +0 -3
- package/components/page/page-md.less +40 -10
- package/components/page/page-transitions/circle.less +15 -9
- package/components/page/page-transitions/fade.less +17 -11
- package/components/page/page-transitions/flip.less +9 -4
- package/components/page/page-vars.less +3 -19
- package/components/page/page.less +2 -10
- package/components/panel/panel-class.js +27 -132
- package/components/panel/panel-md.less +9 -0
- package/components/panel/panel-rtl.css +1 -1
- package/components/panel/panel-vars.less +7 -21
- package/components/panel/panel.css +1 -1
- package/components/panel/panel.d.ts +2 -2
- package/components/panel/panel.js +0 -34
- package/components/panel/panel.less +56 -48
- package/components/panel/resizable-panel.js +2 -32
- package/components/panel/swipe-panel.js +16 -71
- package/components/photo-browser/photo-browser-class.js +41 -171
- package/components/photo-browser/photo-browser-rtl.css +1 -1
- package/components/photo-browser/photo-browser-vars.less +0 -3
- package/components/photo-browser/photo-browser.css +1 -1
- package/components/photo-browser/photo-browser.d.ts +2 -4
- package/components/photo-browser/photo-browser.js +1 -6
- package/components/photo-browser/photo-browser.less +0 -4
- package/components/picker/picker-class.js +26 -133
- package/components/picker/picker-column.js +11 -31
- package/components/picker/picker-ios.less +10 -0
- package/components/picker/picker-md.less +6 -0
- package/components/picker/picker-rtl.css +1 -1
- package/components/picker/picker-vars.less +9 -25
- package/components/picker/picker.css +1 -1
- package/components/picker/picker.js +0 -4
- package/components/picker/picker.less +0 -11
- package/components/pie-chart/pie-chart-class.js +8 -31
- package/components/pie-chart/pie-chart.js +0 -3
- package/components/pie-chart/pie-chart.less +0 -3
- package/components/popover/popover-class.js +72 -126
- package/components/popover/popover-ios.less +0 -50
- package/components/popover/popover-rtl.css +1 -1
- package/components/popover/popover-vars.less +6 -23
- package/components/popover/popover.css +1 -1
- package/components/popover/popover.d.ts +2 -0
- package/components/popover/popover.js +1 -12
- package/components/popover/popover.less +62 -5
- package/components/popup/popup-class.js +12 -78
- package/components/popup/popup-rtl.css +1 -1
- package/components/popup/popup-vars.less +7 -9
- package/components/popup/popup.css +1 -1
- package/components/popup/popup.js +0 -4
- package/components/popup/popup.less +4 -4
- package/components/preloader/preloader-ios.less +3 -1
- package/components/preloader/preloader-md.less +5 -1
- package/components/preloader/preloader-rtl.css +1 -1
- package/components/preloader/preloader-vars.less +0 -6
- package/components/preloader/preloader.css +1 -1
- package/components/preloader/preloader.js +8 -25
- package/components/preloader/preloader.less +6 -3
- package/components/progressbar/progressbar-rtl.css +1 -1
- package/components/progressbar/progressbar-vars.less +2 -12
- package/components/progressbar/progressbar.css +1 -1
- package/components/progressbar/progressbar.js +2 -31
- package/components/progressbar/progressbar.less +0 -3
- package/components/pull-to-refresh/pull-to-refresh-class.js +15 -107
- package/components/pull-to-refresh/pull-to-refresh-md.less +2 -1
- package/components/pull-to-refresh/pull-to-refresh-rtl.css +1 -1
- package/components/pull-to-refresh/pull-to-refresh-vars.less +0 -4
- package/components/pull-to-refresh/pull-to-refresh.css +1 -1
- package/components/pull-to-refresh/pull-to-refresh.js +0 -8
- package/components/pull-to-refresh/pull-to-refresh.less +0 -3
- package/components/radio/radio-rtl.css +1 -1
- package/components/radio/radio-vars.less +0 -7
- package/components/radio/radio.css +1 -1
- package/components/radio/radio.less +12 -5
- package/components/range/range-class.js +27 -112
- package/components/range/range-rtl.css +1 -1
- package/components/range/range-vars.less +10 -32
- package/components/range/range.css +1 -1
- package/components/range/range.js +0 -12
- package/components/range/range.less +0 -3
- package/components/searchbar/remove-diacritics.js +0 -4
- package/components/searchbar/searchbar-class.js +17 -138
- package/components/searchbar/searchbar-md.less +41 -16
- package/components/searchbar/searchbar-rtl.css +1 -1
- package/components/searchbar/searchbar-vars.less +25 -76
- package/components/searchbar/searchbar.css +1 -1
- package/components/searchbar/searchbar.d.ts +2 -2
- package/components/searchbar/searchbar.js +0 -15
- package/components/searchbar/searchbar.less +14 -28
- package/components/sheet/sheet-class.js +15 -110
- package/components/sheet/sheet-rtl.css +1 -1
- package/components/sheet/sheet-vars.less +17 -6
- package/components/sheet/sheet.css +1 -1
- package/components/sheet/sheet.js +0 -9
- package/components/sheet/sheet.less +10 -3
- package/components/skeleton/skeleton.less +0 -3
- package/components/smart-select/smart-select-class.js +39 -176
- package/components/smart-select/smart-select.d.ts +3 -3
- package/components/smart-select/smart-select.js +2 -14
- package/components/smart-select/smart-select.less +0 -3
- package/components/sortable/sortable-rtl.css +1 -1
- package/components/sortable/sortable-vars.less +8 -8
- package/components/sortable/sortable.css +1 -1
- package/components/sortable/sortable.js +0 -44
- package/components/sortable/sortable.less +0 -3
- package/components/statusbar/statusbar.js +0 -36
- package/components/statusbar/statusbar.less +0 -3
- package/components/stepper/stepper-class.js +10 -83
- package/components/stepper/stepper-rtl.css +1 -1
- package/components/stepper/stepper-vars.less +12 -24
- package/components/stepper/stepper.css +1 -1
- package/components/stepper/stepper.js +0 -12
- package/components/stepper/stepper.less +12 -23
- package/components/subnavbar/subnavbar-vars.less +3 -18
- package/components/subnavbar/subnavbar.js +0 -3
- package/components/subnavbar/subnavbar.less +1 -11
- package/components/swipeout/swipeout-rtl.css +1 -1
- package/components/swipeout/swipeout-vars.less +7 -6
- package/components/swipeout/swipeout.css +1 -1
- package/components/swipeout/swipeout.js +2 -99
- package/components/swipeout/swipeout.less +2 -7
- package/components/swiper/swiper-rtl.css +1 -1
- package/components/swiper/swiper.css +1 -1
- package/components/swiper/swiper.js +15 -48
- package/components/swiper/swiper.less +0 -15
- package/components/tabs/tabs-rtl.css +1 -1
- package/components/tabs/tabs.css +1 -1
- package/components/tabs/tabs.js +23 -60
- package/components/tabs/tabs.less +1 -3
- package/components/text-editor/text-editor-class.js +16 -102
- package/components/text-editor/text-editor-rtl.css +1 -1
- package/components/text-editor/text-editor-vars.less +12 -16
- package/components/text-editor/text-editor.css +1 -1
- package/components/text-editor/text-editor.js +0 -8
- package/components/text-editor/text-editor.less +0 -6
- package/components/timeline/timeline-rtl.css +1 -1
- package/components/timeline/timeline-vars.less +13 -47
- package/components/timeline/timeline.css +1 -1
- package/components/timeline/timeline.less +2 -9
- package/components/toast/toast-class.js +2 -16
- package/components/toast/toast-rtl.css +1 -1
- package/components/toast/toast-vars.less +5 -9
- package/components/toast/toast.css +1 -1
- package/components/toast/toast.js +0 -3
- package/components/toast/toast.less +0 -3
- package/components/toggle/toggle-class.js +6 -30
- package/components/toggle/toggle-ios.less +5 -1
- package/components/toggle/toggle-md.less +27 -11
- package/components/toggle/toggle-rtl.css +1 -1
- package/components/toggle/toggle-vars.less +19 -21
- package/components/toggle/toggle.css +1 -1
- package/components/toggle/toggle.js +0 -8
- package/components/toggle/toggle.less +0 -4
- package/components/toolbar/toolbar-ios.less +2 -2
- package/components/toolbar/toolbar-md.less +28 -4
- package/components/toolbar/toolbar-vars.less +17 -52
- package/components/toolbar/toolbar.js +5 -43
- package/components/toolbar/toolbar.less +27 -45
- package/components/tooltip/tooltip-class.js +10 -64
- package/components/tooltip/tooltip-rtl.css +1 -1
- package/components/tooltip/tooltip-vars.less +12 -3
- package/components/tooltip/tooltip.css +1 -1
- package/components/tooltip/tooltip.js +0 -15
- package/components/tooltip/tooltip.less +0 -3
- package/components/touch-ripple/touch-ripple-class.js +0 -13
- package/components/touch-ripple/touch-ripple.js +0 -4
- package/components/touch-ripple/touch-ripple.less +1 -5
- package/components/treeview/treeview-rtl.css +1 -1
- package/components/treeview/treeview-vars.less +0 -3
- package/components/treeview/treeview.css +1 -1
- package/components/treeview/treeview.js +2 -11
- package/components/treeview/treeview.less +0 -3
- package/components/typography/typography-rtl.css +1 -1
- package/components/typography/typography.css +1 -1
- package/components/typography/typography.less +25 -3
- package/components/view/resizable-view.js +2 -24
- package/components/view/view-class.js +28 -53
- package/components/view/view.d.ts +0 -14
- package/components/view/view.js +8 -32
- package/components/view/view.less +1 -4
- package/components/virtual-list/virtual-list-class.js +58 -146
- package/components/virtual-list/virtual-list.d.ts +1 -1
- package/components/virtual-list/virtual-list.js +0 -2
- package/components/virtual-list/virtual-list.less +0 -3
- package/framework7-bundle-rtl.css +3064 -6057
- package/framework7-bundle-rtl.min.css +3 -3
- package/framework7-bundle.css +3063 -6059
- package/framework7-bundle.esm.js +4 -10
- package/framework7-bundle.js +6442 -12377
- package/framework7-bundle.js.map +1 -1
- package/framework7-bundle.less +2 -27
- 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 +4 -10
- package/framework7-lite.esm.js +4 -6
- package/framework7-rtl.css +803 -1591
- package/framework7-rtl.min.css +3 -3
- package/framework7-types.d.ts +1 -32
- package/framework7.css +803 -1594
- package/framework7.d.ts +1 -32
- package/framework7.esm.js +4 -6
- package/framework7.less +2 -23
- package/framework7.min.css +3 -3
- package/less/mixins.less +7 -88
- package/modules/clicks/clicks.js +10 -22
- package/modules/component/$h.js +0 -3
- package/modules/component/$jsx.js +0 -5
- package/modules/component/component-class.js +13 -66
- package/modules/component/component.d.ts +1 -2
- package/modules/component/component.js +0 -8
- package/modules/component/eventslisteners.js +12 -20
- package/modules/component/parse-component.js +18 -20
- package/modules/component/snabbdom/h.js +3 -12
- package/modules/component/snabbdom/helpers/attachto.js +9 -14
- package/modules/component/snabbdom/htmldomapi.js +0 -16
- package/modules/component/snabbdom/modules/attributes.js +7 -11
- package/modules/component/snabbdom/modules/class.js +4 -8
- package/modules/component/snabbdom/modules/dataset.js +3 -7
- package/modules/component/snabbdom/modules/eventlisteners.js +16 -22
- package/modules/component/snabbdom/modules/hero.js +4 -44
- package/modules/component/snabbdom/modules/props.js +5 -9
- package/modules/component/snabbdom/modules/style.js +13 -30
- package/modules/component/snabbdom/snabbdom.bundle.js +0 -6
- package/modules/component/snabbdom/snabbdom.js +13 -72
- package/modules/component/snabbdom/thunk.js +3 -11
- package/modules/component/snabbdom/tovnode.js +1 -6
- package/modules/component/vdom.js +4 -62
- package/modules/demo-module.js +0 -8
- package/modules/device/device.js +6 -11
- package/modules/history/history.js +0 -1
- package/modules/resize/resize.js +8 -11
- package/modules/router/async-component.js +0 -3
- package/modules/router/back.js +86 -275
- package/modules/router/clear-previous-history.js +5 -18
- package/modules/router/component-loader.js +4 -25
- package/modules/router/modal.js +16 -43
- package/modules/router/navigate.js +80 -250
- package/modules/router/process-route-queue.js +0 -12
- package/modules/router/redirect.js +0 -8
- package/modules/router/router-class.js +92 -315
- package/modules/router/router.d.ts +3 -5
- package/modules/router/router.js +0 -3
- package/modules/router/swipe-back.js +35 -139
- package/modules/router/tab.js +14 -43
- package/modules/service-worker/service-worker.js +0 -11
- package/modules/store/create-store.js +10 -29
- package/modules/touch/touch.d.ts +2 -4
- package/modules/touch/touch.js +13 -108
- package/package.json +3 -14
- package/shared/$jsx.js +0 -6
- package/shared/class.js +18 -43
- package/shared/constructor-methods.js +0 -11
- package/shared/events-class.js +0 -17
- package/shared/get-device.js +18 -34
- package/shared/get-support.js +2 -8
- package/shared/history.js +2 -30
- package/shared/material-color-utils.js +728 -0
- package/shared/material-colors.js +75 -0
- package/shared/modal-methods.js +0 -18
- package/shared/utils.d.ts +0 -4
- package/shared/utils.js +191 -71
- package/components/accordion/accordion-aurora.less +0 -2
- package/components/accordion/accordion.lazy.js +0 -1
- package/components/actions/actions-aurora.less +0 -9
- package/components/actions/actions.lazy.js +0 -1
- package/components/app/app-aurora.less +0 -10
- package/components/appbar/appbar-aurora.less +0 -2
- package/components/appbar/appbar-ios.less +0 -2
- package/components/appbar/appbar-md.less +0 -2
- package/components/appbar/appbar-rtl.css +0 -1
- package/components/appbar/appbar-vars.less +0 -28
- package/components/appbar/appbar.css +0 -1
- package/components/appbar/appbar.d.ts +0 -14
- package/components/appbar/appbar.js +0 -3
- package/components/appbar/appbar.lazy.js +0 -1
- package/components/appbar/appbar.less +0 -106
- package/components/area-chart/area-chart-aurora.less +0 -2
- package/components/area-chart/area-chart.lazy.js +0 -1
- package/components/autocomplete/autocomplete-aurora.less +0 -17
- package/components/autocomplete/autocomplete.lazy.js +0 -1
- package/components/badge/badge-aurora.less +0 -2
- package/components/block/block-aurora.less +0 -2
- package/components/breadcrumbs/breadcrumbs-aurora.less +0 -2
- package/components/breadcrumbs/breadcrumbs.lazy.js +0 -1
- package/components/button/button-aurora.less +0 -25
- package/components/calendar/calendar-aurora.less +0 -2
- package/components/calendar/calendar.lazy.js +0 -1
- package/components/card/card-aurora.less +0 -2
- package/components/card/card.lazy.js +0 -1
- package/components/checkbox/checkbox-aurora.less +0 -39
- package/components/checkbox/checkbox.lazy.js +0 -1
- package/components/chip/chip-aurora.less +0 -14
- package/components/chip/chip.lazy.js +0 -1
- package/components/color-picker/color-picker-aurora.less +0 -2
- package/components/color-picker/color-picker.lazy.js +0 -1
- package/components/contacts-list/contacts-list-aurora.less +0 -2
- package/components/contacts-list/contacts-list.lazy.js +0 -1
- package/components/data-table/data-table-aurora.less +0 -64
- package/components/data-table/data-table.lazy.js +0 -1
- package/components/dialog/dialog-aurora.less +0 -112
- package/components/dialog/dialog.lazy.js +0 -1
- package/components/elevation/elevation-aurora.less +0 -2
- package/components/elevation/elevation-ios.less +0 -2
- package/components/elevation/elevation-md.less +0 -2
- package/components/elevation/elevation-rtl.css +0 -1
- package/components/elevation/elevation-vars.less +0 -51
- package/components/elevation/elevation.css +0 -1
- package/components/elevation/elevation.d.ts +0 -14
- package/components/elevation/elevation.js +0 -3
- package/components/elevation/elevation.lazy.js +0 -1
- package/components/elevation/elevation.less +0 -54
- package/components/fab/fab-aurora.less +0 -2
- package/components/fab/fab.lazy.js +0 -1
- package/components/form/form-aurora.less +0 -0
- package/components/form/form.lazy.js +0 -1
- package/components/gauge/gauge-aurora.less +0 -2
- package/components/gauge/gauge.lazy.js +0 -1
- package/components/grid/grid-aurora.less +0 -2
- package/components/grid/grid.lazy.js +0 -1
- package/components/icon/icon-aurora.less +0 -49
- package/components/infinite-scroll/infinite-scroll-aurora.less +0 -6
- package/components/infinite-scroll/infinite-scroll.lazy.js +0 -1
- package/components/input/input-aurora.less +0 -120
- package/components/input/input.lazy.js +0 -1
- package/components/lazy/lazy-aurora.less +0 -2
- package/components/lazy/lazy-ios.less +0 -2
- package/components/lazy/lazy-md.less +0 -2
- package/components/lazy/lazy-rtl.css +0 -1
- package/components/lazy/lazy.css +0 -1
- package/components/lazy/lazy.d.ts +0 -57
- package/components/lazy/lazy.js +0 -283
- package/components/lazy/lazy.lazy.js +0 -1
- package/components/lazy/lazy.less +0 -23
- package/components/link/link-aurora.less +0 -15
- package/components/list/list-aurora.less +0 -25
- package/components/list-index/list-index-aurora.less +0 -21
- package/components/list-index/list-index.lazy.js +0 -1
- package/components/login-screen/login-screen-aurora.less +0 -2
- package/components/login-screen/login-screen.lazy.js +0 -1
- package/components/menu/menu-aurora.less +0 -8
- package/components/menu/menu-ios.less +0 -2
- package/components/menu/menu-md.less +0 -2
- package/components/menu/menu-rtl.css +0 -1
- package/components/menu/menu-vars.less +0 -27
- package/components/menu/menu.css +0 -1
- package/components/menu/menu.d.ts +0 -32
- package/components/menu/menu.js +0 -87
- package/components/menu/menu.lazy.js +0 -1
- package/components/menu/menu.less +0 -232
- package/components/messagebar/messagebar-aurora.less +0 -53
- package/components/messagebar/messagebar.lazy.js +0 -1
- package/components/messages/messages-aurora.less +0 -137
- package/components/messages/messages.lazy.js +0 -1
- package/components/navbar/navbar-aurora.less +0 -70
- package/components/notification/notification-aurora.less +0 -59
- package/components/notification/notification.lazy.js +0 -1
- package/components/page/page-aurora.less +0 -49
- package/components/panel/panel-aurora.less +0 -2
- package/components/panel/panel.lazy.js +0 -1
- package/components/photo-browser/photo-browser-aurora.less +0 -2
- package/components/photo-browser/photo-browser.lazy.js +0 -1
- package/components/picker/picker-aurora.less +0 -2
- package/components/picker/picker.lazy.js +0 -1
- package/components/pie-chart/pie-chart-aurora.less +0 -2
- package/components/pie-chart/pie-chart.lazy.js +0 -1
- package/components/popover/popover-aurora.less +0 -56
- package/components/popover/popover.lazy.js +0 -1
- package/components/popup/popup-aurora.less +0 -2
- package/components/popup/popup.lazy.js +0 -1
- package/components/preloader/preloader-aurora.less +0 -53
- package/components/preloader/preloader.lazy.js +0 -1
- package/components/progressbar/progressbar-aurora.less +0 -72
- package/components/progressbar/progressbar.lazy.js +0 -1
- package/components/pull-to-refresh/pull-to-refresh-aurora.less +0 -122
- package/components/pull-to-refresh/pull-to-refresh.lazy.js +0 -1
- package/components/radio/radio-aurora.less +0 -86
- package/components/radio/radio.lazy.js +0 -1
- package/components/range/range-aurora.less +0 -9
- package/components/range/range.lazy.js +0 -1
- package/components/searchbar/searchbar-aurora.less +0 -86
- package/components/searchbar/searchbar.lazy.js +0 -1
- package/components/sheet/sheet-aurora.less +0 -2
- package/components/sheet/sheet.lazy.js +0 -1
- package/components/skeleton/skeleton-aurora.less +0 -2
- package/components/skeleton/skeleton.lazy.js +0 -1
- package/components/smart-select/smart-select-aurora.less +0 -2
- package/components/smart-select/smart-select.lazy.js +0 -1
- package/components/sortable/sortable-aurora.less +0 -7
- package/components/sortable/sortable.lazy.js +0 -1
- package/components/statusbar/statusbar-aurora.less +0 -2
- package/components/stepper/stepper-aurora.less +0 -32
- package/components/stepper/stepper.lazy.js +0 -1
- package/components/subnavbar/subnavbar-aurora.less +0 -51
- package/components/swipeout/swipeout-aurora.less +0 -2
- package/components/swipeout/swipeout.lazy.js +0 -1
- package/components/swiper/swiper-aurora.less +0 -2
- package/components/swiper/swiper.lazy.js +0 -1
- package/components/tabs/tabs-aurora.less +0 -2
- package/components/tabs/tabs.lazy.js +0 -1
- package/components/text-editor/text-editor-aurora.less +0 -9
- package/components/text-editor/text-editor.lazy.js +0 -1
- package/components/timeline/timeline-aurora.less +0 -7
- package/components/timeline/timeline.lazy.js +0 -1
- package/components/toast/toast-aurora.less +0 -64
- package/components/toast/toast.lazy.js +0 -1
- package/components/toggle/toggle-aurora.less +0 -26
- package/components/toggle/toggle.lazy.js +0 -1
- package/components/toolbar/toolbar-aurora.less +0 -43
- package/components/tooltip/tooltip-aurora.less +0 -2
- package/components/tooltip/tooltip.lazy.js +0 -1
- package/components/touch-ripple/touch-ripple-aurora.less +0 -2
- package/components/treeview/treeview-aurora.less +0 -31
- package/components/treeview/treeview.lazy.js +0 -1
- package/components/typography/typography-aurora.less +0 -2
- package/components/typography/typography.lazy.js +0 -1
- package/components/view/view-aurora.less +0 -2
- package/components/virtual-list/virtual-list-aurora.less +0 -2
- package/components/virtual-list/virtual-list.lazy.js +0 -1
- package/framework7.js +0 -14715
- package/framework7.js.map +0 -1
- package/framework7.min.js +0 -14
- package/framework7.min.js.map +0 -1
- package/modules/request/request.d.ts +0 -15
- package/modules/request/request.js +0 -11
- package/shared/request.d.ts +0 -115
- package/shared/request.js +0 -512
|
@@ -11,14 +11,13 @@ import { modalLoad, modalRemove } from './modal.js';
|
|
|
11
11
|
import { back } from './back.js';
|
|
12
12
|
import { clearPreviousHistory } from './clear-previous-history.js';
|
|
13
13
|
import appRouterCheck from './app-router-check.js';
|
|
14
|
-
|
|
15
14
|
class Router extends Framework7Class {
|
|
16
15
|
constructor(app, view) {
|
|
17
16
|
super({}, [typeof view === 'undefined' ? app : view]);
|
|
18
|
-
const router = this;
|
|
17
|
+
const router = this;
|
|
19
18
|
|
|
19
|
+
// Is App Router
|
|
20
20
|
router.isAppRouter = typeof view === 'undefined';
|
|
21
|
-
|
|
22
21
|
if (router.isAppRouter) {
|
|
23
22
|
// App Router
|
|
24
23
|
extend(false, router, {
|
|
@@ -44,52 +43,46 @@ class Router extends Framework7Class {
|
|
|
44
43
|
initialPages: [],
|
|
45
44
|
initialNavbars: []
|
|
46
45
|
});
|
|
47
|
-
}
|
|
48
|
-
|
|
46
|
+
}
|
|
49
47
|
|
|
50
|
-
|
|
48
|
+
// Install Modules
|
|
49
|
+
router.useModules();
|
|
51
50
|
|
|
52
|
-
|
|
51
|
+
// AllowPageChage
|
|
52
|
+
router.allowPageChange = true;
|
|
53
53
|
|
|
54
|
+
// Current Route
|
|
54
55
|
let currentRoute = {};
|
|
55
56
|
let previousRoute = {};
|
|
56
57
|
Object.defineProperty(router, 'currentRoute', {
|
|
57
58
|
enumerable: true,
|
|
58
59
|
configurable: true,
|
|
59
|
-
|
|
60
60
|
set(newRoute) {
|
|
61
61
|
if (newRoute === void 0) {
|
|
62
62
|
newRoute = {};
|
|
63
63
|
}
|
|
64
|
-
|
|
65
64
|
previousRoute = extend({}, currentRoute);
|
|
66
65
|
currentRoute = newRoute;
|
|
67
66
|
if (!currentRoute) return;
|
|
68
67
|
router.url = currentRoute.url;
|
|
69
68
|
router.emit('routeChange', newRoute, previousRoute, router);
|
|
70
69
|
},
|
|
71
|
-
|
|
72
70
|
get() {
|
|
73
71
|
return currentRoute;
|
|
74
72
|
}
|
|
75
|
-
|
|
76
73
|
});
|
|
77
74
|
Object.defineProperty(router, 'previousRoute', {
|
|
78
75
|
enumerable: true,
|
|
79
76
|
configurable: true,
|
|
80
|
-
|
|
81
77
|
get() {
|
|
82
78
|
return previousRoute;
|
|
83
79
|
},
|
|
84
|
-
|
|
85
80
|
set(newRoute) {
|
|
86
81
|
previousRoute = newRoute;
|
|
87
82
|
}
|
|
88
|
-
|
|
89
83
|
});
|
|
90
84
|
return router;
|
|
91
85
|
}
|
|
92
|
-
|
|
93
86
|
mount() {
|
|
94
87
|
const router = this;
|
|
95
88
|
const view = router.view;
|
|
@@ -103,27 +96,22 @@ class Router extends Framework7Class {
|
|
|
103
96
|
});
|
|
104
97
|
router.emit('local::mount routerMount', router);
|
|
105
98
|
}
|
|
106
|
-
|
|
107
99
|
animatableNavElements($newNavbarEl, $oldNavbarEl, toLarge, fromLarge, direction) {
|
|
108
100
|
const router = this;
|
|
109
101
|
const dynamicNavbar = router.dynamicNavbar;
|
|
110
102
|
const animateIcon = router.params.iosAnimateNavbarBackIcon;
|
|
111
103
|
let newNavEls;
|
|
112
104
|
let oldNavEls;
|
|
113
|
-
|
|
114
105
|
function animatableNavEl($el, $navbarInner) {
|
|
115
106
|
const isSliding = $el.hasClass('sliding') || $navbarInner.hasClass('sliding');
|
|
116
107
|
const isSubnavbar = $el.hasClass('subnavbar');
|
|
117
108
|
const needsOpacityTransition = isSliding ? !isSubnavbar : true;
|
|
118
109
|
const $iconEl = $el.find('.back .icon');
|
|
119
110
|
let isIconLabel;
|
|
120
|
-
|
|
121
111
|
if (isSliding && animateIcon && $el.hasClass('left') && $iconEl.length > 0 && $iconEl.next('span').length) {
|
|
122
112
|
$el = $iconEl.next('span'); // eslint-disable-line
|
|
123
|
-
|
|
124
113
|
isIconLabel = true;
|
|
125
114
|
}
|
|
126
|
-
|
|
127
115
|
return {
|
|
128
116
|
$el,
|
|
129
117
|
isIconLabel,
|
|
@@ -134,7 +122,6 @@ class Router extends Framework7Class {
|
|
|
134
122
|
needsOpacityTransition
|
|
135
123
|
};
|
|
136
124
|
}
|
|
137
|
-
|
|
138
125
|
if (dynamicNavbar) {
|
|
139
126
|
newNavEls = [];
|
|
140
127
|
oldNavEls = [];
|
|
@@ -144,21 +131,17 @@ class Router extends Framework7Class {
|
|
|
144
131
|
if ($navEl.hasClass('title') && toLarge) return;
|
|
145
132
|
newNavEls.push(animatableNavEl($navEl, $newNavbarEl.children('.navbar-inner')));
|
|
146
133
|
});
|
|
147
|
-
|
|
148
134
|
if (!($oldNavbarEl.hasClass('navbar-master') && router.params.masterDetailBreakpoint > 0 && router.app.width >= router.params.masterDetailBreakpoint)) {
|
|
149
135
|
$oldNavbarEl.children('.navbar-inner').children('.left, .right, .title, .subnavbar').each(navEl => {
|
|
150
136
|
const $navEl = $(navEl);
|
|
151
137
|
if ($navEl.hasClass('left') && toLarge && !fromLarge && direction === 'forward') return;
|
|
152
138
|
if ($navEl.hasClass('left') && toLarge && direction === 'backward') return;
|
|
153
|
-
|
|
154
139
|
if ($navEl.hasClass('title') && fromLarge) {
|
|
155
140
|
return;
|
|
156
141
|
}
|
|
157
|
-
|
|
158
142
|
oldNavEls.push(animatableNavEl($navEl, $oldNavbarEl.children('.navbar-inner')));
|
|
159
143
|
});
|
|
160
144
|
}
|
|
161
|
-
|
|
162
145
|
[oldNavEls, newNavEls].forEach(navEls => {
|
|
163
146
|
navEls.forEach(navEl => {
|
|
164
147
|
const n = navEl;
|
|
@@ -177,64 +160,52 @@ class Router extends Framework7Class {
|
|
|
177
160
|
});
|
|
178
161
|
});
|
|
179
162
|
}
|
|
180
|
-
|
|
181
163
|
return {
|
|
182
164
|
newNavEls,
|
|
183
165
|
oldNavEls
|
|
184
166
|
};
|
|
185
167
|
}
|
|
186
|
-
|
|
187
168
|
animate($oldPageEl, $newPageEl, $oldNavbarEl, $newNavbarEl, direction, transition, callback) {
|
|
188
169
|
const router = this;
|
|
189
|
-
|
|
190
170
|
if (router.params.animateCustom) {
|
|
191
171
|
router.params.animateCustom.apply(router, [$oldPageEl, $newPageEl, $oldNavbarEl, $newNavbarEl, direction, callback]);
|
|
192
172
|
return;
|
|
193
173
|
}
|
|
194
|
-
|
|
195
174
|
const dynamicNavbar = router.dynamicNavbar;
|
|
196
175
|
const ios = router.app.theme === 'ios';
|
|
197
|
-
|
|
198
176
|
if (transition) {
|
|
199
|
-
const routerCustomTransitionClass = `router-transition-custom router-transition-${transition}-${direction}`;
|
|
200
|
-
|
|
177
|
+
const routerCustomTransitionClass = `router-transition-custom router-transition-${transition}-${direction}`;
|
|
178
|
+
// Animate
|
|
201
179
|
const onCustomTransitionDone = () => {
|
|
202
180
|
router.$el.removeClass(routerCustomTransitionClass);
|
|
203
|
-
|
|
204
181
|
if (dynamicNavbar && router.$navbarsEl.length) {
|
|
205
182
|
if ($newNavbarEl) {
|
|
206
183
|
router.$navbarsEl.prepend($newNavbarEl);
|
|
207
184
|
}
|
|
208
|
-
|
|
209
185
|
if ($oldNavbarEl) {
|
|
210
186
|
router.$navbarsEl.prepend($oldNavbarEl);
|
|
211
187
|
}
|
|
212
188
|
}
|
|
213
|
-
|
|
214
189
|
if (callback) callback();
|
|
215
190
|
};
|
|
216
|
-
|
|
217
191
|
(direction === 'forward' ? $newPageEl : $oldPageEl).animationEnd(onCustomTransitionDone);
|
|
218
|
-
|
|
219
192
|
if (dynamicNavbar) {
|
|
220
193
|
if ($newNavbarEl && $newPageEl) {
|
|
221
194
|
router.setNavbarPosition($newNavbarEl, '');
|
|
222
195
|
$newNavbarEl.removeClass('navbar-next navbar-previous navbar-current');
|
|
223
196
|
$newPageEl.prepend($newNavbarEl);
|
|
224
197
|
}
|
|
225
|
-
|
|
226
198
|
if ($oldNavbarEl && $oldPageEl) {
|
|
227
199
|
router.setNavbarPosition($oldNavbarEl, '');
|
|
228
200
|
$oldNavbarEl.removeClass('navbar-next navbar-previous navbar-current');
|
|
229
201
|
$oldPageEl.prepend($oldNavbarEl);
|
|
230
202
|
}
|
|
231
203
|
}
|
|
232
|
-
|
|
233
204
|
router.$el.addClass(routerCustomTransitionClass);
|
|
234
205
|
return;
|
|
235
|
-
}
|
|
236
|
-
|
|
206
|
+
}
|
|
237
207
|
|
|
208
|
+
// Router Animation class
|
|
238
209
|
const routerTransitionClass = `router-transition-${direction} router-transition`;
|
|
239
210
|
let newNavEls;
|
|
240
211
|
let oldNavEls;
|
|
@@ -243,10 +214,8 @@ class Router extends Framework7Class {
|
|
|
243
214
|
let toDifferent;
|
|
244
215
|
let oldIsLarge;
|
|
245
216
|
let newIsLarge;
|
|
246
|
-
|
|
247
217
|
if (ios && dynamicNavbar) {
|
|
248
218
|
const betweenMasterAndDetail = router.params.masterDetailBreakpoint > 0 && router.app.width >= router.params.masterDetailBreakpoint && ($oldNavbarEl.hasClass('navbar-master') && $newNavbarEl.hasClass('navbar-master-detail') || $oldNavbarEl.hasClass('navbar-master-detail') && $newNavbarEl.hasClass('navbar-master'));
|
|
249
|
-
|
|
250
219
|
if (!betweenMasterAndDetail) {
|
|
251
220
|
oldIsLarge = $oldNavbarEl && $oldNavbarEl.hasClass('navbar-large');
|
|
252
221
|
newIsLarge = $newNavbarEl && $newNavbarEl.hasClass('navbar-large');
|
|
@@ -254,31 +223,25 @@ class Router extends Framework7Class {
|
|
|
254
223
|
toLarge = newIsLarge && !$newNavbarEl.hasClass('navbar-large-collapsed');
|
|
255
224
|
toDifferent = fromLarge && !toLarge || toLarge && !fromLarge;
|
|
256
225
|
}
|
|
257
|
-
|
|
258
226
|
const navEls = router.animatableNavElements($newNavbarEl, $oldNavbarEl, toLarge, fromLarge, direction);
|
|
259
227
|
newNavEls = navEls.newNavEls;
|
|
260
228
|
oldNavEls = navEls.oldNavEls;
|
|
261
229
|
}
|
|
262
|
-
|
|
263
230
|
function animateNavbars(progress) {
|
|
264
231
|
if (!(ios && dynamicNavbar)) return;
|
|
265
|
-
|
|
266
232
|
if (progress === 1) {
|
|
267
233
|
if (toLarge) {
|
|
268
234
|
$newNavbarEl.addClass('router-navbar-transition-to-large');
|
|
269
235
|
$oldNavbarEl.addClass('router-navbar-transition-to-large');
|
|
270
236
|
}
|
|
271
|
-
|
|
272
237
|
if (fromLarge) {
|
|
273
238
|
$newNavbarEl.addClass('router-navbar-transition-from-large');
|
|
274
239
|
$oldNavbarEl.addClass('router-navbar-transition-from-large');
|
|
275
240
|
}
|
|
276
241
|
}
|
|
277
|
-
|
|
278
242
|
newNavEls.forEach(navEl => {
|
|
279
243
|
const $el = navEl.$el;
|
|
280
244
|
const offset = direction === 'forward' ? navEl.rightOffset : navEl.leftOffset;
|
|
281
|
-
|
|
282
245
|
if (navEl.isSliding) {
|
|
283
246
|
if (navEl.isSubnavbar && newIsLarge) {
|
|
284
247
|
// prettier-ignore
|
|
@@ -291,7 +254,6 @@ class Router extends Framework7Class {
|
|
|
291
254
|
oldNavEls.forEach(navEl => {
|
|
292
255
|
const $el = navEl.$el;
|
|
293
256
|
const offset = direction === 'forward' ? navEl.leftOffset : navEl.rightOffset;
|
|
294
|
-
|
|
295
257
|
if (navEl.isSliding) {
|
|
296
258
|
if (navEl.isSubnavbar && oldIsLarge) {
|
|
297
259
|
$el.transform(`translate3d(${offset * progress}px, calc(-1 * var(--f7-navbar-large-collapse-progress) * var(--f7-navbar-large-title-height)), 0)`);
|
|
@@ -300,9 +262,9 @@ class Router extends Framework7Class {
|
|
|
300
262
|
}
|
|
301
263
|
}
|
|
302
264
|
});
|
|
303
|
-
}
|
|
304
|
-
|
|
265
|
+
}
|
|
305
266
|
|
|
267
|
+
// AnimationEnd Callback
|
|
306
268
|
function onDone() {
|
|
307
269
|
if (router.dynamicNavbar) {
|
|
308
270
|
if ($newNavbarEl) {
|
|
@@ -312,44 +274,40 @@ class Router extends Framework7Class {
|
|
|
312
274
|
$newNavbarEl.removeClass('navbar-no-title-large-transition');
|
|
313
275
|
});
|
|
314
276
|
}
|
|
315
|
-
|
|
316
277
|
if ($oldNavbarEl) {
|
|
317
278
|
$oldNavbarEl.removeClass('router-navbar-transition-to-large router-navbar-transition-from-large');
|
|
318
279
|
}
|
|
319
|
-
|
|
320
280
|
if ($newNavbarEl.hasClass('sliding') || $newNavbarEl.children('.navbar-inner.sliding').length) {
|
|
321
281
|
$newNavbarEl.find('.title, .left, .right, .left .icon, .subnavbar').transform('');
|
|
322
282
|
} else {
|
|
323
283
|
$newNavbarEl.find('.sliding').transform('');
|
|
324
284
|
}
|
|
325
|
-
|
|
326
285
|
if ($oldNavbarEl.hasClass('sliding') || $oldNavbarEl.children('.navbar-inner.sliding').length) {
|
|
327
286
|
$oldNavbarEl.find('.title, .left, .right, .left .icon, .subnavbar').transform('');
|
|
328
287
|
} else {
|
|
329
288
|
$oldNavbarEl.find('.sliding').transform('');
|
|
330
289
|
}
|
|
331
290
|
}
|
|
332
|
-
|
|
333
291
|
router.$el.removeClass(routerTransitionClass);
|
|
334
292
|
if (callback) callback();
|
|
335
293
|
}
|
|
336
294
|
|
|
337
|
-
|
|
295
|
+
// eslint-disable-next-line
|
|
296
|
+
(direction === 'forward' ? $newPageEl : ios ? $oldPageEl : $newPageEl).animationEnd(() => {
|
|
338
297
|
onDone();
|
|
339
|
-
});
|
|
298
|
+
});
|
|
340
299
|
|
|
300
|
+
// Animate
|
|
341
301
|
if (dynamicNavbar) {
|
|
342
302
|
// Prepare Navbars
|
|
343
303
|
animateNavbars(0);
|
|
344
304
|
nextFrame(() => {
|
|
345
305
|
// Add class, start animation
|
|
346
306
|
router.$el.addClass(routerTransitionClass);
|
|
347
|
-
|
|
348
307
|
if (toDifferent) {
|
|
349
308
|
// eslint-disable-next-line
|
|
350
309
|
router.el._clientLeft = router.el.clientLeft;
|
|
351
310
|
}
|
|
352
|
-
|
|
353
311
|
animateNavbars(1);
|
|
354
312
|
});
|
|
355
313
|
} else {
|
|
@@ -357,36 +315,29 @@ class Router extends Framework7Class {
|
|
|
357
315
|
router.$el.addClass(routerTransitionClass);
|
|
358
316
|
}
|
|
359
317
|
}
|
|
360
|
-
|
|
361
318
|
removeModal(modalEl) {
|
|
362
319
|
const router = this;
|
|
363
320
|
router.removeEl(modalEl);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
|
|
321
|
+
}
|
|
322
|
+
// eslint-disable-next-line
|
|
367
323
|
removeTabContent(tabEl) {
|
|
368
324
|
const $tabEl = $(tabEl);
|
|
369
325
|
$tabEl.html('');
|
|
370
326
|
}
|
|
371
|
-
|
|
372
327
|
removeNavbar(el) {
|
|
373
328
|
const router = this;
|
|
374
329
|
router.removeEl(el);
|
|
375
330
|
}
|
|
376
|
-
|
|
377
331
|
removePage(el) {
|
|
378
332
|
const $el = $(el);
|
|
379
333
|
const f7Page = $el && $el[0] && $el[0].f7Page;
|
|
380
334
|
const router = this;
|
|
381
|
-
|
|
382
335
|
if (f7Page && f7Page.route && f7Page.route.route && f7Page.route.route.keepAlive) {
|
|
383
336
|
$el.remove();
|
|
384
337
|
return;
|
|
385
338
|
}
|
|
386
|
-
|
|
387
339
|
router.removeEl(el);
|
|
388
340
|
}
|
|
389
|
-
|
|
390
341
|
removeEl(el) {
|
|
391
342
|
if (!el) return;
|
|
392
343
|
const router = this;
|
|
@@ -400,15 +351,12 @@ class Router extends Framework7Class {
|
|
|
400
351
|
}
|
|
401
352
|
});
|
|
402
353
|
});
|
|
403
|
-
|
|
404
354
|
if ($el[0].f7Component && $el[0].f7Component.destroy) {
|
|
405
355
|
$el[0].f7Component.destroy();
|
|
406
356
|
}
|
|
407
|
-
|
|
408
357
|
if (!router.params.removeElements) {
|
|
409
358
|
return;
|
|
410
359
|
}
|
|
411
|
-
|
|
412
360
|
if (router.params.removeElementsWithTimeout) {
|
|
413
361
|
setTimeout(() => {
|
|
414
362
|
$el.remove();
|
|
@@ -417,65 +365,53 @@ class Router extends Framework7Class {
|
|
|
417
365
|
$el.remove();
|
|
418
366
|
}
|
|
419
367
|
}
|
|
420
|
-
|
|
421
368
|
getPageEl(content) {
|
|
422
369
|
const router = this;
|
|
423
|
-
|
|
424
370
|
if (typeof content === 'string') {
|
|
425
371
|
router.tempDom.innerHTML = content;
|
|
426
372
|
} else {
|
|
427
373
|
if ($(content).hasClass('page')) {
|
|
428
374
|
return content;
|
|
429
375
|
}
|
|
430
|
-
|
|
431
376
|
router.tempDom.innerHTML = '';
|
|
432
377
|
$(router.tempDom).append(content);
|
|
433
378
|
}
|
|
434
|
-
|
|
435
379
|
return router.findElement('.page', router.tempDom);
|
|
436
380
|
}
|
|
437
|
-
|
|
438
|
-
findElement(stringSelector, container, notStacked) {
|
|
381
|
+
findElement(stringSelector, container) {
|
|
439
382
|
const router = this;
|
|
440
383
|
const view = router.view;
|
|
441
|
-
const app = router.app;
|
|
384
|
+
const app = router.app;
|
|
442
385
|
|
|
386
|
+
// Modals Selector
|
|
443
387
|
const modalsSelector = '.popup, .dialog, .popover, .actions-modal, .sheet-modal, .login-screen, .page';
|
|
444
388
|
const $container = $(container);
|
|
445
|
-
|
|
446
|
-
if (notStacked) selector += ':not(.stacked)';
|
|
389
|
+
const selector = stringSelector;
|
|
447
390
|
let found = $container.find(selector).filter(el => $(el).parents(modalsSelector).length === 0);
|
|
448
|
-
|
|
449
391
|
if (found.length > 1) {
|
|
450
392
|
if (typeof view.selector === 'string') {
|
|
451
393
|
// Search in related view
|
|
452
394
|
found = $container.find(`${view.selector} ${selector}`);
|
|
453
395
|
}
|
|
454
|
-
|
|
455
396
|
if (found.length > 1) {
|
|
456
397
|
// Search in main view
|
|
457
398
|
found = $container.find(`.${app.params.viewMainClass} ${selector}`);
|
|
458
399
|
}
|
|
459
400
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
if (!notStacked) found = router.findElement(selector, $container, true);
|
|
401
|
+
if (found.length === 1) return found;
|
|
402
|
+
found = router.findElement(selector, $container);
|
|
464
403
|
if (found && found.length === 1) return found;
|
|
465
404
|
if (found && found.length > 1) return $(found[0]);
|
|
466
405
|
return undefined;
|
|
467
406
|
}
|
|
468
|
-
|
|
469
407
|
flattenRoutes(routes) {
|
|
470
408
|
if (routes === void 0) {
|
|
471
409
|
routes = this.routes;
|
|
472
410
|
}
|
|
473
|
-
|
|
474
411
|
const router = this;
|
|
475
412
|
let flattenedRoutes = [];
|
|
476
413
|
routes.forEach(route => {
|
|
477
414
|
let hasTabRoutes = false;
|
|
478
|
-
|
|
479
415
|
if ('tabs' in route && route.tabs) {
|
|
480
416
|
const mergedPathsRoutes = route.tabs.map(tabRoute => {
|
|
481
417
|
const tRoute = extend({}, route, {
|
|
@@ -490,7 +426,6 @@ class Router extends Framework7Class {
|
|
|
490
426
|
hasTabRoutes = true;
|
|
491
427
|
flattenedRoutes = flattenedRoutes.concat(router.flattenRoutes(mergedPathsRoutes));
|
|
492
428
|
}
|
|
493
|
-
|
|
494
429
|
if ('detailRoutes' in route) {
|
|
495
430
|
const mergedPathsRoutes = route.detailRoutes.map(detailRoute => {
|
|
496
431
|
const dRoute = extend({}, detailRoute);
|
|
@@ -500,29 +435,26 @@ class Router extends Framework7Class {
|
|
|
500
435
|
});
|
|
501
436
|
flattenedRoutes = flattenedRoutes.concat(route, router.flattenRoutes(mergedPathsRoutes));
|
|
502
437
|
}
|
|
503
|
-
|
|
504
438
|
if ('routes' in route) {
|
|
505
439
|
const mergedPathsRoutes = route.routes.map(childRoute => {
|
|
506
440
|
const cRoute = extend({}, childRoute);
|
|
507
441
|
cRoute.path = `${route.path}/${cRoute.path}`.replace('///', '/').replace('//', '/');
|
|
508
442
|
return cRoute;
|
|
509
443
|
});
|
|
510
|
-
|
|
511
444
|
if (hasTabRoutes) {
|
|
512
445
|
flattenedRoutes = flattenedRoutes.concat(router.flattenRoutes(mergedPathsRoutes));
|
|
513
446
|
} else {
|
|
514
447
|
flattenedRoutes = flattenedRoutes.concat(route, router.flattenRoutes(mergedPathsRoutes));
|
|
515
448
|
}
|
|
516
449
|
}
|
|
517
|
-
|
|
518
450
|
if (!('routes' in route) && !('tabs' in route && route.tabs) && !('detailRoutes' in route)) {
|
|
519
451
|
flattenedRoutes.push(route);
|
|
520
452
|
}
|
|
521
453
|
});
|
|
522
454
|
return flattenedRoutes;
|
|
523
|
-
}
|
|
524
|
-
|
|
455
|
+
}
|
|
525
456
|
|
|
457
|
+
// eslint-disable-next-line
|
|
526
458
|
parseRouteUrl(url) {
|
|
527
459
|
if (!url) return {};
|
|
528
460
|
const query = parseUrlQuery(url);
|
|
@@ -537,30 +469,24 @@ class Router extends Framework7Class {
|
|
|
537
469
|
path
|
|
538
470
|
};
|
|
539
471
|
}
|
|
540
|
-
|
|
541
472
|
generateUrl(parameters) {
|
|
542
473
|
if (parameters === void 0) {
|
|
543
474
|
parameters = {};
|
|
544
475
|
}
|
|
545
|
-
|
|
546
476
|
if (typeof parameters === 'string') {
|
|
547
477
|
return parameters;
|
|
548
478
|
}
|
|
549
|
-
|
|
550
479
|
const {
|
|
551
480
|
name,
|
|
552
481
|
path,
|
|
553
482
|
params,
|
|
554
483
|
query
|
|
555
484
|
} = parameters;
|
|
556
|
-
|
|
557
485
|
if (!name && !path) {
|
|
558
486
|
throw new Error('Framework7: "name" or "path" parameter is required');
|
|
559
487
|
}
|
|
560
|
-
|
|
561
488
|
const router = this;
|
|
562
489
|
const route = name ? router.findRouteByKey('name', name) : router.findRouteByKey('path', path);
|
|
563
|
-
|
|
564
490
|
if (!route) {
|
|
565
491
|
if (name) {
|
|
566
492
|
throw new Error(`Framework7: route with name "${name}" not found`);
|
|
@@ -568,20 +494,17 @@ class Router extends Framework7Class {
|
|
|
568
494
|
throw new Error(`Framework7: route with path "${path}" not found`);
|
|
569
495
|
}
|
|
570
496
|
}
|
|
571
|
-
|
|
572
497
|
const url = router.constructRouteUrl(route, {
|
|
573
498
|
params,
|
|
574
499
|
query
|
|
575
500
|
});
|
|
576
|
-
|
|
577
501
|
if (!url) {
|
|
578
502
|
throw new Error(`Framework7: can't construct URL for route with name "${name}"`);
|
|
579
503
|
}
|
|
580
|
-
|
|
581
504
|
return url;
|
|
582
|
-
}
|
|
583
|
-
|
|
505
|
+
}
|
|
584
506
|
|
|
507
|
+
// eslint-disable-next-line
|
|
585
508
|
constructRouteUrl(route, _temp) {
|
|
586
509
|
let {
|
|
587
510
|
params,
|
|
@@ -592,20 +515,16 @@ class Router extends Framework7Class {
|
|
|
592
515
|
} = route;
|
|
593
516
|
const toUrl = compile(path);
|
|
594
517
|
let url;
|
|
595
|
-
|
|
596
518
|
try {
|
|
597
519
|
url = toUrl(params || {});
|
|
598
520
|
} catch (error) {
|
|
599
521
|
throw new Error(`Framework7: error constructing route URL from passed params:\nRoute: ${path}\n${error.toString()}`);
|
|
600
522
|
}
|
|
601
|
-
|
|
602
523
|
if (query) {
|
|
603
524
|
if (typeof query === 'string') url += `?${query}`;else if (Object.keys(query).length) url += `?${serializeObject(query)}`;
|
|
604
525
|
}
|
|
605
|
-
|
|
606
526
|
return url;
|
|
607
527
|
}
|
|
608
|
-
|
|
609
528
|
findTabRouteUrl(tabEl) {
|
|
610
529
|
const router = this;
|
|
611
530
|
const $tabEl = $(tabEl);
|
|
@@ -627,7 +546,6 @@ class Router extends Framework7Class {
|
|
|
627
546
|
});
|
|
628
547
|
return foundTabRouteUrl;
|
|
629
548
|
}
|
|
630
|
-
|
|
631
549
|
findRouteByKey(key, value) {
|
|
632
550
|
const router = this;
|
|
633
551
|
const routes = router.routes;
|
|
@@ -635,14 +553,12 @@ class Router extends Framework7Class {
|
|
|
635
553
|
let matchingRoute;
|
|
636
554
|
flattenedRoutes.forEach(route => {
|
|
637
555
|
if (matchingRoute) return;
|
|
638
|
-
|
|
639
556
|
if (route[key] === value) {
|
|
640
557
|
matchingRoute = route;
|
|
641
558
|
}
|
|
642
559
|
});
|
|
643
560
|
return matchingRoute;
|
|
644
561
|
}
|
|
645
|
-
|
|
646
562
|
findMatchingRoute(url) {
|
|
647
563
|
if (!url) return undefined;
|
|
648
564
|
const router = this;
|
|
@@ -659,7 +575,6 @@ class Router extends Framework7Class {
|
|
|
659
575
|
if (matchingRoute) return;
|
|
660
576
|
const keys = [];
|
|
661
577
|
const pathsToMatch = [route.path];
|
|
662
|
-
|
|
663
578
|
if (route.alias) {
|
|
664
579
|
if (typeof route.alias === 'string') pathsToMatch.push(route.alias);else if (Array.isArray(route.alias)) {
|
|
665
580
|
route.alias.forEach(aliasPath => {
|
|
@@ -667,18 +582,15 @@ class Router extends Framework7Class {
|
|
|
667
582
|
});
|
|
668
583
|
}
|
|
669
584
|
}
|
|
670
|
-
|
|
671
585
|
let matched;
|
|
672
586
|
pathsToMatch.forEach(pathToMatch => {
|
|
673
587
|
if (matched) return;
|
|
674
588
|
matched = pathToRegexp(pathToMatch, keys).exec(path);
|
|
675
589
|
});
|
|
676
|
-
|
|
677
590
|
if (matched) {
|
|
678
591
|
keys.forEach((keyObj, index) => {
|
|
679
592
|
if (typeof keyObj.name === 'number') return;
|
|
680
593
|
const paramValue = matched[index + 1];
|
|
681
|
-
|
|
682
594
|
if (typeof paramValue === 'undefined' || paramValue === null) {
|
|
683
595
|
params[keyObj.name] = paramValue;
|
|
684
596
|
} else {
|
|
@@ -686,11 +598,9 @@ class Router extends Framework7Class {
|
|
|
686
598
|
}
|
|
687
599
|
});
|
|
688
600
|
let parentPath;
|
|
689
|
-
|
|
690
601
|
if (route.parentPath) {
|
|
691
602
|
parentPath = path.split('/').slice(0, route.parentPath.split('/').length - 1).join('/');
|
|
692
603
|
}
|
|
693
|
-
|
|
694
604
|
matchingRoute = {
|
|
695
605
|
query,
|
|
696
606
|
hash,
|
|
@@ -704,42 +614,34 @@ class Router extends Framework7Class {
|
|
|
704
614
|
}
|
|
705
615
|
});
|
|
706
616
|
return matchingRoute;
|
|
707
|
-
}
|
|
708
|
-
|
|
617
|
+
}
|
|
709
618
|
|
|
619
|
+
// eslint-disable-next-line
|
|
710
620
|
replaceRequestUrlParams(url, options) {
|
|
711
621
|
if (url === void 0) {
|
|
712
622
|
url = '';
|
|
713
623
|
}
|
|
714
|
-
|
|
715
624
|
if (options === void 0) {
|
|
716
625
|
options = {};
|
|
717
626
|
}
|
|
718
|
-
|
|
719
627
|
let compiledUrl = url;
|
|
720
|
-
|
|
721
628
|
if (typeof compiledUrl === 'string' && compiledUrl.indexOf('{{') >= 0 && options && options.route && options.route.params && Object.keys(options.route.params).length) {
|
|
722
629
|
Object.keys(options.route.params).forEach(paramName => {
|
|
723
630
|
const regExp = new RegExp(`{{${paramName}}}`, 'g');
|
|
724
631
|
compiledUrl = compiledUrl.replace(regExp, options.route.params[paramName] || '');
|
|
725
632
|
});
|
|
726
633
|
}
|
|
727
|
-
|
|
728
634
|
return compiledUrl;
|
|
729
635
|
}
|
|
730
|
-
|
|
731
636
|
removeFromXhrCache(url) {
|
|
732
637
|
const router = this;
|
|
733
638
|
const xhrCache = router.cache.xhr;
|
|
734
639
|
let index = false;
|
|
735
|
-
|
|
736
640
|
for (let i = 0; i < xhrCache.length; i += 1) {
|
|
737
641
|
if (xhrCache[i].url === url) index = i;
|
|
738
642
|
}
|
|
739
|
-
|
|
740
643
|
if (index !== false) xhrCache.splice(index, 1);
|
|
741
644
|
}
|
|
742
|
-
|
|
743
645
|
xhrRequest(requestUrl, options) {
|
|
744
646
|
const router = this;
|
|
745
647
|
const params = router.params;
|
|
@@ -748,31 +650,25 @@ class Router extends Framework7Class {
|
|
|
748
650
|
} = options;
|
|
749
651
|
let url = requestUrl;
|
|
750
652
|
let hasQuery = url.indexOf('?') >= 0;
|
|
751
|
-
|
|
752
653
|
if (params.passRouteQueryToRequest && options && options.route && options.route.query && Object.keys(options.route.query).length) {
|
|
753
654
|
url += `${hasQuery ? '&' : '?'}${serializeObject(options.route.query)}`;
|
|
754
655
|
hasQuery = true;
|
|
755
656
|
}
|
|
756
|
-
|
|
757
657
|
if (params.passRouteParamsToRequest && options && options.route && options.route.params && Object.keys(options.route.params).length) {
|
|
758
658
|
url += `${hasQuery ? '&' : '?'}${serializeObject(options.route.params)}`;
|
|
759
659
|
hasQuery = true;
|
|
760
660
|
}
|
|
761
|
-
|
|
762
661
|
if (url.indexOf('{{') >= 0) {
|
|
763
662
|
url = router.replaceRequestUrlParams(url, options);
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
|
|
663
|
+
}
|
|
664
|
+
// should we ignore get params or not
|
|
767
665
|
if (params.xhrCacheIgnoreGetParameters && url.indexOf('?') >= 0) {
|
|
768
666
|
url = url.split('?')[0];
|
|
769
667
|
}
|
|
770
|
-
|
|
771
668
|
return new Promise((resolve, reject) => {
|
|
772
669
|
if (params.xhrCache && !ignoreCache && url.indexOf('nocache') < 0 && params.xhrCacheIgnore.indexOf(url) < 0) {
|
|
773
670
|
for (let i = 0; i < router.cache.xhr.length; i += 1) {
|
|
774
671
|
const cachedUrl = router.cache.xhr[i];
|
|
775
|
-
|
|
776
672
|
if (cachedUrl.url === url) {
|
|
777
673
|
// Check expiration
|
|
778
674
|
if (now() - cachedUrl.time < params.xhrCacheDuration) {
|
|
@@ -783,106 +679,86 @@ class Router extends Framework7Class {
|
|
|
783
679
|
}
|
|
784
680
|
}
|
|
785
681
|
}
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
if (
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
});
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
router.emit('routerAjaxSuccess', xhr, options);
|
|
811
|
-
resolve(xhr.responseText);
|
|
812
|
-
} else {
|
|
813
|
-
router.emit('routerAjaxError', xhr, options);
|
|
814
|
-
reject(xhr);
|
|
682
|
+
router.xhrAbortController = new AbortController();
|
|
683
|
+
let fetchRes;
|
|
684
|
+
fetch(url, {
|
|
685
|
+
signal: router.xhrAbortController.signal,
|
|
686
|
+
method: 'GET'
|
|
687
|
+
}).then(res => {
|
|
688
|
+
fetchRes = res;
|
|
689
|
+
return res.text();
|
|
690
|
+
}).then(responseText => {
|
|
691
|
+
const {
|
|
692
|
+
status
|
|
693
|
+
} = fetchRes;
|
|
694
|
+
router.emit('routerAjaxComplete', fetchRes);
|
|
695
|
+
if (status !== 'error' && status !== 'timeout' && status >= 200 && status < 300 || status === 0) {
|
|
696
|
+
if (params.xhrCache && responseText !== '') {
|
|
697
|
+
router.removeFromXhrCache(url);
|
|
698
|
+
router.cache.xhr.push({
|
|
699
|
+
url,
|
|
700
|
+
time: now(),
|
|
701
|
+
content: responseText
|
|
702
|
+
});
|
|
815
703
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
router.emit('routerAjaxError',
|
|
820
|
-
reject(
|
|
704
|
+
router.emit('routerAjaxSuccess', fetchRes, options);
|
|
705
|
+
resolve(responseText);
|
|
706
|
+
} else {
|
|
707
|
+
router.emit('routerAjaxError', fetchRes, options);
|
|
708
|
+
reject(fetchRes);
|
|
821
709
|
}
|
|
822
|
-
|
|
710
|
+
}).catch(err => {
|
|
711
|
+
reject(err);
|
|
823
712
|
});
|
|
824
713
|
});
|
|
825
714
|
}
|
|
826
|
-
|
|
827
715
|
setNavbarPosition($el, position, ariaHidden) {
|
|
828
716
|
const router = this;
|
|
829
717
|
$el.removeClass('navbar-previous navbar-current navbar-next');
|
|
830
|
-
|
|
831
718
|
if (position) {
|
|
832
719
|
$el.addClass(`navbar-${position}`);
|
|
833
720
|
}
|
|
834
|
-
|
|
835
721
|
if (ariaHidden === false) {
|
|
836
722
|
$el.removeAttr('aria-hidden');
|
|
837
723
|
} else if (ariaHidden === true) {
|
|
838
724
|
$el.attr('aria-hidden', 'true');
|
|
839
725
|
}
|
|
840
|
-
|
|
841
726
|
$el.trigger('navbar:position', {
|
|
842
727
|
position
|
|
843
728
|
});
|
|
844
729
|
router.emit('navbarPosition', $el[0], position);
|
|
845
730
|
}
|
|
846
|
-
|
|
847
731
|
setPagePosition($el, position, ariaHidden) {
|
|
848
732
|
const router = this;
|
|
849
733
|
$el.removeClass('page-previous page-current page-next');
|
|
850
734
|
$el.addClass(`page-${position}`);
|
|
851
|
-
|
|
852
735
|
if (ariaHidden === false) {
|
|
853
736
|
$el.removeAttr('aria-hidden');
|
|
854
737
|
} else if (ariaHidden === true) {
|
|
855
738
|
$el.attr('aria-hidden', 'true');
|
|
856
739
|
}
|
|
857
|
-
|
|
858
740
|
$el.trigger('page:position', {
|
|
859
741
|
position
|
|
860
742
|
});
|
|
861
743
|
router.emit('pagePosition', $el[0], position);
|
|
862
|
-
}
|
|
863
|
-
|
|
744
|
+
}
|
|
864
745
|
|
|
746
|
+
// Remove theme elements
|
|
865
747
|
removeThemeElements(el) {
|
|
866
748
|
const router = this;
|
|
867
749
|
const theme = router.app.theme;
|
|
868
750
|
let toRemove;
|
|
869
|
-
|
|
870
751
|
if (theme === 'ios') {
|
|
871
|
-
toRemove = '.md-only, .
|
|
752
|
+
toRemove = '.md-only, .if-md, .if-not-ios, .not-ios';
|
|
872
753
|
} else if (theme === 'md') {
|
|
873
|
-
toRemove = '.ios-only, .
|
|
874
|
-
} else if (theme === 'aurora') {
|
|
875
|
-
toRemove = '.ios-only, .md-only, .if-ios, .if-md, .if-not-aurora, .not-aurora';
|
|
754
|
+
toRemove = '.ios-only, .if-ios, .if-not-md, .not-md';
|
|
876
755
|
}
|
|
877
|
-
|
|
878
756
|
$(el).find(toRemove).remove();
|
|
879
757
|
}
|
|
880
|
-
|
|
881
758
|
getPageData(pageEl, navbarEl, from, to, route, pageFromEl) {
|
|
882
759
|
if (route === void 0) {
|
|
883
760
|
route = {};
|
|
884
761
|
}
|
|
885
|
-
|
|
886
762
|
const router = this;
|
|
887
763
|
const $pageEl = $(pageEl).eq(0);
|
|
888
764
|
const $navbarEl = $(navbarEl).eq(0);
|
|
@@ -891,21 +767,16 @@ class Router extends Framework7Class {
|
|
|
891
767
|
let pageFrom;
|
|
892
768
|
if (from === 'next' && to === 'current' || from === 'current' && to === 'previous') direction = 'forward';
|
|
893
769
|
if (from === 'current' && to === 'next' || from === 'previous' && to === 'current') direction = 'backward';
|
|
894
|
-
|
|
895
770
|
if (currentPage && !currentPage.fromPage) {
|
|
896
771
|
const $pageFromEl = $(pageFromEl);
|
|
897
|
-
|
|
898
772
|
if ($pageFromEl.length) {
|
|
899
773
|
pageFrom = $pageFromEl[0].f7Page;
|
|
900
774
|
}
|
|
901
775
|
}
|
|
902
|
-
|
|
903
776
|
pageFrom = currentPage.pageFrom || pageFrom;
|
|
904
|
-
|
|
905
777
|
if (pageFrom && pageFrom.pageFrom) {
|
|
906
778
|
pageFrom.pageFrom = null;
|
|
907
779
|
}
|
|
908
|
-
|
|
909
780
|
const page = {
|
|
910
781
|
app: router.app,
|
|
911
782
|
view: router.view,
|
|
@@ -926,14 +797,13 @@ class Router extends Framework7Class {
|
|
|
926
797
|
};
|
|
927
798
|
$pageEl[0].f7Page = page;
|
|
928
799
|
return page;
|
|
929
|
-
}
|
|
930
|
-
|
|
800
|
+
}
|
|
931
801
|
|
|
802
|
+
// Callbacks
|
|
932
803
|
pageCallback(callback, pageEl, navbarEl, from, to, options, pageFromEl) {
|
|
933
804
|
if (options === void 0) {
|
|
934
805
|
options = {};
|
|
935
806
|
}
|
|
936
|
-
|
|
937
807
|
if (!pageEl) return;
|
|
938
808
|
const router = this;
|
|
939
809
|
const $pageEl = $(pageEl);
|
|
@@ -944,7 +814,6 @@ class Router extends Framework7Class {
|
|
|
944
814
|
} = options;
|
|
945
815
|
const restoreScrollTopOnBack = router.params.restoreScrollTopOnBack && !(router.params.masterDetailBreakpoint > 0 && $pageEl.hasClass('page-master') && router.app.width >= router.params.masterDetailBreakpoint);
|
|
946
816
|
const keepAlive = $pageEl[0].f7Page && $pageEl[0].f7Page.route && $pageEl[0].f7Page.route.route && $pageEl[0].f7Page.route.route.keepAlive;
|
|
947
|
-
|
|
948
817
|
if (callback === 'beforeRemove' && keepAlive) {
|
|
949
818
|
callback = 'beforeUnmount'; // eslint-disable-line
|
|
950
819
|
}
|
|
@@ -952,7 +821,6 @@ class Router extends Framework7Class {
|
|
|
952
821
|
const camelName = `page${callback[0].toUpperCase() + callback.slice(1, callback.length)}`;
|
|
953
822
|
const colonName = `page:${callback.toLowerCase()}`;
|
|
954
823
|
let page = {};
|
|
955
|
-
|
|
956
824
|
if (callback === 'beforeRemove' && $pageEl[0].f7Page) {
|
|
957
825
|
page = extend($pageEl[0].f7Page, {
|
|
958
826
|
from,
|
|
@@ -962,25 +830,20 @@ class Router extends Framework7Class {
|
|
|
962
830
|
} else {
|
|
963
831
|
page = router.getPageData($pageEl[0], $navbarEl[0], from, to, route, pageFromEl);
|
|
964
832
|
}
|
|
965
|
-
|
|
966
833
|
page.swipeBack = !!options.swipeBack;
|
|
967
834
|
const {
|
|
968
835
|
on = {},
|
|
969
836
|
once = {}
|
|
970
837
|
} = options.route ? options.route.route : {};
|
|
971
|
-
|
|
972
838
|
if (options.on) {
|
|
973
839
|
extend(on, options.on);
|
|
974
840
|
}
|
|
975
|
-
|
|
976
841
|
if (options.once) {
|
|
977
842
|
extend(once, options.once);
|
|
978
843
|
}
|
|
979
|
-
|
|
980
844
|
function attachEvents() {
|
|
981
845
|
if ($pageEl[0].f7RouteEventsAttached) return;
|
|
982
846
|
$pageEl[0].f7RouteEventsAttached = true;
|
|
983
|
-
|
|
984
847
|
if (on && Object.keys(on).length > 0) {
|
|
985
848
|
$pageEl[0].f7RouteEventsOn = on;
|
|
986
849
|
Object.keys(on).forEach(eventName => {
|
|
@@ -988,7 +851,6 @@ class Router extends Framework7Class {
|
|
|
988
851
|
$pageEl.on(eventNameToColonCase(eventName), on[eventName]);
|
|
989
852
|
});
|
|
990
853
|
}
|
|
991
|
-
|
|
992
854
|
if (once && Object.keys(once).length > 0) {
|
|
993
855
|
$pageEl[0].f7RouteEventsOnce = once;
|
|
994
856
|
Object.keys(once).forEach(eventName => {
|
|
@@ -997,22 +859,18 @@ class Router extends Framework7Class {
|
|
|
997
859
|
});
|
|
998
860
|
}
|
|
999
861
|
}
|
|
1000
|
-
|
|
1001
862
|
function detachEvents() {
|
|
1002
863
|
if (!$pageEl[0].f7RouteEventsAttached) return;
|
|
1003
|
-
|
|
1004
864
|
if ($pageEl[0].f7RouteEventsOn) {
|
|
1005
865
|
Object.keys($pageEl[0].f7RouteEventsOn).forEach(eventName => {
|
|
1006
866
|
$pageEl.off(eventNameToColonCase(eventName), $pageEl[0].f7RouteEventsOn[eventName]);
|
|
1007
867
|
});
|
|
1008
868
|
}
|
|
1009
|
-
|
|
1010
869
|
if ($pageEl[0].f7RouteEventsOnce) {
|
|
1011
870
|
Object.keys($pageEl[0].f7RouteEventsOnce).forEach(eventName => {
|
|
1012
871
|
$pageEl.off(eventNameToColonCase(eventName), $pageEl[0].f7RouteEventsOnce[eventName]);
|
|
1013
872
|
});
|
|
1014
873
|
}
|
|
1015
|
-
|
|
1016
874
|
$pageEl[0].f7RouteEventsAttached = null;
|
|
1017
875
|
$pageEl[0].f7RouteEventsOn = null;
|
|
1018
876
|
$pageEl[0].f7RouteEventsOnce = null;
|
|
@@ -1020,109 +878,88 @@ class Router extends Framework7Class {
|
|
|
1020
878
|
delete $pageEl[0].f7RouteEventsOn;
|
|
1021
879
|
delete $pageEl[0].f7RouteEventsOnce;
|
|
1022
880
|
}
|
|
1023
|
-
|
|
1024
881
|
if (callback === 'mounted') {
|
|
1025
882
|
attachEvents();
|
|
1026
883
|
}
|
|
1027
|
-
|
|
1028
884
|
if (callback === 'init') {
|
|
1029
885
|
if (restoreScrollTopOnBack && (from === 'previous' || !from) && to === 'current' && router.scrollHistory[page.route.url] && !$pageEl.hasClass('no-restore-scroll')) {
|
|
1030
886
|
let $pageContent = $pageEl.find('.page-content');
|
|
1031
|
-
|
|
1032
887
|
if ($pageContent.length > 0) {
|
|
1033
888
|
// eslint-disable-next-line
|
|
1034
889
|
$pageContent = $pageContent.filter(pageContentEl => {
|
|
1035
890
|
return $(pageContentEl).parents('.tab:not(.tab-active)').length === 0 && !$(pageContentEl).is('.tab:not(.tab-active)');
|
|
1036
891
|
});
|
|
1037
892
|
}
|
|
1038
|
-
|
|
1039
893
|
$pageContent.scrollTop(router.scrollHistory[page.route.url]);
|
|
1040
894
|
}
|
|
1041
|
-
|
|
1042
895
|
attachEvents();
|
|
1043
|
-
|
|
1044
896
|
if ($pageEl[0].f7PageInitialized) {
|
|
1045
897
|
$pageEl.trigger('page:reinit', page);
|
|
1046
898
|
router.emit('pageReinit', page);
|
|
1047
899
|
return;
|
|
1048
900
|
}
|
|
1049
|
-
|
|
1050
901
|
$pageEl[0].f7PageInitialized = true;
|
|
1051
902
|
}
|
|
1052
|
-
|
|
1053
903
|
if (restoreScrollTopOnBack && callback === 'beforeOut' && from === 'current' && to === 'previous') {
|
|
1054
904
|
// Save scroll position
|
|
1055
905
|
let $pageContent = $pageEl.find('.page-content');
|
|
1056
|
-
|
|
1057
906
|
if ($pageContent.length > 0) {
|
|
1058
907
|
// eslint-disable-next-line
|
|
1059
908
|
$pageContent = $pageContent.filter(pageContentEl => {
|
|
1060
909
|
return $(pageContentEl).parents('.tab:not(.tab-active)').length === 0 && !$(pageContentEl).is('.tab:not(.tab-active)');
|
|
1061
910
|
});
|
|
1062
911
|
}
|
|
1063
|
-
|
|
1064
912
|
router.scrollHistory[page.route.url] = $pageContent.scrollTop();
|
|
1065
913
|
}
|
|
1066
|
-
|
|
1067
914
|
if (restoreScrollTopOnBack && callback === 'beforeOut' && from === 'current' && to === 'next') {
|
|
1068
915
|
// Delete scroll position
|
|
1069
916
|
delete router.scrollHistory[page.route.url];
|
|
1070
917
|
}
|
|
1071
|
-
|
|
1072
918
|
$pageEl.trigger(colonName, page);
|
|
1073
919
|
router.emit(camelName, page);
|
|
1074
|
-
|
|
1075
920
|
if (callback === 'beforeRemove' || callback === 'beforeUnmount') {
|
|
1076
921
|
detachEvents();
|
|
1077
|
-
|
|
1078
922
|
if (!keepAlive) {
|
|
1079
923
|
if ($pageEl[0].f7Page && $pageEl[0].f7Page.navbarEl) {
|
|
1080
924
|
delete $pageEl[0].f7Page.navbarEl.f7Page;
|
|
1081
925
|
}
|
|
1082
|
-
|
|
1083
926
|
$pageEl[0].f7Page = null;
|
|
1084
927
|
}
|
|
1085
928
|
}
|
|
1086
929
|
}
|
|
1087
|
-
|
|
1088
930
|
saveHistory() {
|
|
1089
931
|
const router = this;
|
|
1090
932
|
const window = getWindow();
|
|
1091
933
|
router.view.history = router.history;
|
|
1092
|
-
|
|
1093
934
|
if (router.params.browserHistory && router.params.browserHistoryStoreHistory && window.localStorage) {
|
|
1094
935
|
window.localStorage[`f7router-${router.view.id}-history`] = JSON.stringify(router.history);
|
|
1095
936
|
}
|
|
1096
937
|
}
|
|
1097
|
-
|
|
1098
938
|
restoreHistory() {
|
|
1099
939
|
const router = this;
|
|
1100
940
|
const window = getWindow();
|
|
1101
|
-
|
|
1102
941
|
if (router.params.browserHistory && router.params.browserHistoryStoreHistory && window.localStorage && window.localStorage[`f7router-${router.view.id}-history`]) {
|
|
1103
942
|
router.history = JSON.parse(window.localStorage[`f7router-${router.view.id}-history`]);
|
|
1104
943
|
router.view.history = router.history;
|
|
1105
944
|
}
|
|
1106
945
|
}
|
|
1107
|
-
|
|
1108
946
|
clearHistory() {
|
|
1109
947
|
const router = this;
|
|
1110
948
|
router.history = [];
|
|
1111
949
|
if (router.view) router.view.history = [];
|
|
1112
950
|
router.saveHistory();
|
|
1113
951
|
}
|
|
1114
|
-
|
|
1115
952
|
updateCurrentUrl(newUrl) {
|
|
1116
953
|
const router = this;
|
|
1117
|
-
appRouterCheck(router, 'updateCurrentUrl');
|
|
1118
|
-
|
|
954
|
+
appRouterCheck(router, 'updateCurrentUrl');
|
|
955
|
+
// Update history
|
|
1119
956
|
if (router.history.length) {
|
|
1120
957
|
router.history[router.history.length - 1] = newUrl;
|
|
1121
958
|
} else {
|
|
1122
959
|
router.history.push(newUrl);
|
|
1123
|
-
}
|
|
1124
|
-
|
|
960
|
+
}
|
|
1125
961
|
|
|
962
|
+
// Update current route params
|
|
1126
963
|
const {
|
|
1127
964
|
query,
|
|
1128
965
|
hash,
|
|
@@ -1130,7 +967,6 @@ class Router extends Framework7Class {
|
|
|
1130
967
|
url,
|
|
1131
968
|
path
|
|
1132
969
|
} = router.parseRouteUrl(newUrl);
|
|
1133
|
-
|
|
1134
970
|
if (router.currentRoute) {
|
|
1135
971
|
extend(router.currentRoute, {
|
|
1136
972
|
query,
|
|
@@ -1140,29 +976,25 @@ class Router extends Framework7Class {
|
|
|
1140
976
|
path
|
|
1141
977
|
});
|
|
1142
978
|
}
|
|
1143
|
-
|
|
1144
979
|
if (router.params.browserHistory) {
|
|
1145
980
|
const browserHistoryRoot = router.params.browserHistoryRoot || '';
|
|
1146
981
|
History.replace(router.view.id, {
|
|
1147
982
|
url: newUrl
|
|
1148
983
|
}, browserHistoryRoot + router.params.browserHistorySeparator + newUrl);
|
|
1149
|
-
}
|
|
1150
|
-
|
|
984
|
+
}
|
|
1151
985
|
|
|
986
|
+
// Save History
|
|
1152
987
|
router.saveHistory();
|
|
1153
988
|
router.emit('routeUrlUpdate', router.currentRoute, router);
|
|
1154
989
|
}
|
|
1155
|
-
|
|
1156
990
|
getInitialUrl() {
|
|
1157
991
|
const router = this;
|
|
1158
|
-
|
|
1159
992
|
if (router.initialUrl) {
|
|
1160
993
|
return {
|
|
1161
994
|
initialUrl: router.initialUrl,
|
|
1162
995
|
historyRestored: router.historyRestored
|
|
1163
996
|
};
|
|
1164
997
|
}
|
|
1165
|
-
|
|
1166
998
|
const {
|
|
1167
999
|
app,
|
|
1168
1000
|
view
|
|
@@ -1181,22 +1013,18 @@ class Router extends Framework7Class {
|
|
|
1181
1013
|
let {
|
|
1182
1014
|
browserHistoryRoot
|
|
1183
1015
|
} = router.params;
|
|
1184
|
-
|
|
1185
1016
|
if ((window.cordova || window.Capacitor && window.Capacitor.isNative) && browserHistory && !browserHistorySeparator && !browserHistoryRoot && location.pathname.indexOf('index.html')) {
|
|
1186
1017
|
// eslint-disable-next-line
|
|
1187
1018
|
console.warn('Framework7: wrong or not complete browserHistory configuration, trying to guess browserHistoryRoot');
|
|
1188
1019
|
browserHistoryRoot = location.pathname.split('index.html')[0];
|
|
1189
1020
|
}
|
|
1190
|
-
|
|
1191
1021
|
if (!browserHistory || !browserHistoryOnLoad) {
|
|
1192
1022
|
if (!initialUrl) {
|
|
1193
1023
|
initialUrl = documentUrl;
|
|
1194
1024
|
}
|
|
1195
|
-
|
|
1196
1025
|
if (location.search && initialUrl.indexOf('?') < 0) {
|
|
1197
1026
|
initialUrl += location.search;
|
|
1198
1027
|
}
|
|
1199
|
-
|
|
1200
1028
|
if (location.hash && initialUrl.indexOf('#') < 0) {
|
|
1201
1029
|
initialUrl += location.hash;
|
|
1202
1030
|
}
|
|
@@ -1205,15 +1033,12 @@ class Router extends Framework7Class {
|
|
|
1205
1033
|
documentUrl = documentUrl.substring(documentUrl.indexOf(browserHistoryRoot) + browserHistoryRoot.length);
|
|
1206
1034
|
if (documentUrl === '') documentUrl = '/';
|
|
1207
1035
|
}
|
|
1208
|
-
|
|
1209
1036
|
if (browserHistorySeparator.length > 0 && documentUrl.indexOf(browserHistorySeparator) >= 0) {
|
|
1210
1037
|
initialUrl = documentUrl.substring(documentUrl.indexOf(browserHistorySeparator) + browserHistorySeparator.length);
|
|
1211
1038
|
} else {
|
|
1212
1039
|
initialUrl = documentUrl;
|
|
1213
1040
|
}
|
|
1214
|
-
|
|
1215
1041
|
router.restoreHistory();
|
|
1216
|
-
|
|
1217
1042
|
if (router.history.indexOf(initialUrl) >= 0) {
|
|
1218
1043
|
router.history = router.history.slice(0, router.history.indexOf(initialUrl) + 1);
|
|
1219
1044
|
} else if (router.params.url === initialUrl) {
|
|
@@ -1223,16 +1048,13 @@ class Router extends Framework7Class {
|
|
|
1223
1048
|
} else {
|
|
1224
1049
|
router.history = [documentUrl.split(browserHistorySeparator)[0] || '/', initialUrl];
|
|
1225
1050
|
}
|
|
1226
|
-
|
|
1227
1051
|
if (router.history.length > 1) {
|
|
1228
1052
|
historyRestored = true;
|
|
1229
1053
|
} else {
|
|
1230
1054
|
router.history = [];
|
|
1231
1055
|
}
|
|
1232
|
-
|
|
1233
1056
|
router.saveHistory();
|
|
1234
1057
|
}
|
|
1235
|
-
|
|
1236
1058
|
router.initialUrl = initialUrl;
|
|
1237
1059
|
router.historyRestored = historyRestored;
|
|
1238
1060
|
return {
|
|
@@ -1240,7 +1062,6 @@ class Router extends Framework7Class {
|
|
|
1240
1062
|
historyRestored
|
|
1241
1063
|
};
|
|
1242
1064
|
}
|
|
1243
|
-
|
|
1244
1065
|
init() {
|
|
1245
1066
|
const router = this;
|
|
1246
1067
|
const {
|
|
@@ -1252,12 +1073,12 @@ class Router extends Framework7Class {
|
|
|
1252
1073
|
const {
|
|
1253
1074
|
initialUrl,
|
|
1254
1075
|
historyRestored
|
|
1255
|
-
} = router.getInitialUrl();
|
|
1076
|
+
} = router.getInitialUrl();
|
|
1256
1077
|
|
|
1257
|
-
|
|
1078
|
+
// Init Swipeback
|
|
1079
|
+
if (view && router.params.iosSwipeBack && app.theme === 'ios' || view && router.params.mdSwipeBack && app.theme === 'md') {
|
|
1258
1080
|
SwipeBack(router);
|
|
1259
1081
|
}
|
|
1260
|
-
|
|
1261
1082
|
const {
|
|
1262
1083
|
browserHistory,
|
|
1263
1084
|
browserHistoryOnLoad,
|
|
@@ -1265,12 +1086,10 @@ class Router extends Framework7Class {
|
|
|
1265
1086
|
browserHistoryInitialMatch
|
|
1266
1087
|
} = router.params;
|
|
1267
1088
|
let currentRoute;
|
|
1268
|
-
|
|
1269
1089
|
if (router.history.length > 1) {
|
|
1270
1090
|
// Will load page
|
|
1271
1091
|
const initUrl = browserHistoryInitialMatch ? initialUrl : router.history[0];
|
|
1272
1092
|
currentRoute = router.findMatchingRoute(initUrl);
|
|
1273
|
-
|
|
1274
1093
|
if (!currentRoute) {
|
|
1275
1094
|
currentRoute = extend(router.parseRouteUrl(initUrl), {
|
|
1276
1095
|
route: {
|
|
@@ -1282,7 +1101,6 @@ class Router extends Framework7Class {
|
|
|
1282
1101
|
} else {
|
|
1283
1102
|
// Don't load page
|
|
1284
1103
|
currentRoute = router.findMatchingRoute(initialUrl);
|
|
1285
|
-
|
|
1286
1104
|
if (!currentRoute) {
|
|
1287
1105
|
currentRoute = extend(router.parseRouteUrl(initialUrl), {
|
|
1288
1106
|
route: {
|
|
@@ -1292,19 +1110,7 @@ class Router extends Framework7Class {
|
|
|
1292
1110
|
});
|
|
1293
1111
|
}
|
|
1294
1112
|
}
|
|
1295
|
-
|
|
1296
|
-
if (router.params.stackPages) {
|
|
1297
|
-
router.$el.children('.page').each(pageEl => {
|
|
1298
|
-
const $pageEl = $(pageEl);
|
|
1299
|
-
router.initialPages.push($pageEl[0]);
|
|
1300
|
-
|
|
1301
|
-
if (router.dynamicNavbar && $pageEl.children('.navbar').length > 0) {
|
|
1302
|
-
router.initialNavbars.push($pageEl.children('.navbar')[0]);
|
|
1303
|
-
}
|
|
1304
|
-
});
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
if (router.$el.children('.page:not(.stacked)').length === 0 && initialUrl && router.params.loadInitialPage) {
|
|
1113
|
+
if (router.$el.children('.page').length === 0 && initialUrl && router.params.loadInitialPage) {
|
|
1308
1114
|
// No pages presented in DOM, reload new page
|
|
1309
1115
|
router.navigate(initialUrl, {
|
|
1310
1116
|
initial: true,
|
|
@@ -1315,108 +1121,85 @@ class Router extends Framework7Class {
|
|
|
1315
1121
|
modalOpen() {
|
|
1316
1122
|
if (!historyRestored) return;
|
|
1317
1123
|
const preloadPreviousPage = router.params.preloadPreviousPage || router.params[`${app.theme}SwipeBack`];
|
|
1318
|
-
|
|
1319
1124
|
if (preloadPreviousPage && router.history.length > 1) {
|
|
1320
1125
|
router.back({
|
|
1321
1126
|
preload: true
|
|
1322
1127
|
});
|
|
1323
1128
|
}
|
|
1324
1129
|
},
|
|
1325
|
-
|
|
1326
1130
|
pageAfterIn() {
|
|
1327
1131
|
if (!historyRestored) return;
|
|
1328
1132
|
const preloadPreviousPage = router.params.preloadPreviousPage || router.params[`${app.theme}SwipeBack`];
|
|
1329
|
-
|
|
1330
1133
|
if (preloadPreviousPage && router.history.length > 1) {
|
|
1331
1134
|
router.back({
|
|
1332
1135
|
preload: true
|
|
1333
1136
|
});
|
|
1334
1137
|
}
|
|
1335
1138
|
}
|
|
1336
|
-
|
|
1337
1139
|
}
|
|
1338
1140
|
});
|
|
1339
|
-
} else if (router.$el.children('.page
|
|
1141
|
+
} else if (router.$el.children('.page').length) {
|
|
1340
1142
|
// Init current DOM page
|
|
1341
1143
|
let hasTabRoute;
|
|
1342
1144
|
router.currentRoute = currentRoute;
|
|
1343
|
-
router.$el.children('.page
|
|
1145
|
+
router.$el.children('.page').each(pageEl => {
|
|
1344
1146
|
const $pageEl = $(pageEl);
|
|
1345
1147
|
let $navbarEl;
|
|
1346
1148
|
router.setPagePosition($pageEl, 'current');
|
|
1347
|
-
|
|
1348
1149
|
if (router.dynamicNavbar) {
|
|
1349
1150
|
$navbarEl = $pageEl.children('.navbar');
|
|
1350
|
-
|
|
1351
1151
|
if ($navbarEl.length > 0) {
|
|
1352
1152
|
if (!router.$navbarsEl.parents(document).length) {
|
|
1353
1153
|
router.$el.prepend(router.$navbarsEl);
|
|
1354
1154
|
}
|
|
1355
|
-
|
|
1356
1155
|
router.setNavbarPosition($navbarEl, 'current');
|
|
1357
1156
|
router.$navbarsEl.append($navbarEl);
|
|
1358
|
-
|
|
1359
1157
|
if ($navbarEl.children('.title-large').length) {
|
|
1360
1158
|
$navbarEl.addClass('navbar-large');
|
|
1361
1159
|
}
|
|
1362
|
-
|
|
1363
1160
|
$pageEl.children('.navbar').remove();
|
|
1364
1161
|
} else {
|
|
1365
1162
|
router.$navbarsEl.addClass('navbar-hidden');
|
|
1366
|
-
|
|
1367
1163
|
if ($navbarEl.children('.title-large').length) {
|
|
1368
1164
|
router.$navbarsEl.addClass('navbar-hidden navbar-large-hidden');
|
|
1369
1165
|
}
|
|
1370
1166
|
}
|
|
1371
1167
|
}
|
|
1372
|
-
|
|
1373
1168
|
if (router.currentRoute && router.currentRoute.route && (router.currentRoute.route.master === true || typeof router.currentRoute.route.master === 'function' && router.currentRoute.route.master(app, router)) && router.params.masterDetailBreakpoint > 0) {
|
|
1374
1169
|
$pageEl.addClass('page-master');
|
|
1375
1170
|
$pageEl.trigger('page:role', {
|
|
1376
1171
|
role: 'master'
|
|
1377
1172
|
});
|
|
1378
|
-
|
|
1379
1173
|
if ($navbarEl && $navbarEl.length) {
|
|
1380
1174
|
$navbarEl.addClass('navbar-master');
|
|
1381
1175
|
}
|
|
1382
|
-
|
|
1383
1176
|
view.checkMasterDetailBreakpoint();
|
|
1384
1177
|
}
|
|
1385
|
-
|
|
1386
1178
|
const initOptions = {
|
|
1387
1179
|
route: router.currentRoute
|
|
1388
1180
|
};
|
|
1389
|
-
|
|
1390
1181
|
if (router.currentRoute && router.currentRoute.route && router.currentRoute.route.options) {
|
|
1391
1182
|
extend(initOptions, router.currentRoute.route.options);
|
|
1392
1183
|
}
|
|
1393
|
-
|
|
1394
1184
|
router.currentPageEl = $pageEl[0];
|
|
1395
|
-
|
|
1396
1185
|
if (router.dynamicNavbar && $navbarEl.length) {
|
|
1397
1186
|
router.currentNavbarEl = $navbarEl[0];
|
|
1398
1187
|
}
|
|
1399
|
-
|
|
1400
1188
|
router.removeThemeElements($pageEl);
|
|
1401
|
-
|
|
1402
1189
|
if (router.dynamicNavbar && $navbarEl.length) {
|
|
1403
1190
|
router.removeThemeElements($navbarEl);
|
|
1404
1191
|
}
|
|
1405
|
-
|
|
1406
1192
|
if (initOptions.route.route.tab) {
|
|
1407
1193
|
hasTabRoute = true;
|
|
1408
1194
|
router.tabLoad(initOptions.route.route.tab, extend({}, initOptions));
|
|
1409
1195
|
}
|
|
1410
|
-
|
|
1411
1196
|
router.pageCallback('init', $pageEl, $navbarEl, 'current', undefined, initOptions);
|
|
1412
1197
|
router.pageCallback('beforeIn', $pageEl, $navbarEl, 'current', undefined, initOptions);
|
|
1413
1198
|
router.pageCallback('afterIn', $pageEl, $navbarEl, 'current', undefined, initOptions);
|
|
1414
1199
|
});
|
|
1415
|
-
|
|
1416
1200
|
if (historyRestored) {
|
|
1417
1201
|
if (browserHistoryInitialMatch) {
|
|
1418
1202
|
const preloadPreviousPage = router.params.preloadPreviousPage || router.params[`${app.theme}SwipeBack`];
|
|
1419
|
-
|
|
1420
1203
|
if (preloadPreviousPage && router.history.length > 1) {
|
|
1421
1204
|
router.back({
|
|
1422
1205
|
preload: true
|
|
@@ -1431,58 +1214,52 @@ class Router extends Framework7Class {
|
|
|
1431
1214
|
once: {
|
|
1432
1215
|
pageAfterIn() {
|
|
1433
1216
|
const preloadPreviousPage = router.params.preloadPreviousPage || router.params[`${app.theme}SwipeBack`];
|
|
1434
|
-
|
|
1435
1217
|
if (preloadPreviousPage && router.history.length > 2) {
|
|
1436
1218
|
router.back({
|
|
1437
1219
|
preload: true
|
|
1438
1220
|
});
|
|
1439
1221
|
}
|
|
1440
1222
|
}
|
|
1441
|
-
|
|
1442
1223
|
}
|
|
1443
1224
|
});
|
|
1444
1225
|
}
|
|
1445
1226
|
}
|
|
1446
|
-
|
|
1447
1227
|
if (!historyRestored && !hasTabRoute) {
|
|
1448
1228
|
router.history.push(initialUrl);
|
|
1449
1229
|
router.saveHistory();
|
|
1450
1230
|
}
|
|
1451
1231
|
}
|
|
1452
|
-
|
|
1453
1232
|
if (initialUrl && browserHistory && browserHistoryOnLoad && (!History.state || !History.state[view.id])) {
|
|
1454
1233
|
History.initViewState(view.id, {
|
|
1455
1234
|
url: initialUrl
|
|
1456
1235
|
});
|
|
1457
1236
|
}
|
|
1458
|
-
|
|
1459
1237
|
router.emit('local::init routerInit', router);
|
|
1460
1238
|
}
|
|
1461
|
-
|
|
1462
1239
|
destroy() {
|
|
1463
1240
|
let router = this;
|
|
1464
|
-
router.emit('local::destroy routerDestroy', router);
|
|
1241
|
+
router.emit('local::destroy routerDestroy', router);
|
|
1465
1242
|
|
|
1243
|
+
// Delete props & methods
|
|
1466
1244
|
Object.keys(router).forEach(routerProp => {
|
|
1467
1245
|
router[routerProp] = null;
|
|
1468
1246
|
delete router[routerProp];
|
|
1469
1247
|
});
|
|
1470
1248
|
router = null;
|
|
1471
1249
|
}
|
|
1250
|
+
}
|
|
1472
1251
|
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1252
|
+
// Load
|
|
1476
1253
|
Router.prototype.navigate = navigate;
|
|
1477
|
-
Router.prototype.refreshPage = refreshPage;
|
|
1478
|
-
|
|
1254
|
+
Router.prototype.refreshPage = refreshPage;
|
|
1255
|
+
// Tab
|
|
1479
1256
|
Router.prototype.tabLoad = tabLoad;
|
|
1480
|
-
Router.prototype.tabRemove = tabRemove;
|
|
1481
|
-
|
|
1257
|
+
Router.prototype.tabRemove = tabRemove;
|
|
1258
|
+
// Modal
|
|
1482
1259
|
Router.prototype.modalLoad = modalLoad;
|
|
1483
|
-
Router.prototype.modalRemove = modalRemove;
|
|
1484
|
-
|
|
1485
|
-
Router.prototype.back = back;
|
|
1486
|
-
|
|
1260
|
+
Router.prototype.modalRemove = modalRemove;
|
|
1261
|
+
// Back
|
|
1262
|
+
Router.prototype.back = back;
|
|
1263
|
+
// Clear history
|
|
1487
1264
|
Router.prototype.clearPreviousHistory = clearPreviousHistory;
|
|
1488
1265
|
export default Router;
|