@mptw/skylens-ui 1.5.20 → 1.5.22
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/app/app.vue
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
div
|
|
3
|
-
|
|
3
|
+
SLPopupMenuButton(:buttons='buttons')
|
|
4
4
|
</template>
|
|
5
5
|
|
|
6
|
-
<script setup lang="ts"
|
|
6
|
+
<script setup lang="ts">
|
|
7
|
+
const buttons = [
|
|
8
|
+
{ name: "複製", event: "copy" },
|
|
9
|
+
{ name: "下載 Excel", event: "download" },
|
|
10
|
+
];
|
|
11
|
+
</script>
|
|
@@ -47,6 +47,8 @@ export default defineComponent({
|
|
|
47
47
|
const isCollapsed = ref(defaultCollapsed.value);
|
|
48
48
|
const bodyHeight = ref(0);
|
|
49
49
|
|
|
50
|
+
let observer: MutationObserver | null = null;
|
|
51
|
+
|
|
50
52
|
function onToggleCollapse() {
|
|
51
53
|
isCollapsed.value = !isCollapsed.value;
|
|
52
54
|
}
|
|
@@ -84,6 +86,21 @@ export default defineComponent({
|
|
|
84
86
|
onMounted(() => {
|
|
85
87
|
getWrapperHeight();
|
|
86
88
|
checkImageLoaded();
|
|
89
|
+
|
|
90
|
+
if (wrapperEl.value) {
|
|
91
|
+
observer = new MutationObserver(getWrapperHeight);
|
|
92
|
+
observer.observe(wrapperEl.value, {
|
|
93
|
+
childList: true,
|
|
94
|
+
attributes: true,
|
|
95
|
+
subtree: true,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
onBeforeUnmount(() => {
|
|
101
|
+
if (observer) {
|
|
102
|
+
observer.disconnect();
|
|
103
|
+
}
|
|
87
104
|
});
|
|
88
105
|
|
|
89
106
|
return {
|
|
@@ -4,7 +4,7 @@ a.popup-menu-button(
|
|
|
4
4
|
@click='onClickedToggle'
|
|
5
5
|
ref='toggleEl'
|
|
6
6
|
)
|
|
7
|
-
SLIcon(icon='three-dot
|
|
7
|
+
SLIcon(icon='three-dot')
|
|
8
8
|
ClientOnly
|
|
9
9
|
Teleport(to="body")
|
|
10
10
|
.buttons-popup(ref='popupEl')
|
|
@@ -15,9 +15,8 @@ a.popup-menu-button(
|
|
|
15
15
|
href='javascript:;'
|
|
16
16
|
@click='onClickedMenuButton(button.event)'
|
|
17
17
|
)
|
|
18
|
-
SLIcon(:icon='button.icon')
|
|
18
|
+
SLIcon(v-if='button.icon', :icon='button.icon')
|
|
19
19
|
span {{ button.name }}
|
|
20
|
-
.menu-button-splitter(v-if='(i + 1) < buttons.length')
|
|
21
20
|
</template>
|
|
22
21
|
|
|
23
22
|
<script lang="ts">
|
|
@@ -133,31 +132,20 @@ export default defineComponent({
|
|
|
133
132
|
});
|
|
134
133
|
</script>
|
|
135
134
|
|
|
136
|
-
<style>
|
|
135
|
+
<style scoped>
|
|
137
136
|
@reference '~uiApp/assets/css/main.css';
|
|
138
137
|
|
|
139
138
|
.popup-menu-button {
|
|
140
|
-
@apply inline-
|
|
139
|
+
@apply inline-flex relative p-1.75 border border-primary-600 rounded-sm text-base text-primary-600;
|
|
141
140
|
}
|
|
142
141
|
|
|
143
142
|
.buttons-popup {
|
|
144
|
-
@apply
|
|
145
|
-
|
|
146
|
-
.menu-button-splitter {
|
|
147
|
-
@apply h-px mx-auto my-1 bg-primary-100;
|
|
148
|
-
width: calc(100% - var(--spacing) * 4);
|
|
149
|
-
}
|
|
143
|
+
@apply hidden;
|
|
144
|
+
@apply z-60 flex-col items-stretch border border-primary-300 rounded bg-white divide-y divide-primary-100 shadow-md overflow-hidden;
|
|
150
145
|
|
|
151
146
|
.menu-button {
|
|
152
|
-
@apply inline-flex flex-row flex-nowrap items-center justify-center px-
|
|
153
|
-
|
|
154
|
-
&:first-child {
|
|
155
|
-
@apply pt-2;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
&:last-child {
|
|
159
|
-
@apply pb-2;
|
|
160
|
-
}
|
|
147
|
+
@apply inline-flex flex-row flex-nowrap gap-2 items-center justify-center px-3 py-2 bg-white text-base text-primary truncate;
|
|
148
|
+
@apply hover:bg-primary-50;
|
|
161
149
|
}
|
|
162
150
|
|
|
163
151
|
&[data-show] {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default interface IPopupMenuButton {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
2
|
+
name: string;
|
|
3
|
+
icon?: string;
|
|
4
|
+
event: string;
|
|
5
|
+
}
|