@appscode/design-system 2.0.73 → 2.0.75
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/package.json
CHANGED
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
height: calc(100vh - 80px);
|
|
53
53
|
overflow-y: auto;
|
|
54
54
|
padding-top: 4px;
|
|
55
|
-
scrollbar-color:
|
|
55
|
+
scrollbar-color: transparent transparent;
|
|
56
|
+
scrollbar-width: none;
|
|
56
57
|
|
|
57
58
|
/* width */
|
|
58
59
|
&::-webkit-scrollbar {
|
|
@@ -178,8 +179,6 @@
|
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
ul {
|
|
181
|
-
max-height: 0;
|
|
182
|
-
transition: max-height 0.2s ease-out;
|
|
183
182
|
margin: 0;
|
|
184
183
|
padding: 0;
|
|
185
184
|
border-left: none;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { ref } from "vue";
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
isDropDownOpen?: boolean;
|
|
@@ -13,85 +13,12 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
13
13
|
icon: "https://cdn.appscode.com/k8s/icons/apiextensions.k8s.io/customresourcedefinitions.svg",
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const dropDownStatus = ref("close");
|
|
19
|
-
const dropDownSectionHeight = ref<string | null>(null);
|
|
20
|
-
const isCompMounted = ref(false);
|
|
21
|
-
const sectionItems = ref(null as HTMLElement | null);
|
|
22
|
-
|
|
23
|
-
const setDropdownMaxHeight = (mode: string) => {
|
|
24
|
-
if (mode === "open" && sectionItems.value) {
|
|
25
|
-
dropDownSectionHeight.value = `${sectionItems.value.scrollHeight}px`;
|
|
26
|
-
} else {
|
|
27
|
-
dropDownSectionHeight.value = null;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
16
|
+
const dropDownStatus = ref<"close" | "open">(`${props.isDropDownOpen ? "open" : "close"}`);
|
|
30
17
|
|
|
31
18
|
const toggleDropDownStatus = () => {
|
|
32
|
-
if (dropDownStatus.value === "open")
|
|
33
|
-
|
|
34
|
-
} else dropDownStatus.value = "open";
|
|
19
|
+
if (dropDownStatus.value === "open") dropDownStatus.value = "close";
|
|
20
|
+
else dropDownStatus.value = "open";
|
|
35
21
|
};
|
|
36
|
-
|
|
37
|
-
onMounted(() => {
|
|
38
|
-
isCompMounted.value = true;
|
|
39
|
-
setTimeout(() => {
|
|
40
|
-
// for expanding dropdown
|
|
41
|
-
if (props.isDropDownOpen) {
|
|
42
|
-
setDropdownMaxHeight("open");
|
|
43
|
-
} else {
|
|
44
|
-
setDropdownMaxHeight("close");
|
|
45
|
-
}
|
|
46
|
-
}, 200);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
watch(
|
|
50
|
-
() => props.title,
|
|
51
|
-
(n, o) => {
|
|
52
|
-
if (n && isCompMounted.value) {
|
|
53
|
-
nextTick(() => {
|
|
54
|
-
// for expanding dropdown
|
|
55
|
-
setDropdownMaxHeight("open");
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (o && isCompMounted.value) {
|
|
60
|
-
nextTick(() => {
|
|
61
|
-
// for expanding dropdown
|
|
62
|
-
setDropdownMaxHeight("close");
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
watch(
|
|
69
|
-
() => props.isDropDownOpen,
|
|
70
|
-
(n) => {
|
|
71
|
-
if (n) {
|
|
72
|
-
dropDownStatus.value = "open";
|
|
73
|
-
} else dropDownStatus.value = "close";
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
immediate: true,
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
watch(dropDownStatus, (n) => {
|
|
81
|
-
if (n === "open") {
|
|
82
|
-
// emit event to close other drop down items
|
|
83
|
-
emit("dropDownItemChange");
|
|
84
|
-
|
|
85
|
-
nextTick(() => {
|
|
86
|
-
const dropDownUl = sectionItems.value;
|
|
87
|
-
// debugger;
|
|
88
|
-
if (dropDownUl) dropDownSectionHeight.value = `${dropDownUl.scrollHeight}px`;
|
|
89
|
-
});
|
|
90
|
-
} else {
|
|
91
|
-
// emit event to close other drop down items
|
|
92
|
-
dropDownSectionHeight.value = null;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
22
|
</script>
|
|
96
23
|
|
|
97
24
|
<template>
|
|
@@ -106,7 +33,7 @@ watch(dropDownStatus, (n) => {
|
|
|
106
33
|
</span>
|
|
107
34
|
</a>
|
|
108
35
|
|
|
109
|
-
<ul
|
|
36
|
+
<ul v-if="dropDownStatus == 'open'">
|
|
110
37
|
<slot />
|
|
111
38
|
</ul>
|
|
112
39
|
</li>
|