From 312b6f2478d4dbc2b2e9bd6c148844679c5c4833 Mon Sep 17 00:00:00 2001 From: Kyle Kemp Date: Thu, 22 Aug 2024 09:01:37 -0500 Subject: [PATCH] closes #70 --- .../cell-buttons/cell-buttons.component.html | 7 ++++--- .../cell-buttons/cell-buttons.component.ts | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/app/shared/components/cell-buttons/cell-buttons.component.html b/src/app/shared/components/cell-buttons/cell-buttons.component.html index 3ba8bf4..9306396 100644 --- a/src/app/shared/components/cell-buttons/cell-buttons.component.html +++ b/src/app/shared/components/cell-buttons/cell-buttons.component.html @@ -19,12 +19,13 @@ } @if(params.showDeleteButton) { - - + } \ No newline at end of file diff --git a/src/app/shared/components/cell-buttons/cell-buttons.component.ts b/src/app/shared/components/cell-buttons/cell-buttons.component.ts index 5fda75f..6c21093 100644 --- a/src/app/shared/components/cell-buttons/cell-buttons.component.ts +++ b/src/app/shared/components/cell-buttons/cell-buttons.component.ts @@ -1,4 +1,5 @@ -import { Component } from '@angular/core'; +import { Component, viewChild } from '@angular/core'; +import { SwalComponent } from '@sweetalert2/ngx-sweetalert2'; import { ICellRendererAngularComp } from 'ag-grid-angular'; import { ICellRendererParams } from 'ag-grid-community'; @@ -10,6 +11,8 @@ import { ICellRendererParams } from 'ag-grid-community'; export class CellButtonsComponent implements ICellRendererAngularComp { public params!: any; + public deleteWarnSwal = viewChild('deleteItem'); + agInit(params: ICellRendererParams) { this.params = params; } @@ -18,4 +21,14 @@ export class CellButtonsComponent implements ICellRendererAngularComp { this.params = params; return true; } + + async attemptDelete($event: any) { + const holdingShift = $event.shiftKey; + if (!holdingShift) { + await this.deleteWarnSwal()?.fire(); + return; + } + + this.params.deleteCallback?.(this.params.data); + } }