From bfdc898945f602a4f272c237dd219bbb4c613c88 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Thu, 23 Jun 2016 21:17:25 +0200 Subject: [PATCH] feat(item): sliding items work with list reorder --- demos/item-sliding/index.ts | 48 +++- demos/item-sliding/main.html | 20 +- src/components/item/item-reorder-gesture.ts | 86 +++---- src/components/item/item-reorder.scss | 5 +- src/components/item/item-reorder.ts | 183 ++++++++++++++- src/components/item/item-sliding-gesture.ts | 48 ++-- src/components/item/item-sliding.scss | 4 +- src/components/item/item-sliding.ts | 237 ++++++++++---------- src/components/item/item.ts | 35 +-- src/components/item/test/reorder/index.ts | 6 +- src/components/item/test/reorder/main.html | 3 +- src/components/list/list.ts | 157 +++---------- src/config/directives.ts | 2 + src/index.ts | 1 + src/util/util.ts | 8 + 15 files changed, 494 insertions(+), 349 deletions(-) diff --git a/demos/item-sliding/index.ts b/demos/item-sliding/index.ts index 2ab466b7872..65c41e1846a 100644 --- a/demos/item-sliding/index.ts +++ b/demos/item-sliding/index.ts @@ -1,17 +1,52 @@ -import { Component } from '@angular/core'; +import { Component, ViewEncapsulation } from '@angular/core'; import { ionicBootstrap, ItemSliding, NavController, Toast } from 'ionic-angular'; @Component({ - templateUrl: 'main.html' + templateUrl: 'main.html', + encapsulation: ViewEncapsulation.None }) class ApiDemoPage { chats: any[]; logins: any[]; + editButton: string = 'Edit'; + editing: boolean = false; constructor(private nav: NavController) { this.chats = [ + { + img: './avatar-cher.png', + name: 'Cher', + message: 'Ugh. As if.', + time: '9:38 pm' + }, { + img: './avatar-dionne.png', + name: 'Dionne', + message: 'Mr. Hall was way harsh.', + time: '8:59 pm' + }, { + img: './avatar-murray.png', + name: 'Murray', + message: 'Excuse me, "Ms. Dione."', + time: 'Wed' + }, + { + img: './avatar-cher.png', + name: 'Cher', + message: 'Ugh. As if.', + time: '9:38 pm' + }, { + img: './avatar-dionne.png', + name: 'Dionne', + message: 'Mr. Hall was way harsh.', + time: '8:59 pm' + }, { + img: './avatar-murray.png', + name: 'Murray', + message: 'Excuse me, "Ms. Dione."', + time: 'Wed' + }, { img: './avatar-cher.png', name: 'Cher', @@ -49,6 +84,15 @@ class ApiDemoPage { }]; } + toggleEdit() { + this.editing = !this.editing; + if (this.editing) { + this.editButton = 'Done'; + } else { + this.editButton = 'Edit'; + } + } + more(item: ItemSliding) { console.log('More'); item.close(); diff --git a/demos/item-sliding/main.html b/demos/item-sliding/main.html index 5dcd34ef35d..f0aa037119b 100644 --- a/demos/item-sliding/main.html +++ b/demos/item-sliding/main.html @@ -2,19 +2,24 @@ Item Sliding + + + - + - + Chats - + + + @@ -41,13 +46,14 @@

{{chat.name}}

- +
+