mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-08 07:41:51 +08:00
Fixed #102
This commit is contained in:
1
dist/css/ionic.css
vendored
1
dist/css/ionic.css
vendored
@ -3553,7 +3553,6 @@ button.item-button-right:after {
|
|||||||
*/
|
*/
|
||||||
.list {
|
.list {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
padding-top: 1px;
|
padding-top: 1px;
|
||||||
padding-bottom: 1px;
|
padding-bottom: 1px;
|
||||||
|
|||||||
68
dist/js/ionic-angular.js
vendored
68
dist/js/ionic-angular.js
vendored
@ -489,7 +489,8 @@ angular.module('ionic.ui.content', [])
|
|||||||
transclude: true,
|
transclude: true,
|
||||||
scope: {
|
scope: {
|
||||||
onRefresh: '&',
|
onRefresh: '&',
|
||||||
onRefreshOpening: '&'
|
onRefreshOpening: '&',
|
||||||
|
scroll: '@'
|
||||||
},
|
},
|
||||||
compile: function(element, attr, transclude) {
|
compile: function(element, attr, transclude) {
|
||||||
return function($scope, $element, $attr) {
|
return function($scope, $element, $attr) {
|
||||||
@ -510,7 +511,9 @@ angular.module('ionic.ui.content', [])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If they want plain overflows scrolling, add that as a class
|
// If they want plain overflows scrolling, add that as a class
|
||||||
if(attr.overflowScroll === "true") {
|
if($scope.scroll === "false") {
|
||||||
|
// Do nothing for now
|
||||||
|
} else if(attr.overflowScroll === "true") {
|
||||||
c.addClass('overflow-scroll');
|
c.addClass('overflow-scroll');
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, supercharge this baby!
|
// Otherwise, supercharge this baby!
|
||||||
@ -638,7 +641,9 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
scope: {
|
scope: {
|
||||||
isEditing: '=',
|
isEditing: '=',
|
||||||
deleteIcon: '@',
|
deleteIcon: '@',
|
||||||
reorderIcon: '@'
|
reorderIcon: '@',
|
||||||
|
onRefresh: '&',
|
||||||
|
onRefreshOpening: '&'
|
||||||
},
|
},
|
||||||
|
|
||||||
controller: function($scope) {
|
controller: function($scope) {
|
||||||
@ -656,66 +661,25 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
|
|
||||||
compile: function(element, attr, transclude) {
|
compile: function(element, attr, transclude) {
|
||||||
return function($scope, $element, $attr) {
|
return function($scope, $element, $attr) {
|
||||||
var lv = new ionic.views.ListView({
|
|
||||||
el: $element[0],
|
|
||||||
listEl: $element[0].children[0]
|
|
||||||
});
|
|
||||||
|
|
||||||
if(attr.animation) {
|
|
||||||
$element.addClass(attr.animation);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
||||||
.directive('virtualList', function() {
|
|
||||||
return {
|
|
||||||
restrict: 'E',
|
|
||||||
replace: true,
|
|
||||||
transclude: true,
|
|
||||||
|
|
||||||
scope: {
|
|
||||||
isEditing: '=',
|
|
||||||
deleteIcon: '@',
|
|
||||||
reorderIcon: '@',
|
|
||||||
itemHeight: '@'
|
|
||||||
},
|
|
||||||
|
|
||||||
controller: function($scope, $element) {
|
|
||||||
var _this = this;
|
|
||||||
|
|
||||||
this.scope = $scope;
|
|
||||||
|
|
||||||
this.element = $element;
|
|
||||||
|
|
||||||
var lv = new ionic.views.ListView({
|
var lv = new ionic.views.ListView({
|
||||||
el: $element[0],
|
el: $element[0],
|
||||||
listEl: $element[0].children[0],
|
listEl: $element[0].children[0],
|
||||||
isVirtual: true,
|
hasPullToRefresh: (typeof $scope.onRefresh !== 'undefined'),
|
||||||
itemHeight: $scope.itemHeight,
|
onRefresh: function() {
|
||||||
});
|
$scope.onRefresh();
|
||||||
|
|
||||||
this.listView = lv;
|
|
||||||
|
|
||||||
|
|
||||||
$scope.$watch('isEditing', function(v) {
|
|
||||||
_this.isEditing = true;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
onRefreshOpening: function(amt) {
|
||||||
|
$scope.onRefreshOpening({amount: amt});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
template: '<div class="scroll"><ul class="list" ng-class="{\'list-editing\': isEditing}" ng-transclude>\
|
|
||||||
</ul></div>',
|
|
||||||
|
|
||||||
compile: function(element, attr, transclude) {
|
|
||||||
return function($scope, $element, $attr) {
|
|
||||||
if(attr.animation) {
|
if(attr.animation) {
|
||||||
$element.addClass(attr.animation);
|
$element.addClass(attr.animation);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
;
|
;
|
||||||
|
|||||||
7
js/ext/angular/src/directive/ionicContent.js
vendored
7
js/ext/angular/src/directive/ionicContent.js
vendored
@ -22,7 +22,8 @@ angular.module('ionic.ui.content', [])
|
|||||||
transclude: true,
|
transclude: true,
|
||||||
scope: {
|
scope: {
|
||||||
onRefresh: '&',
|
onRefresh: '&',
|
||||||
onRefreshOpening: '&'
|
onRefreshOpening: '&',
|
||||||
|
scroll: '@'
|
||||||
},
|
},
|
||||||
compile: function(element, attr, transclude) {
|
compile: function(element, attr, transclude) {
|
||||||
return function($scope, $element, $attr) {
|
return function($scope, $element, $attr) {
|
||||||
@ -43,7 +44,9 @@ angular.module('ionic.ui.content', [])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If they want plain overflows scrolling, add that as a class
|
// If they want plain overflows scrolling, add that as a class
|
||||||
if(attr.overflowScroll === "true") {
|
if($scope.scroll === "false") {
|
||||||
|
// Do nothing for now
|
||||||
|
} else if(attr.overflowScroll === "true") {
|
||||||
c.addClass('overflow-scroll');
|
c.addClass('overflow-scroll');
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, supercharge this baby!
|
// Otherwise, supercharge this baby!
|
||||||
|
|||||||
61
js/ext/angular/src/directive/ionicList.js
vendored
61
js/ext/angular/src/directive/ionicList.js
vendored
@ -89,7 +89,9 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
scope: {
|
scope: {
|
||||||
isEditing: '=',
|
isEditing: '=',
|
||||||
deleteIcon: '@',
|
deleteIcon: '@',
|
||||||
reorderIcon: '@'
|
reorderIcon: '@',
|
||||||
|
onRefresh: '&',
|
||||||
|
onRefreshOpening: '&'
|
||||||
},
|
},
|
||||||
|
|
||||||
controller: function($scope) {
|
controller: function($scope) {
|
||||||
@ -107,65 +109,24 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
|||||||
|
|
||||||
compile: function(element, attr, transclude) {
|
compile: function(element, attr, transclude) {
|
||||||
return function($scope, $element, $attr) {
|
return function($scope, $element, $attr) {
|
||||||
var lv = new ionic.views.ListView({
|
|
||||||
el: $element[0],
|
|
||||||
listEl: $element[0].children[0]
|
|
||||||
});
|
|
||||||
|
|
||||||
if(attr.animation) {
|
|
||||||
$element.addClass(attr.animation);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
||||||
.directive('virtualList', function() {
|
|
||||||
return {
|
|
||||||
restrict: 'E',
|
|
||||||
replace: true,
|
|
||||||
transclude: true,
|
|
||||||
|
|
||||||
scope: {
|
|
||||||
isEditing: '=',
|
|
||||||
deleteIcon: '@',
|
|
||||||
reorderIcon: '@',
|
|
||||||
itemHeight: '@'
|
|
||||||
},
|
|
||||||
|
|
||||||
controller: function($scope, $element) {
|
|
||||||
var _this = this;
|
|
||||||
|
|
||||||
this.scope = $scope;
|
|
||||||
|
|
||||||
this.element = $element;
|
|
||||||
|
|
||||||
var lv = new ionic.views.ListView({
|
var lv = new ionic.views.ListView({
|
||||||
el: $element[0],
|
el: $element[0],
|
||||||
listEl: $element[0].children[0],
|
listEl: $element[0].children[0],
|
||||||
isVirtual: true,
|
hasPullToRefresh: (typeof $scope.onRefresh !== 'undefined'),
|
||||||
itemHeight: $scope.itemHeight,
|
onRefresh: function() {
|
||||||
});
|
$scope.onRefresh();
|
||||||
|
|
||||||
this.listView = lv;
|
|
||||||
|
|
||||||
|
|
||||||
$scope.$watch('isEditing', function(v) {
|
|
||||||
_this.isEditing = true;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
onRefreshOpening: function(amt) {
|
||||||
|
$scope.onRefreshOpening({amount: amt});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
template: '<div class="scroll"><ul class="list" ng-class="{\'list-editing\': isEditing}" ng-transclude>\
|
|
||||||
</ul></div>',
|
|
||||||
|
|
||||||
compile: function(element, attr, transclude) {
|
|
||||||
return function($scope, $element, $attr) {
|
|
||||||
if(attr.animation) {
|
if(attr.animation) {
|
||||||
$element.addClass(attr.animation);
|
$element.addClass(attr.animation);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@ -48,7 +48,11 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body ng-controller="RootCtrl">
|
<body ng-controller="RootCtrl">
|
||||||
<tabs animation="fade-in-out" tabs-type="tabs-icon-only" tabs-style="tabs-primary" controller-changed="onControllerChanged(oldController, oldIndex, newController, newIndex)">
|
<tabs
|
||||||
|
animation="fade-in-out"
|
||||||
|
tabs-type="tabs-icon-only"
|
||||||
|
tabs-style="tabs-primary"
|
||||||
|
controller-changed="onControllerChanged(oldController, oldIndex, newController, newIndex)">
|
||||||
|
|
||||||
<tab title="Home" icon-on="icon ion-ios7-filing" icon-off="icon ion-ios7-filing-outline" ng-controller="HomeCtrl">
|
<tab title="Home" icon-on="icon ion-ios7-filing" icon-off="icon ion-ios7-filing-outline" ng-controller="HomeCtrl">
|
||||||
<header class="bar bar-header bar-secondary">
|
<header class="bar bar-header bar-secondary">
|
||||||
@ -56,8 +60,14 @@
|
|||||||
<h1 class="title">Tasks</h1>
|
<h1 class="title">Tasks</h1>
|
||||||
<button class="button button-clear button-primary" ng-click="isEditingItems = !isEditingItems">Edit</button>
|
<button class="button button-clear button-primary" ng-click="isEditingItems = !isEditingItems">Edit</button>
|
||||||
</header>
|
</header>
|
||||||
<content has-header="true" has-tabs="true">
|
<content has-header="true" has-tabs="true" scroll="false">
|
||||||
<list is-editing="isEditingItems" animation="fade-out" delete-icon="icon ion-minus-circled" reorder-icon="icon ion-navicon">
|
<list on-refresh="onRefresh()" is-editing="isEditingItems" animation="fade-out" delete-icon="icon ion-minus-circled" reorder-icon="icon ion-navicon">
|
||||||
|
<refresher>
|
||||||
|
<div id="refresh-content">
|
||||||
|
Refreshing
|
||||||
|
<i class="icon ion-ios7-reloading"></i>
|
||||||
|
</div>
|
||||||
|
</refresher>
|
||||||
<list-item ng-repeat="item in items"
|
<list-item ng-repeat="item in items"
|
||||||
item="item"
|
item="item"
|
||||||
buttons="item.buttons"
|
buttons="item.buttons"
|
||||||
@ -145,6 +155,9 @@
|
|||||||
item.isCompleted = true;
|
item.isCompleted = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.onRefresh = function() {
|
||||||
|
console.log('ON REFRESH');
|
||||||
|
}
|
||||||
|
|
||||||
$scope.removeItem = function(item) {
|
$scope.removeItem = function(item) {
|
||||||
removeItem(item);
|
removeItem(item);
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
.list {
|
.list {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
padding-top: $item-border-width;
|
padding-top: $item-border-width;
|
||||||
padding-bottom: $item-border-width;
|
padding-bottom: $item-border-width;
|
||||||
|
|||||||
Reference in New Issue
Block a user