mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
Removed hacking folder, distributed files
This commit is contained in:
355
dist/ionic-angular.js
vendored
355
dist/ionic-angular.js
vendored
@ -7,64 +7,302 @@ angular.module('ionic.ui.content', {})
|
||||
template: '<div class="content"></div>'
|
||||
}
|
||||
});
|
||||
;angular.module('ionic.ui.tabbar', {})
|
||||
;angular.module('ionic.ui', ['ngTouch'])
|
||||
|
||||
.controller('TabBarCtrl', ['$scope', '$element', function($scope, $element) {
|
||||
console.log('Tab controller');
|
||||
var tabs = $scope.tabs = [];
|
||||
.directive('content', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
scope: true,
|
||||
template: '<div class="content" ng-class="{\'has-header\': hasHeader, \'has-tabs\': hasTabs}"></div>',
|
||||
compile: function(element, attr, transclude, navCtrl) {
|
||||
return function($scope, $element, $attr) {
|
||||
$scope.hasHeader = attr.hasHeader;
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
$scope.selectTab = function(index) {
|
||||
};
|
||||
$scope.beforeTabSelect = function(index) {
|
||||
};
|
||||
$scope.tabSelected = function(index) {
|
||||
};
|
||||
.controller('NavCtrl', function($scope, $element, $compile) {
|
||||
var _this = this;
|
||||
|
||||
this.addTab = function(tab) {
|
||||
tabs.push(tab);
|
||||
};
|
||||
|
||||
this.getSelectedTabIndex = function() {
|
||||
return $scope.selectedIndex;
|
||||
};
|
||||
angular.extend(this, NavController.prototype);
|
||||
|
||||
this.selectTabAtIndex = function(index) {
|
||||
$scope.selectedIndex = index;
|
||||
console.log('Scope selected tab is', index);
|
||||
};
|
||||
NavController.call(this, {
|
||||
content: {
|
||||
},
|
||||
navBar: {
|
||||
shouldGoBack: function() {
|
||||
},
|
||||
setTitle: function(title) {
|
||||
$scope.title = title;
|
||||
},
|
||||
showBackButton: function(show) {
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
this.getNumTabs = function() {
|
||||
return tabs.length;
|
||||
};
|
||||
}])
|
||||
$scope.controllers = this.controllers;
|
||||
|
||||
.directive('tabBar', function() {
|
||||
$scope.getTopController = function() {
|
||||
return $scope.controllers[$scope.controllers.length-1];
|
||||
}
|
||||
|
||||
$scope.pushController = function(controller) {
|
||||
//console.log('PUSHING OCNTROLLER', controller);
|
||||
_this.push(controller);
|
||||
}
|
||||
|
||||
$scope.navController = this;
|
||||
})
|
||||
|
||||
.directive('navController', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
controller: 'NavCtrl',
|
||||
//templateUrl: 'ext/angular/tmpl/ionicTabBar.tmpl.html',
|
||||
template: '<div class="view"><div ng-transclude></div></div>',
|
||||
compile: function(element, attr, transclude, navCtrl) {
|
||||
return function($scope, $element, $attr) {
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.directive('navBar', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
require: '^navController',
|
||||
transclude: true,
|
||||
replace: true,
|
||||
template: '<header class="bar bar-header bar-dark nav-bar">' +
|
||||
'<a href="#" ng-click="goBack()" class="button" ng-if="controllers.length > 1">Back</a>' +
|
||||
'<h1 class="title">{{getTopController().title}}</h1>' +
|
||||
'</header>',
|
||||
link: function(scope, element, attrs, navCtrl) {
|
||||
scope.goBack = function() {
|
||||
navCtrl.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.directive('navContent', function() {
|
||||
return {
|
||||
restrict: 'ECA',
|
||||
scope: true,
|
||||
link: function(scope, element, attrs) {
|
||||
scope.title = attrs.title;
|
||||
scope.isVisible = true;
|
||||
scope.pushController(scope);
|
||||
}
|
||||
}
|
||||
});
|
||||
;angular.module('ionic.ui', [])
|
||||
|
||||
.controller('SideMenuCtrl', function($scope) {
|
||||
var _this = this;
|
||||
|
||||
angular.extend(this, SideMenuController.prototype);
|
||||
|
||||
SideMenuController.call(this, {
|
||||
left: {
|
||||
width: 270,
|
||||
isEnabled: true,
|
||||
pushDown: function() {
|
||||
$scope.leftZIndex = -1;
|
||||
},
|
||||
bringUp: function() {
|
||||
$scope.leftZIndex = 0;
|
||||
}
|
||||
},
|
||||
right: {
|
||||
width: 270,
|
||||
isEnabled: true,
|
||||
pushDown: function() {
|
||||
$scope.rightZIndex = -1;
|
||||
},
|
||||
bringUp: function() {
|
||||
$scope.rightZIndex = 0;
|
||||
}
|
||||
},
|
||||
content: {
|
||||
onDrag: function(e) {},
|
||||
endDrag: function(e) {},
|
||||
getTranslateX: function() {
|
||||
/*
|
||||
var r = /translate3d\((-?.+)px/;
|
||||
var d = r.exec(this.el.style.webkitTransform);
|
||||
|
||||
if(d && d.length > 0) {
|
||||
return parseFloat(d[1]);
|
||||
}
|
||||
*/
|
||||
return $scope.contentTranslateX || 0;
|
||||
},
|
||||
setTranslateX: function(amount) {
|
||||
$scope.contentTranslateX = amount;
|
||||
$scope.$apply();
|
||||
},
|
||||
enableAnimation: function() {
|
||||
//this.el.classList.add(this.animateClass);
|
||||
$scope.animationEnabled = true;
|
||||
},
|
||||
disableAnimation: function() {
|
||||
//this.el.classList.remove(this.animateClass);
|
||||
$scope.animationEnabled = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$scope.contentTranslateX = 0;
|
||||
})
|
||||
|
||||
.directive('sideMenuController', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
controller: 'SideMenuCtrl',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
template: '<div class="view"><div ng-transclude></div></div>',
|
||||
}
|
||||
})
|
||||
|
||||
.directive('sideMenuContent', function() {
|
||||
return {
|
||||
restrict: 'CA',
|
||||
require: '^sideMenuController',
|
||||
compile: function(element, attr, transclude) {
|
||||
return function($scope, $element, $attr, sideMenuCtrl) {
|
||||
window.ionic.onGesture('drag', function(e) {
|
||||
sideMenuCtrl._handleDrag(e);
|
||||
}, $element[0]);
|
||||
|
||||
window.ionic.onGesture('release', function(e) {
|
||||
sideMenuCtrl._endDrag(e);
|
||||
}, $element[0]);
|
||||
|
||||
$scope.$watch('contentTranslateX', function(value) {
|
||||
$element[0].style.webkitTransform = 'translate3d(' + value + 'px, 0, 0)';
|
||||
});
|
||||
|
||||
$scope.$watch('animationEnabled', function(isAnimationEnabled) {
|
||||
if(isAnimationEnabled) {
|
||||
$element[0].classList.add('menu-animated');
|
||||
} else {
|
||||
$element[0].classList.remove('menu-animated');
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
.directive('menu', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
require: '^sideMenuController',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
scope: true,
|
||||
template: '<div class="menu menu-{{side}}" ng-transclude></div>',
|
||||
compile: function(element, attr, transclude, sideMenuCtrl) {
|
||||
return function($scope, $element, $attr) {
|
||||
$scope.side = attr.side;
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
;angular.module('ionic.ui', [])
|
||||
|
||||
.directive('content', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
scope: {
|
||||
hasHeader: '@',
|
||||
hasTabs: '@'
|
||||
},
|
||||
template: '<div class="content" ng-class="{\'has-header\': hasHeader, \'has-tabs\': hasTabs}" ng-transclude></div>'
|
||||
}
|
||||
})
|
||||
|
||||
.controller('TabsCtrl', function($scope) {
|
||||
var _this = this;
|
||||
|
||||
angular.extend(this, TabBarController.prototype);
|
||||
|
||||
TabBarController.call(this, {
|
||||
tabBar: {
|
||||
tryTabSelect: function() {},
|
||||
setSelectedItem: function(index) {
|
||||
console.log('TAB BAR SET SELECTED INDEX', index);
|
||||
},
|
||||
addItem: function(item) {
|
||||
console.log('TAB BAR ADD ITEM', item);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$scope.controllers = this.controllers;
|
||||
|
||||
$scope.$watch('controllers', function(newV, oldV) {
|
||||
console.log("CControlelrs changed", newV, oldV);
|
||||
//$scope.$apply();
|
||||
});
|
||||
})
|
||||
|
||||
.directive('tabController', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
scope: {},
|
||||
transclude: true,
|
||||
controller: 'TabBarCtrl',
|
||||
controller: 'TabsCtrl',
|
||||
//templateUrl: 'ext/angular/tmpl/ionicTabBar.tmpl.html',
|
||||
template: '<div class="view-wrapper" ng-transclude></div>',
|
||||
template: '<div class="view"><div ng-transclude></div><tab-bar></tab-bar></div>',
|
||||
compile: function(element, attr, transclude, tabsCtrl) {
|
||||
return function($scope, $element, $attr) {
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
.directive('tabs', function() {
|
||||
// Generic controller directive
|
||||
.directive('tabContent', function() {
|
||||
return {
|
||||
restrict: 'CA',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
template: '<div ng-show="isVisible" ng-transclude></div>',
|
||||
require: '^tabController',
|
||||
scope: true,
|
||||
link: function(scope, element, attrs, tabsCtrl) {
|
||||
scope.title = attrs.title;
|
||||
scope.icon = attrs.icon;
|
||||
tabsCtrl.addController(scope);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
.directive('tabBar', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
require: '^tabBar',
|
||||
require: '^tabController',
|
||||
transclude: true,
|
||||
template: '<footer class="bar bar-tabs bar-footer bar-success">' +
|
||||
'<nav class="tabs">' +
|
||||
'<ul class="tabs-inner">' +
|
||||
'<tab-item text="Item" icon="icon-default" ng-repeat="tab in tabs">' +
|
||||
'</tab-item>' +
|
||||
'</ul>' +
|
||||
'</nav>' +
|
||||
'</footer>'
|
||||
replace: true,
|
||||
scope: true,
|
||||
template: '<div class="tabs tabs-primary">' +
|
||||
'<tab-item title="{{controller.title}}" icon="{{controller.icon}}" active="controller.isVisible" index="$index" ng-repeat="controller in controllers"></tab-item>' +
|
||||
'</div>'
|
||||
}
|
||||
})
|
||||
|
||||
@ -72,42 +310,23 @@ angular.module('ionic.ui.content', {})
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
require: '^tabBar',
|
||||
require: '^tabController',
|
||||
scope: {
|
||||
text: '@',
|
||||
title: '@',
|
||||
icon: '@',
|
||||
active: '=',
|
||||
tabSelected: '@',
|
||||
index: '='
|
||||
},
|
||||
compile: function(element, attrs, transclude) {
|
||||
return function(scope, element, attrs, tabBarCtrl) {
|
||||
var getActive, setActive;
|
||||
|
||||
scope.$watch('active', function(active) {
|
||||
console.log('ACTIVE CHANGED', active);
|
||||
});
|
||||
};
|
||||
},
|
||||
link: function(scope, element, attrs, tabBarCtrl) {
|
||||
|
||||
// Store the index of this list item, which
|
||||
// specifies which tab item it is
|
||||
scope.tabIndex = element.index();
|
||||
|
||||
scope.active = true;
|
||||
|
||||
link: function(scope, element, attrs, tabsCtrl) {
|
||||
console.log('Linked item', scope);
|
||||
scope.selectTab = function(index) {
|
||||
console.log('SELECT TAB', index);
|
||||
tabBarCtrl.selectTabAtIndex(index);
|
||||
tabsCtrl.selectController(scope.index);
|
||||
};
|
||||
|
||||
tabBarCtrl.addTab(scope);
|
||||
},
|
||||
template: '<li class="tab-item" ng-class="{active:active}">' +
|
||||
'<a href="#" ng-click="selectTab(tabIndex)">' +
|
||||
'<i class="{{icon}}"></i>' +
|
||||
'{{text}}' +
|
||||
'</a></li>'
|
||||
template:
|
||||
'<a href="#" ng-class="{active:active}" ng-click="selectTab()" class="tab-item">' +
|
||||
'<i class="{{icon}}"></i> {{title}}' +
|
||||
'</a>'
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user