Skip to content

Commit

Permalink
Merging 4.2.2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dioslaska committed May 15, 2018
1 parent 08203a8 commit 36a7f2c
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 54 deletions.
52 changes: 20 additions & 32 deletions src/js/classes/frame.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { $, extend, Base, mobiscroll, classes, instances } from '../core/core';
import { os, majorVersion, isBrowser, userAgent } from '../util/platform';
import { animEnd } from '../util/dom';
import { getCoord, preventClick } from '../util/tap';
import { constrain, isString, noop } from '../util/misc';

var $activeElm,
Expand Down Expand Up @@ -221,6 +220,12 @@ export const Frame = function (el, settings, inherit) {
$markup
.on('selectstart mousedown', prevdef) // Prevents blue highlight on Android and text selection in IE
.on('click', '.mbsc-fr-btn-e', prevdef)
.on('touchstart mousedown', function (ev) {
// Need this to prevent opening of sidemenus or similar
if (s.stopProp) {
ev.stopPropagation();
}
})
.on('keydown', '.mbsc-fr-btn-e', function (ev) {
if (ev.keyCode == 32) { // Space
ev.preventDefault();
Expand Down Expand Up @@ -811,37 +816,20 @@ export const Frame = function (el, settings, inherit) {
}

if (s.closeOnOverlayTap) {
var moved,
target,
startX,
startY;

$overlay
.on('touchstart mousedown', function (ev) {
if (!target && ev.target == $overlay[0]) {
target = true;
moved = false;
startX = getCoord(ev, 'X');
startY = getCoord(ev, 'Y');
}
})
.on('touchmove mousemove', function (ev) {
if (target && !moved && (Math.abs(getCoord(ev, 'X') - startX) > 9 || Math.abs(getCoord(ev, 'Y') - startY) > 9)) {
moved = true;
}
})
.on('touchcancel', function () {
target = false;
})
.on('touchend touchcancel mouseup', function (ev) {
if (target && !moved) {
that.cancel();
if (ev.type != 'mouseup') {
preventClick();
}
}
target = false;
});
var target;

$overlay.on('touchstart mousedown', function (ev) {
target = ev.target == overlay;
}).on('mouseup', function (ev) {
target = target && ev.target == overlay;
});

that.tap(overlay, function (ev) {
if (target && ev.target == overlay) {
that.cancel();
}
target = false;
});
}
}

Expand Down
13 changes: 3 additions & 10 deletions src/js/classes/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class Select extends Input {
const $input = $existing.length ? $existing : $('<input tabindex="-1" class="mbsc-control" readonly>');

this._$input = $input;
this._setText = this._setText.bind(this);

$parent.addClass('mbsc-select' + (this._$frame ? ' mbsc-select-inline' : ''));

Expand All @@ -20,23 +21,15 @@ export class Select extends Input {

// Check if select and mobiscroll select was not initialized
if (!$elm.hasClass('mbsc-comp')) {
elm.addEventListener('change', this);
$elm.on('change', this._setText);
this._setText();
}
}

destroy() {
super.destroy();
this._$parent.find('.mbsc-select-ic').remove();
this._elm.removeEventListener('change', this);
}

handleEvent(ev) {
super.handleEvent(ev);

if (ev.type == 'change') {
this._setText();
}
this._$elm.off('change', this._setText);
}

_setText() {
Expand Down
12 changes: 8 additions & 4 deletions src/js/classes/textarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function sizeTextArea(control) {
lineNr = Math.round(height / 24);

if (lineNr > rowNr) {
control.scrollTop = height;
//control.scrollTop = height;
height = 24 * rowNr + (height - lineNr * 24);
$(control).addClass('mbsc-textarea-scroll');
} else {
Expand All @@ -46,10 +46,14 @@ function scrollTextArea(elm) {

if (!$elm.hasClass('mbsc-textarea-scroll')) {
let line = elm.scrollHeight - elm.offsetHeight,
height = elm.offsetHeight + line;
height = elm.offsetHeight + line,
lineNr = Math.round(height / 24),
rowNr = $elm.attr('rows') || 6;

elm.scrollTop = 0;
elm.style.height = height + 'px';
if (lineNr <= rowNr) {
elm.scrollTop = 0;
elm.style.height = height + 'px';
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/js/core/core.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Mobiscroll v4.2.1
* Mobiscroll v4.2.2
* http://mobiscroll.com
*
* Copyright 2010-2018, Acid Media
Expand Down Expand Up @@ -69,7 +69,7 @@ extend(util, {

ms = extend(mobiscroll, {
$: $,
version: '4.2.1',
version: '4.2.2',
autoTheme: 'mobiscroll',
themes: {
form: {},
Expand Down
4 changes: 2 additions & 2 deletions src/js/forms.angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class MbscFormBase extends MbscBase implements OnInit {
}

export class MbscFormValueBase extends MbscFormBase implements ControlValueAccessor {
protected _value: any;
_value: any;

set innerValue(v: any) {
this._value = v;
Expand Down Expand Up @@ -908,7 +908,7 @@ export class MbscRadioGroupBase extends MbscFormValueBase {
this._radioService.changeValue(v);
}

constructor(hostElement: ElementRef, @Optional() formService: MbscOptionsService, protected _radioService: MbscRadioService, control: NgControl) {
constructor(hostElement: ElementRef, @Optional() formService: MbscOptionsService, public _radioService: MbscRadioService, control: NgControl) {
super(hostElement, formService, control, null);
this._radioService.onValueChanged().subscribe(v => {
this.innerValue = v;
Expand Down
2 changes: 1 addition & 1 deletion src/js/frameworks/angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class MbscBase implements AfterViewInit, OnDestroy {
}
}

constructor(protected initialElem: ElementRef) { }
constructor(public initialElem: ElementRef) { }

/* AfterViewInit Interface */

Expand Down
3 changes: 2 additions & 1 deletion src/less/notifications.less
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@
}

&.mbsc-toast .mbsc-toast-msg {
background: rgba(120, 120, 120, .9);
background: #787878;
opacity: .9;
border-radius: .5em;
color: #fff;
}
Expand Down
3 changes: 2 additions & 1 deletion src/less/themes/ios.notifications.less
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@
/* Toast */

&.mbsc-toast .mbsc-toast-msg {
background: rgba(100, 100, 100, .9);
background: #646464;
border-radius: .5em;
color: #fff;
opacity: .9;
}

/* Snackbar and Toast color presets */
Expand Down
3 changes: 2 additions & 1 deletion src/less/themes/material.notifications.less
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
/* Toast */

&.mbsc-toast .mbsc-toast-msg {
background: rgba(80, 80, 80, .9);
background: #505050;
opacity: .9;
border-radius: 1.571429em;
color: #fff;
}
Expand Down

0 comments on commit 36a7f2c

Please sign in to comment.