Skip to content

Commit dbd0ffc

Browse files
committed
3.4.2 release
1 parent ab0ac0c commit dbd0ffc

File tree

79 files changed

+937
-278
lines changed

Some content is hidden

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

79 files changed

+937
-278
lines changed

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,29 @@
22

33
# Change Log
44

5+
# [v3.4.2](https://github.com/framework7io/framework7/compare/v3.4.0...v3.4.2) - October 12, 2018
6+
* Core
7+
* Device
8+
* Added correct detection for `webView` prop when app installed to home screen
9+
* Accordion
10+
* Fixes issue when `accordionOpened` event fired without passing opened element as argument
11+
* Request
12+
* If `contentType: 'application/json'` and `processData: false` it will automatically send POST data as JSON
13+
* Picker
14+
* Fixed issue when double click outside of opened Picker could cause router navigating to previous page
15+
* Pull To Refresh
16+
* Now it will ignore PTR when scrolling in page's nested container
17+
* Panel
18+
* Now it respects `swipeThreshold` parameter when `swipeNoFollow` is enabled
19+
* Searchbar
20+
* New `searchGroup` parameter to handle custom item groups to hide on search
21+
* New `searchGroupTitle` parameter to handle custom item groups titles to hide on search
22+
* Phenome (React / Vue)
23+
* Input - better handling of `with-value` and `focused` states when used in list item
24+
* Searchbar - new `searchGroup` and `searchGroupTitle` props
25+
* Page - improved router-related page classes handling that could cause issue with navigation
26+
* Minor fixes
27+
528
# [v3.4.0](https://github.com/framework7io/framework7/compare/v3.3.2...v3.4.0) - September 28, 2018
629
* Core
730
* Lazy modules support 🎉
@@ -26,7 +49,6 @@
2649
* Lots of TypeScript definitions fixes and tweaks
2750
* Minor fixes
2851

29-
3052
# [v3.3.2](https://github.com/framework7io/framework7/compare/v3.3.1...v3.3.2) - September 20, 2018
3153
* Core
3254
* Support for new iPhone XR / XS / XS Max

packages/core/components/accordion/accordion.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ const Accordion = {
3434
$contentEl.css('height', 'auto');
3535
Utils.nextFrame(() => {
3636
$contentEl.transition('');
37+
$el.trigger('accordion:opened');
38+
app.emit('accordionOpened', $el[0]);
3739
});
38-
$contentEl.transition('');
39-
$el.trigger('accordion:opened');
40-
app.emit('accordionOpened', $el[0]);
4140
} else {
4241
$contentEl.css('height', '');
4342
$el.trigger('accordion:closed');
@@ -65,9 +64,9 @@ const Accordion = {
6564
$contentEl.css('height', 'auto');
6665
Utils.nextFrame(() => {
6766
$contentEl.transition('');
67+
$el.trigger('accordion:opened');
68+
app.emit('accordionOpened', $el[0]);
6869
});
69-
$el.trigger('accordion:opened');
70-
app.emit('accordionOpened', $el[0]);
7170
} else {
7271
$contentEl.css('height', '');
7372
$el.trigger('accordion:closed');

packages/core/components/app/app-class.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export interface Framework7Params {
6464
initOnDeviceReady? : boolean
6565
/** Object with events handlers.. (default {}) */
6666
on?: {
67-
[event in keyof Framework7Events] : Framework7Events[event]
67+
[event in keyof Framework7Events]? : Framework7Events[event]
6868
}
6969

7070
}
@@ -144,9 +144,9 @@ interface Framework7 extends Framework7Class<Framework7Events> {
144144
/** Initialize app. In case you disabled auto initialization with init: false parameter */
145145
init() : void
146146
/** Load module */
147-
loadModule(module: string | Function | Framework7Plugin) : Promise
147+
loadModule(module: string | Function | Framework7Plugin) : Promise<any>
148148
/** Load modules */
149-
loadModules(modules: any[]) : Promise
149+
loadModules(modules: any[]) : Promise<any>
150150
}
151151

152152
declare class Framework7 implements Framework7 {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ class Autocomplete extends Framework7Class {
473473
// Dropwdown placeholder
474474
itemHtml = `
475475
<li class="autocomplete-dropdown-placeholder">
476-
<div class="item-content">
476+
<label class="item-content">
477477
<div class="item-inner">
478478
<div class="item-title">${item.text}</div>
479479
</div>

packages/core/components/input/input.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,12 @@ const Input = {
106106
$inputEl.removeClass('input-focused');
107107
},
108108
checkEmptyState(inputEl) {
109-
const $inputEl = $(inputEl);
109+
let $inputEl = $(inputEl);
110+
if (!$inputEl.is('input, select, textarea')) {
111+
$inputEl = $inputEl.find('input, select, textarea').eq(0);
112+
}
113+
if (!$inputEl.length) return;
114+
110115
const value = $inputEl.val();
111116
const $itemInputEl = $inputEl.parents('.item-input');
112117
const $inputWrapEl = $inputEl.parents('.input');
@@ -216,7 +221,7 @@ const Input = {
216221
const previousValue = $inputEl.val();
217222
$inputEl
218223
.val('')
219-
.trigger('change input')
224+
.trigger('input change')
220225
.focus()
221226
.trigger('input:clear', previousValue);
222227
}

packages/core/components/panel/swipe-panel.js

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -127,20 +127,40 @@ function swipePanel(panel) {
127127
}
128128
}
129129

130+
let threshold = panel.opened ? 0 : -params.swipeThreshold;
131+
if (side === 'right') threshold = -threshold;
132+
130133
if (params.swipeNoFollow) {
134+
const touchesDiffNoFollow = (pageX - touchesStart.x);
131135
const timeDiff = (new Date()).getTime() - touchStartTime;
132-
if (timeDiff < 300) {
133-
if (direction === 'to-left') {
134-
if (side === 'right') app.panel.open(side);
135-
if (side === 'left' && $el.hasClass('panel-active')) app.panel.close();
136-
}
137-
if (direction === 'to-right') {
138-
if (side === 'left') app.panel.open(side);
139-
if (side === 'right' && $el.hasClass('panel-active')) app.panel.close();
136+
let needToSwitch;
137+
if (!panel.opened && (
138+
(side === 'left' && touchesDiffNoFollow > -threshold)
139+
|| (side === 'right' && -touchesDiffNoFollow > threshold)
140+
)) {
141+
needToSwitch = true;
142+
}
143+
if (panel.opened && (
144+
(side === 'left' && touchesDiffNoFollow < 0)
145+
|| (side === 'right' && touchesDiffNoFollow > 0)
146+
)) {
147+
needToSwitch = true;
148+
}
149+
150+
if (needToSwitch) {
151+
if (timeDiff < 300) {
152+
if (direction === 'to-left') {
153+
if (side === 'right') app.panel.open(side);
154+
if (side === 'left' && $el.hasClass('panel-active')) app.panel.close();
155+
}
156+
if (direction === 'to-right') {
157+
if (side === 'left') app.panel.open(side);
158+
if (side === 'right' && $el.hasClass('panel-active')) app.panel.close();
159+
}
140160
}
161+
isTouched = false;
162+
isMoved = false;
141163
}
142-
isTouched = false;
143-
isMoved = false;
144164
return;
145165
}
146166

@@ -158,8 +178,6 @@ function swipePanel(panel) {
158178
isMoved = true;
159179

160180
e.preventDefault();
161-
let threshold = panel.opened ? 0 : -params.swipeThreshold;
162-
if (side === 'right') threshold = -threshold;
163181

164182
touchesDiff = (pageX - touchesStart.x) + threshold;
165183

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Picker extends Framework7Class {
5454
function onHtmlClick(e) {
5555
const $targetEl = $(e.target);
5656
if (picker.isPopover()) return;
57-
if (!picker.opened) return;
57+
if (!picker.opened || picker.closing) return;
5858
if ($targetEl.closest('[class*="backdrop"]').length) return;
5959
if ($inputEl && $inputEl.length > 0) {
6060
if ($targetEl[0] !== $inputEl[0] && $targetEl.closest('.sheet-modal').length === 0) {
@@ -318,6 +318,8 @@ class Picker extends Framework7Class {
318318
const picker = this;
319319
const { initialized, $el, app, $inputEl, inline, value, params } = picker;
320320
picker.opened = true;
321+
picker.closing = false;
322+
picker.opening = true;
321323

322324
// Init main events
323325
picker.attachResizeEvent();
@@ -363,6 +365,7 @@ class Picker extends Framework7Class {
363365

364366
onOpened() {
365367
const picker = this;
368+
picker.opening = false;
366369

367370
if (picker.$el) {
368371
picker.$el.trigger('picker:opened', picker);
@@ -376,6 +379,8 @@ class Picker extends Framework7Class {
376379
onClose() {
377380
const picker = this;
378381
const app = picker.app;
382+
picker.opening = false;
383+
picker.closing = true;
379384

380385
// Detach events
381386
picker.detachResizeEvent();
@@ -399,6 +404,7 @@ class Picker extends Framework7Class {
399404
onClosed() {
400405
const picker = this;
401406
picker.opened = false;
407+
picker.closing = false;
402408

403409
if (!picker.inline) {
404410
Utils.nextTick(() => {

packages/core/components/pull-to-refresh/pull-to-refresh-class.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,19 @@ class PullToRefresh extends Framework7Class {
128128

129129
if (!isMoved) {
130130
$el.removeClass('ptr-transitioning');
131-
if (scrollTop > $el[0].offsetHeight) {
131+
let targetIsEl;
132+
let targetIsScrollable;
133+
$(e.target).parents().each((index, targetEl) => {
134+
if (targetEl === el) {
135+
targetIsEl = true;
136+
}
137+
if (targetIsEl) return;
138+
if (targetEl.scrollHeight > targetEl.offsetHeight) {
139+
targetIsScrollable = true;
140+
}
141+
});
142+
143+
if (targetIsScrollable || scrollTop > $el[0].offsetHeight) {
132144
isTouched = false;
133145
return;
134146
}

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class Searchbar extends FrameworkClass {
1818
searchContainer: undefined, // container to search, HTMLElement or CSS selector
1919
searchItem: 'li', // single item selector, CSS selector
2020
searchIn: undefined, // where to search in item, CSS selector
21+
searchGroup: '.list-group',
22+
searchGroupTitle: '.item-divider, .list-group-title',
2123
ignore: '.searchbar-ignore',
2224
foundEl: '.searchbar-found',
2325
notFoundEl: '.searchbar-not-found',
@@ -477,13 +479,13 @@ class Searchbar extends FrameworkClass {
477479
});
478480

479481
if (sb.params.hideDividers) {
480-
$searchContainer.find('.item-divider, .list-group-title').each((titleIndex, titleEl) => {
482+
$searchContainer.find(sb.params.searchGroupTitle).each((titleIndex, titleEl) => {
481483
const $titleEl = $(titleEl);
482-
const $nextElements = $titleEl.nextAll('li');
484+
const $nextElements = $titleEl.nextAll(sb.params.searchItem);
483485
let hide = true;
484486
for (let i = 0; i < $nextElements.length; i += 1) {
485487
const $nextEl = $nextElements.eq(i);
486-
if ($nextEl.hasClass('list-group-title') || $nextEl.hasClass('item-divider')) break;
488+
if ($nextEl.is(sb.params.searchGroupTitle)) break;
487489
if (!$nextEl.hasClass('hidden-by-searchbar')) {
488490
hide = false;
489491
}
@@ -494,10 +496,13 @@ class Searchbar extends FrameworkClass {
494496
});
495497
}
496498
if (sb.params.hideGroups) {
497-
$searchContainer.find('.list-group').each((groupIndex, groupEl) => {
499+
$searchContainer.find(sb.params.searchGroup).each((groupIndex, groupEl) => {
498500
const $groupEl = $(groupEl);
499501
const ignore = sb.params.ignore && $groupEl.is(sb.params.ignore);
500-
const notHidden = $groupEl.find('li:not(.hidden-by-searchbar)');
502+
// eslint-disable-next-line
503+
const notHidden = $groupEl.find(sb.params.searchItem).filter((index, el) => {
504+
return !$(el).hasClass('hidden-by-searchbar');
505+
});
501506
if (notHidden.length === 0 && !ignore) {
502507
$groupEl.addClass('hidden-by-searchbar');
503508
} else {

packages/core/components/searchbar/searchbar.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export namespace Searchbar {
1717
searchIn?: CSSSelector
1818
/** CSS selector of single search item. If we do a search in List View, then it must be a single list element li (default "li") */
1919
searchItem?: CSSSelector
20+
/** CSS selector of group element. Used when hideGroups enabled to hide groups. If we do a search in List View, then it usually a list group (default "list-group") */
21+
searchGroup?: CSSSelector
22+
/** CSS selector of group titles and dividers. Used when hideDividers enabled to hide group titles and dividers. If we do a search in List View, then it usually a list group title or list item divider (default ".item-divider, .list-group-title") */
23+
searchGroupTitle?: CSSSelector
2024
/** CSS selector or HTMLElement of searchbar "found" element to make it hidden when there is no search results (default ".searchbar-found") */
2125
foundEl?: HTMLElement | CSSSelector
2226
/** CSS selector or HTMLElement of searchbar "not-found" element to make it visible when there is no search results (default ".searchbar-not-found") */

0 commit comments

Comments
 (0)