cynx-lib 1.3.62 → 1.3.64
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 +1 -1
- package/vue/components/Table.vue +32 -6
package/package.json
CHANGED
package/vue/components/Table.vue
CHANGED
|
@@ -62,8 +62,15 @@ const emit = defineEmits<{
|
|
|
62
62
|
}>();
|
|
63
63
|
|
|
64
64
|
const rootRef = ref<HTMLElement | null>(null);
|
|
65
|
+
const headerScrollRef = ref<HTMLElement | null>(null);
|
|
65
66
|
const bodyScrollRef = ref<HTMLElement | null>(null);
|
|
66
67
|
|
|
68
|
+
const handleBodyScroll = () => {
|
|
69
|
+
if (headerScrollRef.value && bodyScrollRef.value) {
|
|
70
|
+
headerScrollRef.value.scrollLeft = bodyScrollRef.value.scrollLeft;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
67
74
|
const { rows: autoRows } = useAutoSkeletonRows(rootRef, {
|
|
68
75
|
rowHeight: props.rowHeight,
|
|
69
76
|
bottomBuffer: 50,
|
|
@@ -126,24 +133,23 @@ const getSkeletonWidth = (rIdx: number, cIdx: number, key: string) => {
|
|
|
126
133
|
]"
|
|
127
134
|
:style="height ? { height: formatWidth(height) } : undefined"
|
|
128
135
|
>
|
|
129
|
-
<!--
|
|
136
|
+
<!-- Dedicated Fixed Header Container (Never moves on row scroll) -->
|
|
130
137
|
<div
|
|
131
|
-
ref="
|
|
132
|
-
class="w-full overflow-
|
|
133
|
-
style="scrollbar-gutter: stable;"
|
|
138
|
+
ref="headerScrollRef"
|
|
139
|
+
class="w-full overflow-hidden flex-shrink-0 border-b border-slate-200 dark:border-slate-800 bg-[#f8fafc] dark:bg-[#16192e]"
|
|
134
140
|
>
|
|
135
141
|
<table class="w-full border-collapse text-left text-xs table-fixed">
|
|
136
142
|
<colgroup>
|
|
137
143
|
<col
|
|
138
144
|
v-for="col in columns"
|
|
139
|
-
:key="`col-${col.key}`"
|
|
145
|
+
:key="`h-col-${col.key}`"
|
|
140
146
|
:style="{
|
|
141
147
|
width: formatWidth(col.width),
|
|
142
148
|
minWidth: formatWidth(col.minWidth || col.width || 100),
|
|
143
149
|
}"
|
|
144
150
|
/>
|
|
145
151
|
</colgroup>
|
|
146
|
-
<thead
|
|
152
|
+
<thead>
|
|
147
153
|
<tr>
|
|
148
154
|
<th
|
|
149
155
|
v-for="col in columns"
|
|
@@ -194,6 +200,26 @@ const getSkeletonWidth = (rIdx: number, cIdx: number, key: string) => {
|
|
|
194
200
|
</th>
|
|
195
201
|
</tr>
|
|
196
202
|
</thead>
|
|
203
|
+
</table>
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
<!-- Dedicated Scrollable Body Container -->
|
|
207
|
+
<div
|
|
208
|
+
ref="bodyScrollRef"
|
|
209
|
+
class="w-full overflow-x-auto overflow-y-auto custom-scrollbar flex-1 relative"
|
|
210
|
+
@scroll="handleBodyScroll"
|
|
211
|
+
>
|
|
212
|
+
<table class="w-full border-collapse text-left text-xs table-fixed">
|
|
213
|
+
<colgroup>
|
|
214
|
+
<col
|
|
215
|
+
v-for="col in columns"
|
|
216
|
+
:key="`b-col-${col.key}`"
|
|
217
|
+
:style="{
|
|
218
|
+
width: formatWidth(col.width),
|
|
219
|
+
minWidth: formatWidth(col.minWidth || col.width || 100),
|
|
220
|
+
}"
|
|
221
|
+
/>
|
|
222
|
+
</colgroup>
|
|
197
223
|
<tbody class="divide-y divide-slate-100 dark:divide-slate-800/80">
|
|
198
224
|
<!-- Loading State (Real matching heights and paddings) -->
|
|
199
225
|
<template v-if="loading">
|