first chrome implementation

This commit is contained in:
DEV Sam Hayes
2025-01-10 19:37:10 +01:00
parent dc7a980dc5
commit a652718bc7
175 changed files with 18526 additions and 610 deletions

View File

@@ -0,0 +1,42 @@
import { AfterViewInit, Component, EventEmitter, Output } from '@angular/core';
import * as bootstrap from 'bootstrap';
@Component({
// eslint-disable-next-line @angular-eslint/component-selector
selector: 'lib-confirm',
imports: [],
templateUrl: './confirm.component.html',
styleUrl: './confirm.component.scss',
})
export class ConfirmComponent implements AfterViewInit {
@Output() yes = new EventEmitter<void>();
@Output() no = new EventEmitter<void>();
message: string | undefined;
onYes: ((() => Promise<void>) | (() => void)) | undefined;
modal: bootstrap.Modal | undefined;
readonly idString = crypto.randomUUID();
ngAfterViewInit(): void {
const myModalEl = document.getElementById(this.idString);
if (!myModalEl) {
return;
}
this.modal = new bootstrap.Modal(myModalEl);
}
onClickYes() {
this.modal?.hide();
if (typeof this.onYes !== 'undefined') {
this.onYes();
}
}
show(message: string, onYes: (() => Promise<void>) | (() => void)): void {
this.message = message;
this.onYes = onYes;
this.modal?.show();
}
}