From 06b034052289e35423124cd50774a083d3d3321c Mon Sep 17 00:00:00 2001 From: cyuamber Date: Fri, 2 Aug 2019 11:19:36 +0800 Subject: [PATCH] feat(card):add button click event Change-Id: Ib3937be5aa39402cd90c6d354ef5def133f43f51 Issue-ID: DCAEGEN2-1671 Signed-off-by: cyuamber --- .../src/src/app/shared/modules/card/card.component.html | 6 +++--- .../src/src/app/shared/modules/card/card.component.ts | 14 +++++++++++++- .../admin/src/src/app/views/test/test.component.html | 4 ++-- .../admin/src/src/app/views/test/test.component.ts | 12 ++++++++++++ 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.html b/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.html index 7081054f..7b8d865b 100644 --- a/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.html +++ b/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.html @@ -17,7 +17,7 @@ See the License for the specific language governing permissions and limitations under the License. ============LICENSE_END========================================================= --> -
+
{{ this.title }}
@@ -26,10 +26,10 @@ limitations under the License. diff --git a/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.ts b/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.ts index c5f90d22..9be0b84a 100644 --- a/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.ts +++ b/components/datalake-handler/admin/src/src/app/shared/modules/card/card.component.ts @@ -23,7 +23,7 @@ * @author Ekko Chang * */ -import { Component, OnInit, Input } from "@angular/core"; +import { Component, OnInit, Input, Output, EventEmitter } from "@angular/core"; @Component({ selector: "app-card", @@ -38,7 +38,19 @@ export class CardComponent implements OnInit { @Input() modifiable: boolean; @Input() iconSize: string[] = ["sm", "md", "lg"]; + @Output() cardAction = new EventEmitter(); + @Output() edit = new EventEmitter(); + constructor() {} ngOnInit() {} + + cardClick() { + this.cardAction.emit(); + } + + cardMoreAction(type) { + this.edit.emit(type); + } + } diff --git a/components/datalake-handler/admin/src/src/app/views/test/test.component.html b/components/datalake-handler/admin/src/src/app/views/test/test.component.html index 6f077f60..549fa545 100644 --- a/components/datalake-handler/admin/src/src/app/views/test/test.component.html +++ b/components/datalake-handler/admin/src/src/app/views/test/test.component.html @@ -3,13 +3,13 @@

Module 1 -----> card

+ [modifiable]="this.cardModifiable" (edit)="cardMoreAction($event)">

- +
diff --git a/components/datalake-handler/admin/src/src/app/views/test/test.component.ts b/components/datalake-handler/admin/src/src/app/views/test/test.component.ts index 97866123..d7dbc962 100644 --- a/components/datalake-handler/admin/src/src/app/views/test/test.component.ts +++ b/components/datalake-handler/admin/src/src/app/views/test/test.component.ts @@ -141,4 +141,16 @@ export class TestComponent implements OnInit { modalRef.close(); }); } + + cardMoreAction($event) { + if($event == "edit"){ + this.openModalDemo() + }else { + console.log($event,"$event") + } + } + cardClick(){ + this.openModalDemo(); + } + } -- 2.16.6