mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
Merge branch 'master' of https://github.com/driftyco/ionic
Conflicts: dist/ionic-simple.js dist/ionic.js
This commit is contained in:
31
Gruntfile.js
31
Gruntfile.js
@ -9,32 +9,35 @@ module.exports = function(grunt) {
|
|||||||
},
|
},
|
||||||
dist: {
|
dist: {
|
||||||
src: [
|
src: [
|
||||||
|
|
||||||
|
// Base
|
||||||
'js/ionic.js',
|
'js/ionic.js',
|
||||||
'js/platform.js',
|
|
||||||
'js/utils.js',
|
// Utils
|
||||||
'js/events.js',
|
'js/utils/**/*.js',
|
||||||
'js/gestures.js',
|
|
||||||
'js/animate.js',
|
// Views
|
||||||
'js/viewController.js',
|
'js/views/navBarView.js',
|
||||||
'js/views/navBar.js',
|
'js/views/headerBarView.js',
|
||||||
'js/views/headerBar.js',
|
'js/views/sideMenuView.js',
|
||||||
'js/views/tabBar.js',
|
'js/views/tabBarView.js',
|
||||||
'js/views/sideMenu.js',
|
|
||||||
'js/views/toggleView.js',
|
'js/views/toggleView.js',
|
||||||
'js/controllers/**/*.js',
|
|
||||||
'js/tapPolyfill.js'
|
// Controllers
|
||||||
|
'js/controllers/**/*.js'
|
||||||
|
|
||||||
],
|
],
|
||||||
dest: 'dist/<%= pkg.name %>.js'
|
dest: 'dist/<%= pkg.name %>.js'
|
||||||
},
|
},
|
||||||
distAngular: {
|
distAngular: {
|
||||||
src: [
|
src: [
|
||||||
'ext/angular/src/*.js'
|
'js/ext/angular/src/*.js'
|
||||||
],
|
],
|
||||||
dest: 'dist/<%= pkg.name %>-angular.js'
|
dest: 'dist/<%= pkg.name %>-angular.js'
|
||||||
},
|
},
|
||||||
distSimple: {
|
distSimple: {
|
||||||
src: [
|
src: [
|
||||||
'ext/simple/*.js'
|
'js/ext/simple/*.js'
|
||||||
],
|
],
|
||||||
dest: 'dist/<%= pkg.name %>-simple.js'
|
dest: 'dist/<%= pkg.name %>-simple.js'
|
||||||
}
|
}
|
||||||
|
|||||||
7
dist/ionic.css
vendored
7
dist/ionic.css
vendored
@ -1909,6 +1909,13 @@ input[type="checkbox"][readonly] {
|
|||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
transition: -webkit-transform 0.1s ease-in-out; }
|
transition: -webkit-transform 0.1s ease-in-out; }
|
||||||
|
.toggle .handle:before {
|
||||||
|
position: absolute;
|
||||||
|
content: '.';
|
||||||
|
color: transparent;
|
||||||
|
left: -14px;
|
||||||
|
top: -11px;
|
||||||
|
padding: 14px 30px; }
|
||||||
|
|
||||||
/* When the toggle is "on" */
|
/* When the toggle is "on" */
|
||||||
.toggle :checked + .track {
|
.toggle :checked + .track {
|
||||||
|
|||||||
7
dist/ionicIcons.css
vendored
7
dist/ionicIcons.css
vendored
@ -1909,6 +1909,13 @@ input[type="checkbox"][readonly] {
|
|||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
transition: -webkit-transform 0.1s ease-in-out; }
|
transition: -webkit-transform 0.1s ease-in-out; }
|
||||||
|
.toggle .handle:before {
|
||||||
|
position: absolute;
|
||||||
|
content: '.';
|
||||||
|
color: transparent;
|
||||||
|
left: -14px;
|
||||||
|
top: -11px;
|
||||||
|
padding: 14px 30px; }
|
||||||
|
|
||||||
/* When the toggle is "on" */
|
/* When the toggle is "on" */
|
||||||
.toggle :checked + .track {
|
.toggle :checked + .track {
|
||||||
|
|||||||
@ -7,10 +7,6 @@
|
|||||||
ionic.Components.push(instance);
|
ionic.Components.push(instance);
|
||||||
};
|
};
|
||||||
|
|
||||||
ionic.get = function(elementId) {
|
|
||||||
return ionic.component( document.getElementById(elementId) );
|
|
||||||
};
|
|
||||||
|
|
||||||
ionic.component = function(el) {
|
ionic.component = function(el) {
|
||||||
if(el) {
|
if(el) {
|
||||||
if(el.component) {
|
if(el.component) {
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
(function(ionic) {
|
(function(ionic) {
|
||||||
ionic.Animator = {
|
ionic.Animator = {
|
||||||
animate: function(element, className, fn) {
|
animate: function(element, className, fn) {
|
||||||
@ -40,4 +41,4 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})(window.ionic);
|
})(ionic);
|
||||||
@ -93,6 +93,8 @@
|
|||||||
if(this === this.window) {
|
if(this === this.window) {
|
||||||
// this is a window, then only allow the Tap gesture to be added
|
// this is a window, then only allow the Tap gesture to be added
|
||||||
ionic.Gestures.detection.register(ionic.Gestures.gestures.Tap);
|
ionic.Gestures.detection.register(ionic.Gestures.gestures.Tap);
|
||||||
|
ionic.Gestures.detection.register(ionic.Gestures.gestures.Drag);
|
||||||
|
ionic.Gestures.detection.register(ionic.Gestures.gestures.Release);
|
||||||
} else {
|
} else {
|
||||||
// everything else but the window
|
// everything else but the window
|
||||||
for(var name in ionic.Gestures.gestures) {
|
for(var name in ionic.Gestures.gestures) {
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
(function(ionic) {
|
(function(ionic) {
|
||||||
|
|
||||||
ionic.views.HeaderBar = function(opts) {
|
ionic.views.HeaderBar = function(opts) {
|
||||||
@ -6,6 +6,7 @@
|
|||||||
this.checkbox = opts.checkbox;
|
this.checkbox = opts.checkbox;
|
||||||
this.track = opts.track;
|
this.track = opts.track;
|
||||||
this.handle = opts.handle;
|
this.handle = opts.handle;
|
||||||
|
this.openPercent = -1;
|
||||||
|
|
||||||
// remember that this element, and all its children are apart of a component
|
// remember that this element, and all its children are apart of a component
|
||||||
// and assign the component instance to each element so the lookups
|
// and assign the component instance to each element so the lookups
|
||||||
@ -15,21 +16,55 @@
|
|||||||
this.track.isComponent = true;
|
this.track.isComponent = true;
|
||||||
this.handle.component = this;
|
this.handle.component = this;
|
||||||
this.handle.isComponent = true;
|
this.handle.isComponent = true;
|
||||||
|
|
||||||
// ensure the handle is draggable
|
|
||||||
this.handle.draggable = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ionic.views.Toggle.prototype = {
|
ionic.views.Toggle.prototype = {
|
||||||
|
|
||||||
tap: function(e) {
|
tap: function(e) {
|
||||||
e.stopPropa
|
this.val( !this.checkbox.checked );
|
||||||
return false;
|
},
|
||||||
|
|
||||||
|
drag: function(e) {
|
||||||
|
var slidePageLeft = this.track.offsetLeft + (this.handle.offsetWidth / 2);
|
||||||
|
var slidePageRight = this.track.offsetLeft + this.track.offsetWidth - (this.handle.offsetWidth / 2);
|
||||||
|
|
||||||
|
if(e.pageX >= slidePageRight - 4) {
|
||||||
|
this.val(true);
|
||||||
|
} else if(e.pageX <= slidePageLeft) {
|
||||||
|
this.val(false);
|
||||||
|
} else {
|
||||||
|
this.setOpenPercent( Math.round( (1 - ((slidePageRight - e.pageX) / (slidePageRight - slidePageLeft) )) * 100) );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setOpenPercent: function(openPercent) {
|
||||||
|
// only make a change if the new open percent has changed
|
||||||
|
if(this.openPercent < 0 || (openPercent < (this.openPercent - 3) || openPercent > (this.openPercent + 3) ) ) {
|
||||||
|
this.openPercent = openPercent;
|
||||||
|
|
||||||
|
if(openPercent === 0) {
|
||||||
|
this.val(false);
|
||||||
|
} else if(openPercent === 100) {
|
||||||
|
this.val(true);
|
||||||
|
} else {
|
||||||
|
var openPixel = Math.round( (openPercent / 100) * this.track.offsetWidth - (this.handle.offsetWidth) );
|
||||||
|
openPixel = (openPixel < 1 ? 0 : openPixel);
|
||||||
|
this.handle.style.webkitTransform = 'translate3d(' + openPixel + 'px,0,0)';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
release: function(e) {
|
||||||
|
this.val( this.openPercent >= 50 );
|
||||||
},
|
},
|
||||||
|
|
||||||
val: function(value) {
|
val: function(value) {
|
||||||
if(value === true || value === false) {
|
if(value === true || value === false) {
|
||||||
|
if(this.handle.style.webkitTransform !== "") {
|
||||||
|
this.handle.style.webkitTransform = "";
|
||||||
|
}
|
||||||
this.checkbox.checked = value;
|
this.checkbox.checked = value;
|
||||||
|
this.openPercent = (value ? 100 : 0);
|
||||||
}
|
}
|
||||||
return this.checkbox.checked;
|
return this.checkbox.checked;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,6 +36,15 @@
|
|||||||
border-radius: $toggle-handle-radius;
|
border-radius: $toggle-handle-radius;
|
||||||
background-color: $toggle-handle-off-bg-color;
|
background-color: $toggle-handle-off-bg-color;
|
||||||
transition: -webkit-transform $toggle-transition-duration ease-in-out;
|
transition: -webkit-transform $toggle-transition-duration ease-in-out;
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
position: absolute;
|
||||||
|
content: '.';
|
||||||
|
color: transparent;
|
||||||
|
left: ( ($toggle-handle-width / 2) * -1);
|
||||||
|
top: ( ($toggle-handle-height / 2) * -1) + 3;
|
||||||
|
padding: ($toggle-handle-height / 2) ($toggle-handle-width + 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -16,28 +16,32 @@
|
|||||||
<h1 class="title">Ionic Tests</h1>
|
<h1 class="title">Ionic Tests</h1>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main class="content padded has-header">
|
<div class="content-wrapper">
|
||||||
<p><a class="button button-block button-default" href="alerts.html"><i class="icon-star"></i> Alerts</a></p>
|
|
||||||
<p><a class="button button-block button-default" href="buttons.html"><i class="icon-star-half-empty"></i> Buttons</a></p>
|
<main class="content padded has-header">
|
||||||
<p><a class="button button-block button-default" href="button-groups.html"><i class="icon-star"></i> Button Groups</a></p>
|
<p><a class="button button-block button-default" href="alerts.html"><i class="icon-star"></i> Alerts</a></p>
|
||||||
<p><a class="button button-block button-default" href="cards.html"><i class="icon-star-empty"></i> Cards</a></p>
|
<p><a class="button button-block button-default" href="buttons.html"><i class="icon-star-half-empty"></i> Buttons</a></p>
|
||||||
<p><a class="button button-block button-default" href="footers.html"><i class="icon-star"></i> Footers</a></p>
|
<p><a class="button button-block button-default" href="button-groups.html"><i class="icon-star"></i> Button Groups</a></p>
|
||||||
<p><a class="button button-block button-default" href="headers.html"><i class="icon-star-half-empty"></i> Headers</a></p>
|
<p><a class="button button-block button-default" href="cards.html"><i class="icon-star-empty"></i> Cards</a></p>
|
||||||
<p><a class="button button-block button-default" href="input-text.html"><i class="icon-star"></i> Input: Text (single-line)</a></p>
|
<p><a class="button button-block button-default" href="footers.html"><i class="icon-star"></i> Footers</a></p>
|
||||||
<p><a class="button button-block button-default" href="input-textarea.html"><i class="icon-star"></i> Input: Text (multi-line)</a></p>
|
<p><a class="button button-block button-default" href="headers.html"><i class="icon-star-half-empty"></i> Headers</a></p>
|
||||||
<p><a class="button button-block button-default" href="input-radio.html"><i class="icon-star-half-empty"></i> Input: Radio Buttons</a></p>
|
<p><a class="button button-block button-default" href="input-text.html"><i class="icon-star"></i> Input: Text (single-line)</a></p>
|
||||||
<p><a class="button button-block button-default" href="input-range.html"><i class="icon-star"></i> Input: Range</a></p>
|
<p><a class="button button-block button-default" href="input-textarea.html"><i class="icon-star"></i> Input: Text (multi-line)</a></p>
|
||||||
<p><a class="button button-block button-default" href="input-select.html"><i class="icon-star-empty"></i> Input: Select</a></p>
|
<p><a class="button button-block button-default" href="input-radio.html"><i class="icon-star-half-empty"></i> Input: Radio Buttons</a></p>
|
||||||
<p><a class="button button-block button-default" href="input-toggle.html"><i class="icon-star-half-empty"></i> Input: Toggle</a></p>
|
<p><a class="button button-block button-default" href="input-range.html"><i class="icon-star"></i> Input: Range</a></p>
|
||||||
<p><a class="button button-block button-default" href="lists.html"><i class="icon-star-half-empty"></i> Lists</a></p>
|
<p><a class="button button-block button-default" href="input-select.html"><i class="icon-star-empty"></i> Input: Select</a></p>
|
||||||
<p><a class="button button-block button-default" href="modals.html"><i class="icon-star-empty"></i> Modals</a></p>
|
<p><a class="button button-block button-default" href="input-toggle.html"><i class="icon-star-half-empty"></i> Input: Toggle</a></p>
|
||||||
<p><a class="button button-block button-default" href="popovers.html"><i class="icon-star-empty"></i> Popovers</a></p>
|
<p><a class="button button-block button-default" href="lists.html"><i class="icon-star-half-empty"></i> Lists</a></p>
|
||||||
<p><a class="button button-block button-default" href="pull-to-refresh.html"><i class="icon-star-empty"></i> Pull To Refresh</a></p>
|
<p><a class="button button-block button-default" href="modals.html"><i class="icon-star-empty"></i> Modals</a></p>
|
||||||
<p><a class="button button-block button-default" href="side-menus.html"><i class="icon-star-empty"></i> Side Menus</a></p>
|
<p><a class="button button-block button-default" href="popovers.html"><i class="icon-star-empty"></i> Popovers</a></p>
|
||||||
<p><a class="button button-block button-default" href="swipe.html"><i class="icon-star-empty"></i> Swipe</a></p>
|
<p><a class="button button-block button-default" href="pull-to-refresh.html"><i class="icon-star-empty"></i> Pull To Refresh</a></p>
|
||||||
<p><a class="button button-block button-default" href="tab-bars.html"><i class="icon-star-half-empty"></i> Tab Bars</a></p>
|
<p><a class="button button-block button-default" href="side-menus.html"><i class="icon-star-empty"></i> Side Menus</a></p>
|
||||||
<p><a class="button button-block button-default" href="type.html"><i class="icon-star"></i> Type</a></p>
|
<p><a class="button button-block button-default" href="swipe.html"><i class="icon-star-empty"></i> Swipe</a></p>
|
||||||
</main>
|
<p><a class="button button-block button-default" href="tab-bars.html"><i class="icon-star-half-empty"></i> Tab Bars</a></p>
|
||||||
|
<p><a class="button button-block button-default" href="type.html"><i class="icon-star"></i> Type</a></p>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
@ -21,21 +21,21 @@
|
|||||||
<ul class="list">
|
<ul class="list">
|
||||||
<li class="list-item">
|
<li class="list-item">
|
||||||
Airplane Mode
|
Airplane Mode
|
||||||
<label class="toggle" id="airplaneMode">
|
<div class="toggle" id="airplaneMode">
|
||||||
<input type="checkbox" name="airplaneMode">
|
<input type="checkbox" name="airplaneMode">
|
||||||
<div class="track">
|
<div class="track">
|
||||||
<div class="handle"></div>
|
<div class="handle"></div>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-item">
|
<li class="list-item">
|
||||||
Do Not Disturb
|
Do Not Disturb
|
||||||
<label class="toggle" id="doNotDisturb">
|
<div class="toggle" id="doNotDisturb">
|
||||||
<input type="checkbox" name="doNotDisturb" checked="checked">
|
<input type="checkbox" name="doNotDisturb" checked="checked">
|
||||||
<div class="track">
|
<div class="track">
|
||||||
<div class="handle"></div>
|
<div class="handle"></div>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user