framework7 8.3.4 → 9.0.0-beta.1
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/actions/actions-ios.less +22 -15
- package/components/actions/actions-rtl.css +1 -1
- package/components/actions/actions-vars.less +4 -7
- package/components/actions/actions.css +1 -1
- package/components/actions/actions.js +2 -8
- package/components/actions/actions.less +0 -3
- package/components/app/app-class.d.ts +2 -0
- package/components/app/app-class.js +19 -15
- package/components/app/app-vars.less +41 -6
- package/components/app/app.less +1 -1
- package/components/area-chart/area-chart-class.js +18 -31
- package/components/area-chart/area-chart-rtl.css +1 -1
- package/components/area-chart/area-chart.css +1 -1
- package/components/autocomplete/autocomplete-class.js +13 -14
- package/components/autocomplete/autocomplete-ios.less +16 -0
- package/components/autocomplete/autocomplete-rtl.css +1 -1
- package/components/autocomplete/autocomplete.css +1 -1
- package/components/autocomplete/autocomplete.d.ts +3 -3
- package/components/autocomplete/autocomplete.js +3 -3
- package/components/autocomplete/autocomplete.less +7 -1
- package/components/block/block-vars.less +6 -6
- package/components/breadcrumbs/breadcrumbs-rtl.css +1 -1
- package/components/breadcrumbs/breadcrumbs.css +1 -1
- package/components/button/button-vars.less +13 -12
- package/components/button/button.less +2 -1
- package/components/calendar/calendar-class.js +20 -17
- package/components/calendar/calendar-ios.less +43 -0
- package/components/calendar/calendar-md.less +3 -0
- package/components/calendar/calendar-rtl.css +1 -1
- package/components/calendar/calendar-vars.less +24 -19
- package/components/calendar/calendar.css +1 -1
- package/components/calendar/calendar.d.ts +1 -1
- package/components/calendar/calendar.js +5 -8
- package/components/calendar/calendar.less +4 -2
- package/components/card/card-rtl.css +1 -1
- package/components/card/card-vars.less +5 -5
- package/components/card/card.css +1 -1
- package/components/card/card.js +3 -18
- package/components/card/card.less +1 -1
- package/components/color-picker/color-picker-class.js +11 -23
- package/components/color-picker/color-picker-ios.less +9 -0
- package/components/color-picker/color-picker-md.less +15 -0
- package/components/color-picker/color-picker-rtl.css +1 -1
- package/components/color-picker/color-picker-vars.less +9 -3
- package/components/color-picker/color-picker.css +1 -1
- package/components/color-picker/color-picker.d.ts +1 -2
- package/components/color-picker/color-picker.js +3 -7
- package/components/color-picker/color-picker.less +5 -25
- package/components/color-picker/modules/alpha-slider.js +2 -0
- package/components/color-picker/modules/brightness-slider.js +2 -0
- package/components/color-picker/modules/hs-spectrum.js +1 -2
- package/components/color-picker/modules/hsb-sliders.js +6 -0
- package/components/color-picker/modules/hue-slider.js +2 -0
- package/components/color-picker/modules/rgb-bars.js +6 -0
- package/components/color-picker/modules/rgb-sliders.js +6 -0
- package/components/color-picker/modules/sb-spectrum.js +1 -2
- package/components/color-picker/modules/wheel.js +1 -2
- package/components/data-table/data-table-class.js +1 -4
- package/components/data-table/data-table-ios.less +1 -1
- package/components/data-table/data-table-md.less +4 -2
- 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.less +4 -4
- package/components/dialog/dialog-class.js +6 -3
- package/components/dialog/dialog-ios.less +10 -34
- package/components/dialog/dialog-md.less +2 -22
- package/components/dialog/dialog-rtl.css +1 -1
- package/components/dialog/dialog-vars.less +8 -10
- package/components/dialog/dialog.css +1 -1
- package/components/dialog/dialog.js +9 -27
- package/components/dialog/dialog.less +6 -25
- package/components/fab/fab-ios.less +2 -0
- package/components/fab/fab-rtl.css +1 -1
- package/components/fab/fab-vars.less +30 -6
- package/components/fab/fab.css +1 -1
- package/components/fab/fab.js +3 -12
- package/components/gauge/gauge-class.js +2 -8
- package/components/icon/icon-ios.less +10 -0
- package/components/icon/icon-md.less +9 -0
- package/components/icon/icon.less +2 -1
- package/components/input/input-ios.less +3 -2
- package/components/input/input-rtl.css +1 -1
- package/components/input/input.css +1 -1
- package/components/input/input.js +2 -5
- package/components/list/list-vars.less +7 -5
- package/components/list/list.less +1 -1
- package/components/list-index/list-index-class.js +3 -7
- package/components/login-screen/login-screen.js +2 -8
- package/components/login-screen/login-screen.less +1 -0
- package/components/messagebar/messagebar-class.js +5 -20
- package/components/messagebar/messagebar-ios.less +19 -14
- package/components/messagebar/messagebar-md.less +3 -0
- package/components/messagebar/messagebar-rtl.css +1 -1
- package/components/messagebar/messagebar-vars.less +12 -15
- package/components/messagebar/messagebar.css +1 -1
- package/components/messagebar/messagebar.less +4 -5
- package/components/messages/messages-class.js +25 -52
- package/components/messages/messages-ios.less +6 -2
- package/components/messages/messages-rtl.css +1 -1
- package/components/messages/messages-vars.less +1 -1
- package/components/messages/messages.css +1 -1
- package/components/navbar/navbar-ios.less +48 -672
- package/components/navbar/navbar-md.less +41 -1
- package/components/navbar/navbar-vars.less +4 -3
- package/components/navbar/navbar.js +28 -185
- package/components/navbar/navbar.less +8 -66
- package/components/notification/notification-class.js +6 -6
- package/components/notification/notification-ios.less +3 -8
- package/components/notification/notification-md.less +1 -20
- package/components/notification/notification-rtl.css +1 -1
- package/components/notification/notification-vars.less +13 -16
- package/components/notification/notification.css +1 -1
- package/components/notification/notification.less +8 -1
- package/components/page/page-ios.less +1 -8
- package/components/page/page-md.less +12 -11
- package/components/page/page.less +14 -12
- package/components/panel/panel-class.js +7 -28
- package/components/panel/panel-ios.less +4 -0
- package/components/panel/panel-rtl.css +2 -2
- package/components/panel/panel-vars.less +8 -5
- package/components/panel/panel.css +2 -2
- package/components/panel/panel.js +8 -32
- package/components/panel/panel.less +9 -9
- package/components/panel/resizable-panel.js +2 -4
- package/components/photo-browser/photo-browser-class.js +12 -47
- package/components/photo-browser/photo-browser-rtl.css +1 -1
- package/components/photo-browser/photo-browser-vars.less +8 -10
- 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 -3
- package/components/photo-browser/photo-browser.less +15 -71
- package/components/picker/picker-class.js +4 -5
- package/components/picker/picker-ios.less +6 -1
- package/components/picker/picker-md.less +9 -0
- package/components/picker/picker-rtl.css +1 -1
- package/components/picker/picker-vars.less +1 -1
- package/components/picker/picker.css +1 -1
- package/components/picker/picker.d.ts +1 -1
- package/components/picker/picker.js +2 -5
- package/components/picker/picker.less +0 -4
- package/components/pie-chart/pie-chart-class.js +7 -14
- package/components/popover/popover-class.js +22 -62
- package/components/popover/popover-ios.less +66 -2
- package/components/popover/popover-md.less +2 -27
- package/components/popover/popover-rtl.css +1 -1
- package/components/popover/popover-vars.less +2 -3
- package/components/popover/popover.css +1 -1
- package/components/popover/popover.d.ts +0 -2
- package/components/popover/popover.js +2 -9
- package/components/popover/popover.less +28 -50
- package/components/popup/popup-class.js +15 -9
- package/components/popup/popup-rtl.css +1 -1
- package/components/popup/popup-vars.less +2 -2
- package/components/popup/popup.css +1 -1
- package/components/popup/popup.js +2 -8
- package/components/popup/popup.less +6 -6
- package/components/preloader/preloader.js +2 -8
- package/components/progressbar/progressbar-md.less +12 -0
- package/components/progressbar/progressbar-rtl.css +1 -1
- package/components/progressbar/progressbar-vars.less +6 -5
- package/components/progressbar/progressbar.css +1 -1
- package/components/progressbar/progressbar.js +3 -12
- package/components/progressbar/progressbar.less +6 -0
- package/components/pull-to-refresh/pull-to-refresh-class.js +5 -12
- package/components/range/range-class.js +34 -27
- package/components/range/range-ios.less +60 -0
- package/components/range/range-md.less +67 -4
- package/components/range/range-rtl.css +1 -1
- package/components/range/range-vars.less +18 -13
- package/components/range/range.css +1 -1
- package/components/range/range.d.ts +3 -1
- package/components/range/range.js +2 -8
- package/components/range/range.less +11 -24
- package/components/searchbar/searchbar-class.js +7 -8
- package/components/searchbar/searchbar-ios.less +37 -13
- package/components/searchbar/searchbar-md.less +5 -0
- package/components/searchbar/searchbar-rtl.css +1 -1
- package/components/searchbar/searchbar-vars.less +13 -16
- package/components/searchbar/searchbar.css +1 -1
- package/components/searchbar/searchbar.js +4 -32
- package/components/searchbar/searchbar.less +4 -5
- package/components/sheet/sheet-class.js +21 -17
- package/components/sheet/sheet-ios.less +10 -0
- package/components/sheet/sheet-md.less +14 -0
- package/components/sheet/sheet-rtl.css +1 -1
- package/components/sheet/sheet-vars.less +5 -9
- package/components/sheet/sheet.css +1 -1
- package/components/sheet/sheet.js +2 -8
- package/components/sheet/sheet.less +5 -17
- package/components/skeleton/skeleton-rtl.css +1 -1
- package/components/skeleton/skeleton.css +1 -1
- package/components/smart-select/smart-select-class.js +15 -20
- package/components/smart-select/smart-select.d.ts +5 -7
- package/components/smart-select/smart-select.js +4 -4
- package/components/sortable/sortable.js +8 -27
- package/components/statusbar/statusbar.js +1 -4
- package/components/stepper/stepper-rtl.css +1 -1
- package/components/stepper/stepper-vars.less +3 -3
- package/components/stepper/stepper.css +1 -1
- package/components/stepper/stepper.js +2 -8
- package/components/subnavbar/subnavbar-ios.less +16 -1
- package/components/subnavbar/subnavbar-md.less +1 -1
- package/components/subnavbar/subnavbar-vars.less +12 -6
- package/components/subnavbar/subnavbar.less +5 -6
- package/components/swipeout/swipeout-ios.less +37 -0
- package/components/swipeout/swipeout-md.less +56 -0
- package/components/swipeout/swipeout-rtl.css +1 -1
- package/components/swipeout/swipeout-vars.less +13 -2
- package/components/swipeout/swipeout.css +1 -1
- package/components/swipeout/swipeout.js +102 -35
- package/components/swipeout/swipeout.less +20 -44
- package/components/swiper/swiper-rtl.css +1 -1
- package/components/swiper/swiper.css +1 -1
- package/components/tabs/tabs.js +3 -9
- package/components/text-editor/text-editor-class.js +1 -1
- package/components/text-editor/text-editor-rtl.css +1 -1
- package/components/text-editor/text-editor.css +1 -1
- package/components/timeline/timeline-ios.less +0 -5
- package/components/timeline/timeline-md.less +0 -5
- package/components/timeline/timeline-rtl.css +1 -1
- package/components/timeline/timeline-vars.less +1 -17
- package/components/timeline/timeline.css +1 -1
- package/components/timeline/timeline.less +0 -196
- package/components/toast/toast-class.js +2 -2
- package/components/toast/toast-ios.less +2 -0
- package/components/toast/toast-rtl.css +1 -1
- package/components/toast/toast-vars.less +2 -4
- package/components/toast/toast.css +1 -1
- package/components/toast/toast.less +1 -1
- package/components/toggle/toggle-class.js +5 -12
- package/components/toggle/toggle-ios.less +68 -50
- package/components/toggle/toggle-rtl.css +1 -1
- package/components/toggle/toggle-vars.less +2 -2
- package/components/toggle/toggle.css +1 -1
- package/components/toolbar/tabbar-highlight.js +134 -0
- package/components/toolbar/toolbar-ios.less +152 -14
- package/components/toolbar/toolbar-md.less +77 -3
- package/components/toolbar/toolbar-vars.less +14 -10
- package/components/toolbar/toolbar.js +32 -13
- package/components/toolbar/toolbar.less +8 -56
- package/components/tooltip/tooltip-class.js +13 -16
- package/components/tooltip/tooltip.js +0 -16
- package/components/touch-highlight/touch-highlight-ios.less +17 -0
- package/components/touch-highlight/touch-highlight-md.less +2 -0
- package/components/touch-highlight/touch-highlight-vars.less +8 -0
- package/components/touch-highlight/touch-highlight.d.ts +25 -0
- package/components/touch-highlight/touch-highlight.js +123 -0
- package/components/touch-highlight/touch-highlight.less +9 -0
- package/components/touch-ripple/touch-ripple.js +1 -4
- package/components/view/resizable-view.js +2 -4
- package/components/view/view-class.js +1 -15
- package/components/view/view.d.ts +0 -4
- package/components/view/view.js +1 -5
- package/components/virtual-list/virtual-list-class.js +2 -8
- package/framework7-bundle-rtl.css +2284 -3019
- package/framework7-bundle-rtl.min.css +9 -7
- package/framework7-bundle.css +2245 -2978
- package/framework7-bundle.esm.js +5 -4
- package/framework7-bundle.js +7170 -6469
- package/framework7-bundle.js.map +1 -1
- package/framework7-bundle.less +4 -3
- package/framework7-bundle.min.css +9 -7
- package/framework7-bundle.min.js +4 -4
- package/framework7-bundle.min.js.map +1 -1
- package/framework7-lite-bundle.esm.js +5 -4
- package/framework7-lite.esm.js +5 -4
- package/framework7-rtl.css +509 -844
- package/framework7-rtl.min.css +8 -6
- package/framework7-types.d.ts +5 -1
- package/framework7.css +509 -843
- package/framework7.d.ts +4 -0
- package/framework7.esm.js +5 -4
- package/framework7.less +4 -3
- package/framework7.min.css +8 -6
- package/less/mixins.less +10 -12
- package/modules/component/$h.js +1 -4
- package/modules/component/$jsx.js +1 -4
- package/modules/component/component-class.js +49 -114
- package/modules/component/component.js +6 -7
- package/modules/component/eventslisteners.js +1 -4
- package/modules/component/snabbdom/modules/hero.js +0 -1
- package/modules/component/snabbdom/modules/style.js +1 -1
- package/modules/component/vdom.js +17 -29
- package/modules/router/back.js +22 -96
- package/modules/router/clear-previous-history.js +1 -7
- package/modules/router/component-loader.js +23 -32
- package/modules/router/modal.js +1 -4
- package/modules/router/navigate.js +28 -167
- package/modules/router/redirect.js +1 -5
- package/modules/router/router-class.js +21 -288
- package/modules/router/swipe-back.js +10 -318
- package/modules/router/tab.js +1 -4
- package/modules/store/create-store.js +2 -8
- package/modules/touch/touch.d.ts +5 -3
- package/modules/touch/touch.js +22 -36
- package/package.json +4 -4
- package/shared/$jsx.js +1 -4
- package/shared/class.js +5 -26
- package/shared/constructor-methods.js +4 -19
- package/shared/events-class.js +3 -12
- package/shared/get-device.js +4 -11
- package/shared/get-support.d.ts +0 -6
- package/shared/get-support.js +1 -20
- package/shared/material-color-utils.js +2102 -693
- package/shared/material-colors.js +94 -23
- package/shared/modal-methods.js +2 -8
- package/shared/utils.js +23 -45
|
@@ -2,7 +2,7 @@ import { getWindow, getDocument } from 'ssr-window';
|
|
|
2
2
|
import { pathToRegexp, compile } from 'path-to-regexp';
|
|
3
3
|
import $ from '../../shared/dom7.js';
|
|
4
4
|
import Framework7Class from '../../shared/class.js';
|
|
5
|
-
import { extend,
|
|
5
|
+
import { extend, parseUrlQuery, serializeObject, now, eventNameToColonCase } from '../../shared/utils.js';
|
|
6
6
|
import History from '../../shared/history.js';
|
|
7
7
|
import SwipeBack from './swipe-back.js';
|
|
8
8
|
import { refreshPage, navigate } from './navigate.js';
|
|
@@ -39,9 +39,7 @@ class Router extends Framework7Class {
|
|
|
39
39
|
propsHistory: [],
|
|
40
40
|
scrollHistory: view.scrollHistory,
|
|
41
41
|
cache: app.cache,
|
|
42
|
-
|
|
43
|
-
initialPages: [],
|
|
44
|
-
initialNavbars: []
|
|
42
|
+
initialPages: []
|
|
45
43
|
});
|
|
46
44
|
}
|
|
47
45
|
|
|
@@ -57,10 +55,7 @@ class Router extends Framework7Class {
|
|
|
57
55
|
Object.defineProperty(router, 'currentRoute', {
|
|
58
56
|
enumerable: true,
|
|
59
57
|
configurable: true,
|
|
60
|
-
set(newRoute) {
|
|
61
|
-
if (newRoute === void 0) {
|
|
62
|
-
newRoute = {};
|
|
63
|
-
}
|
|
58
|
+
set(newRoute = {}) {
|
|
64
59
|
previousRoute = extend({}, currentRoute);
|
|
65
60
|
currentRoute = newRoute;
|
|
66
61
|
if (!currentRoute) return;
|
|
@@ -90,204 +85,34 @@ class Router extends Framework7Class {
|
|
|
90
85
|
extend(false, router, {
|
|
91
86
|
tempDom: document.createElement('div'),
|
|
92
87
|
$el: view.$el,
|
|
93
|
-
el: view.el
|
|
94
|
-
$navbarsEl: view.$navbarsEl,
|
|
95
|
-
navbarsEl: view.navbarsEl
|
|
88
|
+
el: view.el
|
|
96
89
|
});
|
|
97
90
|
router.emit('local::mount routerMount', router);
|
|
98
91
|
}
|
|
99
|
-
|
|
100
|
-
const router = this;
|
|
101
|
-
const dynamicNavbar = router.dynamicNavbar;
|
|
102
|
-
const animateIcon = router.params.iosAnimateNavbarBackIcon;
|
|
103
|
-
let newNavEls;
|
|
104
|
-
let oldNavEls;
|
|
105
|
-
function animatableNavEl($el, $navbarInner) {
|
|
106
|
-
const isSliding = $el.hasClass('sliding') || $navbarInner.hasClass('sliding');
|
|
107
|
-
const isSubnavbar = $el.hasClass('subnavbar');
|
|
108
|
-
const needsOpacityTransition = isSliding ? !isSubnavbar : true;
|
|
109
|
-
const $iconEl = $el.find('.back .icon');
|
|
110
|
-
let isIconLabel;
|
|
111
|
-
if (isSliding && animateIcon && $el.hasClass('left') && $iconEl.length > 0 && $iconEl.next('span').length) {
|
|
112
|
-
$el = $iconEl.next('span'); // eslint-disable-line
|
|
113
|
-
isIconLabel = true;
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
$el,
|
|
117
|
-
isIconLabel,
|
|
118
|
-
leftOffset: $el[0].f7NavbarLeftOffset,
|
|
119
|
-
rightOffset: $el[0].f7NavbarRightOffset,
|
|
120
|
-
isSliding,
|
|
121
|
-
isSubnavbar,
|
|
122
|
-
needsOpacityTransition
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
if (dynamicNavbar) {
|
|
126
|
-
newNavEls = [];
|
|
127
|
-
oldNavEls = [];
|
|
128
|
-
$newNavbarEl.children('.navbar-inner').children('.left, .right, .title, .subnavbar').each(navEl => {
|
|
129
|
-
const $navEl = $(navEl);
|
|
130
|
-
if ($navEl.hasClass('left') && fromLarge && direction === 'forward') return;
|
|
131
|
-
if ($navEl.hasClass('title') && toLarge) return;
|
|
132
|
-
newNavEls.push(animatableNavEl($navEl, $newNavbarEl.children('.navbar-inner')));
|
|
133
|
-
});
|
|
134
|
-
if (!($oldNavbarEl.hasClass('navbar-master') && router.params.masterDetailBreakpoint > 0 && router.app.width >= router.params.masterDetailBreakpoint)) {
|
|
135
|
-
$oldNavbarEl.children('.navbar-inner').children('.left, .right, .title, .subnavbar').each(navEl => {
|
|
136
|
-
const $navEl = $(navEl);
|
|
137
|
-
if ($navEl.hasClass('left') && toLarge && !fromLarge && direction === 'forward') return;
|
|
138
|
-
if ($navEl.hasClass('left') && toLarge && direction === 'backward') return;
|
|
139
|
-
if ($navEl.hasClass('title') && fromLarge) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
oldNavEls.push(animatableNavEl($navEl, $oldNavbarEl.children('.navbar-inner')));
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
[oldNavEls, newNavEls].forEach(navEls => {
|
|
146
|
-
navEls.forEach(navEl => {
|
|
147
|
-
const n = navEl;
|
|
148
|
-
const {
|
|
149
|
-
isSliding,
|
|
150
|
-
$el
|
|
151
|
-
} = navEl;
|
|
152
|
-
const otherEls = navEls === oldNavEls ? newNavEls : oldNavEls;
|
|
153
|
-
if (!(isSliding && $el.hasClass('title') && otherEls)) return;
|
|
154
|
-
otherEls.forEach(otherNavEl => {
|
|
155
|
-
if (otherNavEl.isIconLabel) {
|
|
156
|
-
const iconTextEl = otherNavEl.$el[0];
|
|
157
|
-
n.leftOffset += iconTextEl ? iconTextEl.offsetLeft || 0 : 0;
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
return {
|
|
164
|
-
newNavEls,
|
|
165
|
-
oldNavEls
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
animate($oldPageEl, $newPageEl, $oldNavbarEl, $newNavbarEl, direction, transition, callback) {
|
|
92
|
+
animate($oldPageEl, $newPageEl, direction, transition, callback) {
|
|
169
93
|
const router = this;
|
|
170
94
|
if (router.params.animateCustom) {
|
|
171
|
-
router.params.animateCustom.apply(router, [$oldPageEl, $newPageEl,
|
|
95
|
+
router.params.animateCustom.apply(router, [$oldPageEl, $newPageEl, direction, callback]);
|
|
172
96
|
return;
|
|
173
97
|
}
|
|
174
|
-
const dynamicNavbar = router.dynamicNavbar;
|
|
175
98
|
const ios = router.app.theme === 'ios';
|
|
176
99
|
if (transition) {
|
|
177
100
|
const routerCustomTransitionClass = `router-transition-custom router-transition-${transition}-${direction}`;
|
|
178
101
|
// Animate
|
|
179
102
|
const onCustomTransitionDone = () => {
|
|
180
103
|
router.$el.removeClass(routerCustomTransitionClass);
|
|
181
|
-
if (dynamicNavbar && router.$navbarsEl.length) {
|
|
182
|
-
if ($newNavbarEl) {
|
|
183
|
-
router.$navbarsEl.prepend($newNavbarEl);
|
|
184
|
-
}
|
|
185
|
-
if ($oldNavbarEl) {
|
|
186
|
-
router.$navbarsEl.prepend($oldNavbarEl);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
104
|
if (callback) callback();
|
|
190
105
|
};
|
|
191
106
|
(direction === 'forward' ? $newPageEl : $oldPageEl).animationEnd(onCustomTransitionDone);
|
|
192
|
-
if (dynamicNavbar) {
|
|
193
|
-
if ($newNavbarEl && $newPageEl) {
|
|
194
|
-
router.setNavbarPosition($newNavbarEl, '');
|
|
195
|
-
$newNavbarEl.removeClass('navbar-next navbar-previous navbar-current');
|
|
196
|
-
$newPageEl.prepend($newNavbarEl);
|
|
197
|
-
}
|
|
198
|
-
if ($oldNavbarEl && $oldPageEl) {
|
|
199
|
-
router.setNavbarPosition($oldNavbarEl, '');
|
|
200
|
-
$oldNavbarEl.removeClass('navbar-next navbar-previous navbar-current');
|
|
201
|
-
$oldPageEl.prepend($oldNavbarEl);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
107
|
router.$el.addClass(routerCustomTransitionClass);
|
|
205
108
|
return;
|
|
206
109
|
}
|
|
207
110
|
|
|
208
111
|
// Router Animation class
|
|
209
112
|
const routerTransitionClass = `router-transition-${direction} router-transition`;
|
|
210
|
-
let newNavEls;
|
|
211
|
-
let oldNavEls;
|
|
212
|
-
let fromLarge;
|
|
213
|
-
let toLarge;
|
|
214
|
-
let toDifferent;
|
|
215
|
-
let oldIsLarge;
|
|
216
|
-
let newIsLarge;
|
|
217
|
-
if (ios && dynamicNavbar) {
|
|
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'));
|
|
219
|
-
if (!betweenMasterAndDetail) {
|
|
220
|
-
oldIsLarge = $oldNavbarEl && $oldNavbarEl.hasClass('navbar-large');
|
|
221
|
-
newIsLarge = $newNavbarEl && $newNavbarEl.hasClass('navbar-large');
|
|
222
|
-
fromLarge = oldIsLarge && !$oldNavbarEl.hasClass('navbar-large-collapsed');
|
|
223
|
-
toLarge = newIsLarge && !$newNavbarEl.hasClass('navbar-large-collapsed');
|
|
224
|
-
toDifferent = fromLarge && !toLarge || toLarge && !fromLarge;
|
|
225
|
-
}
|
|
226
|
-
const navEls = router.animatableNavElements($newNavbarEl, $oldNavbarEl, toLarge, fromLarge, direction);
|
|
227
|
-
newNavEls = navEls.newNavEls;
|
|
228
|
-
oldNavEls = navEls.oldNavEls;
|
|
229
|
-
}
|
|
230
|
-
function animateNavbars(progress) {
|
|
231
|
-
if (!(ios && dynamicNavbar)) return;
|
|
232
|
-
if (progress === 1) {
|
|
233
|
-
if (toLarge) {
|
|
234
|
-
$newNavbarEl.addClass('router-navbar-transition-to-large');
|
|
235
|
-
$oldNavbarEl.addClass('router-navbar-transition-to-large');
|
|
236
|
-
}
|
|
237
|
-
if (fromLarge) {
|
|
238
|
-
$newNavbarEl.addClass('router-navbar-transition-from-large');
|
|
239
|
-
$oldNavbarEl.addClass('router-navbar-transition-from-large');
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
newNavEls.forEach(navEl => {
|
|
243
|
-
const $el = navEl.$el;
|
|
244
|
-
const offset = direction === 'forward' ? navEl.rightOffset : navEl.leftOffset;
|
|
245
|
-
if (navEl.isSliding) {
|
|
246
|
-
if (navEl.isSubnavbar && newIsLarge) {
|
|
247
|
-
// prettier-ignore
|
|
248
|
-
$el[0].style.setProperty('transform', `translate3d(${offset * (1 - progress)}px, calc(-1 * var(--f7-navbar-large-collapse-progress) * var(--f7-navbar-large-title-height)), 0)`, 'important');
|
|
249
|
-
} else {
|
|
250
|
-
$el.transform(`translate3d(${offset * (1 - progress)}px,0,0)`);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
oldNavEls.forEach(navEl => {
|
|
255
|
-
const $el = navEl.$el;
|
|
256
|
-
const offset = direction === 'forward' ? navEl.leftOffset : navEl.rightOffset;
|
|
257
|
-
if (navEl.isSliding) {
|
|
258
|
-
if (navEl.isSubnavbar && oldIsLarge) {
|
|
259
|
-
$el.transform(`translate3d(${offset * progress}px, calc(-1 * var(--f7-navbar-large-collapse-progress) * var(--f7-navbar-large-title-height)), 0)`);
|
|
260
|
-
} else {
|
|
261
|
-
$el.transform(`translate3d(${offset * progress}px,0,0)`);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
113
|
|
|
267
114
|
// AnimationEnd Callback
|
|
268
115
|
function onDone() {
|
|
269
|
-
if (router.dynamicNavbar) {
|
|
270
|
-
if ($newNavbarEl) {
|
|
271
|
-
$newNavbarEl.removeClass('router-navbar-transition-to-large router-navbar-transition-from-large');
|
|
272
|
-
$newNavbarEl.addClass('navbar-no-title-large-transition');
|
|
273
|
-
nextFrame(() => {
|
|
274
|
-
$newNavbarEl.removeClass('navbar-no-title-large-transition');
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
if ($oldNavbarEl) {
|
|
278
|
-
$oldNavbarEl.removeClass('router-navbar-transition-to-large router-navbar-transition-from-large');
|
|
279
|
-
}
|
|
280
|
-
if ($newNavbarEl.hasClass('sliding') || $newNavbarEl.children('.navbar-inner.sliding').length) {
|
|
281
|
-
$newNavbarEl.find('.title, .left, .right, .left .icon, .subnavbar').transform('');
|
|
282
|
-
} else {
|
|
283
|
-
$newNavbarEl.find('.sliding').transform('');
|
|
284
|
-
}
|
|
285
|
-
if ($oldNavbarEl.hasClass('sliding') || $oldNavbarEl.children('.navbar-inner.sliding').length) {
|
|
286
|
-
$oldNavbarEl.find('.title, .left, .right, .left .icon, .subnavbar').transform('');
|
|
287
|
-
} else {
|
|
288
|
-
$oldNavbarEl.find('.sliding').transform('');
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
116
|
router.$el.removeClass(routerTransitionClass);
|
|
292
117
|
if (callback) callback();
|
|
293
118
|
}
|
|
@@ -297,23 +122,8 @@ class Router extends Framework7Class {
|
|
|
297
122
|
onDone();
|
|
298
123
|
});
|
|
299
124
|
|
|
300
|
-
//
|
|
301
|
-
|
|
302
|
-
// Prepare Navbars
|
|
303
|
-
animateNavbars(0);
|
|
304
|
-
nextFrame(() => {
|
|
305
|
-
// Add class, start animation
|
|
306
|
-
router.$el.addClass(routerTransitionClass);
|
|
307
|
-
if (toDifferent) {
|
|
308
|
-
// eslint-disable-next-line
|
|
309
|
-
router.el._clientLeft = router.el.clientLeft;
|
|
310
|
-
}
|
|
311
|
-
animateNavbars(1);
|
|
312
|
-
});
|
|
313
|
-
} else {
|
|
314
|
-
// Add class, start animation
|
|
315
|
-
router.$el.addClass(routerTransitionClass);
|
|
316
|
-
}
|
|
125
|
+
// Add class, start animation
|
|
126
|
+
router.$el.addClass(routerTransitionClass);
|
|
317
127
|
}
|
|
318
128
|
removeModal(modalEl) {
|
|
319
129
|
const router = this;
|
|
@@ -324,10 +134,6 @@ class Router extends Framework7Class {
|
|
|
324
134
|
const $tabEl = $(tabEl);
|
|
325
135
|
$tabEl.html('');
|
|
326
136
|
}
|
|
327
|
-
removeNavbar(el) {
|
|
328
|
-
const router = this;
|
|
329
|
-
router.removeEl(el);
|
|
330
|
-
}
|
|
331
137
|
removePage(el) {
|
|
332
138
|
const $el = $(el);
|
|
333
139
|
const f7Page = $el && $el[0] && $el[0].f7Page;
|
|
@@ -404,10 +210,7 @@ class Router extends Framework7Class {
|
|
|
404
210
|
if (found && found.length > 1) return $(found[0]);
|
|
405
211
|
return undefined;
|
|
406
212
|
}
|
|
407
|
-
flattenRoutes(routes) {
|
|
408
|
-
if (routes === void 0) {
|
|
409
|
-
routes = this.routes;
|
|
410
|
-
}
|
|
213
|
+
flattenRoutes(routes = this.routes) {
|
|
411
214
|
const router = this;
|
|
412
215
|
let flattenedRoutes = [];
|
|
413
216
|
routes.forEach(route => {
|
|
@@ -469,10 +272,7 @@ class Router extends Framework7Class {
|
|
|
469
272
|
path
|
|
470
273
|
};
|
|
471
274
|
}
|
|
472
|
-
generateUrl(parameters) {
|
|
473
|
-
if (parameters === void 0) {
|
|
474
|
-
parameters = {};
|
|
475
|
-
}
|
|
275
|
+
generateUrl(parameters = {}) {
|
|
476
276
|
if (typeof parameters === 'string') {
|
|
477
277
|
return parameters;
|
|
478
278
|
}
|
|
@@ -508,11 +308,10 @@ class Router extends Framework7Class {
|
|
|
508
308
|
}
|
|
509
309
|
|
|
510
310
|
// eslint-disable-next-line
|
|
511
|
-
constructRouteUrl(route,
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
} = _temp === void 0 ? {} : _temp;
|
|
311
|
+
constructRouteUrl(route, {
|
|
312
|
+
params,
|
|
313
|
+
query
|
|
314
|
+
} = {}) {
|
|
516
315
|
const {
|
|
517
316
|
path
|
|
518
317
|
} = route;
|
|
@@ -620,13 +419,7 @@ class Router extends Framework7Class {
|
|
|
620
419
|
}
|
|
621
420
|
|
|
622
421
|
// eslint-disable-next-line
|
|
623
|
-
replaceRequestUrlParams(url, options) {
|
|
624
|
-
if (url === void 0) {
|
|
625
|
-
url = '';
|
|
626
|
-
}
|
|
627
|
-
if (options === void 0) {
|
|
628
|
-
options = {};
|
|
629
|
-
}
|
|
422
|
+
replaceRequestUrlParams(url = '', options = {}) {
|
|
630
423
|
let compiledUrl = url;
|
|
631
424
|
if (typeof compiledUrl === 'string' && compiledUrl.indexOf('{{') >= 0 && options && options.route && options.route.params && Object.keys(options.route.params).length) {
|
|
632
425
|
Object.keys(options.route.params).forEach(paramName => {
|
|
@@ -715,22 +508,6 @@ class Router extends Framework7Class {
|
|
|
715
508
|
});
|
|
716
509
|
});
|
|
717
510
|
}
|
|
718
|
-
setNavbarPosition($el, position, ariaHidden) {
|
|
719
|
-
const router = this;
|
|
720
|
-
$el.removeClass('navbar-previous navbar-current navbar-next');
|
|
721
|
-
if (position) {
|
|
722
|
-
$el.addClass(`navbar-${position}`);
|
|
723
|
-
}
|
|
724
|
-
if (ariaHidden === false) {
|
|
725
|
-
$el.removeAttr('aria-hidden');
|
|
726
|
-
} else if (ariaHidden === true) {
|
|
727
|
-
$el.attr('aria-hidden', 'true');
|
|
728
|
-
}
|
|
729
|
-
$el.trigger('navbar:position', {
|
|
730
|
-
position
|
|
731
|
-
});
|
|
732
|
-
router.emit('navbarPosition', $el[0], position);
|
|
733
|
-
}
|
|
734
511
|
setPagePosition($el, position, ariaHidden) {
|
|
735
512
|
const router = this;
|
|
736
513
|
$el.removeClass('page-previous page-current page-next');
|
|
@@ -758,13 +535,9 @@ class Router extends Framework7Class {
|
|
|
758
535
|
}
|
|
759
536
|
$(el).find(toRemove).remove();
|
|
760
537
|
}
|
|
761
|
-
getPageData(pageEl,
|
|
762
|
-
if (route === void 0) {
|
|
763
|
-
route = {};
|
|
764
|
-
}
|
|
538
|
+
getPageData(pageEl, from, to, route = {}, pageFromEl) {
|
|
765
539
|
const router = this;
|
|
766
540
|
const $pageEl = $(pageEl).eq(0);
|
|
767
|
-
const $navbarEl = $(navbarEl).eq(0);
|
|
768
541
|
const currentPage = $pageEl[0].f7Page || {};
|
|
769
542
|
let direction;
|
|
770
543
|
let pageFrom;
|
|
@@ -788,8 +561,6 @@ class Router extends Framework7Class {
|
|
|
788
561
|
el: $pageEl[0],
|
|
789
562
|
$pageEl,
|
|
790
563
|
pageEl: $pageEl[0],
|
|
791
|
-
$navbarEl,
|
|
792
|
-
navbarEl: $navbarEl[0],
|
|
793
564
|
name: $pageEl.attr('data-name'),
|
|
794
565
|
position: from,
|
|
795
566
|
from,
|
|
@@ -803,15 +574,11 @@ class Router extends Framework7Class {
|
|
|
803
574
|
}
|
|
804
575
|
|
|
805
576
|
// Callbacks
|
|
806
|
-
pageCallback(callback, pageEl,
|
|
807
|
-
if (options === void 0) {
|
|
808
|
-
options = {};
|
|
809
|
-
}
|
|
577
|
+
pageCallback(callback, pageEl, from, to, options = {}, pageFromEl) {
|
|
810
578
|
if (!pageEl) return;
|
|
811
579
|
const router = this;
|
|
812
580
|
const $pageEl = $(pageEl);
|
|
813
581
|
if (!$pageEl.length) return;
|
|
814
|
-
const $navbarEl = $(navbarEl);
|
|
815
582
|
const {
|
|
816
583
|
route
|
|
817
584
|
} = options;
|
|
@@ -820,7 +587,6 @@ class Router extends Framework7Class {
|
|
|
820
587
|
if (callback === 'beforeRemove' && keepAlive) {
|
|
821
588
|
callback = 'beforeUnmount'; // eslint-disable-line
|
|
822
589
|
}
|
|
823
|
-
|
|
824
590
|
const camelName = `page${callback[0].toUpperCase() + callback.slice(1, callback.length)}`;
|
|
825
591
|
const colonName = `page:${callback.toLowerCase()}`;
|
|
826
592
|
let page = {};
|
|
@@ -831,7 +597,7 @@ class Router extends Framework7Class {
|
|
|
831
597
|
position: from
|
|
832
598
|
});
|
|
833
599
|
} else {
|
|
834
|
-
page = router.getPageData($pageEl[0],
|
|
600
|
+
page = router.getPageData($pageEl[0], from, to, route, pageFromEl);
|
|
835
601
|
}
|
|
836
602
|
page.swipeBack = !!options.swipeBack;
|
|
837
603
|
const {
|
|
@@ -923,9 +689,6 @@ class Router extends Framework7Class {
|
|
|
923
689
|
if (callback === 'beforeRemove' || callback === 'beforeUnmount') {
|
|
924
690
|
detachEvents();
|
|
925
691
|
if (!keepAlive) {
|
|
926
|
-
if ($pageEl[0].f7Page && $pageEl[0].f7Page.navbarEl) {
|
|
927
|
-
delete $pageEl[0].f7Page.navbarEl.f7Page;
|
|
928
|
-
}
|
|
929
692
|
$pageEl[0].f7Page = null;
|
|
930
693
|
}
|
|
931
694
|
}
|
|
@@ -1071,7 +834,6 @@ class Router extends Framework7Class {
|
|
|
1071
834
|
app,
|
|
1072
835
|
view
|
|
1073
836
|
} = router;
|
|
1074
|
-
const document = getDocument();
|
|
1075
837
|
router.mount();
|
|
1076
838
|
const {
|
|
1077
839
|
initialUrl,
|
|
@@ -1147,35 +909,12 @@ class Router extends Framework7Class {
|
|
|
1147
909
|
router.currentRoute = currentRoute;
|
|
1148
910
|
router.$el.children('.page').each(pageEl => {
|
|
1149
911
|
const $pageEl = $(pageEl);
|
|
1150
|
-
let $navbarEl;
|
|
1151
912
|
router.setPagePosition($pageEl, 'current');
|
|
1152
|
-
if (router.dynamicNavbar) {
|
|
1153
|
-
$navbarEl = $pageEl.children('.navbar');
|
|
1154
|
-
if ($navbarEl.length > 0) {
|
|
1155
|
-
if (!router.$navbarsEl.parents(document).length) {
|
|
1156
|
-
router.$el.prepend(router.$navbarsEl);
|
|
1157
|
-
}
|
|
1158
|
-
router.setNavbarPosition($navbarEl, 'current');
|
|
1159
|
-
router.$navbarsEl.append($navbarEl);
|
|
1160
|
-
if ($navbarEl.children('.title-large').length) {
|
|
1161
|
-
$navbarEl.addClass('navbar-large');
|
|
1162
|
-
}
|
|
1163
|
-
$pageEl.children('.navbar').remove();
|
|
1164
|
-
} else {
|
|
1165
|
-
router.$navbarsEl.addClass('navbar-hidden');
|
|
1166
|
-
if ($navbarEl.children('.title-large').length) {
|
|
1167
|
-
router.$navbarsEl.addClass('navbar-hidden navbar-large-hidden');
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
913
|
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) {
|
|
1172
914
|
$pageEl.addClass('page-master');
|
|
1173
915
|
$pageEl.trigger('page:role', {
|
|
1174
916
|
role: 'master'
|
|
1175
917
|
});
|
|
1176
|
-
if ($navbarEl && $navbarEl.length) {
|
|
1177
|
-
$navbarEl.addClass('navbar-master');
|
|
1178
|
-
}
|
|
1179
918
|
view.checkMasterDetailBreakpoint();
|
|
1180
919
|
}
|
|
1181
920
|
const initOptions = {
|
|
@@ -1185,20 +924,14 @@ class Router extends Framework7Class {
|
|
|
1185
924
|
extend(initOptions, router.currentRoute.route.options);
|
|
1186
925
|
}
|
|
1187
926
|
router.currentPageEl = $pageEl[0];
|
|
1188
|
-
if (router.dynamicNavbar && $navbarEl.length) {
|
|
1189
|
-
router.currentNavbarEl = $navbarEl[0];
|
|
1190
|
-
}
|
|
1191
927
|
router.removeThemeElements($pageEl);
|
|
1192
|
-
if (router.dynamicNavbar && $navbarEl.length) {
|
|
1193
|
-
router.removeThemeElements($navbarEl);
|
|
1194
|
-
}
|
|
1195
928
|
if (initOptions.route.route.tab) {
|
|
1196
929
|
hasTabRoute = true;
|
|
1197
930
|
router.tabLoad(initOptions.route.route.tab, extend({}, initOptions));
|
|
1198
931
|
}
|
|
1199
|
-
router.pageCallback('init', $pageEl,
|
|
1200
|
-
router.pageCallback('beforeIn', $pageEl,
|
|
1201
|
-
router.pageCallback('afterIn', $pageEl,
|
|
932
|
+
router.pageCallback('init', $pageEl, 'current', undefined, initOptions);
|
|
933
|
+
router.pageCallback('beforeIn', $pageEl, 'current', undefined, initOptions);
|
|
934
|
+
router.pageCallback('afterIn', $pageEl, 'current', undefined, initOptions);
|
|
1202
935
|
});
|
|
1203
936
|
if (historyRestored) {
|
|
1204
937
|
if (browserHistoryInitialMatch) {
|