|
|
@ -1,3 +1,4 @@ |
|
|
|
|
|
import { Clipboard } from '@angular/cdk/clipboard'; |
|
|
import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; |
|
|
import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
import { MatDialogModule, MatDialogRef } from '@angular/material/dialog'; |
|
|
import { MatDialogModule, MatDialogRef } from '@angular/material/dialog'; |
|
|
@ -12,6 +13,7 @@ import { AlertDialogParams } from './interfaces/interfaces'; |
|
|
templateUrl: './alert-dialog.html' |
|
|
templateUrl: './alert-dialog.html' |
|
|
}) |
|
|
}) |
|
|
export class GfAlertDialogComponent { |
|
|
export class GfAlertDialogComponent { |
|
|
|
|
|
public copyValue?: string; |
|
|
public discardLabel: string; |
|
|
public discardLabel: string; |
|
|
public message?: string; |
|
|
public message?: string; |
|
|
public title: string; |
|
|
public title: string; |
|
|
@ -19,9 +21,25 @@ export class GfAlertDialogComponent { |
|
|
protected readonly dialogRef = |
|
|
protected readonly dialogRef = |
|
|
inject<MatDialogRef<GfAlertDialogComponent>>(MatDialogRef); |
|
|
inject<MatDialogRef<GfAlertDialogComponent>>(MatDialogRef); |
|
|
|
|
|
|
|
|
public initialize({ discardLabel, message, title }: AlertDialogParams) { |
|
|
private readonly clipboard = inject(Clipboard); |
|
|
|
|
|
|
|
|
|
|
|
public initialize({ |
|
|
|
|
|
copyValue, |
|
|
|
|
|
discardLabel, |
|
|
|
|
|
message, |
|
|
|
|
|
title |
|
|
|
|
|
}: AlertDialogParams) { |
|
|
|
|
|
this.copyValue = copyValue; |
|
|
this.discardLabel = discardLabel; |
|
|
this.discardLabel = discardLabel; |
|
|
this.message = message; |
|
|
this.message = message; |
|
|
this.title = title; |
|
|
this.title = title; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public onCopyToClipboard() { |
|
|
|
|
|
if (this.copyValue) { |
|
|
|
|
|
this.clipboard.copy(this.copyValue); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.dialogRef.close('copy'); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|