Skip to content

Commit 8353596

Browse files
committed
Merge 4.7.3
1 parent 0ffd03f commit 8353596

22 files changed

+128
-23
lines changed

examples/angular/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@angular/platform-browser": "~8.0.0",
2020
"@angular/platform-browser-dynamic": "~8.0.0",
2121
"@angular/router": "~8.0.0",
22-
"@mobiscroll/angular-lite": "4.7.2",
22+
"@mobiscroll/angular-lite": "4.7.3",
2323
"rxjs": "~6.4.0",
2424
"rxjs-compat": "^6.5.2",
2525
"tslib": "^1.9.0",

examples/react/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@mobiscroll/react-lite": "4.7.2",
6+
"@mobiscroll/react-lite": "4.7.3",
77
"@types/jest": "^24.0.11",
88
"@types/node": "^11.12.1",
99
"@types/react": "^16.8.10",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mobiscroll",
3-
"version": "4.7.2",
3+
"version": "4.7.3",
44
"description": "Cross platform UI controls for progressive web an hybrid apps",
55
"homepage": "https://mobiscroll.com/",
66
"license": "Apache-2.0",

packages/angular/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mobiscroll/angular-lite",
3-
"version": "4.7.2",
3+
"version": "4.7.3",
44
"description": "Angular UI library for progressive web and hybrid apps",
55
"homepage": "https://mobiscroll.com/",
66
"license": "Apache-2.0",

packages/angularjs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mobiscroll/angularjs-lite",
3-
"version": "4.7.2",
3+
"version": "4.7.3",
44
"description": "AngularJS UI library for progressive web and hybrid apps",
55
"homepage": "https://mobiscroll.com/",
66
"license": "Apache-2.0",

packages/javascript/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mobiscroll/javascript-lite",
3-
"version": "4.7.2",
3+
"version": "4.7.3",
44
"description": "Framework agnostic UI library for progressive web and hybrid apps",
55
"homepage": "https://mobiscroll.com/",
66
"license": "Apache-2.0",

packages/jquery/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mobiscroll/jquery-lite",
3-
"version": "4.7.2",
3+
"version": "4.7.3",
44
"description": "jQuery and jQuery Mobile UI library for progressive web and hybrid apps",
55
"homepage": "https://mobiscroll.com/",
66
"license": "Apache-2.0",

packages/react/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mobiscroll/react-lite",
3-
"version": "4.7.2",
3+
"version": "4.7.3",
44
"description": "React UI library for progressive web and hybrid apps",
55
"homepage": "https://mobiscroll.com/",
66
"license": "Apache-2.0",

src/js/classes/form-control.js

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ let $active;
1212

1313
function addIcon($control, ic) {
1414
var icons = {},
15+
control = $control[0],
1516
$parent = $control.parent(),
1617
errorMsg = $parent.find('.mbsc-err-msg'),
1718
align = $control.attr('data-icon-align') || 'left',
@@ -36,6 +37,11 @@ function addIcon($control, ic) {
3637
}
3738
}
3839

40+
if (control.type == 'file') {
41+
// Set icon
42+
icons.right = $control.attr('data-icon-upload') || 'upload';
43+
}
44+
3945
if (icon || ic) {
4046
extend(icons, ic);
4147

src/js/classes/input.js

+33-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { $ } from '../core/core';
12
import { FormControl, addIconToggle } from './form-control';
23

34
const events = ['focus', 'change', 'blur', 'animationstart'];
@@ -6,15 +7,45 @@ export class Input extends FormControl {
67
constructor(elm, settings) {
78
super(elm, settings);
89

9-
addIconToggle(this, this._$parent, this._$elm);
10+
const $elm = this._$elm;
11+
const $dummy = this._$parent.find('.mbsc-select-input');
12+
13+
addIconToggle(this, this._$parent, $elm);
14+
15+
if (elm.type == 'file') {
16+
// Copy attributes and create dummy input
17+
var $inp = $('<input type="text" class="' +
18+
($elm.attr('class') || '') + '" placeholder="' +
19+
($elm.attr('placeholder') || '') +
20+
'"/>').insertAfter($elm);
21+
22+
// Copy value on file upload
23+
$elm.on('change', function (ev) {
24+
var files = ev.target.files,
25+
names = [];
26+
27+
for (var i = 0; i < files.length; ++i) {
28+
names.push(files[i].name);
29+
}
30+
names.join(', ');
31+
$inp.val(names);
32+
});
33+
}
1034

1135
this._$parent.addClass('mbsc-input');
1236
this.checkLabel = this.checkLabel.bind(this);
1337

1438
// Attach events
1539
events.forEach(ev => {
16-
this._$elm.on(ev, this.checkLabel);
40+
$elm.on(ev, this.checkLabel);
1741
});
42+
43+
// Move the dummy input after the element for correct styling
44+
if ($dummy.length) {
45+
$elm.after($dummy);
46+
this._delm = $dummy[0];
47+
this.refresh();
48+
}
1849
}
1950

2051
checkLabel(ev) {

src/js/classes/select.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export class Select extends Input {
77

88
const $elm = this._$elm;
99
const $parent = this._$parent;
10-
const $existing = $parent.find('input.mbsc-control');
11-
const $input = $existing.length ? $existing : $('<input tabindex="-1" class="mbsc-control" readonly>');
10+
const $existing = $parent.find('.mbsc-select-input');
11+
const $input = $existing.length ? $existing : $('<input tabindex="-1" class="mbsc-select-input mbsc-control" readonly>');
1212

1313
this._$input = $input;
1414
this._delm = $input[0];

src/js/core/core.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Mobiscroll v4.7.2
2+
* Mobiscroll v4.7.3
33
* http://mobiscroll.com
44
*
55
* Copyright 2010-2018, Acid Media
@@ -76,7 +76,7 @@ extend(util, {
7676

7777
ms = extend(mobiscroll, {
7878
$: $,
79-
version: '4.7.2',
79+
version: '4.7.3',
8080
autoTheme: 'mobiscroll',
8181
themes: {
8282
form: {},

src/js/forms.react.jsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ class MbscInput extends MbscInit {
228228
passwordToggle: PropTypes.bool,
229229
iconShow: PropTypes.string,
230230
iconHide: PropTypes.string,
231+
iconUpload: PropTypes.string,
231232
name: PropTypes.string,
232233
dropdown: PropTypes.bool,
233234
inputStyle: PropTypes.string,
@@ -245,7 +246,7 @@ class MbscInput extends MbscInit {
245246

246247
render() {
247248
/* eslint-disable no-unused-vars */
248-
var { valid, errorMessage, type, icon, iconAlign, passwordToggle, iconShow, iconHide, inputStyle, labelStyle, children, dropdown, ...other } = this.props;
249+
var { valid, errorMessage, type, icon, iconAlign, passwordToggle, iconShow, iconHide, iconUpload, inputStyle, labelStyle, children, dropdown, ...other } = this.props;
249250
/* eslint-enable */
250251

251252
var error = null;
@@ -262,7 +263,7 @@ class MbscInput extends MbscInit {
262263
return <MbscLabel valid={valid} inputStyle={inputStyle} labelStyle={labelStyle} className={dropdown ? 'mbsc-select' : ''}>
263264
{children}
264265
<span className="mbsc-input-wrap">
265-
<input ref={this.inputMounted} type={type} data-icon={icon} data-icon-align={iconAlign} data-password-toggle={passwordToggle} data-icon-show={iconShow} data-icon-hide={iconHide} {...other} />
266+
<input ref={this.inputMounted} type={type} data-icon={icon} data-icon-align={iconAlign} data-password-toggle={passwordToggle} data-icon-show={iconShow} data-icon-hide={iconHide} data-icon-upload={iconUpload} {...other} />
266267
{drop}
267268
{error}
268269
</span>

src/js/input.angular.ts

+51
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ export class MbscInputBase extends MbscFormValueBase {
204204
@Input('icon-hide')
205205
iconHide: string;
206206

207+
/**
208+
* Specify the upload icon.
209+
*/
210+
@Input('icon-upload')
211+
iconUpload: boolean;
212+
207213
/**
208214
* Specify the inputStyle.
209215
*/
@@ -249,6 +255,21 @@ export class MbscInputBase extends MbscFormValueBase {
249255
[attr.data-password-toggle]="passwordToggle ? 'true': null"
250256
[attr.data-icon-show]="iconShow ? iconShow : null"
251257
[attr.data-icon-hide]="iconHide ? iconHide : null"
258+
[attr.data-icon-upload]="iconUpload ? iconUpload : null"
259+
[attr.min]="min"
260+
[attr.max]="max"
261+
[attr.minlength]="minlength"
262+
[attr.maxlength]="maxlength"
263+
[attr.autocomplete]="autocomplete"
264+
[attr.autocapitalize]="autocapitalize"
265+
[attr.autocorrect]="autocorrect"
266+
[attr.spellcheck]="spellcheck"
267+
[attr.autofocus]="autofocus"
268+
[attr.step]="step"
269+
[attr.pattern]="pattern"
270+
[attr.required]="required"
271+
[attr.accept]="accept"
272+
[attr.multiple]="multiple"
252273
[disabled]="disabled"
253274
[attr.readonly]="_readonly" />
254275
<span *ngIf="dropdown" class="mbsc-select-ic mbsc-ic mbsc-ic-arrow-down5"></span>
@@ -261,6 +282,36 @@ export class MbscInputBase extends MbscFormValueBase {
261282
export class MbscInput extends MbscInputBase {
262283
instance: FormInput;
263284

285+
@Input()
286+
min: number;
287+
@Input()
288+
max: number;
289+
@Input()
290+
minlength: number;
291+
@Input()
292+
maxlength: number;
293+
294+
@Input()
295+
autocomplete: 'on' | 'off';
296+
@Input()
297+
autocapitalize: string;
298+
@Input()
299+
autocorrect: string;
300+
@Input()
301+
spellcheck: string;
302+
@Input()
303+
autofocus: string;
304+
@Input()
305+
step: number;
306+
@Input()
307+
pattern: string;
308+
@Input()
309+
required: string;
310+
@Input()
311+
accept: string;
312+
@Input()
313+
multiple: string;
314+
264315
@Input()
265316
controlNg: boolean = true;
266317

src/scss/core/ios.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ $mbsc-ios-dark: #47494A !default;
120120
$empty-color: lighten($text, 43%);
121121
$btn-cont-background: darken($background, 3%);
122122
$background-contrast: #000;
123+
$snackbar-button: hsl(hue($button), saturation($button), max(lightness($button), 80%));
123124
}
124125

125126
// Dark background
@@ -161,22 +162,21 @@ $mbsc-ios-dark: #47494A !default;
161162
$empty-color: $text;
162163
$btn-cont-background: lighten($background-limited, 8%);
163164
$background-contrast: #fff;
165+
$snackbar-button: $button;
164166
}
165167

166168
// Light button
167169
@if (lightness($button) > 50%) {
168170
$button-contrast: #000;
169171
$cal-text: lighten(saturate($button, 5%), 42%);
170172
$form-selection: lighten(saturate($accent, 15%), 3%);
171-
$snackbar-button: hsl(hue($button), saturation($button), max(lightness($button), 80%));
172173
}
173174

174175
// Dark button
175176
@else {
176177
$button-contrast: #fff;
177178
$cal-text: adjust-hue(lighten(desaturate($button, 42%), 35%), 3%);
178179
$form-selection: darken(desaturate($accent, 15%), 3%);
179-
$snackbar-button: $button;
180180
}
181181

182182
// Light button

src/scss/core/mobiscroll.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ $mbsc-mobiscroll-dark: #47494A !default;
5656
@else {
5757
$border: lighten($background, 17%);
5858
$empty-color: $text;
59-
$input-disabled: darken($background, 17%);
60-
$handle: darken($background, 7%);
59+
$input-disabled: lighten($background, 17%);
60+
$handle: lighten($background, 7%);
6161
$btn-disabled: lighten($background, 8%);
6262
$switch: lighten($background, 14%);
6363
$btn-light: $background;

src/scss/forms/forms.ios.colors.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
}
191191

192192
.mbsc-segmented .mbsc-segmented-item input.mbsc-active + .mbsc-segmented-content {
193-
background: rgba(18, 114, 220, .3);
193+
background: rgba($accent, .3);
194194
color: $form-selection;
195195
}
196196

src/scss/forms/forms.material.colors.scss

+4
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@
225225
background: $background;
226226
}
227227

228+
.mbsc-stepper input {
229+
color: $text;
230+
}
231+
228232
.mbsc-stepper input:disabled {
229233
color: $input-color;
230234
-webkit-text-fill-color: $input-color;

src/scss/forms/forms.mobiscroll.colors.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
}
115115

116116
.mbsc-btn-flat.mbsc-btn.mbsc-active {
117-
background: rgba(78, 204, 196, .3)
117+
background: rgba($accent, .3)
118118
}
119119

120120
.mbsc-btn-flat:disabled {

src/scss/forms/forms.scss

+6
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,12 @@
315315
z-index: 2;
316316
}
317317

318+
// Angular + Bootstrap compatibility
319+
.mbsc-segmented-item label {
320+
display: block;
321+
margin: 0;
322+
}
323+
318324
.mbsc-segmented input:disabled ~ .mbsc-segmented-item .mbsc-segmented-content,
319325
.mbsc-disabled .mbsc-segmented-content,
320326
.mbsc-segmented input:disabled + .mbsc-segmented-content {

src/scss/input/input.mobiscroll.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@
501501
}
502502

503503
&.mbsc-input .mbsc-label {
504-
top: .166667em;
504+
top: -.166667em;
505505
z-index: 1;
506506
padding: 0 .333334em;
507507
}

src/scss/input/input.scss

+6
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,10 @@
202202
-webkit-transform-origin: top right;
203203
transform-origin: top right;
204204
}
205+
206+
/* file type */
207+
.mbsc-input-wrap .mbsc-control[type="file"] {
208+
position: absolute;
209+
opacity: 0;
210+
}
205211
}

0 commit comments

Comments
 (0)