cynx-lib 1.3.64 → 1.3.66
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/ui/components/Button.jsx +31 -2
- package/vue/components/Button.vue +17 -0
- package/vue/components/Table.vue +46 -1
package/package.json
CHANGED
package/ui/components/Button.jsx
CHANGED
|
@@ -51,6 +51,33 @@ const VARIANTS = {
|
|
|
51
51
|
hoverBg: 'var(--grey-1,#f5f5f8)',
|
|
52
52
|
hoverBorder: 'var(--grey-2,#ebebee)',
|
|
53
53
|
},
|
|
54
|
+
plain: {
|
|
55
|
+
background: 'transparent',
|
|
56
|
+
color: 'var(--t2,#797b8d)',
|
|
57
|
+
border: '1px solid transparent',
|
|
58
|
+
hoverColor: 'var(--t1,#1a1a2e)',
|
|
59
|
+
hoverBg: 'var(--grey-1,#f5f5f8)',
|
|
60
|
+
hoverBorder: 'transparent',
|
|
61
|
+
boxShadow: 'none',
|
|
62
|
+
},
|
|
63
|
+
flat: {
|
|
64
|
+
background: 'transparent',
|
|
65
|
+
color: 'var(--t2,#797b8d)',
|
|
66
|
+
border: '1px solid transparent',
|
|
67
|
+
hoverColor: 'var(--t1,#1a1a2e)',
|
|
68
|
+
hoverBg: 'var(--grey-1,#f5f5f8)',
|
|
69
|
+
hoverBorder: 'transparent',
|
|
70
|
+
boxShadow: 'none',
|
|
71
|
+
},
|
|
72
|
+
icon: {
|
|
73
|
+
background: 'transparent',
|
|
74
|
+
color: 'var(--t2,#797b8d)',
|
|
75
|
+
border: '1px solid transparent',
|
|
76
|
+
hoverColor: 'var(--t1,#1a1a2e)',
|
|
77
|
+
hoverBg: 'var(--grey-1,#f5f5f8)',
|
|
78
|
+
hoverBorder: 'transparent',
|
|
79
|
+
boxShadow: 'none',
|
|
80
|
+
},
|
|
54
81
|
outline: {
|
|
55
82
|
background: 'transparent',
|
|
56
83
|
color: 'var(--accent,#f99e2c)',
|
|
@@ -102,7 +129,7 @@ export default function Button({
|
|
|
102
129
|
const v = VARIANTS[variant] || VARIANTS.default;
|
|
103
130
|
const s = SIZES[size] || SIZES.md;
|
|
104
131
|
|
|
105
|
-
const isIconOnly = variant === 'icon';
|
|
132
|
+
const isIconOnly = variant === 'icon' || (!children && (Boolean(icon) || Boolean(iconRight)));
|
|
106
133
|
|
|
107
134
|
return (
|
|
108
135
|
<button
|
|
@@ -122,7 +149,7 @@ export default function Button({
|
|
|
122
149
|
transition: 'all .14s',
|
|
123
150
|
letterSpacing: '-.01em',
|
|
124
151
|
outline: 'none',
|
|
125
|
-
boxShadow: 'var(--shadow,0 1px 3px rgba(20,22,41,.1))',
|
|
152
|
+
boxShadow: v.boxShadow !== undefined ? v.boxShadow : 'var(--shadow,0 1px 3px rgba(20,22,41,.1))',
|
|
126
153
|
opacity: disabled ? 0.45 : 1,
|
|
127
154
|
pointerEvents: disabled ? 'none' : undefined,
|
|
128
155
|
background: v.background,
|
|
@@ -132,6 +159,8 @@ export default function Button({
|
|
|
132
159
|
fontSize: s.fontSize,
|
|
133
160
|
height: s.height,
|
|
134
161
|
width: isIconOnly ? s.height : undefined,
|
|
162
|
+
minWidth: isIconOnly ? s.height : undefined,
|
|
163
|
+
maxWidth: isIconOnly ? s.height : undefined,
|
|
135
164
|
...(v.paddingLeft !== undefined && { paddingLeft: v.paddingLeft }),
|
|
136
165
|
...(v.paddingRight !== undefined && { paddingRight: v.paddingRight }),
|
|
137
166
|
...(v.boxShadow !== undefined && { boxShadow: v.boxShadow }),
|
|
@@ -60,6 +60,23 @@ const VARIANTS: Record<string, any> = {
|
|
|
60
60
|
hoverShadow: "0 2px 8px rgba(249,158,44,.25)",
|
|
61
61
|
},
|
|
62
62
|
ghost: {
|
|
63
|
+
background: "var(--surface, #ffffff)",
|
|
64
|
+
color: "var(--t2, #797b8d)",
|
|
65
|
+
border: "1px solid var(--bd, #d7d8e0)",
|
|
66
|
+
hoverColor: "var(--t1, #1a1a2e)",
|
|
67
|
+
hoverBg: "var(--grey-1, #f5f5f8)",
|
|
68
|
+
hoverBorder: "var(--grey-2, #ebebee)",
|
|
69
|
+
},
|
|
70
|
+
plain: {
|
|
71
|
+
background: "transparent",
|
|
72
|
+
color: "var(--t2, #797b8d)",
|
|
73
|
+
border: "1px solid transparent",
|
|
74
|
+
hoverColor: "var(--t1, #1a1a2e)",
|
|
75
|
+
hoverBg: "var(--grey-1, #f5f5f8)",
|
|
76
|
+
hoverBorder: "transparent",
|
|
77
|
+
boxShadow: "none",
|
|
78
|
+
},
|
|
79
|
+
flat: {
|
|
63
80
|
background: "transparent",
|
|
64
81
|
color: "var(--t2, #797b8d)",
|
|
65
82
|
border: "1px solid transparent",
|
package/vue/components/Table.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, ref } from "vue";
|
|
2
|
+
import { computed, ref, onMounted, onUnmounted, watch, nextTick } from "vue";
|
|
3
3
|
import {
|
|
4
4
|
ChevronUp,
|
|
5
5
|
ChevronDown,
|
|
@@ -64,6 +64,45 @@ const emit = defineEmits<{
|
|
|
64
64
|
const rootRef = ref<HTMLElement | null>(null);
|
|
65
65
|
const headerScrollRef = ref<HTMLElement | null>(null);
|
|
66
66
|
const bodyScrollRef = ref<HTMLElement | null>(null);
|
|
67
|
+
const gutterWidth = ref(0);
|
|
68
|
+
|
|
69
|
+
const updateGutter = () => {
|
|
70
|
+
if (bodyScrollRef.value) {
|
|
71
|
+
const hasVScroll = bodyScrollRef.value.scrollHeight > bodyScrollRef.value.clientHeight;
|
|
72
|
+
if (hasVScroll) {
|
|
73
|
+
const scrollWidth = bodyScrollRef.value.offsetWidth - bodyScrollRef.value.clientWidth;
|
|
74
|
+
gutterWidth.value = scrollWidth > 0 ? scrollWidth : 6;
|
|
75
|
+
} else {
|
|
76
|
+
gutterWidth.value = 0;
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
gutterWidth.value = 0;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
let resizeObserver: ResizeObserver | null = null;
|
|
84
|
+
|
|
85
|
+
onMounted(() => {
|
|
86
|
+
if (bodyScrollRef.value && typeof ResizeObserver !== "undefined") {
|
|
87
|
+
resizeObserver = new ResizeObserver(() => {
|
|
88
|
+
updateGutter();
|
|
89
|
+
});
|
|
90
|
+
resizeObserver.observe(bodyScrollRef.value);
|
|
91
|
+
}
|
|
92
|
+
nextTick(updateGutter);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
onUnmounted(() => {
|
|
96
|
+
resizeObserver?.disconnect();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
watch(
|
|
100
|
+
() => [props.data, props.columns, props.loading],
|
|
101
|
+
() => {
|
|
102
|
+
nextTick(updateGutter);
|
|
103
|
+
},
|
|
104
|
+
{ deep: true }
|
|
105
|
+
);
|
|
67
106
|
|
|
68
107
|
const handleBodyScroll = () => {
|
|
69
108
|
if (headerScrollRef.value && bodyScrollRef.value) {
|
|
@@ -148,6 +187,7 @@ const getSkeletonWidth = (rIdx: number, cIdx: number, key: string) => {
|
|
|
148
187
|
minWidth: formatWidth(col.minWidth || col.width || 100),
|
|
149
188
|
}"
|
|
150
189
|
/>
|
|
190
|
+
<col v-if="gutterWidth > 0" :style="{ width: `${gutterWidth}px` }" />
|
|
151
191
|
</colgroup>
|
|
152
192
|
<thead>
|
|
153
193
|
<tr>
|
|
@@ -198,6 +238,11 @@ const getSkeletonWidth = (rIdx: number, cIdx: number, key: string) => {
|
|
|
198
238
|
</span>
|
|
199
239
|
</div>
|
|
200
240
|
</th>
|
|
241
|
+
<th
|
|
242
|
+
v-if="gutterWidth > 0"
|
|
243
|
+
class="bg-[#f8fafc] dark:bg-[#16192e] p-0 border-0 pointer-events-none"
|
|
244
|
+
:style="{ width: `${gutterWidth}px`, minWidth: `${gutterWidth}px` }"
|
|
245
|
+
/>
|
|
201
246
|
</tr>
|
|
202
247
|
</thead>
|
|
203
248
|
</table>
|