@tak-ps/vue-tabler 4.14.0 → 4.15.0
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.
- package/CHANGELOG.md +4 -0
- package/components/Slidedown.vue +18 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/components/Slidedown.vue
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
class='hover-expandable rounded position-relative px-2 py-2'
|
|
4
4
|
:class='{
|
|
5
5
|
"expanded mb-3": isExpanded,
|
|
6
|
-
"cursor-pointer": props.clickAnywhereExpand
|
|
6
|
+
"cursor-pointer": props.clickAnywhereExpand || props.clickAnywhereCollapse,
|
|
7
7
|
"no-border": !props.border
|
|
8
8
|
}'
|
|
9
|
-
@click='
|
|
9
|
+
@click='handleClick'
|
|
10
10
|
>
|
|
11
11
|
<div
|
|
12
12
|
:class='{
|
|
@@ -53,12 +53,14 @@ export interface SlidedownProps {
|
|
|
53
53
|
arrow?: boolean;
|
|
54
54
|
border?: boolean;
|
|
55
55
|
clickAnywhereExpand?: boolean;
|
|
56
|
+
clickAnywhereCollapse?: boolean;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
const props = withDefaults(defineProps<SlidedownProps>(), {
|
|
59
60
|
arrow: true,
|
|
60
61
|
border: true,
|
|
61
|
-
clickAnywhereExpand: false
|
|
62
|
+
clickAnywhereExpand: false,
|
|
63
|
+
clickAnywhereCollapse: false
|
|
62
64
|
});
|
|
63
65
|
|
|
64
66
|
const isExpanded = ref(false);
|
|
@@ -77,6 +79,19 @@ function toggle() {
|
|
|
77
79
|
el.style.maxHeight = ''; // Reset to CSS default (0)
|
|
78
80
|
}
|
|
79
81
|
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function handleClick(event: MouseEvent) {
|
|
85
|
+
// Don't handle clicks from the expanded content wrapper
|
|
86
|
+
const el = contentWrapperRef.value;
|
|
87
|
+
if (el && el === event.target) return;
|
|
88
|
+
if (el && el.contains(event.target as Node)) return;
|
|
89
|
+
|
|
90
|
+
if (props.clickAnywhereExpand) {
|
|
91
|
+
toggle();
|
|
92
|
+
} else if (props.clickAnywhereCollapse && isExpanded.value) {
|
|
93
|
+
toggle();
|
|
94
|
+
}
|
|
80
95
|
};
|
|
81
96
|
</script>
|
|
82
97
|
|