cynx-lib 1.3.56 → 1.3.57
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/Button.vue +18 -7
- package/vue/components/Table.vue +12 -39
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, useSlots } from "vue";
|
|
3
3
|
import Spinner from "./Spinner.vue";
|
|
4
4
|
|
|
5
5
|
const VARIANTS: Record<string, any> = {
|
|
@@ -60,12 +60,22 @@ const VARIANTS: Record<string, any> = {
|
|
|
60
60
|
hoverShadow: "0 2px 8px rgba(249,158,44,.25)",
|
|
61
61
|
},
|
|
62
62
|
ghost: {
|
|
63
|
-
background: "
|
|
63
|
+
background: "transparent",
|
|
64
64
|
color: "var(--t2, #797b8d)",
|
|
65
|
-
border: "1px solid
|
|
65
|
+
border: "1px solid transparent",
|
|
66
66
|
hoverColor: "var(--t1, #1a1a2e)",
|
|
67
67
|
hoverBg: "var(--grey-1, #f5f5f8)",
|
|
68
|
-
hoverBorder: "
|
|
68
|
+
hoverBorder: "transparent",
|
|
69
|
+
boxShadow: "none",
|
|
70
|
+
},
|
|
71
|
+
icon: {
|
|
72
|
+
background: "transparent",
|
|
73
|
+
color: "var(--t2, #797b8d)",
|
|
74
|
+
border: "1px solid transparent",
|
|
75
|
+
hoverColor: "var(--t1, #1a1a2e)",
|
|
76
|
+
hoverBg: "var(--grey-1, #f5f5f8)",
|
|
77
|
+
hoverBorder: "transparent",
|
|
78
|
+
boxShadow: "none",
|
|
69
79
|
},
|
|
70
80
|
outline: {
|
|
71
81
|
background: "transparent",
|
|
@@ -120,9 +130,10 @@ const emit = defineEmits<{
|
|
|
120
130
|
(e: "click", event: MouseEvent): void;
|
|
121
131
|
}>();
|
|
122
132
|
|
|
133
|
+
const slots = useSlots();
|
|
123
134
|
const v = computed(() => VARIANTS[props.variant] || VARIANTS.default);
|
|
124
135
|
const s = computed(() => SIZES[props.size] || SIZES.md);
|
|
125
|
-
const isIconOnly = computed(() => props.variant === "icon");
|
|
136
|
+
const isIconOnly = computed(() => props.variant === "icon" || (!slots.default && (Boolean(slots.icon) || Boolean(slots.iconRight))));
|
|
126
137
|
</script>
|
|
127
138
|
|
|
128
139
|
<template>
|
|
@@ -137,7 +148,7 @@ const isIconOnly = computed(() => props.variant === "icon");
|
|
|
137
148
|
whiteSpace: 'nowrap',
|
|
138
149
|
letterSpacing: '-.01em',
|
|
139
150
|
outline: 'none',
|
|
140
|
-
boxShadow: 'var(--shadow, 0 1px 3px rgba(20,22,41,.1))',
|
|
151
|
+
boxShadow: v.boxShadow !== undefined ? v.boxShadow : 'var(--shadow, 0 1px 3px rgba(20,22,41,.1))',
|
|
141
152
|
opacity: disabled ? 0.45 : 1,
|
|
142
153
|
pointerEvents: disabled ? 'none' : undefined,
|
|
143
154
|
background: v.background,
|
|
@@ -147,9 +158,9 @@ const isIconOnly = computed(() => props.variant === "icon");
|
|
|
147
158
|
fontSize: `${s.fontSize}px`,
|
|
148
159
|
height: `${s.height}px`,
|
|
149
160
|
width: isIconOnly ? `${s.height}px` : undefined,
|
|
161
|
+
minWidth: isIconOnly ? `${s.height}px` : undefined,
|
|
150
162
|
...(v.paddingLeft !== undefined && { paddingLeft: v.paddingLeft }),
|
|
151
163
|
...(v.paddingRight !== undefined && { paddingRight: v.paddingRight }),
|
|
152
|
-
...(v.boxShadow !== undefined && { boxShadow: v.boxShadow }),
|
|
153
164
|
}"
|
|
154
165
|
@click="emit('click', $event)"
|
|
155
166
|
>
|
package/vue/components/Table.vue
CHANGED
|
@@ -52,7 +52,7 @@ const props = withDefaults(
|
|
|
52
52
|
bordered: true,
|
|
53
53
|
skeletonRows: undefined,
|
|
54
54
|
autoSkeleton: true,
|
|
55
|
-
rowHeight:
|
|
55
|
+
rowHeight: 40,
|
|
56
56
|
}
|
|
57
57
|
);
|
|
58
58
|
|
|
@@ -62,18 +62,11 @@ const emit = defineEmits<{
|
|
|
62
62
|
}>();
|
|
63
63
|
|
|
64
64
|
const rootRef = ref<HTMLElement | null>(null);
|
|
65
|
-
const headerScrollRef = ref<HTMLElement | null>(null);
|
|
66
65
|
const bodyScrollRef = ref<HTMLElement | null>(null);
|
|
67
66
|
|
|
68
|
-
const handleBodyScroll = () => {
|
|
69
|
-
if (headerScrollRef.value && bodyScrollRef.value) {
|
|
70
|
-
headerScrollRef.value.scrollLeft = bodyScrollRef.value.scrollLeft;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
67
|
const { rows: autoRows } = useAutoSkeletonRows(rootRef, {
|
|
75
68
|
rowHeight: props.rowHeight,
|
|
76
|
-
bottomBuffer:
|
|
69
|
+
bottomBuffer: 50,
|
|
77
70
|
});
|
|
78
71
|
|
|
79
72
|
const skeletonCount = computed(() => {
|
|
@@ -133,23 +126,23 @@ const getSkeletonWidth = (rIdx: number, cIdx: number, key: string) => {
|
|
|
133
126
|
]"
|
|
134
127
|
:style="height ? { height: formatWidth(height) } : undefined"
|
|
135
128
|
>
|
|
136
|
-
<!--
|
|
129
|
+
<!-- Scrollable Single Unified Table Container (100% Column Alignment) -->
|
|
137
130
|
<div
|
|
138
|
-
ref="
|
|
139
|
-
class="w-full overflow-
|
|
131
|
+
ref="bodyScrollRef"
|
|
132
|
+
class="w-full overflow-x-auto overflow-y-auto custom-scrollbar flex-1 relative"
|
|
140
133
|
>
|
|
141
134
|
<table class="w-full border-collapse text-left text-xs table-fixed">
|
|
142
135
|
<colgroup>
|
|
143
136
|
<col
|
|
144
137
|
v-for="col in columns"
|
|
145
|
-
:key="`
|
|
138
|
+
:key="`col-${col.key}`"
|
|
146
139
|
:style="{
|
|
147
140
|
width: formatWidth(col.width),
|
|
148
141
|
minWidth: formatWidth(col.minWidth || col.width || 100),
|
|
149
142
|
}"
|
|
150
143
|
/>
|
|
151
144
|
</colgroup>
|
|
152
|
-
<thead>
|
|
145
|
+
<thead class="sticky top-0 z-10 bg-[#f8fafc] dark:bg-[#16192e] border-b border-slate-200 dark:border-slate-800 shadow-[0_1px_0_0_rgba(226,232,240,1)] dark:shadow-[0_1px_0_0_rgba(30,41,59,1)]">
|
|
153
146
|
<tr>
|
|
154
147
|
<th
|
|
155
148
|
v-for="col in columns"
|
|
@@ -160,7 +153,7 @@ const getSkeletonWidth = (rIdx: number, cIdx: number, key: string) => {
|
|
|
160
153
|
textAlign: col.align || 'left',
|
|
161
154
|
}"
|
|
162
155
|
:class="[
|
|
163
|
-
'px-
|
|
156
|
+
'px-3.5 py-2.5 font-semibold text-[11px] uppercase tracking-wider text-slate-500 dark:text-slate-400 select-none transition-colors bg-[#f8fafc] dark:bg-[#16192e]',
|
|
164
157
|
col.sortable ? 'cursor-pointer hover:text-slate-900 dark:hover:text-white' : '',
|
|
165
158
|
col.headerClass || ''
|
|
166
159
|
]"
|
|
@@ -200,28 +193,8 @@ const getSkeletonWidth = (rIdx: number, cIdx: number, key: string) => {
|
|
|
200
193
|
</th>
|
|
201
194
|
</tr>
|
|
202
195
|
</thead>
|
|
203
|
-
</table>
|
|
204
|
-
</div>
|
|
205
|
-
|
|
206
|
-
<!-- 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>
|
|
223
196
|
<tbody class="divide-y divide-slate-100 dark:divide-slate-800/80">
|
|
224
|
-
<!-- Loading State (
|
|
197
|
+
<!-- Loading State (Real matching heights and paddings) -->
|
|
225
198
|
<template v-if="loading">
|
|
226
199
|
<tr
|
|
227
200
|
v-for="i in skeletonCount"
|
|
@@ -235,7 +208,7 @@ const getSkeletonWidth = (rIdx: number, cIdx: number, key: string) => {
|
|
|
235
208
|
textAlign: col.align || 'left',
|
|
236
209
|
height: `${rowHeight}px`,
|
|
237
210
|
}"
|
|
238
|
-
class="px-
|
|
211
|
+
class="px-3.5 py-2 align-middle"
|
|
239
212
|
>
|
|
240
213
|
<!-- Action button skeleton -->
|
|
241
214
|
<div v-if="col.key === 'actions'" class="flex items-center justify-center">
|
|
@@ -251,7 +224,7 @@ const getSkeletonWidth = (rIdx: number, cIdx: number, key: string) => {
|
|
|
251
224
|
<Skeleton
|
|
252
225
|
v-else
|
|
253
226
|
:width="getSkeletonWidth(i, cIdx, col.key)"
|
|
254
|
-
:height="
|
|
227
|
+
:height="14"
|
|
255
228
|
:radius="4"
|
|
256
229
|
/>
|
|
257
230
|
</td>
|
|
@@ -291,7 +264,7 @@ const getSkeletonWidth = (rIdx: number, cIdx: number, key: string) => {
|
|
|
291
264
|
height: `${rowHeight}px`,
|
|
292
265
|
}"
|
|
293
266
|
:class="[
|
|
294
|
-
'px-
|
|
267
|
+
'px-3.5 py-2 text-slate-700 dark:text-slate-200 text-xs font-normal align-middle',
|
|
295
268
|
col.cellClass || ''
|
|
296
269
|
]"
|
|
297
270
|
>
|