Skip to content

Commit

Permalink
5.4.0-beta.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Jan 25, 2020
1 parent 71445f4 commit 99072eb
Show file tree
Hide file tree
Showing 48 changed files with 412 additions and 260 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

# Change Log

# [v5.4.0-beta.3](https://github.com/framework7io/framework7/compare/v5.4.0-beta.2...v5.4.0-beta.3) - January 25, 2020
* Core
* Autocomplete
* Now it falls back to not "routable" modal when there is no View passed or it can't be found.
* Calendar
* Now it falls back to not "routable" modal when there is no View passed or it can't be found.
* Color Picker
* Now it falls back to not "routable" modal when there is no View passed or it can't be found.
* Photo Browser
* Now it falls back to not "routable" modal when there is no View passed or it can't be found.
* Picker
* Now it falls back to not "routable" modal when there is no View passed or it can't be found.
* Smart Select
* Now it falls back to not "routable" modal when there is no View passed or it can't be found.

# [v5.4.0-beta.2](https://github.com/framework7io/framework7/compare/v5.4.0-beta.1...v5.4.0-beta.2) - January 25, 2020
* Fix missing packages

Expand Down
2 changes: 1 addition & 1 deletion packages/core/components/autocomplete.js

Large diffs are not rendered by default.

28 changes: 16 additions & 12 deletions packages/core/components/autocomplete/autocomplete-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@ class Autocomplete extends Framework7Class {
if ($inputEl.length) $inputEl[0].f7Autocomplete = ac;
}

let view;
if (ac.params.view) {
view = ac.params.view;
} else if ($openerEl || $inputEl) {
const $el = $openerEl || $inputEl;
view = $el.closest('.view').length && $el.closest('.view')[0].f7View;
}
if (!view) view = app.views.main;

const id = Utils.id();

let url = params.url;
Expand All @@ -63,7 +54,6 @@ class Autocomplete extends Framework7Class {
$inputEl,
inputEl: $inputEl && $inputEl[0],
id,
view,
url,
value: ac.params.value || [],
inputType,
Expand Down Expand Up @@ -326,6 +316,20 @@ class Autocomplete extends Framework7Class {
return ac;
}

get view() {
const ac = this;
const { $openerEl, $inputEl, app } = ac;
let view;
if (ac.params.view) {
view = ac.params.view;
} else if ($openerEl || $inputEl) {
const $el = $openerEl || $inputEl;
view = $el.closest('.view').length && $el.closest('.view')[0].f7View;
}
if (!view) view = app.views.main;
return view;
}

positionDropdown() {
const ac = this;
const { $inputEl, app, $dropdownEl } = ac;
Expand Down Expand Up @@ -784,7 +788,7 @@ class Autocomplete extends Framework7Class {
},
};

if (ac.params.routableModals) {
if (ac.params.routableModals && ac.view) {
ac.view.router.navigate({
url: ac.url,
route: {
Expand Down Expand Up @@ -839,7 +843,7 @@ class Autocomplete extends Framework7Class {
if (ac.params.openIn === 'dropdown') {
ac.onClose();
ac.onClosed();
} else if (ac.params.routableModals || ac.openedIn === 'page') {
} else if ((ac.params.routableModals && ac.view) || ac.openedIn === 'page') {
ac.view.router.back({ animate: ac.params.animate });
} else {
ac.modal.once('modalClosed', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/components/calendar.js

Large diffs are not rendered by default.

23 changes: 14 additions & 9 deletions packages/core/components/calendar/calendar-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ class Calendar extends Framework7Class {
$inputEl = $(calendar.params.inputEl);
}

let view;
if ($inputEl) {
view = $inputEl.parents('.view').length && $inputEl.parents('.view')[0].f7View;
}
if (!view) view = app.views.main;

const isHorizontal = calendar.params.direction === 'horizontal';

let inverter = 1;
Expand All @@ -45,7 +39,6 @@ class Calendar extends Framework7Class {
url: calendar.params.url,
isHorizontal,
inverter,
view,
animating: false,
hasTimePicker: calendar.params.timePicker && !calendar.params.rangePicker && !calendar.params.multiple,
});
Expand Down Expand Up @@ -391,6 +384,18 @@ class Calendar extends Framework7Class {
return calendar;
}

get view() {
const { $inputEl, app, params } = this;
let view;
if (params.view) {
view = params.view;
} else if ($inputEl) {
view = $inputEl.parents('.view').length && $inputEl.parents('.view')[0].f7View;
}
if (!view) view = app.views.main;
return view;
}

getIntlNames() {
const calendar = this;
const locale = calendar.params.locale;
Expand Down Expand Up @@ -1703,7 +1708,7 @@ class Calendar extends Framework7Class {
modalParams.push = params.sheetPush;
modalParams.swipeToClose = params.sheetSwipeToClose;
}
if (params.routableModals) {
if (params.routableModals && calendar.view) {
calendar.view.router.navigate({
url: calendar.url,
route: {
Expand All @@ -1726,7 +1731,7 @@ class Calendar extends Framework7Class {
calendar.onClosed();
return;
}
if (calendar.params.routableModals) {
if (calendar.params.routableModals && calendar.view) {
calendar.view.router.back();
} else {
calendar.modal.close();
Expand Down
2 changes: 1 addition & 1 deletion packages/core/components/color-picker.js

Large diffs are not rendered by default.

32 changes: 20 additions & 12 deletions packages/core/components/color-picker/color-picker-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ class ColorPicker extends Framework7Class {
$targetEl = $(self.params.targetEl);
}

let view;
if ($inputEl) {
view = $inputEl.parents('.view').length && $inputEl.parents('.view')[0].f7View;
}
if (!view && $targetEl) {
view = $targetEl.parents('.view').length && $targetEl.parents('.view')[0].f7View;
}
if (!view) view = app.views.main;

Utils.extend(self, {
app,
$containerEl,
Expand All @@ -60,7 +51,6 @@ class ColorPicker extends Framework7Class {
initialized: false,
opened: false,
url: self.params.url,
view,
modules: {
'alpha-slider': moduleAlphaSlider,
'current-color': moduleCurrentColor,
Expand Down Expand Up @@ -136,6 +126,24 @@ class ColorPicker extends Framework7Class {
return self;
}

get view() {
const { $inputEl, $targetEl, app, params } = this;
let view;
if (params.view) {
view = params.view;
} else {
if ($inputEl) {
view = $inputEl.parents('.view').length && $inputEl.parents('.view')[0].f7View;
}
if (!view && $targetEl) {
view = $targetEl.parents('.view').length && $targetEl.parents('.view')[0].f7View;
}
}
if (!view) view = app.views.main;

return view;
}

attachEvents() {
const self = this;
self.centerModules = self.centerModules.bind(self);
Expand Down Expand Up @@ -746,7 +754,7 @@ class ColorPicker extends Framework7Class {
modalParams.push = params.sheetPush;
modalParams.swipeToClose = params.sheetSwipeToClose;
}
if (params.routableModals) {
if (params.routableModals && self.view) {
self.view.router.navigate({
url: self.url,
route: {
Expand All @@ -770,7 +778,7 @@ class ColorPicker extends Framework7Class {
self.onClosed();
return;
}
if (self.params.routableModals) {
if ((self.params.routableModals && self.view) || self.params.openIn === 'page') {
self.view.router.back();
} else {
self.modal.close();
Expand Down
2 changes: 1 addition & 1 deletion packages/core/components/photo-browser.js

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions packages/core/components/photo-browser/photo-browser-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class PhotoBrowser extends Framework7Class {
opened: false,
activeIndex: pb.params.swiper.initialSlide,
url: pb.params.url,
view: pb.params.view || app.views.main,
swipeToClose: {
allow: true,
isTouched: false,
Expand All @@ -44,6 +43,11 @@ class PhotoBrowser extends Framework7Class {
pb.init();
}

get view() {
const { params, app } = this;
return params.view || app.views.main;
}

onSlideChange(swiper) {
const pb = this;
pb.activeIndex = swiper.activeIndex;
Expand Down Expand Up @@ -546,7 +550,7 @@ class PhotoBrowser extends Framework7Class {
},
};

if (pb.params.routableModals) {
if (pb.params.routableModals && pb.view) {
pb.view.router.navigate({
url: pb.url,
route: {
Expand Down Expand Up @@ -585,7 +589,7 @@ class PhotoBrowser extends Framework7Class {
},
};

if (pb.params.routableModals) {
if (pb.params.routableModals && pb.view) {
pb.view.router.navigate({
url: pb.url,
route: {
Expand Down Expand Up @@ -660,8 +664,8 @@ class PhotoBrowser extends Framework7Class {
close() {
const pb = this;
if (!pb.opened) return pb;
if (pb.params.routableModals || pb.openedIn === 'page') {
if (pb.view) pb.view.router.back();
if ((pb.params.routableModals && pb.view) || pb.openedIn === 'page') {
pb.view.router.back();
} else {
pb.modal.once('modalClosed', () => {
Utils.nextTick(() => {
Expand Down
Loading

0 comments on commit 99072eb

Please sign in to comment.