diff --git a/dist/css/ionic-ios7.css b/dist/css/ionic-ios7.css index d0ccad656c..d6c46fe274 100644 --- a/dist/css/ionic-ios7.css +++ b/dist/css/ionic-ios7.css @@ -1,4 +1,3 @@ -@charset "UTF-8"; /** * Adapted from normalize.css and some reset.css. We don't care even one * bit about old IE, so we don't need any hacks for that in here. @@ -1094,7 +1093,7 @@ a.list-item { background-color: #fff; z-index: 2; padding: 15px 15px; - -webkit-transition: margin-left 0.2s ease-in-out, left 0.2s ease-in-out; } + -webkit-transition: margin-left 0.2s ease-in-out, margin-right 0.2s ease-in-out, left 0.2s ease-in-out; } .list-item-content > i:last-child { float: right; } .list-item-content > .toggle:last-child, .list-item-content input:last-child, .list-item-content > button:last-child { @@ -1124,6 +1123,20 @@ a.list-item { .list-item-edit i { color: #ef4e3a; font-size: 24px; } + .list-item-edit.ng-enter { + -webkit-transition: left 0.2s ease-in-out, opacity 0.2s ease-in-out; + left: -48px; + opacity: 0; } + .list-item-edit.ng-enter-active { + opacity: 1; + left: 0; } + .list-item-edit.ng-leave { + -webkit-transition: left 0.2s ease-in-out, opacity 0.2s ease-in-out; + left: 0px; + opacity: 1; } + .list-item-edit.ng-leave-active { + opacity: 0; + left: -48px; } .list-item-drag { position: absolute; diff --git a/dist/css/ionic.css b/dist/css/ionic.css index d01aeeea9c..7bee43b4b8 100644 --- a/dist/css/ionic.css +++ b/dist/css/ionic.css @@ -1,4 +1,3 @@ -@charset "UTF-8"; @font-face { font-family: 'ionicons'; src: url("fonts/ionicons.eot"); @@ -2181,7 +2180,7 @@ a.list-item { background-color: #fff; z-index: 2; padding: 15px 15px; - -webkit-transition: margin-left 0.2s ease-in-out, left 0.2s ease-in-out; } + -webkit-transition: margin-left 0.2s ease-in-out, margin-right 0.2s ease-in-out, left 0.2s ease-in-out; } .list-item-content > i:last-child { float: right; } .list-item-content > .toggle:last-child, .list-item-content input:last-child, .list-item-content > button:last-child { @@ -2211,6 +2210,20 @@ a.list-item { .list-item-edit i { color: #ef4e3a; font-size: 24px; } + .list-item-edit.ng-enter { + -webkit-transition: left 0.2s ease-in-out, opacity 0.2s ease-in-out; + left: -48px; + opacity: 0; } + .list-item-edit.ng-enter-active { + opacity: 1; + left: 0; } + .list-item-edit.ng-leave { + -webkit-transition: left 0.2s ease-in-out, opacity 0.2s ease-in-out; + left: 0px; + opacity: 1; } + .list-item-edit.ng-leave-active { + opacity: 0; + left: -48px; } .list-item-drag { position: absolute; diff --git a/dist/js/ionic-angular.js b/dist/js/ionic-angular.js index e6399d9079..582c3ba185 100644 --- a/dist/js/ionic-angular.js +++ b/dist/js/ionic-angular.js @@ -187,31 +187,37 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate']) .directive('listItem', function() { return { restrict: 'E', + require: '^list', replace: true, transclude: true, - template: '
  • ' + - '
    ' + - ' ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - ' ' + - '
    ' + - '
    ' + - ' ' + - '
    ' + - '
  • ', - link: function($scope, $element, $attr) { - // Triggered when a button is clicked - $scope.buttonClicked = function(button) { - button.buttonClicked && button.buttonClicked($scope.item); - } + scope: { + onSelect: '&', + onDelete: '&', + onButtonClicked: '&', + canDelete: '@', + canReorder: '@', + canSwipe: '@', + buttons: '=', + }, + template: '
  • \ +
    \ + \ +
    \ +
    \ +
    \ +
    \ + \ +
    \ +
    \ + \ +
    \ +
  • ', + link: function($scope, $element, $attr, list) { + $scope.deleteIcon = list.scope.deleteIcon; - // Triggered when the delete item is clicked - $scope.deleteClicked = function() { - $scope.item.deleteItem && $scope.item.deleteItem(); - } + list.scope.$watch('isEditing', function(v) { + $scope.isEditing = v; + }); } } }) @@ -221,46 +227,27 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate']) restrict: 'E', replace: true, transclude: true, + scope: { isEditing: '=', - items: '=', - animation: '@', - deleteIcon: '@', - reorderIcon: '@' - }, - template: '', - compile: function(element, attr, transclude) { - return function($scope, $element, $attr) { - var lv = new ionic.views.List({el: $element[0]}); - - if(attr.animation) { - $element.addClass(attr.animation); - } - - $element.append(transclude($scope)); - } - } - } -}) - -.directive('listSimple', function() { - return { - restrict: 'E', - replace: true, - transclude: true, - scope: { - isEditing: '=', - items: '=', - animation: '@', deleteIcon: '@' }, - template: '', + + // So we can require being under this + controller: function($scope) { + var _this = this; + + this.scope = $scope; + + $scope.$watch('isEditing', function(v) { + _this.isEditing = true; + console.log('Is Editing Changed', v); + }); + }, + + template: '', + compile: function(element, attr, transclude) { return function($scope, $element, $attr) { var lv = new ionic.views.List({el: $element[0]}); diff --git a/js/ext/angular/src/directive/ionicList.js b/js/ext/angular/src/directive/ionicList.js index 5349f132d9..825ae14e66 100644 --- a/js/ext/angular/src/directive/ionicList.js +++ b/js/ext/angular/src/directive/ionicList.js @@ -3,31 +3,37 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate']) .directive('listItem', function() { return { restrict: 'E', + require: '^list', replace: true, transclude: true, - template: '
  • ' + - '
    ' + - ' ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - ' ' + - '
    ' + - '
    ' + - ' ' + - '
    ' + - '
  • ', - link: function($scope, $element, $attr) { - // Triggered when a button is clicked - $scope.buttonClicked = function(button) { - button.buttonClicked && button.buttonClicked($scope.item); - } + scope: { + onSelect: '&', + onDelete: '&', + onButtonClicked: '&', + canDelete: '@', + canReorder: '@', + canSwipe: '@', + buttons: '=', + }, + template: '
  • \ +
    \ + \ +
    \ +
    \ +
    \ +
    \ + \ +
    \ +
    \ + \ +
    \ +
  • ', + link: function($scope, $element, $attr, list) { + $scope.deleteIcon = list.scope.deleteIcon; - // Triggered when the delete item is clicked - $scope.deleteClicked = function() { - $scope.item.deleteItem && $scope.item.deleteItem(); - } + list.scope.$watch('isEditing', function(v) { + $scope.isEditing = v; + }); } } }) @@ -37,46 +43,27 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate']) restrict: 'E', replace: true, transclude: true, + scope: { isEditing: '=', - items: '=', - animation: '@', - deleteIcon: '@', - reorderIcon: '@' - }, - template: '', - compile: function(element, attr, transclude) { - return function($scope, $element, $attr) { - var lv = new ionic.views.List({el: $element[0]}); - - if(attr.animation) { - $element.addClass(attr.animation); - } - - $element.append(transclude($scope)); - } - } - } -}) - -.directive('listSimple', function() { - return { - restrict: 'E', - replace: true, - transclude: true, - scope: { - isEditing: '=', - items: '=', - animation: '@', deleteIcon: '@' }, - template: '', + + // So we can require being under this + controller: function($scope) { + var _this = this; + + this.scope = $scope; + + $scope.$watch('isEditing', function(v) { + _this.isEditing = true; + console.log('Is Editing Changed', v); + }); + }, + + template: '', + compile: function(element, attr, transclude) { return function($scope, $element, $attr) { var lv = new ionic.views.List({el: $element[0]}); diff --git a/js/ext/angular/test/list.html b/js/ext/angular/test/list.html index 6c776e6e9c..69dc6e9dbd 100644 --- a/js/ext/angular/test/list.html +++ b/js/ext/angular/test/list.html @@ -5,7 +5,7 @@ - + @@ -49,45 +49,20 @@ - -
  • -
    - -
    -
    - Item 1 - -
    -
    - -
    -
  • -
  • -
    - Item 2 - -
    -
    - -
    -
  • -
  • -
    - Item 3 - -
    -
    - -
    -
  • -
    - + + + {{item.text}} + +
    - - + +