Skip to content

Commit

Permalink
Merging 4.4.2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dioslaska committed Nov 5, 2018
1 parent 065d32c commit e47e7d5
Show file tree
Hide file tree
Showing 34 changed files with 244 additions and 92 deletions.
6 changes: 3 additions & 3 deletions examples/angular/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@angular/platform-browser": "^5.2.11",
"@angular/platform-browser-dynamic": "^5.2.11",
"@angular/router": "^5.2.11",
"@mobiscroll/angular-lite": "^4.4.0",
"@mobiscroll/angular-lite": "^4.4.2",
"core-js": "^2.5.7",
"rxjs": "^5.5.11",
"zone.js": "^0.8.26"
Expand Down
8 changes: 4 additions & 4 deletions examples/react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@mobiscroll/react-lite": "^4.4.0",
"@mobiscroll/react-lite": "^4.4.2",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-scripts": "^1.1.4"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobiscroll",
"version": "4.4.1",
"version": "4.4.2",
"description": "Cross platform UI controls for progressive web an hybrid apps",
"homepage": "https://mobiscroll.com/",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mobiscroll/angular-lite",
"version": "4.4.1",
"version": "4.4.2",
"description": "Angular UI library for progressive web and hybrid apps",
"homepage": "https://mobiscroll.com/",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/angularjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mobiscroll/angularjs-lite",
"version": "4.4.1",
"version": "4.4.2",
"description": "AngularJS UI library for progressive web and hybrid apps",
"homepage": "https://mobiscroll.com/",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/javascript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mobiscroll/javascript-lite",
"version": "4.4.1",
"version": "4.4.2",
"description": "Framework agnostic UI library for progressive web and hybrid apps",
"homepage": "https://mobiscroll.com/",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/jquery/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mobiscroll/jquery-lite",
"version": "4.4.1",
"version": "4.4.2",
"description": "jQuery and jQuery Mobile UI library for progressive web and hybrid apps",
"homepage": "https://mobiscroll.com/",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mobiscroll/react-lite",
"version": "4.4.1",
"version": "4.4.2",
"description": "React UI library for progressive web and hybrid apps",
"homepage": "https://mobiscroll.com/",
"license": "Apache-2.0",
Expand Down
5 changes: 3 additions & 2 deletions src/js/classes/form-control.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { $, extend, mobiscroll } from '../core/core';
import { activateControl, getControlType, getCoord, tap } from '../util/tap';
import { testTouch, hasTouchAction } from '../util/dom';
import { testTouch, hasGhostClick } from '../util/dom';

const wrapClass = 'mbsc-input-wrap';
const events = ['touchstart', 'touchmove', 'touchend', 'touchcancel', 'mousedown', 'mousemove', 'mouseup', 'mouseleave'];
const defaults = {
tap: !hasTouchAction
tap: hasGhostClick
};

let $active;
Expand Down Expand Up @@ -42,6 +42,7 @@ function addIcon($control, ic) {
$parent
.addClass((icons.right ? 'mbsc-ic-right ' : '') + (icons.left ? ' mbsc-ic-left' : ''))
.find('.' + wrapClass)
.append('<span class="mbsc-input-fill"></span>')
.append(icons.left ? '<span class="mbsc-input-ic mbsc-left-ic mbsc-ic mbsc-ic-' + icons.left + '"></span>' : '')
.append(icons.right ? '<span class="mbsc-input-ic mbsc-right-ic mbsc-ic mbsc-ic-' + icons.right + '"></span>' : '');
}
Expand Down
4 changes: 2 additions & 2 deletions src/js/classes/forms.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { $, Base, mobiscroll, classes, autoInit } from '../core/core';
import { hasTouchAction } from '../util/dom';
import { hasGhostClick } from '../util/dom';
import { os, majorVersion } from '../util/platform';
import { initControls } from '../util/forms';
import '../util/notifications';
Expand Down Expand Up @@ -86,7 +86,7 @@ Form.prototype = {
_hasLang: true,
_class: 'form',
_defaults: {
tap: !hasTouchAction,
tap: hasGhostClick,
stopProp: true,
rtl: false
}
Expand Down
1 change: 1 addition & 0 deletions src/js/classes/frame.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface MbscFrameOptions extends MbscCoreOptions {
focusOnClose?: boolean | string | HTMLElement;
focusTrap?: boolean;
headerText?: string | boolean | ((formattedValue: string) => string);
scrollLock?: boolean;
showOnFocus?: boolean;
showOnTap?: boolean;
touchUi?: boolean;
Expand Down
28 changes: 17 additions & 11 deletions src/js/classes/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var $activeElm,
};

const EDITABLE = 'input,select,textarea,button';
const ALLOW_ENTER = 'textarea,button,input[type="button"],input[type="submit"]';
const FOCUSABLE = EDITABLE + ',[tabindex="0"]';

export const Frame = function (el, settings, inherit) {
Expand Down Expand Up @@ -49,6 +50,7 @@ export const Frame = function (el, settings, inherit) {
overlay,
popup,
posDebounce,
prevInst,
s,
scrollLeft,
scrollLock,
Expand Down Expand Up @@ -97,10 +99,12 @@ export const Frame = function (el, settings, inherit) {
}

function onWndKeyDown(ev) {
if (ev.keyCode == 13 && !$(ev.target).is(EDITABLE)) {
that.select();
} else if (ev.keyCode == 27) {
that.cancel();
if (mobiscroll.activeInstance == that) {
if (ev.keyCode == 13 && (!$(ev.target).is(ALLOW_ENTER) || ev.shiftKey)) {
that.select();
} else if (ev.keyCode == 27) {
that.cancel();
}
}
}

Expand Down Expand Up @@ -143,6 +147,9 @@ export const Frame = function (el, settings, inherit) {
$wnd.scrollLeft(scrollLeft);
$wnd.scrollTop(scrollTop);
}
}

if (!ctx.mbscModals || prevInst) {
// Put focus back to the last active element
if (!prevAnim) {
if (!$activeEl) {
Expand All @@ -160,6 +167,7 @@ export const Frame = function (el, settings, inherit) {
}
}

prevInst = undefined;
isInserted = false;

trigger('onHide');
Expand All @@ -181,8 +189,8 @@ export const Frame = function (el, settings, inherit) {
}

function onFocus(ev) {
if (ev.target.nodeType && !overlay.contains(ev.target) && lastFocus - new Date() > 100) {
overlay.focus();
if (mobiscroll.activeInstance == that && ev.target.nodeType && !overlay.contains(ev.target) && new Date() - lastFocus > 100) {
that._activeElm.focus();
lastFocus = new Date();
}
}
Expand Down Expand Up @@ -703,10 +711,8 @@ export const Frame = function (el, settings, inherit) {
document.activeElement.blur();
}

// Hide active instance
if (mobiscroll.activeInstance) {
mobiscroll.activeInstance.hide();
}
// Save active instance to previous
prevInst = mobiscroll.activeInstance;

// Set active instance
mobiscroll.activeInstance = that;
Expand Down Expand Up @@ -892,7 +898,7 @@ export const Frame = function (el, settings, inherit) {
document.activeElement.blur();
}
if (mobiscroll.activeInstance == that) {
delete mobiscroll.activeInstance;
mobiscroll.activeInstance = prevInst;
}
$(window).off('keydown', onWndKeyDown);
}
Expand Down
8 changes: 8 additions & 0 deletions src/js/classes/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ export class Input extends FormControl {
events.forEach(ev => {
elm.addEventListener(ev, this);
});

setTimeout(() => {
// if label is floating and input is autofill, add floating active class
// input has no value yet
if (this._isFloating && this._$elm.is("*:-webkit-autofill")) {
this._$parent.addClass('mbsc-label-floating-active');
}
});
}

handleEvent(ev) {
Expand Down
12 changes: 8 additions & 4 deletions src/js/classes/scroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ var presets = {},
has3d = css && css.supports && css.supports("(transform-style: preserve-3d)"),
force2D = !has3d || os == 'wp' || os == 'android';

function sanitize(str) {
return (str + '').replace('"', '___');
}

export { presets };

export const Scroller = function (el, settings, inherit) {
Expand Down Expand Up @@ -252,7 +256,7 @@ export const Scroller = function (el, settings, inherit) {
(invalid ? ' mbsc-sc-itm-inv-h mbsc-disabled' : '') +
(disabled[value] ? ' mbsc-sc-itm-inv mbsc-disabled' : '') +
'" data-index="' + i +
'" data-val="' + value + '"' +
'" data-val="' + sanitize(value) + '"' +
(lbl ? ' aria-label="' + lbl + '"' : '') +
(selected ? ' aria-selected="true"' : '') +
' style="height:' + itemHeight + 'px;line-height:' + itemHeight + 'px;' +
Expand Down Expand Up @@ -379,7 +383,7 @@ export const Scroller = function (el, settings, inherit) {
$.each(ret.disabled[i], function (j, v) {
wheel._disabled[v] = true;
if (isVisible) {
wheel._$markup.find('.mbsc-sc-itm[data-val="' + v + '"]').addClass('mbsc-sc-itm-inv mbsc-disabled');
wheel._$markup.find('.mbsc-sc-itm[data-val="' + sanitize(v) + '"]').addClass('mbsc-sc-itm-inv mbsc-disabled');
}
});
}
Expand Down Expand Up @@ -414,15 +418,15 @@ export const Scroller = function (el, settings, inherit) {
if (index === undefined) {
for (var v in that._tempSelected[i]) {
wheel._$markup
.find('.mbsc-sc-itm[data-val="' + v + '"]')
.find('.mbsc-sc-itm[data-val="' + sanitize(v) + '"]')
.addClass(selectedClass)
.attr('aria-selected', 'true');
}
}
} else {
// Mark element as aria selected
wheel._$markup
.find('.mbsc-sc-itm[data-val="' + tempWheelArray[i] + '"]')
.find('.mbsc-sc-itm[data-val="' + sanitize(tempWheelArray[i]) + '"]')
.addClass('mbsc-sc-itm-sel')
.attr('aria-selected', 'true');
}
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.4.1
* Mobiscroll v4.4.2
* http://mobiscroll.com
*
* Copyright 2010-2018, Acid Media
Expand Down Expand Up @@ -76,7 +76,7 @@ extend(util, {

ms = extend(mobiscroll, {
$: $,
version: '4.4.1',
version: '4.4.2',
autoTheme: 'mobiscroll',
themes: {
form: {},
Expand Down
10 changes: 6 additions & 4 deletions src/js/forms.angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1568,7 +1568,8 @@ export class MbscRating extends MbscControlBase implements OnInit {
selector: 'mbsc-form-group',
template: '<ng-content></ng-content>',
host: {
'[class]': "inset !== undefined ? 'mbsc-form-group-inset' : 'mbsc-form-group'"
'[class.mbsc-form-group-inset]': 'inset !== undefined',
'[class.mbsc-form-group]': 'inset === undefined'
},
styles: [':host { display: block; }']
})
Expand All @@ -1589,6 +1590,7 @@ export class MbscFormGroup implements AfterViewInit {
this._open = v;
}

/** Note on type: using as attribute without a value (empty string) */
@Input()
inset: string;

Expand Down Expand Up @@ -1633,7 +1635,7 @@ export class MbscFormGroup implements AfterViewInit {
selector: 'mbsc-form-group-title',
template: '<ng-content></ng-content>',
host: {
'class': 'mbsc-form-group-title'
'[class.mbsc-form-group-title]': 'true'
},
styles: [':host { display: block; }']
})
Expand All @@ -1643,7 +1645,7 @@ export class MbscFormGroupTitle { }
selector: 'mbsc-form-group-content',
template: '<ng-content></ng-content>',
host: {
'class': 'mbsc-form-group-content'
'[class.mbsc-form-group-content]': 'true'
},
styles: [':host { display: block; }']
})
Expand All @@ -1653,7 +1655,7 @@ export class MbscFormGroupContent { }
selector: 'mbsc-accordion',
template: '<ng-content></ng-content>',
host: {
'class': 'mbsc-accordion'
'[class.mbsc-accordion]': 'true'
},
styles: [':host { display: block; }']
})
Expand Down
Loading

0 comments on commit e47e7d5

Please sign in to comment.