mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
Progress on #37
This commit is contained in:
@ -45,9 +45,15 @@ module.exports = function(grunt) {
|
||||
jshint: {
|
||||
files: ['Gruntfile.js', 'js/**/*.js', 'test/**/*.js'],
|
||||
options: {
|
||||
// Disable short circuit check, I will not bend to its will.
|
||||
expr: true,
|
||||
browser: true,
|
||||
multistr: true,
|
||||
// options here to override JSHint defaults
|
||||
globals: {
|
||||
jQuery: true,
|
||||
ionic: true,
|
||||
angular: true,
|
||||
console: true,
|
||||
module: true,
|
||||
document: true
|
||||
|
||||
1
dist/css/ionic-ios7.css
vendored
1
dist/css/ionic-ios7.css
vendored
@ -1577,7 +1577,6 @@ input[type="checkbox"][readonly] {
|
||||
.button {
|
||||
position: relative;
|
||||
display: block;
|
||||
margin: 10px 0 10px 0;
|
||||
padding: 8px 12px;
|
||||
width: 100%;
|
||||
border-width: 0;
|
||||
|
||||
1
dist/css/ionic-scoped.css
vendored
1
dist/css/ionic-scoped.css
vendored
@ -2204,7 +2204,6 @@
|
||||
.ionic .button {
|
||||
position: relative;
|
||||
display: block;
|
||||
margin: 10px 0 10px 0;
|
||||
padding: 8px 12px;
|
||||
width: 100%;
|
||||
border-width: 0;
|
||||
|
||||
1
dist/css/ionic.css
vendored
1
dist/css/ionic.css
vendored
@ -2695,7 +2695,6 @@ input[type="checkbox"][readonly] {
|
||||
.button {
|
||||
position: relative;
|
||||
display: block;
|
||||
margin: 10px 0 10px 0;
|
||||
padding: 8px 12px;
|
||||
width: 100%;
|
||||
border-width: 0;
|
||||
|
||||
122
dist/js/ionic-angular.js
vendored
122
dist/js/ionic-angular.js
vendored
@ -33,7 +33,7 @@ angular.module('ionic.service.actionSheet', ['ionic.service', 'ionic.ui.actionSh
|
||||
scope.sheet.hide();
|
||||
//scope.$destroy();
|
||||
opts.cancel();
|
||||
}
|
||||
};
|
||||
|
||||
scope.buttonClicked = function(index) {
|
||||
// Check if the button click event returned true, which means
|
||||
@ -51,17 +51,17 @@ angular.module('ionic.service.actionSheet', ['ionic.service', 'ionic.ui.actionSh
|
||||
scope.sheet.hide();
|
||||
//scope.$destroy();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Compile the template
|
||||
var element = $compile('<action-sheet buttons="buttons"></action-sheet>')(scope);
|
||||
|
||||
var scope = element.scope();
|
||||
var s = element.scope();
|
||||
|
||||
$document[0].body.appendChild(element[0]);
|
||||
|
||||
var sheet = new ionic.views.ActionSheet({el: element[0] });
|
||||
scope.sheet = sheet;
|
||||
s.sheet = sheet;
|
||||
|
||||
sheet.show();
|
||||
|
||||
@ -71,6 +71,16 @@ angular.module('ionic.service.actionSheet', ['ionic.service', 'ionic.ui.actionSh
|
||||
}]);
|
||||
;
|
||||
;
|
||||
angular.module('ionic.service.gesture', [])
|
||||
|
||||
.factory('Gesture', [function() {
|
||||
return {
|
||||
on: function(eventType, cb, element) {
|
||||
return window.ionic.onGesture(eventType, cb, element);
|
||||
}
|
||||
};
|
||||
}]);
|
||||
;
|
||||
angular.module('ionic.service.modal', ['ionic.service'])
|
||||
|
||||
|
||||
@ -125,9 +135,12 @@ angular.module('ionic.service', [])
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
};
|
||||
}]);
|
||||
;
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('ionic.ui.actionSheet', [])
|
||||
|
||||
.directive('actionSheet', function() {
|
||||
@ -152,9 +165,14 @@ angular.module('ionic.ui.actionSheet', [])
|
||||
'<button class="button" ng-click="cancel()">{{cancelText}}</button>' +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
})();
|
||||
;
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('ionic.ui.checkbox', [])
|
||||
|
||||
|
||||
@ -193,8 +211,14 @@ angular.module('ionic.ui.checkbox', [])
|
||||
$scope.checkbox.val(ngModel.$viewValue);
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
})();
|
||||
;
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('ionic.ui.content', [])
|
||||
|
||||
// The content directive is a core scrollable content area
|
||||
@ -221,11 +245,15 @@ angular.module('ionic.ui.content', [])
|
||||
c.addClass('has-tabs');
|
||||
}
|
||||
c.append(transclude($scope));
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
});
|
||||
})();
|
||||
;
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
||||
|
||||
.directive('listItem', function() {
|
||||
@ -234,7 +262,6 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
||||
require: '^list',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
scope: true,
|
||||
scope: {
|
||||
item: '=',
|
||||
onSelect: '&',
|
||||
@ -270,7 +297,7 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
||||
$scope.isEditing = v;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
.directive('list', function() {
|
||||
@ -306,11 +333,16 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
||||
if(attr.animation) {
|
||||
$element.addClass(attr.animation);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
});
|
||||
|
||||
})();
|
||||
;
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('ionic.ui.nav', ['ionic.service'])
|
||||
|
||||
.controller('NavCtrl', ['$scope', '$element', '$compile', 'TemplateLoader', function($scope, $element, $compile, TemplateLoader) {
|
||||
@ -329,7 +361,7 @@ angular.module('ionic.ui.nav', ['ionic.service'])
|
||||
$element.append(cloned);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ionic.controllers.NavController.call(this, {
|
||||
content: {
|
||||
@ -366,7 +398,7 @@ angular.module('ionic.ui.nav', ['ionic.service'])
|
||||
controller: 'NavCtrl',
|
||||
//templateUrl: 'ext/angular/tmpl/ionicTabBar.tmpl.html',
|
||||
template: '<div class="view" ng-transclude></div>',
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
.directive('navBar', function() {
|
||||
@ -383,9 +415,9 @@ angular.module('ionic.ui.nav', ['ionic.service'])
|
||||
scope.navController = navCtrl;
|
||||
scope.goBack = function() {
|
||||
navCtrl.pop();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
.directive('navContent', function() {
|
||||
@ -414,11 +446,27 @@ angular.module('ionic.ui.nav', ['ionic.service'])
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
;
|
||||
angular.module('ionic.ui.sideMenu', [])
|
||||
|
||||
})();
|
||||
;
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @description
|
||||
* The sideMenuCtrl lets you quickly have a draggable side
|
||||
* left and/or right menu, which a center content area.
|
||||
*/
|
||||
|
||||
angular.module('ionic.ui.sideMenu', ['ionic.service.gesture'])
|
||||
|
||||
/**
|
||||
* The internal controller for the side menu controller. This
|
||||
* extends our core Ionic side menu controller and exposes
|
||||
* some side menu stuff on the current scope.
|
||||
*/
|
||||
.controller('SideMenuCtrl', function($scope) {
|
||||
var _this = this;
|
||||
|
||||
@ -454,21 +502,22 @@ angular.module('ionic.ui.sideMenu', [])
|
||||
return {
|
||||
restrict: 'CA',
|
||||
controller: 'SideMenuCtrl',
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
.directive('sideMenuContent', function() {
|
||||
.directive('sideMenuContent', ['Gesture', function(Gesture) {
|
||||
return {
|
||||
restrict: 'CA',
|
||||
require: '^sideMenuCtrl',
|
||||
scope: true,
|
||||
compile: function(element, attr, transclude) {
|
||||
return function($scope, $element, $attr, sideMenuCtrl) {
|
||||
window.ionic.onGesture('drag', function(e) {
|
||||
|
||||
Gesture.on('drag', function(e) {
|
||||
sideMenuCtrl._handleDrag(e);
|
||||
}, $element[0]);
|
||||
|
||||
window.ionic.onGesture('release', function(e) {
|
||||
Gesture.on('release', function(e) {
|
||||
sideMenuCtrl._endDrag(e);
|
||||
}, $element[0]);
|
||||
|
||||
@ -495,8 +544,8 @@ angular.module('ionic.ui.sideMenu', [])
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
}])
|
||||
|
||||
|
||||
.directive('menu', function() {
|
||||
@ -519,8 +568,9 @@ angular.module('ionic.ui.sideMenu', [])
|
||||
$element.append(transclude($scope));
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
});
|
||||
})();
|
||||
;
|
||||
angular.module('ionic.ui.tabs', [])
|
||||
|
||||
@ -562,7 +612,7 @@ angular.module('ionic.ui.tabs', [])
|
||||
return function($scope, $element, $attr) {
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
// Generic controller directive
|
||||
@ -587,7 +637,7 @@ angular.module('ionic.ui.tabs', [])
|
||||
scope.iconOff = attrs.iconOff;
|
||||
tabsCtrl.addController(scope);
|
||||
}
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
|
||||
@ -601,7 +651,7 @@ angular.module('ionic.ui.tabs', [])
|
||||
template: '<div class="tabs tabs-primary">' +
|
||||
'<tab-item title="{{controller.title}}" icon="{{controller.icon}}" icon-on="{{controller.iconOn}}" icon-off="{{controller.iconOff}}" active="controller.isVisible" index="$index" ng-repeat="controller in controllers"></tab-item>' +
|
||||
'</div>'
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
.directive('tabItem', function() {
|
||||
@ -629,7 +679,7 @@ angular.module('ionic.ui.tabs', [])
|
||||
'<i class="{{iconOn}}" ng-if="active"></i>' +
|
||||
'<i class="{{iconOff}}" ng-if="!active"></i> {{title}}' +
|
||||
'</a>'
|
||||
}
|
||||
};
|
||||
});
|
||||
;
|
||||
angular.module('ionic.ui.toggle', [])
|
||||
@ -678,5 +728,5 @@ angular.module('ionic.ui.toggle', [])
|
||||
$scope.toggle.val(ngModel.$viewValue);
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
});
|
||||
|
||||
46
dist/js/ionic.js
vendored
46
dist/js/ionic.js
vendored
@ -94,7 +94,7 @@ window.ionic = {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
})(window.ionic);
|
||||
;
|
||||
/**
|
||||
@ -196,11 +196,11 @@ window.ionic = {
|
||||
|
||||
|
||||
// Map some convenient top-level functions for event handling
|
||||
ionic.on = function() { ionic.EventController.on.apply(ionic.EventController, arguments); }
|
||||
ionic.off = function() { ionic.EventController.off.apply(ionic.EventController, arguments); }
|
||||
ionic.trigger = function() { ionic.EventController.trigger.apply(ionic.EventController.trigger, arguments); }
|
||||
ionic.onGesture = function() { ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); }
|
||||
ionic.offGesture = function() { ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); }
|
||||
ionic.on = function() { ionic.EventController.on.apply(ionic.EventController, arguments); };
|
||||
ionic.off = function() { ionic.EventController.off.apply(ionic.EventController, arguments); };
|
||||
ionic.trigger = function() { ionic.EventController.trigger.apply(ionic.EventController.trigger, arguments); };
|
||||
ionic.onGesture = function() { ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); };
|
||||
ionic.offGesture = function() { ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); };
|
||||
|
||||
// DISABLING FOR NOW. THE TAP CODE AT THE EXT LEVEL SHOULD BE DOING THIS
|
||||
// Set up various listeners
|
||||
@ -1672,7 +1672,7 @@ window.ionic = {
|
||||
}
|
||||
return parseFloat(window.device.version) >= 7.0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ionic.Platform.detect();
|
||||
})(window.ionic);
|
||||
@ -1697,9 +1697,9 @@ window.ionic = {
|
||||
// if the source event wasn't from a touch event then don't use this polyfill
|
||||
if(!e.gesture || e.gesture.pointerType !== "touch" || !e.gesture.srcEvent) return;
|
||||
|
||||
var
|
||||
e = e.gesture.srcEvent, // evaluate the actual source event, not the created event by gestures.js
|
||||
ele = e.target;
|
||||
e = e.gesture.srcEvent; // evaluate the actual source event, not the created event by gestures.js
|
||||
|
||||
var ele = e.target;
|
||||
|
||||
while(ele) {
|
||||
if( ele.tagName === "INPUT" || ele.tagName === "TEXTAREA" || ele.tagName === "SELECT" ) {
|
||||
@ -1754,7 +1754,7 @@ window.ionic = {
|
||||
}
|
||||
return dest;
|
||||
},
|
||||
}
|
||||
};
|
||||
})(window.ionic);
|
||||
;
|
||||
(function(ionic) {
|
||||
@ -1848,7 +1848,7 @@ window.ionic = {
|
||||
},
|
||||
end: function(e) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var SlideDrag = function(opts) {
|
||||
this.dragThresholdX = opts.dragThresholdX || 10;
|
||||
@ -1958,7 +1958,7 @@ window.ionic = {
|
||||
content.classList.remove('list-item-sliding');
|
||||
}
|
||||
e.target.removeEventListener('webkitTransitionEnd', onRestingAnimationEnd);
|
||||
}
|
||||
};
|
||||
|
||||
window.requestAnimationFrame(function() {
|
||||
var currentX = parseFloat(_this._currentDrag.content.style.webkitTransform.replace('translate3d(', '').split(',')[0]) || 0;
|
||||
@ -1975,12 +1975,13 @@ window.ionic = {
|
||||
// We are done, notify caller
|
||||
doneCallback && doneCallback();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var ReorderDrag = function(opts) {
|
||||
this.dragThresholdY = opts.dragThresholdY || 0;
|
||||
this.el = opts.el;
|
||||
};
|
||||
|
||||
ReorderDrag.prototype = new DragOp();
|
||||
|
||||
ReorderDrag.prototype.start = function(e) {
|
||||
@ -2178,7 +2179,6 @@ window.ionic = {
|
||||
|
||||
})(ionic);
|
||||
;
|
||||
|
||||
(function(ionic) {
|
||||
|
||||
ionic.views.NavBar = function(opts) {
|
||||
@ -2218,7 +2218,7 @@ window.ionic = {
|
||||
this._currentBackButton = back;
|
||||
this._currentBackButton.onclick = function(event) {
|
||||
_this.shouldGoBack && _this.shouldGoBack();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if(shouldShow && !this._currentBackButton.parentNode) {
|
||||
@ -2562,7 +2562,7 @@ ionic.controllers.NavController = function(opts) {
|
||||
// TODO: Is this the best way?
|
||||
this.navBar.shouldGoBack = function() {
|
||||
_this.pop();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ionic.controllers.NavController.prototype = {
|
||||
@ -2808,8 +2808,9 @@ ionic.controllers.NavController.prototype = {
|
||||
};
|
||||
})(window.ionic);
|
||||
;
|
||||
|
||||
(function(ionic) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The SideMenuController is a controller with a left and/or right menu that
|
||||
* can be slid out and toggled. Seen on many an app.
|
||||
@ -2989,11 +2990,11 @@ ionic.controllers.NavController.prototype = {
|
||||
// what the drag velocity is
|
||||
var ratio = this.getOpenRatio();
|
||||
|
||||
if(ratio == 0)
|
||||
if(ratio === 0)
|
||||
return;
|
||||
|
||||
var velocityThreshold = 0.3;
|
||||
var velocityX = e.gesture.velocityX
|
||||
var velocityX = e.gesture.velocityX;
|
||||
var direction = e.gesture.direction;
|
||||
|
||||
// Less than half, going left
|
||||
@ -3060,7 +3061,7 @@ ionic.controllers.NavController.prototype = {
|
||||
if(!this._isDragging && Math.abs(this._lastX - this._startX) > this.dragThresholdX) {
|
||||
// if the difference is greater than threshold, start dragging using the current
|
||||
// point as the starting point
|
||||
this._startX = this._lastX
|
||||
this._startX = this._lastX;
|
||||
|
||||
this._isDragging = true;
|
||||
// Initialize dragging
|
||||
@ -3077,6 +3078,7 @@ ionic.controllers.NavController.prototype = {
|
||||
})(ionic);
|
||||
;
|
||||
(function(ionic) {
|
||||
'use strict';
|
||||
|
||||
ionic.controllers.TabBarController = function(options) {
|
||||
this.tabBar = options.tabBar;
|
||||
@ -3195,7 +3197,7 @@ ionic.controllers.TabBarController.prototype = {
|
||||
this._clearSelected();
|
||||
this.selectController(0);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
})(window.ionic);
|
||||
;
|
||||
|
||||
@ -22,7 +22,7 @@ ionic.controllers.NavController = function(opts) {
|
||||
// TODO: Is this the best way?
|
||||
this.navBar.shouldGoBack = function() {
|
||||
_this.pop();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ionic.controllers.NavController.prototype = {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
|
||||
(function(ionic) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The SideMenuController is a controller with a left and/or right menu that
|
||||
* can be slid out and toggled. Seen on many an app.
|
||||
@ -179,11 +180,11 @@
|
||||
// what the drag velocity is
|
||||
var ratio = this.getOpenRatio();
|
||||
|
||||
if(ratio == 0)
|
||||
if(ratio === 0)
|
||||
return;
|
||||
|
||||
var velocityThreshold = 0.3;
|
||||
var velocityX = e.gesture.velocityX
|
||||
var velocityX = e.gesture.velocityX;
|
||||
var direction = e.gesture.direction;
|
||||
|
||||
// Less than half, going left
|
||||
@ -250,7 +251,7 @@
|
||||
if(!this._isDragging && Math.abs(this._lastX - this._startX) > this.dragThresholdX) {
|
||||
// if the difference is greater than threshold, start dragging using the current
|
||||
// point as the starting point
|
||||
this._startX = this._lastX
|
||||
this._startX = this._lastX;
|
||||
|
||||
this._isDragging = true;
|
||||
// Initialize dragging
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
(function(ionic) {
|
||||
'use strict';
|
||||
|
||||
ionic.controllers.TabBarController = function(options) {
|
||||
this.tabBar = options.tabBar;
|
||||
@ -117,6 +118,6 @@ ionic.controllers.TabBarController.prototype = {
|
||||
this._clearSelected();
|
||||
this.selectController(0);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
})(window.ionic);
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('ionic.ui.actionSheet', [])
|
||||
|
||||
.directive('actionSheet', function() {
|
||||
@ -22,5 +25,7 @@ angular.module('ionic.ui.actionSheet', [])
|
||||
'<button class="button" ng-click="cancel()">{{cancelText}}</button>' +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('ionic.ui.checkbox', [])
|
||||
|
||||
|
||||
@ -36,5 +39,7 @@ angular.module('ionic.ui.checkbox', [])
|
||||
$scope.checkbox.val(ngModel.$viewValue);
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
10
js/ext/angular/src/directive/ionicContent.js
vendored
10
js/ext/angular/src/directive/ionicContent.js
vendored
@ -1,3 +1,6 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('ionic.ui.content', [])
|
||||
|
||||
// The content directive is a core scrollable content area
|
||||
@ -24,7 +27,8 @@ angular.module('ionic.ui.content', [])
|
||||
c.addClass('has-tabs');
|
||||
}
|
||||
c.append(transclude($scope));
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
});
|
||||
})();
|
||||
|
||||
14
js/ext/angular/src/directive/ionicList.js
vendored
14
js/ext/angular/src/directive/ionicList.js
vendored
@ -1,3 +1,6 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
||||
|
||||
.directive('listItem', function() {
|
||||
@ -6,7 +9,6 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
||||
require: '^list',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
scope: true,
|
||||
scope: {
|
||||
item: '=',
|
||||
onSelect: '&',
|
||||
@ -42,7 +44,7 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
||||
$scope.isEditing = v;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
.directive('list', function() {
|
||||
@ -78,7 +80,9 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
||||
if(attr.animation) {
|
||||
$element.addClass(attr.animation);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
15
js/ext/angular/src/directive/ionicNav.js
vendored
15
js/ext/angular/src/directive/ionicNav.js
vendored
@ -1,3 +1,6 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('ionic.ui.nav', ['ionic.service'])
|
||||
|
||||
.controller('NavCtrl', ['$scope', '$element', '$compile', 'TemplateLoader', function($scope, $element, $compile, TemplateLoader) {
|
||||
@ -16,7 +19,7 @@ angular.module('ionic.ui.nav', ['ionic.service'])
|
||||
$element.append(cloned);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ionic.controllers.NavController.call(this, {
|
||||
content: {
|
||||
@ -53,7 +56,7 @@ angular.module('ionic.ui.nav', ['ionic.service'])
|
||||
controller: 'NavCtrl',
|
||||
//templateUrl: 'ext/angular/tmpl/ionicTabBar.tmpl.html',
|
||||
template: '<div class="view" ng-transclude></div>',
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
.directive('navBar', function() {
|
||||
@ -70,9 +73,9 @@ angular.module('ionic.ui.nav', ['ionic.service'])
|
||||
scope.navController = navCtrl;
|
||||
scope.goBack = function() {
|
||||
navCtrl.pop();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
.directive('navContent', function() {
|
||||
@ -101,5 +104,7 @@ angular.module('ionic.ui.nav', ['ionic.service'])
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
34
js/ext/angular/src/directive/ionicSideMenu.js
vendored
34
js/ext/angular/src/directive/ionicSideMenu.js
vendored
@ -1,5 +1,19 @@
|
||||
angular.module('ionic.ui.sideMenu', [])
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @description
|
||||
* The sideMenuCtrl lets you quickly have a draggable side
|
||||
* left and/or right menu, which a center content area.
|
||||
*/
|
||||
|
||||
angular.module('ionic.ui.sideMenu', ['ionic.service.gesture'])
|
||||
|
||||
/**
|
||||
* The internal controller for the side menu controller. This
|
||||
* extends our core Ionic side menu controller and exposes
|
||||
* some side menu stuff on the current scope.
|
||||
*/
|
||||
.controller('SideMenuCtrl', function($scope) {
|
||||
var _this = this;
|
||||
|
||||
@ -35,21 +49,22 @@ angular.module('ionic.ui.sideMenu', [])
|
||||
return {
|
||||
restrict: 'CA',
|
||||
controller: 'SideMenuCtrl',
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
.directive('sideMenuContent', function() {
|
||||
.directive('sideMenuContent', ['Gesture', function(Gesture) {
|
||||
return {
|
||||
restrict: 'CA',
|
||||
require: '^sideMenuCtrl',
|
||||
scope: true,
|
||||
compile: function(element, attr, transclude) {
|
||||
return function($scope, $element, $attr, sideMenuCtrl) {
|
||||
window.ionic.onGesture('drag', function(e) {
|
||||
|
||||
Gesture.on('drag', function(e) {
|
||||
sideMenuCtrl._handleDrag(e);
|
||||
}, $element[0]);
|
||||
|
||||
window.ionic.onGesture('release', function(e) {
|
||||
Gesture.on('release', function(e) {
|
||||
sideMenuCtrl._endDrag(e);
|
||||
}, $element[0]);
|
||||
|
||||
@ -76,8 +91,8 @@ angular.module('ionic.ui.sideMenu', [])
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
}])
|
||||
|
||||
|
||||
.directive('menu', function() {
|
||||
@ -100,5 +115,6 @@ angular.module('ionic.ui.sideMenu', [])
|
||||
$element.append(transclude($scope));
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
});
|
||||
})();
|
||||
|
||||
8
js/ext/angular/src/directive/ionicTabBar.js
vendored
8
js/ext/angular/src/directive/ionicTabBar.js
vendored
@ -38,7 +38,7 @@ angular.module('ionic.ui.tabs', [])
|
||||
return function($scope, $element, $attr) {
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
// Generic controller directive
|
||||
@ -63,7 +63,7 @@ angular.module('ionic.ui.tabs', [])
|
||||
scope.iconOff = attrs.iconOff;
|
||||
tabsCtrl.addController(scope);
|
||||
}
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ angular.module('ionic.ui.tabs', [])
|
||||
template: '<div class="tabs tabs-primary">' +
|
||||
'<tab-item title="{{controller.title}}" icon="{{controller.icon}}" icon-on="{{controller.iconOn}}" icon-off="{{controller.iconOff}}" active="controller.isVisible" index="$index" ng-repeat="controller in controllers"></tab-item>' +
|
||||
'</div>'
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
.directive('tabItem', function() {
|
||||
@ -105,5 +105,5 @@ angular.module('ionic.ui.tabs', [])
|
||||
'<i class="{{iconOn}}" ng-if="active"></i>' +
|
||||
'<i class="{{iconOff}}" ng-if="!active"></i> {{title}}' +
|
||||
'</a>'
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
4
js/ext/angular/src/directive/ionicToggle.js
vendored
4
js/ext/angular/src/directive/ionicToggle.js
vendored
@ -44,5 +44,5 @@ angular.module('ionic.ui.toggle', [])
|
||||
$scope.toggle.val(ngModel.$viewValue);
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
});
|
||||
|
||||
@ -19,7 +19,7 @@ angular.module('ionic.service.actionSheet', ['ionic.service', 'ionic.ui.actionSh
|
||||
scope.sheet.hide();
|
||||
//scope.$destroy();
|
||||
opts.cancel();
|
||||
}
|
||||
};
|
||||
|
||||
scope.buttonClicked = function(index) {
|
||||
// Check if the button click event returned true, which means
|
||||
@ -37,17 +37,17 @@ angular.module('ionic.service.actionSheet', ['ionic.service', 'ionic.ui.actionSh
|
||||
scope.sheet.hide();
|
||||
//scope.$destroy();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Compile the template
|
||||
var element = $compile('<action-sheet buttons="buttons"></action-sheet>')(scope);
|
||||
|
||||
var scope = element.scope();
|
||||
var s = element.scope();
|
||||
|
||||
$document[0].body.appendChild(element[0]);
|
||||
|
||||
var sheet = new ionic.views.ActionSheet({el: element[0] });
|
||||
scope.sheet = sheet;
|
||||
s.sheet = sheet;
|
||||
|
||||
sheet.show();
|
||||
|
||||
|
||||
9
js/ext/angular/src/service/ionicGesture.js
vendored
Normal file
9
js/ext/angular/src/service/ionicGesture.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
angular.module('ionic.service.gesture', [])
|
||||
|
||||
.factory('Gesture', [function() {
|
||||
return {
|
||||
on: function(eventType, cb, element) {
|
||||
return window.ionic.onGesture(eventType, cb, element);
|
||||
}
|
||||
};
|
||||
}]);
|
||||
@ -11,5 +11,5 @@ angular.module('ionic.service', [])
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
||||
@ -91,4 +91,4 @@ describe('Tab Item directive', function() {
|
||||
a.click();
|
||||
expect(scope.selectTab).toHaveBeenCalled();
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
@ -9,16 +9,13 @@
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (window.jQuery) {
|
||||
// if jQuery is present then it should be the default
|
||||
jq = window.jQuery;
|
||||
|
||||
// extend the methods which are in ionic.fn and in jQuery.fn
|
||||
for(var name in ionic.fn) {
|
||||
var jQueryFn = jq.fn[name];
|
||||
jq.fn[name] = function() {
|
||||
var fnExtended = function() {
|
||||
var
|
||||
x,
|
||||
ret; // if incase this isn't an ionic component
|
||||
@ -32,7 +29,12 @@
|
||||
|
||||
// if this isn't an ionic component, run the usual jQuery fn
|
||||
return jQueryFn.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
// extend the methods which are in ionic.fn and in jQuery.fn
|
||||
for(var name in ionic.fn) {
|
||||
var jQueryFn = jq.fn[name];
|
||||
jq.fn[name] = fnExtended;
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -56,7 +58,7 @@
|
||||
|
||||
$ = function(selector, context) {
|
||||
return jq.init(selector, context);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
})(this, document, ionic);
|
||||
|
||||
@ -30,5 +30,5 @@
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
})(window.ionic);
|
||||
|
||||
@ -97,11 +97,11 @@
|
||||
|
||||
|
||||
// Map some convenient top-level functions for event handling
|
||||
ionic.on = function() { ionic.EventController.on.apply(ionic.EventController, arguments); }
|
||||
ionic.off = function() { ionic.EventController.off.apply(ionic.EventController, arguments); }
|
||||
ionic.trigger = function() { ionic.EventController.trigger.apply(ionic.EventController.trigger, arguments); }
|
||||
ionic.onGesture = function() { ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); }
|
||||
ionic.offGesture = function() { ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); }
|
||||
ionic.on = function() { ionic.EventController.on.apply(ionic.EventController, arguments); };
|
||||
ionic.off = function() { ionic.EventController.off.apply(ionic.EventController, arguments); };
|
||||
ionic.trigger = function() { ionic.EventController.trigger.apply(ionic.EventController.trigger, arguments); };
|
||||
ionic.onGesture = function() { ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); };
|
||||
ionic.offGesture = function() { ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); };
|
||||
|
||||
// DISABLING FOR NOW. THE TAP CODE AT THE EXT LEVEL SHOULD BE DOING THIS
|
||||
// Set up various listeners
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
}
|
||||
return parseFloat(window.device.version) >= 7.0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ionic.Platform.detect();
|
||||
})(window.ionic);
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
// if the source event wasn't from a touch event then don't use this polyfill
|
||||
if(!e.gesture || e.gesture.pointerType !== "touch" || !e.gesture.srcEvent) return;
|
||||
|
||||
var
|
||||
e = e.gesture.srcEvent, // evaluate the actual source event, not the created event by gestures.js
|
||||
ele = e.target;
|
||||
e = e.gesture.srcEvent; // evaluate the actual source event, not the created event by gestures.js
|
||||
|
||||
var ele = e.target;
|
||||
|
||||
while(ele) {
|
||||
if( ele.tagName === "INPUT" || ele.tagName === "TEXTAREA" || ele.tagName === "SELECT" ) {
|
||||
|
||||
@ -18,5 +18,5 @@
|
||||
}
|
||||
return dest;
|
||||
},
|
||||
}
|
||||
};
|
||||
})(window.ionic);
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
},
|
||||
end: function(e) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var SlideDrag = function(opts) {
|
||||
this.dragThresholdX = opts.dragThresholdX || 10;
|
||||
@ -117,7 +117,7 @@
|
||||
content.classList.remove('list-item-sliding');
|
||||
}
|
||||
e.target.removeEventListener('webkitTransitionEnd', onRestingAnimationEnd);
|
||||
}
|
||||
};
|
||||
|
||||
window.requestAnimationFrame(function() {
|
||||
var currentX = parseFloat(_this._currentDrag.content.style.webkitTransform.replace('translate3d(', '').split(',')[0]) || 0;
|
||||
@ -134,12 +134,13 @@
|
||||
// We are done, notify caller
|
||||
doneCallback && doneCallback();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var ReorderDrag = function(opts) {
|
||||
this.dragThresholdY = opts.dragThresholdY || 0;
|
||||
this.el = opts.el;
|
||||
};
|
||||
|
||||
ReorderDrag.prototype = new DragOp();
|
||||
|
||||
ReorderDrag.prototype.start = function(e) {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
(function(ionic) {
|
||||
|
||||
ionic.views.NavBar = function(opts) {
|
||||
@ -38,7 +37,7 @@
|
||||
this._currentBackButton = back;
|
||||
this._currentBackButton.onclick = function(event) {
|
||||
_this.shouldGoBack && _this.shouldGoBack();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if(shouldShow && !this._currentBackButton.parentNode) {
|
||||
|
||||
@ -10,8 +10,8 @@ describe('NavController', function() {
|
||||
},
|
||||
attach: function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
beforeEach(function() {
|
||||
navBarEl = document.createElement('div');
|
||||
|
||||
@ -8,7 +8,7 @@ describe('TabBarController', function() {
|
||||
el: tabEl.get(0)
|
||||
})
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
it('Should add Controllers', function() {
|
||||
ctrl.addController({
|
||||
@ -82,4 +82,4 @@ describe('TabBarController', function() {
|
||||
expect(ctrl.getSelectedController()).toBe(ctrl.getController(0));
|
||||
});
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
@ -80,7 +80,7 @@ describe('TabBar view', function() {
|
||||
|
||||
tabBar.destroy();
|
||||
|
||||
var event = new CustomEvent('tap', {
|
||||
event = new CustomEvent('tap', {
|
||||
target: item.el
|
||||
});
|
||||
item.el.dispatchEvent(event);
|
||||
@ -129,7 +129,7 @@ describe('TabBarItem view', function() {
|
||||
|
||||
item.destroy();
|
||||
|
||||
var event = new CustomEvent('tap', {
|
||||
event = new CustomEvent('tap', {
|
||||
target: item.el
|
||||
});
|
||||
item.el.dispatchEvent(event);
|
||||
|
||||
Reference in New Issue
Block a user