mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
removed link-item and onSelect
This commit is contained in:
5
dist/css/ionic.css
vendored
5
dist/css/ionic.css
vendored
@@ -3857,6 +3857,11 @@ button.item.item-complex {
|
||||
border: none;
|
||||
background-color: white; }
|
||||
|
||||
a.item-content {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: inherit; }
|
||||
|
||||
.item-text-wrap,
|
||||
.item-text-wrap h1,
|
||||
.item-text-wrap h2,
|
||||
|
||||
108
dist/js/ionic-angular.js
vendored
108
dist/js/ionic-angular.js
vendored
@@ -814,18 +814,17 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
||||
canDelete: '@',
|
||||
canReorder: '@',
|
||||
canSwipe: '@',
|
||||
onSelect: '&',
|
||||
onDelete: '&',
|
||||
optionButtons: '&',
|
||||
deleteIcon: '@',
|
||||
reorderIcon: '@'
|
||||
},
|
||||
|
||||
template: '<div class="item item-complex" ng-class="itemClass" ng-click="selectClick()">\
|
||||
template: '<div class="item item-complex" ng-class="itemClass">\
|
||||
<div class="item-edit" ng-if="deleteClick !== undefined">\
|
||||
<button class="button button-icon icon" ng-class="deleteIconClass" ng-click="deleteClick()"></button>\
|
||||
</div>\
|
||||
<div class="item-content" ng-transclude></div>\
|
||||
<a class="item-content" ng-href="{{ href }}" ng-transclude></a>\
|
||||
<div class="item-drag" ng-if="reorderIconClass !== undefined">\
|
||||
<button data-ionic-action="reorder" class="button button-icon icon" ng-class="reorderIconClass"></button>\
|
||||
</div>\
|
||||
@@ -840,104 +839,6 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
||||
var $parentScope = list.scope;
|
||||
var $parentAttrs = list.attrs;
|
||||
|
||||
// Set this item's class, first from the item directive attr, and then the list attr if item not set
|
||||
$scope.itemClass = $scope.itemType || $parentScope.itemType;
|
||||
|
||||
// Decide if this item can do stuff, and follow a certain priority
|
||||
// depending on where the value comes from
|
||||
if(($attr.canDelete ? $scope.canDelete : $parentScope.canDelete) !== "false") {
|
||||
if($attr.onDelete || $parentAttrs.onDelete) {
|
||||
|
||||
// only assign this method when we need to
|
||||
// and use its existence to decide if the delete should show or not
|
||||
$scope.deleteClick = function() {
|
||||
if($attr.onDelete) {
|
||||
// this item has an on-delete attribute
|
||||
$scope.onDelete($scope.item);
|
||||
} else if($parentAttrs.onDelete) {
|
||||
// run the parent list's onDelete method
|
||||
// if it doesn't exist nothing will happen
|
||||
$parentScope.onDelete($scope.item);
|
||||
}
|
||||
};
|
||||
|
||||
// Set which icons to use for deleting
|
||||
$scope.deleteIconClass = $scope.deleteIcon || $parentScope.deleteIcon || 'ion-minus-circled';
|
||||
}
|
||||
}
|
||||
|
||||
if($attr.onSelect || $parentAttrs.onSelect) {
|
||||
// only assign this method when we need to
|
||||
$scope.selectClick = function() {
|
||||
if($attr.onSelect) {
|
||||
// this item has an on-delete attribute
|
||||
$scope.onSelect($scope.item);
|
||||
} else if($parentAttrs.onSelect) {
|
||||
// run the parent list's onDelete method
|
||||
// if it doesn't exist nothing will happen
|
||||
$parentScope.onSelect($scope.item);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// set the reorder Icon Class only if the item or list set can-reorder="true"
|
||||
if(($attr.canReorder ? $scope.canReorder : $parentScope.canReorder) === "true") {
|
||||
$scope.reorderIconClass = $scope.reorderIcon || $parentScope.reorderIcon || 'ion-navicon';
|
||||
}
|
||||
|
||||
// Set the option buttons which can be revealed by swiping to the left
|
||||
// if canSwipe was set to false don't even bother
|
||||
if(($attr.canSwipe ? $scope.canSwipe : $parentScope.canSwipe) !== "false") {
|
||||
$scope.itemOptionButtons = $scope.optionButtons();
|
||||
if(typeof $scope.itemOptionButtons === "undefined") {
|
||||
$scope.itemOptionButtons = $parentScope.optionButtons();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
.directive('linkItem', [function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
require: '?^list',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
|
||||
scope: {
|
||||
item: '=',
|
||||
itemType: '@',
|
||||
canDelete: '@',
|
||||
canReorder: '@',
|
||||
canSwipe: '@',
|
||||
onSelect: '&',
|
||||
onDelete: '&',
|
||||
optionButtons: '&',
|
||||
deleteIcon: '@',
|
||||
reorderIcon: '@',
|
||||
href: '@'
|
||||
},
|
||||
|
||||
template: '<a class="item item-complex" ng-class="itemClass" ng-href="{{ href }}" ng-click="onSelect()">\
|
||||
<div class="item-edit" ng-if="deleteClick !== undefined">\
|
||||
<button class="button button-icon icon" ng-class="deleteIconClass" ng-click="deleteClick()"></button>\
|
||||
</div>\
|
||||
<div class="item-content" ng-transclude></div>\
|
||||
<div class="item-drag" ng-if="reorderIconClass !== undefined">\
|
||||
<button data-ionic-action="reorder" class="button button-icon icon" ng-class="reorderIconClass"></button>\
|
||||
</div>\
|
||||
<div class="item-options" ng-if="itemOptionButtons">\
|
||||
<button ng-click="b.onClick(item, b)" class="button" ng-class="b.type" ng-repeat="b in itemOptionButtons" ng-bind="b.text"></button>\
|
||||
</div>\
|
||||
</a>',
|
||||
|
||||
link: function($scope, $element, $attr, list) {
|
||||
if(!list) return;
|
||||
|
||||
var $parentScope = list.scope;
|
||||
var $parentAttrs = list.attrs;
|
||||
|
||||
$attr.$observe('href', function(value) {
|
||||
if(value) $scope.href = value.trim();
|
||||
});
|
||||
@@ -955,11 +856,11 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
||||
$scope.deleteClick = function() {
|
||||
if($attr.onDelete) {
|
||||
// this item has an on-delete attribute
|
||||
$scope.onDelete($scope.item);
|
||||
$scope.onDelete({ item: $scope.item });
|
||||
} else if($parentAttrs.onDelete) {
|
||||
// run the parent list's onDelete method
|
||||
// if it doesn't exist nothing will happen
|
||||
$parentScope.onDelete($scope.item);
|
||||
$parentScope.onDelete({ item: $scope.item });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1003,7 +904,6 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
||||
onRefresh: '&',
|
||||
onRefreshOpening: '&',
|
||||
refreshComplete: '=',
|
||||
onSelect: '&',
|
||||
onDelete: '&',
|
||||
onReorder: '&',
|
||||
optionButtons: '&',
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<content has-header="true">
|
||||
|
||||
<list>
|
||||
<link-item ng-repeat="movie in movies" href="#/movie/{{movie.id}}" type="item-link">
|
||||
<item ng-repeat="movie in movies" href="#/movie/{{movie.id}}" type="item-link">
|
||||
{{ movie.title }}
|
||||
</item>
|
||||
</list>
|
||||
|
||||
108
js/ext/angular/src/directive/ionicList.js
vendored
108
js/ext/angular/src/directive/ionicList.js
vendored
@@ -16,18 +16,17 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
||||
canDelete: '@',
|
||||
canReorder: '@',
|
||||
canSwipe: '@',
|
||||
onSelect: '&',
|
||||
onDelete: '&',
|
||||
optionButtons: '&',
|
||||
deleteIcon: '@',
|
||||
reorderIcon: '@'
|
||||
},
|
||||
|
||||
template: '<div class="item item-complex" ng-class="itemClass" ng-click="selectClick()">\
|
||||
template: '<div class="item item-complex" ng-class="itemClass">\
|
||||
<div class="item-edit" ng-if="deleteClick !== undefined">\
|
||||
<button class="button button-icon icon" ng-class="deleteIconClass" ng-click="deleteClick()"></button>\
|
||||
</div>\
|
||||
<div class="item-content" ng-transclude></div>\
|
||||
<a class="item-content" ng-href="{{ href }}" ng-transclude></a>\
|
||||
<div class="item-drag" ng-if="reorderIconClass !== undefined">\
|
||||
<button data-ionic-action="reorder" class="button button-icon icon" ng-class="reorderIconClass"></button>\
|
||||
</div>\
|
||||
@@ -42,104 +41,6 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
||||
var $parentScope = list.scope;
|
||||
var $parentAttrs = list.attrs;
|
||||
|
||||
// Set this item's class, first from the item directive attr, and then the list attr if item not set
|
||||
$scope.itemClass = $scope.itemType || $parentScope.itemType;
|
||||
|
||||
// Decide if this item can do stuff, and follow a certain priority
|
||||
// depending on where the value comes from
|
||||
if(($attr.canDelete ? $scope.canDelete : $parentScope.canDelete) !== "false") {
|
||||
if($attr.onDelete || $parentAttrs.onDelete) {
|
||||
|
||||
// only assign this method when we need to
|
||||
// and use its existence to decide if the delete should show or not
|
||||
$scope.deleteClick = function() {
|
||||
if($attr.onDelete) {
|
||||
// this item has an on-delete attribute
|
||||
$scope.onDelete($scope.item);
|
||||
} else if($parentAttrs.onDelete) {
|
||||
// run the parent list's onDelete method
|
||||
// if it doesn't exist nothing will happen
|
||||
$parentScope.onDelete($scope.item);
|
||||
}
|
||||
};
|
||||
|
||||
// Set which icons to use for deleting
|
||||
$scope.deleteIconClass = $scope.deleteIcon || $parentScope.deleteIcon || 'ion-minus-circled';
|
||||
}
|
||||
}
|
||||
|
||||
if($attr.onSelect || $parentAttrs.onSelect) {
|
||||
// only assign this method when we need to
|
||||
$scope.selectClick = function() {
|
||||
if($attr.onSelect) {
|
||||
// this item has an on-delete attribute
|
||||
$scope.onSelect($scope.item);
|
||||
} else if($parentAttrs.onSelect) {
|
||||
// run the parent list's onDelete method
|
||||
// if it doesn't exist nothing will happen
|
||||
$parentScope.onSelect($scope.item);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// set the reorder Icon Class only if the item or list set can-reorder="true"
|
||||
if(($attr.canReorder ? $scope.canReorder : $parentScope.canReorder) === "true") {
|
||||
$scope.reorderIconClass = $scope.reorderIcon || $parentScope.reorderIcon || 'ion-navicon';
|
||||
}
|
||||
|
||||
// Set the option buttons which can be revealed by swiping to the left
|
||||
// if canSwipe was set to false don't even bother
|
||||
if(($attr.canSwipe ? $scope.canSwipe : $parentScope.canSwipe) !== "false") {
|
||||
$scope.itemOptionButtons = $scope.optionButtons();
|
||||
if(typeof $scope.itemOptionButtons === "undefined") {
|
||||
$scope.itemOptionButtons = $parentScope.optionButtons();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
.directive('linkItem', [function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
require: '?^list',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
|
||||
scope: {
|
||||
item: '=',
|
||||
itemType: '@',
|
||||
canDelete: '@',
|
||||
canReorder: '@',
|
||||
canSwipe: '@',
|
||||
onSelect: '&',
|
||||
onDelete: '&',
|
||||
optionButtons: '&',
|
||||
deleteIcon: '@',
|
||||
reorderIcon: '@',
|
||||
href: '@'
|
||||
},
|
||||
|
||||
template: '<a class="item item-complex" ng-class="itemClass" ng-href="{{ href }}" ng-click="onSelect()">\
|
||||
<div class="item-edit" ng-if="deleteClick !== undefined">\
|
||||
<button class="button button-icon icon" ng-class="deleteIconClass" ng-click="deleteClick()"></button>\
|
||||
</div>\
|
||||
<div class="item-content" ng-transclude></div>\
|
||||
<div class="item-drag" ng-if="reorderIconClass !== undefined">\
|
||||
<button data-ionic-action="reorder" class="button button-icon icon" ng-class="reorderIconClass"></button>\
|
||||
</div>\
|
||||
<div class="item-options" ng-if="itemOptionButtons">\
|
||||
<button ng-click="b.onClick(item, b)" class="button" ng-class="b.type" ng-repeat="b in itemOptionButtons" ng-bind="b.text"></button>\
|
||||
</div>\
|
||||
</a>',
|
||||
|
||||
link: function($scope, $element, $attr, list) {
|
||||
if(!list) return;
|
||||
|
||||
var $parentScope = list.scope;
|
||||
var $parentAttrs = list.attrs;
|
||||
|
||||
$attr.$observe('href', function(value) {
|
||||
if(value) $scope.href = value.trim();
|
||||
});
|
||||
@@ -157,11 +58,11 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
||||
$scope.deleteClick = function() {
|
||||
if($attr.onDelete) {
|
||||
// this item has an on-delete attribute
|
||||
$scope.onDelete($scope.item);
|
||||
$scope.onDelete({ item: $scope.item });
|
||||
} else if($parentAttrs.onDelete) {
|
||||
// run the parent list's onDelete method
|
||||
// if it doesn't exist nothing will happen
|
||||
$parentScope.onDelete($scope.item);
|
||||
$parentScope.onDelete({ item: $scope.item });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -205,7 +106,6 @@ angular.module('ionic.ui.list', ['ngAnimate'])
|
||||
onRefresh: '&',
|
||||
onRefreshOpening: '&',
|
||||
refreshComplete: '=',
|
||||
onSelect: '&',
|
||||
onDelete: '&',
|
||||
onReorder: '&',
|
||||
optionButtons: '&',
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
on-refresh-opening="refreshOpening(ratio)"
|
||||
on-refresh="refreshItems()"
|
||||
refresh-complete="refreshComplete"
|
||||
on-delete="deleteListItem()"
|
||||
on-delete="deleteListItem(item)"
|
||||
delete-icon="ion-minus-circled"
|
||||
reorder-icon="ion-navicon"
|
||||
animation="my-repeat-animation"
|
||||
@@ -98,7 +98,7 @@
|
||||
</item>
|
||||
|
||||
<!-- shows that the item directive can receive many attributes and overrides the list attributes -->
|
||||
<item on-delete="deleteItem()"
|
||||
<item on-delete="deleteItem(item)"
|
||||
delete-icon="ion-trash-a"
|
||||
reorder-icon="ion-navicon-round"
|
||||
can-delete="true"
|
||||
|
||||
@@ -189,6 +189,12 @@ button.item.item-complex {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
a.item-content {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.item-text-wrap,
|
||||
.item-text-wrap h1,
|
||||
.item-text-wrap h2,
|
||||
|
||||
Reference in New Issue
Block a user