Skip to content

Commit 99072eb

Browse files
committed
5.4.0-beta.3 release
1 parent 71445f4 commit 99072eb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+412
-260
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
# Change Log
44

5+
# [v5.4.0-beta.3](https://github.com/framework7io/framework7/compare/v5.4.0-beta.2...v5.4.0-beta.3) - January 25, 2020
6+
* Core
7+
* Autocomplete
8+
* Now it falls back to not "routable" modal when there is no View passed or it can't be found.
9+
* Calendar
10+
* Now it falls back to not "routable" modal when there is no View passed or it can't be found.
11+
* Color Picker
12+
* Now it falls back to not "routable" modal when there is no View passed or it can't be found.
13+
* Photo Browser
14+
* Now it falls back to not "routable" modal when there is no View passed or it can't be found.
15+
* Picker
16+
* Now it falls back to not "routable" modal when there is no View passed or it can't be found.
17+
* Smart Select
18+
* Now it falls back to not "routable" modal when there is no View passed or it can't be found.
19+
520
# [v5.4.0-beta.2](https://github.com/framework7io/framework7/compare/v5.4.0-beta.1...v5.4.0-beta.2) - January 25, 2020
621
* Fix missing packages
722

packages/core/components/autocomplete.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/components/autocomplete/autocomplete-class.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,6 @@ class Autocomplete extends Framework7Class {
3535
if ($inputEl.length) $inputEl[0].f7Autocomplete = ac;
3636
}
3737

38-
let view;
39-
if (ac.params.view) {
40-
view = ac.params.view;
41-
} else if ($openerEl || $inputEl) {
42-
const $el = $openerEl || $inputEl;
43-
view = $el.closest('.view').length && $el.closest('.view')[0].f7View;
44-
}
45-
if (!view) view = app.views.main;
46-
4738
const id = Utils.id();
4839

4940
let url = params.url;
@@ -63,7 +54,6 @@ class Autocomplete extends Framework7Class {
6354
$inputEl,
6455
inputEl: $inputEl && $inputEl[0],
6556
id,
66-
view,
6757
url,
6858
value: ac.params.value || [],
6959
inputType,
@@ -326,6 +316,20 @@ class Autocomplete extends Framework7Class {
326316
return ac;
327317
}
328318

319+
get view() {
320+
const ac = this;
321+
const { $openerEl, $inputEl, app } = ac;
322+
let view;
323+
if (ac.params.view) {
324+
view = ac.params.view;
325+
} else if ($openerEl || $inputEl) {
326+
const $el = $openerEl || $inputEl;
327+
view = $el.closest('.view').length && $el.closest('.view')[0].f7View;
328+
}
329+
if (!view) view = app.views.main;
330+
return view;
331+
}
332+
329333
positionDropdown() {
330334
const ac = this;
331335
const { $inputEl, app, $dropdownEl } = ac;
@@ -784,7 +788,7 @@ class Autocomplete extends Framework7Class {
784788
},
785789
};
786790

787-
if (ac.params.routableModals) {
791+
if (ac.params.routableModals && ac.view) {
788792
ac.view.router.navigate({
789793
url: ac.url,
790794
route: {
@@ -839,7 +843,7 @@ class Autocomplete extends Framework7Class {
839843
if (ac.params.openIn === 'dropdown') {
840844
ac.onClose();
841845
ac.onClosed();
842-
} else if (ac.params.routableModals || ac.openedIn === 'page') {
846+
} else if ((ac.params.routableModals && ac.view) || ac.openedIn === 'page') {
843847
ac.view.router.back({ animate: ac.params.animate });
844848
} else {
845849
ac.modal.once('modalClosed', () => {

packages/core/components/calendar.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/components/calendar/calendar-class.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ class Calendar extends Framework7Class {
2020
$inputEl = $(calendar.params.inputEl);
2121
}
2222

23-
let view;
24-
if ($inputEl) {
25-
view = $inputEl.parents('.view').length && $inputEl.parents('.view')[0].f7View;
26-
}
27-
if (!view) view = app.views.main;
28-
2923
const isHorizontal = calendar.params.direction === 'horizontal';
3024

3125
let inverter = 1;
@@ -45,7 +39,6 @@ class Calendar extends Framework7Class {
4539
url: calendar.params.url,
4640
isHorizontal,
4741
inverter,
48-
view,
4942
animating: false,
5043
hasTimePicker: calendar.params.timePicker && !calendar.params.rangePicker && !calendar.params.multiple,
5144
});
@@ -391,6 +384,18 @@ class Calendar extends Framework7Class {
391384
return calendar;
392385
}
393386

387+
get view() {
388+
const { $inputEl, app, params } = this;
389+
let view;
390+
if (params.view) {
391+
view = params.view;
392+
} else if ($inputEl) {
393+
view = $inputEl.parents('.view').length && $inputEl.parents('.view')[0].f7View;
394+
}
395+
if (!view) view = app.views.main;
396+
return view;
397+
}
398+
394399
getIntlNames() {
395400
const calendar = this;
396401
const locale = calendar.params.locale;
@@ -1703,7 +1708,7 @@ class Calendar extends Framework7Class {
17031708
modalParams.push = params.sheetPush;
17041709
modalParams.swipeToClose = params.sheetSwipeToClose;
17051710
}
1706-
if (params.routableModals) {
1711+
if (params.routableModals && calendar.view) {
17071712
calendar.view.router.navigate({
17081713
url: calendar.url,
17091714
route: {
@@ -1726,7 +1731,7 @@ class Calendar extends Framework7Class {
17261731
calendar.onClosed();
17271732
return;
17281733
}
1729-
if (calendar.params.routableModals) {
1734+
if (calendar.params.routableModals && calendar.view) {
17301735
calendar.view.router.back();
17311736
} else {
17321737
calendar.modal.close();

packages/core/components/color-picker.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/components/color-picker/color-picker-class.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,6 @@ class ColorPicker extends Framework7Class {
3939
$targetEl = $(self.params.targetEl);
4040
}
4141

42-
let view;
43-
if ($inputEl) {
44-
view = $inputEl.parents('.view').length && $inputEl.parents('.view')[0].f7View;
45-
}
46-
if (!view && $targetEl) {
47-
view = $targetEl.parents('.view').length && $targetEl.parents('.view')[0].f7View;
48-
}
49-
if (!view) view = app.views.main;
50-
5142
Utils.extend(self, {
5243
app,
5344
$containerEl,
@@ -60,7 +51,6 @@ class ColorPicker extends Framework7Class {
6051
initialized: false,
6152
opened: false,
6253
url: self.params.url,
63-
view,
6454
modules: {
6555
'alpha-slider': moduleAlphaSlider,
6656
'current-color': moduleCurrentColor,
@@ -136,6 +126,24 @@ class ColorPicker extends Framework7Class {
136126
return self;
137127
}
138128

129+
get view() {
130+
const { $inputEl, $targetEl, app, params } = this;
131+
let view;
132+
if (params.view) {
133+
view = params.view;
134+
} else {
135+
if ($inputEl) {
136+
view = $inputEl.parents('.view').length && $inputEl.parents('.view')[0].f7View;
137+
}
138+
if (!view && $targetEl) {
139+
view = $targetEl.parents('.view').length && $targetEl.parents('.view')[0].f7View;
140+
}
141+
}
142+
if (!view) view = app.views.main;
143+
144+
return view;
145+
}
146+
139147
attachEvents() {
140148
const self = this;
141149
self.centerModules = self.centerModules.bind(self);
@@ -746,7 +754,7 @@ class ColorPicker extends Framework7Class {
746754
modalParams.push = params.sheetPush;
747755
modalParams.swipeToClose = params.sheetSwipeToClose;
748756
}
749-
if (params.routableModals) {
757+
if (params.routableModals && self.view) {
750758
self.view.router.navigate({
751759
url: self.url,
752760
route: {
@@ -770,7 +778,7 @@ class ColorPicker extends Framework7Class {
770778
self.onClosed();
771779
return;
772780
}
773-
if (self.params.routableModals) {
781+
if ((self.params.routableModals && self.view) || self.params.openIn === 'page') {
774782
self.view.router.back();
775783
} else {
776784
self.modal.close();

packages/core/components/photo-browser.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/components/photo-browser/photo-browser-class.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class PhotoBrowser extends Framework7Class {
2424
opened: false,
2525
activeIndex: pb.params.swiper.initialSlide,
2626
url: pb.params.url,
27-
view: pb.params.view || app.views.main,
2827
swipeToClose: {
2928
allow: true,
3029
isTouched: false,
@@ -44,6 +43,11 @@ class PhotoBrowser extends Framework7Class {
4443
pb.init();
4544
}
4645

46+
get view() {
47+
const { params, app } = this;
48+
return params.view || app.views.main;
49+
}
50+
4751
onSlideChange(swiper) {
4852
const pb = this;
4953
pb.activeIndex = swiper.activeIndex;
@@ -546,7 +550,7 @@ class PhotoBrowser extends Framework7Class {
546550
},
547551
};
548552

549-
if (pb.params.routableModals) {
553+
if (pb.params.routableModals && pb.view) {
550554
pb.view.router.navigate({
551555
url: pb.url,
552556
route: {
@@ -585,7 +589,7 @@ class PhotoBrowser extends Framework7Class {
585589
},
586590
};
587591

588-
if (pb.params.routableModals) {
592+
if (pb.params.routableModals && pb.view) {
589593
pb.view.router.navigate({
590594
url: pb.url,
591595
route: {
@@ -660,8 +664,8 @@ class PhotoBrowser extends Framework7Class {
660664
close() {
661665
const pb = this;
662666
if (!pb.opened) return pb;
663-
if (pb.params.routableModals || pb.openedIn === 'page') {
664-
if (pb.view) pb.view.router.back();
667+
if ((pb.params.routableModals && pb.view) || pb.openedIn === 'page') {
668+
pb.view.router.back();
665669
} else {
666670
pb.modal.once('modalClosed', () => {
667671
Utils.nextTick(() => {

0 commit comments

Comments
 (0)