tera-system-ui 0.0.47 → 0.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,6 +3,10 @@ export function clickOutside(node, data) {
|
|
|
3
3
|
const handleClick = (event) => {
|
|
4
4
|
if (node && !node.contains(event.target) && !event.defaultPrevented
|
|
5
5
|
&& (!(data?.exceptElement) || !data.exceptElement.contains(event.target))) {
|
|
6
|
+
if (data?.preventDefaultFn?.()) {
|
|
7
|
+
event.preventDefault();
|
|
8
|
+
event.stopPropagation();
|
|
9
|
+
}
|
|
6
10
|
node.dispatchEvent(new CustomEvent('click_outside', node));
|
|
7
11
|
}
|
|
8
12
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
mainLayout,
|
|
5
5
|
setSideNavState,
|
|
6
6
|
type SideNavigationProps,
|
|
7
|
-
toggleSideNavigation
|
|
7
|
+
toggleSideNavigation, getSideNavState
|
|
8
8
|
} from "./SideNavigation";
|
|
9
9
|
import {clickOutside} from "../../actions/clickOutside"
|
|
10
10
|
import {Button} from "../button";
|
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
|
|
22
22
|
let {children, sideNavHref, language, ...props}: SideNavigationProps = $props();
|
|
23
23
|
|
|
24
|
-
let temporaryExpand: any = undefined
|
|
25
|
-
|
|
26
24
|
|
|
27
25
|
function handleClickOutside() {
|
|
28
26
|
let screenWidth = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0)
|
|
@@ -36,10 +34,10 @@
|
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
function handleHover(isHover: boolean) {
|
|
39
|
-
temporaryExpand = isHover ? true : undefined
|
|
37
|
+
let temporaryExpand = isHover ? true : undefined
|
|
40
38
|
|
|
41
39
|
if (temporaryExpand) {
|
|
42
|
-
mainLayout()?.setAttribute('data-side-nav-temporary-expand', temporaryExpand)
|
|
40
|
+
mainLayout()?.setAttribute('data-side-nav-temporary-expand', temporaryExpand.toString())
|
|
43
41
|
} else {
|
|
44
42
|
mainLayout()?.removeAttribute('data-side-nav-temporary-expand')
|
|
45
43
|
}
|
|
@@ -88,7 +86,10 @@
|
|
|
88
86
|
</script>
|
|
89
87
|
|
|
90
88
|
<nav class="side-nav_main-side-bar grid grid-rows-[auto_1fr_auto]"
|
|
91
|
-
use:clickOutside
|
|
89
|
+
use:clickOutside={
|
|
90
|
+
{preventDefaultFn: () => {
|
|
91
|
+
return getSideNavState() === 'expand';
|
|
92
|
+
}}}
|
|
92
93
|
onclick_outside={handleClickOutside}
|
|
93
94
|
>
|
|
94
95
|
<div class="flex mt-2 gap-1 items-center">
|