feat: update launch configurations and add outside click handling for date input component
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
parent
bc28d869eb
commit
c0180aab13
7 changed files with 193 additions and 14 deletions
|
|
@ -86,4 +86,42 @@ window.workTrackerPreferences = {
|
|||
}
|
||||
};
|
||||
|
||||
window.workTrackerDateInput = (() => {
|
||||
const listeners = new WeakMap();
|
||||
|
||||
function unregisterOutsideClick(root) {
|
||||
const existingListener = listeners.get(root);
|
||||
if (!existingListener) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.removeEventListener("pointerdown", existingListener, true);
|
||||
listeners.delete(root);
|
||||
}
|
||||
|
||||
function registerOutsideClick(root, dotNetReference) {
|
||||
if (!root || !dotNetReference) {
|
||||
return;
|
||||
}
|
||||
|
||||
unregisterOutsideClick(root);
|
||||
|
||||
const listener = (event) => {
|
||||
if (root.contains(event.target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
dotNetReference.invokeMethodAsync("ClosePopupFromOutsideClickAsync");
|
||||
};
|
||||
|
||||
listeners.set(root, listener);
|
||||
document.addEventListener("pointerdown", listener, true);
|
||||
}
|
||||
|
||||
return {
|
||||
registerOutsideClick,
|
||||
unregisterOutsideClick
|
||||
};
|
||||
})();
|
||||
|
||||
window.workTrackerTheme.init();
|
||||
Loading…
Add table
Add a link
Reference in a new issue