Skip to content

Commit

Permalink
Merging 4.5.2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dioslaska committed Jan 24, 2019
1 parent a1ef109 commit 8b956d3
Show file tree
Hide file tree
Showing 33 changed files with 3,331 additions and 1,105 deletions.
226 changes: 169 additions & 57 deletions examples/angular/package-lock.json

Large diffs are not rendered by default.

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.5.0",
"@mobiscroll/angular-lite": "^4.5.2",
"core-js": "^2.5.7",
"rxjs": "^5.5.11",
"zone.js": "^0.8.26"
Expand Down
3,969 changes: 3,012 additions & 957 deletions examples/react/package-lock.json

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions examples/react/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"name": "react-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@mobiscroll/react-lite": "^4.5.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-scripts": "^2.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
"name": "react-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@mobiscroll/react-lite": "^4.5.2",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-scripts": "^2.1.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
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.5.0",
"version": "4.5.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.5.0",
"version": "4.5.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.5.0",
"version": "4.5.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.5.0",
"version": "4.5.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.5.0",
"version": "4.5.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.5.0",
"version": "4.5.2",
"description": "React UI library for progressive web and hybrid apps",
"homepage": "https://mobiscroll.com/",
"license": "Apache-2.0",
Expand Down
3 changes: 3 additions & 0 deletions src/js/classes/frame.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ export interface MbscFrameOptions extends MbscCoreOptions {
focusOnClose?: boolean | string | HTMLElement;
focusTrap?: boolean;
headerText?: string | boolean | ((formattedValue: string) => string);
layout?: 'liquid' | 'fixed';
scrollLock?: boolean;
showOnFocus?: boolean;
showOnTap?: boolean;
touchUi?: boolean;
labelStyle?: 'stacked' | 'inline' | 'floating';
inputStyle?: 'underline' | 'box' | 'outline';

// Events
onBeforeClose?(event: { valueText: string, button: string }, inst: any): void;
Expand Down
37 changes: 21 additions & 16 deletions src/js/classes/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export const Frame = function (el, settings, inherit) {
btn,
ctx,
doAnim,
firstPosition,
hasContext,
isModal,
isInserted,
Expand Down Expand Up @@ -111,6 +110,7 @@ export const Frame = function (el, settings, inherit) {
function onShow(prevFocus) {
if (!prevFocus && !isAndroid && that._activeElm) {
//overlay.focus();
lastFocus = new Date();
that._activeElm.focus();
}
//that.ariaMessage(s.ariaMessage);
Expand Down Expand Up @@ -174,24 +174,21 @@ export const Frame = function (el, settings, inherit) {
}

function onPosition() {
if (firstPosition) {
firstPosition = false;
return;
}
clearTimeout(posDebounce);
posDebounce = setTimeout(function () {
that.position(true);
// Trigger reflow, needed on iOS safari, when orientation is changed
popup.style.visibility = 'hidden';
popup.offsetHeight;
popup.style.visibility = '';
if (that.position(true)) {
// Trigger reflow, needed on iOS safari, when orientation is changed
popup.style.visibility = 'hidden';
popup.offsetHeight;
popup.style.visibility = '';
}
}, 200);
}

function onFocus(ev) {
if (mobiscroll.activeInstance == that && ev.target.nodeType && !overlay.contains(ev.target) && new Date() - lastFocus > 100) {
that._activeElm.focus();
lastFocus = new Date();
that._activeElm.focus();
}
}

Expand Down Expand Up @@ -226,7 +223,6 @@ export const Frame = function (el, settings, inherit) {
}

isInserted = true;
firstPosition = true;

that._markupInserted($markup);

Expand Down Expand Up @@ -320,6 +316,10 @@ export const Frame = function (el, settings, inherit) {
}

function show(beforeShow, $elm) {
if (that._isVisible) {
return;
}

if (beforeShow) {
beforeShow();
}
Expand Down Expand Up @@ -367,6 +367,8 @@ export const Frame = function (el, settings, inherit) {
isWrapped,
newHeight,
newWidth,
oldHeight,
oldWidth,
width,
top,
left,
Expand All @@ -380,11 +382,12 @@ export const Frame = function (el, settings, inherit) {
return false;
}

oldWidth = wndWidth;
oldHeight = wndHeight;
newHeight = markup.offsetHeight;
newWidth = markup.offsetWidth;

if (!newWidth || !newHeight || (wndWidth === newWidth && wndHeight === newHeight && check)) {
firstPosition = false;
return;
}

Expand Down Expand Up @@ -433,6 +436,8 @@ export const Frame = function (el, settings, inherit) {
target: markup,
popup: popup,
hasTabs: isWrapped,
oldWidth: oldWidth,
oldHeight: oldHeight,
windowWidth: newWidth,
windowHeight: newHeight
}) === false || !isModal) {
Expand Down Expand Up @@ -513,6 +518,8 @@ export const Frame = function (el, settings, inherit) {
css.left = Math.floor(left);

$popup.css(css);

return true;
};

/**
Expand Down Expand Up @@ -901,6 +908,7 @@ export const Frame = function (el, settings, inherit) {
mobiscroll.activeInstance = prevInst;
}
$(window).off('keydown', onWndKeyDown);
$wnd.off('focusin', onFocus);
}

// Hide wheels and overlay
Expand All @@ -916,9 +924,6 @@ export const Frame = function (el, settings, inherit) {
}

that._detachEvents($markup);

// Stop positioning on window resize
$wnd.off('focusin', onFocus);
}

if (callback) {
Expand Down
16 changes: 5 additions & 11 deletions src/js/classes/input.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FormControl, addIconToggle } from './form-control';

const events = ['focus', 'change', 'blur'];
const events = ['focus', 'change', 'blur', 'animationstart'];

export class Input extends FormControl {
constructor(elm, settings) {
Expand All @@ -15,20 +15,14 @@ export class Input extends FormControl {
events.forEach(ev => {
this._$elm.on(ev, this.checkLabel);
});

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');
}
});
}


checkLabel(ev) {
if (this._isFloating) {
if (this._elm.value || (ev && ev.type == 'focus')) {
// In case of autofill in webkit browsers the animationstart event will fire
// due to the empty animation added in the css,
// because there's no other event in case of the initial autofill
if (this._elm.value || (ev && (ev.type == 'focus' || (ev.type == 'animationstart' && this._$elm.is('*:-webkit-autofill'))))) {
this._$parent.addClass('mbsc-label-floating-active');
} else {
this._$parent.removeClass('mbsc-label-floating-active');
Expand Down
1 change: 0 additions & 1 deletion src/js/classes/scroller.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export interface MbscScrollerOptions extends MbscFrameOptions {
// Settings
circular?: boolean | Array<boolean>;
height?: number;
layout?: 'liquid' | 'fixed';
maxWidth?: number | Array<number>;
minWidth?: number | Array<number>;
multiline?: number;
Expand Down
4 changes: 2 additions & 2 deletions src/js/classes/scroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,8 @@ export const Scroller = function (el, settings, inherit) {
'<div aria-live="off" aria-label="' + lbl + '"' + (w.multiple ? ' aria-multiselectable="true"' : '') + ' role="listbox" data-index="' + l + '" class="mbsc-sc-whl"' + ' style="' +
'height:' + (s.rows * itemHeight * (scroll3d ? 1.1 : 1)) + 'px;">' +
(showScrollArrows ?
'<div data-index="' + l + '" data-step="1" class="mbsc-sc-btn mbsc-sc-btn-plus ' + (s.btnPlusClass || '') + '" style="height:' + itemHeight + 'px;line-height:' + itemHeight + 'px;"></div>' + // + button
'<div data-index="' + l + '" data-step="-1" class="mbsc-sc-btn mbsc-sc-btn-minus ' + (s.btnMinusClass || '') + '" style="height:' + itemHeight + 'px;line-height:' + itemHeight + 'px;"></div>' : '') + // - button
'<div data-index="' + l + '" data-step="1" class="mbsc-sc-btn mbsc-sc-btn-plus ' + (s.btnPlusClass || '') + '"></div>' + // + button
'<div data-index="' + l + '" data-step="-1" class="mbsc-sc-btn mbsc-sc-btn-minus ' + (s.btnMinusClass || '') + '"></div>' : '') + // - button
'<div class="mbsc-sc-lbl">' + lbl + '</div>' + // Wheel label
'<div class="mbsc-sc-whl-c"' +
' style="height:' + itemHeight3d + 'px;margin-top:-' + (itemHeight3d / 2 + 1) + 'px;' + style + '">' +
Expand Down
5 changes: 5 additions & 0 deletions src/js/classes/scrollview-base.angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ import { MbscScrollViewOptions } from './scrollview';
export class MbscNotifyItemService {
private _instanceSubject: Subject<any> = new Subject();
private _addRemoveSubject: Subject<any> = new Subject();
public inst: any = null;

notifyInstanceReady(instance: any) {
this.inst = instance;
this._instanceSubject.next(instance);
}

Expand Down Expand Up @@ -58,6 +60,9 @@ export class MbscScrollItemBase implements AfterViewInit, OnDestroy {
this.notifyItemService.onInstanceReady().subscribe((instance: any) => {
this._instance = instance;
});
if (notifyItemService.inst) {
this._instance = notifyItemService.inst;
}
}

ngAfterViewInit() {
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.5.0
* Mobiscroll v4.5.2
* http://mobiscroll.com
*
* Copyright 2010-2018, Acid Media
Expand Down Expand Up @@ -76,7 +76,7 @@ extend(util, {

ms = extend(mobiscroll, {
$: $,
version: '4.5.0',
version: '4.5.2',
autoTheme: 'mobiscroll',
themes: {
form: {},
Expand Down
11 changes: 10 additions & 1 deletion src/js/forms.angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
MbscOptionsService,
AfterViewInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
NgModule,
CommonModule,
emptyOrTrue
Expand Down Expand Up @@ -379,7 +380,7 @@ export class MbscCheckbox extends MbscFormValueBase {
return this._colorClass;
}

constructor(hostElem: ElementRef, @Optional() formService: MbscOptionsService, @Optional() control: NgControl) {
constructor(hostElem: ElementRef, public cdr: ChangeDetectorRef, @Optional() formService: MbscOptionsService, @Optional() control: NgControl) {
super(hostElem, formService, control, false);
}

Expand All @@ -389,6 +390,14 @@ export class MbscCheckbox extends MbscFormValueBase {
let options = extend({}, this._inheritedOptions, this.inlineEvents(), this.options, this.inlineOptions());
this._instance = new CheckBox(this._initElem.nativeElement, options);
}

/** Overwritten to work with onPush change detection strategy
* When using the onPush changedetection strategy and the value is set from the model,
* the UI doesn't change (because there is no input change) unless we trigger a change manually */
writeValue(v: any) {
this._value = v;
this.cdr.detectChanges();
}
}

@Component({
Expand Down
Loading

0 comments on commit 8b956d3

Please sign in to comment.