/
dialog.component.ts
61 lines (50 loc) · 1.67 KB
/
dialog.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { Component, Inject, OnInit, ViewChild } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { FilteredResources } from '@dasch-swiss/dsp-ui';
import { PropertyInfoObject } from 'src/app/project/ontology/default-data/default-properties';
export interface DialogData {
mode: string; // switch mode
id: string | number; // main iri or status code
project?: string; // project code
title?: string;
subtitle?: string;
comment?: string;
name?: string;
existing?: string[];
propInfo?: PropertyInfoObject;
canBeUpdated?: boolean;
position?: number;
parentIri?: string;
projectCode?: string;
selectedResources?: FilteredResources;
}
export interface ConfirmationWithComment {
confirmed: boolean;
comment?: string;
}
@Component({
selector: 'app-material-dialog',
templateUrl: './dialog.component.html',
styleUrls: ['./dialog.component.scss']
})
export class DialogComponent implements OnInit {
notYetImplemented = `The component <strong>${this.data.mode}</strong> is not implemented yet.`;
comment?: string;
constructor(
public dialogRef: MatDialogRef<DialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: DialogData
) { }
ngOnInit() { }
closeDialog(data: any): void {
this.dialogRef.close();
}
replaceTitle(heading: { title: string; subtitle?: string }) {
this.data.title = heading.title;
if (heading.subtitle) {
this.data.subtitle = heading.subtitle;
}
}
onKey(event: KeyboardEvent) {
this.comment = (event.target as HTMLInputElement).value;
}
}