change modals so they close on mouse down outside the box

This commit is contained in:
Olivier Gagnon
2021-09-10 00:53:39 -04:00
parent c4617e4b9a
commit e906a6331f
7 changed files with 182 additions and 104 deletions
+4
View File
@@ -36,6 +36,7 @@ interface ICreateElementLabelOptions {
interface ICreateElementListenerOptions {
changeListener?(this: HTMLElement, ev: Event): any;
clickListener?(this: HTMLElement, ev: MouseEvent): any;
mouseDown?(this: HTMLElement, ev: MouseEvent): any;
inputListener?(this: HTMLElement, ev: Event): any;
onfocus?(this: HTMLElement, ev: FocusEvent): any;
onkeydown?(this: HTMLElement, ev: KeyboardEvent): any;
@@ -158,6 +159,9 @@ function setElementListeners(el: HTMLElement, params: ICreateElementListenerOpti
if (params.clickListener !== undefined) {
el.addEventListener("click", params.clickListener);
}
if (params.mouseDown !== undefined) {
el.addEventListener("mousedown", params.mouseDown);
}
if (params.inputListener !== undefined) {
el.addEventListener("input", params.inputListener);
}