From 64a78a7692942563e3c9e03c7e9c6b121e205b0e Mon Sep 17 00:00:00 2001 From: Sparkomatic Date: Tue, 6 Jun 2017 09:45:51 +0100 Subject: [PATCH 1/7] using correct version number of swing --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 82d0f19..26b45f0 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ }, "homepage": "https://github.com/ksachdeva/angular2-swing#readme", "dependencies": { - "swing": "^4.3.0" + "swing": "^3.1.0" }, "devDependencies": { "@angular/common": "^4.0.0", From 0451f4edae835c3f749f2f8404255d6cd31cfdeb Mon Sep 17 00:00:00 2001 From: Sparkomatic Date: Tue, 6 Jun 2017 09:48:26 +0100 Subject: [PATCH 2/7] updating interface to include destroyCard function --- src/swing.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/swing.ts b/src/swing.ts index 061a7a2..fbc9c20 100644 --- a/src/swing.ts +++ b/src/swing.ts @@ -93,6 +93,12 @@ export interface Stack { */ getCard(element: HTMLElement): Card; + /** + * + *@param {Card} card + */ + destroyCard(card: Card): void; + on(eventName: ThrowEventName, callabck: (event: ThrowEvent) => void): void; on(eventName: DragEventName, callabck: (event: DragEvent) => void): void; } From 891eb26dbc6f6b3c01e0ae61a42280b19b2a7caa Mon Sep 17 00:00:00 2001 From: Sparkomatic Date: Tue, 6 Jun 2017 09:49:27 +0100 Subject: [PATCH 3/7] adding destoryCard function to swing-card-component --- src/swing-card-component.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/swing-card-component.ts b/src/swing-card-component.ts index c247d29..a9cb535 100644 --- a/src/swing-card-component.ts +++ b/src/swing-card-component.ts @@ -31,4 +31,10 @@ export class SwingCardComponent { getCard(): Card { return this.swingStack.stack.getCard(this.getNativeElement()); } + + destroyCard() { + this.swingStack.cards.pop(); + var card = this.swingStack.stack.getCard(this.getNativeElement()); + this.swingStack.stack.destroyCard(card); + } } From f3be87b22ef0388a9efcf939cd266e9943dec1d7 Mon Sep 17 00:00:00 2001 From: Sparkomatic Date: Tue, 6 Jun 2017 09:52:54 +0100 Subject: [PATCH 4/7] styling change --- src/swing.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/swing.ts b/src/swing.ts index fbc9c20..e0514ff 100644 --- a/src/swing.ts +++ b/src/swing.ts @@ -93,12 +93,12 @@ export interface Stack { */ getCard(element: HTMLElement): Card; - /** - * - *@param {Card} card - */ - destroyCard(card: Card): void; - + /** + * + *@param {Card} card + */ + destroyCard(card: Card): void; + on(eventName: ThrowEventName, callabck: (event: ThrowEvent) => void): void; on(eventName: DragEventName, callabck: (event: DragEvent) => void): void; } From 0c4207f031326eb9910dc447cd27a2bb8b9111ce Mon Sep 17 00:00:00 2001 From: Sparkomatic Date: Sat, 24 Jun 2017 14:01:24 +0100 Subject: [PATCH 5/7] cardComponent being deleted from this.swingStack.cards is now this of swing-card-component rather than assuming it will always be the cardComponent at the end of the array --- src/swing-card-component.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/swing-card-component.ts b/src/swing-card-component.ts index a9cb535..f00e392 100644 --- a/src/swing-card-component.ts +++ b/src/swing-card-component.ts @@ -11,6 +11,8 @@ import {Card} from './swing'; export class SwingCardComponent { @Input() prepend: boolean = false; + card: Card; + constructor( private elmentRef: ElementRef, private swingStack: SwingStackComponent) { @@ -33,8 +35,8 @@ export class SwingCardComponent { } destroyCard() { - this.swingStack.cards.pop(); - var card = this.swingStack.stack.getCard(this.getNativeElement()); - this.swingStack.stack.destroyCard(card); - } + this.swingStack.cards = this.swingStack.cards.filter(swingCardComponent => swingCardComponent !== this); + let card = this.swingStack.stack.getCard(this.getNativeElement()); + this.swingStack.stack.destroyCard(card); + } } From d8aaa36faf762e6e479f0861ac7a1776e0a98be0 Mon Sep 17 00:00:00 2001 From: Sparkomatic Date: Tue, 27 Jun 2017 19:30:33 +0100 Subject: [PATCH 6/7] changing swing npm version back to 4.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 26b45f0..82d0f19 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ }, "homepage": "https://github.com/ksachdeva/angular2-swing#readme", "dependencies": { - "swing": "^3.1.0" + "swing": "^4.3.0" }, "devDependencies": { "@angular/common": "^4.0.0", From 6ea4957ac71449aa1f091bfb442ba69146013f80 Mon Sep 17 00:00:00 2001 From: Sparkomatic Date: Sun, 2 Jul 2017 09:53:36 +0100 Subject: [PATCH 7/7] updating swing to curent version in npm --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 82d0f19..5251771 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ }, "homepage": "https://github.com/ksachdeva/angular2-swing#readme", "dependencies": { - "swing": "^4.3.0" + "swing": "^3.1.1" }, "devDependencies": { "@angular/common": "^4.0.0",