Skip to content

Commit 1c1797c

Browse files
committed
chore: update modal function signature
1 parent da67352 commit 1c1797c

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

libs/flowbite-angular/modal/modal.component.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -177,51 +177,51 @@ export class ModalComponent extends BaseComponent<ModalClass> {
177177
}
178178
//#endregion
179179

180-
open() {
180+
public open(): void {
181181
this.isOpen.set(true);
182182
this.changeBackdrop();
183183
}
184184

185-
close() {
185+
public close(): void {
186186
this.isOpen.set(false);
187187
this.changeBackdrop();
188188
}
189189

190-
toggle() {
190+
public toggle(): void {
191191
this.isOpen.set(!this.isOpen());
192192
this.changeBackdrop();
193193
}
194194

195195
// If isOpen changes, add or remove template
196-
changeBackdrop() {
196+
public changeBackdrop(): void {
197197
if (this.isOpen()) {
198198
this.createTemplate();
199199
} else {
200200
this.destroyTemplate();
201201
}
202202
}
203203

204-
private createTemplate() {
205-
if (this.embeddedView) {
206-
this.destroyTemplate();
207-
}
208-
209-
this.embeddedView = this.viewContainer.createEmbeddedView(this.template());
210-
}
211-
212-
private destroyTemplate() {
213-
this.embeddedView?.destroy();
214-
}
215-
216-
onKeydownHandler(event: KeyboardEvent) {
204+
protected onKeydownHandler(event: KeyboardEvent): void {
217205
if (event.key === 'Escape') {
218206
this.close();
219207
}
220208
}
221209

222-
onBackdropClick(event: MouseEvent) {
210+
protected onBackdropClick(event: MouseEvent): void {
223211
if (event.target == event.currentTarget && this.isDismissable()) {
224212
this.close();
225213
}
226214
}
215+
216+
private createTemplate(): void {
217+
if (this.embeddedView) {
218+
this.destroyTemplate();
219+
}
220+
221+
this.embeddedView = this.viewContainer.createEmbeddedView(this.template());
222+
}
223+
224+
private destroyTemplate(): void {
225+
this.embeddedView?.destroy();
226+
}
227227
}

0 commit comments

Comments
 (0)