sprintify-ui 0.6.59 → 0.6.61
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/dist/sprintify-ui.es.js +949 -934
- package/dist/types/src/components/BaseTableCell.vue.d.ts +5 -5
- package/dist/types/src/components/BaseTableHeader.vue.d.ts +2 -2
- package/dist/types/src/components/BaseTableRow.vue.d.ts +20 -2
- package/package.json +1 -1
- package/src/components/BaseTable.stories.js +41 -1
- package/src/components/BaseTableCell.vue +21 -5
- package/src/components/BaseTableHeader.vue +1 -1
- package/src/components/BaseTableRow.vue +24 -1
|
@@ -23,10 +23,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
23
23
|
};
|
|
24
24
|
align: {
|
|
25
25
|
type: import("vue").PropType<"left" | "right" | "center">;
|
|
26
|
-
default:
|
|
26
|
+
default: string;
|
|
27
27
|
};
|
|
28
28
|
colspan: {
|
|
29
|
-
type: import("vue").PropType<number>;
|
|
29
|
+
type: import("vue").PropType<string | number>;
|
|
30
30
|
default: undefined;
|
|
31
31
|
};
|
|
32
32
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -52,10 +52,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
52
52
|
};
|
|
53
53
|
align: {
|
|
54
54
|
type: import("vue").PropType<"left" | "right" | "center">;
|
|
55
|
-
default:
|
|
55
|
+
default: string;
|
|
56
56
|
};
|
|
57
57
|
colspan: {
|
|
58
|
-
type: import("vue").PropType<number>;
|
|
58
|
+
type: import("vue").PropType<string | number>;
|
|
59
59
|
default: undefined;
|
|
60
60
|
};
|
|
61
61
|
}>>, {
|
|
@@ -65,7 +65,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
65
65
|
target: "_blank" | "_self" | "_parent" | "_top";
|
|
66
66
|
href: string;
|
|
67
67
|
align: "left" | "right" | "center";
|
|
68
|
-
colspan: number;
|
|
68
|
+
colspan: string | number;
|
|
69
69
|
}, {}>, {
|
|
70
70
|
default?(_: {}): any;
|
|
71
71
|
}>;
|
|
@@ -6,7 +6,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
6
6
|
};
|
|
7
7
|
align: {
|
|
8
8
|
type: import("vue").PropType<"left" | "right" | "center">;
|
|
9
|
-
default:
|
|
9
|
+
default: string;
|
|
10
10
|
};
|
|
11
11
|
colspan: {
|
|
12
12
|
type: import("vue").PropType<number>;
|
|
@@ -19,7 +19,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
19
19
|
};
|
|
20
20
|
align: {
|
|
21
21
|
type: import("vue").PropType<"left" | "right" | "center">;
|
|
22
|
-
default:
|
|
22
|
+
default: string;
|
|
23
23
|
};
|
|
24
24
|
colspan: {
|
|
25
25
|
type: import("vue").PropType<number>;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { ClassNameValue } from 'tailwind-merge';
|
|
1
2
|
import { RouteLocationRaw } from 'vue-router';
|
|
2
3
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
4
|
+
class: {
|
|
5
|
+
type: import("vue").PropType<string | false | 0 | ClassNameValue[] | null>;
|
|
6
|
+
default: undefined;
|
|
7
|
+
};
|
|
3
8
|
title: {
|
|
4
9
|
type: import("vue").PropType<string>;
|
|
5
10
|
default: undefined;
|
|
@@ -16,7 +21,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
16
21
|
type: import("vue").PropType<string>;
|
|
17
22
|
default: undefined;
|
|
18
23
|
};
|
|
19
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
24
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
+
click: (...args: any[]) => void;
|
|
26
|
+
mouseenter: (...args: any[]) => void;
|
|
27
|
+
mouseleave: (...args: any[]) => void;
|
|
28
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
29
|
+
class: {
|
|
30
|
+
type: import("vue").PropType<string | false | 0 | ClassNameValue[] | null>;
|
|
31
|
+
default: undefined;
|
|
32
|
+
};
|
|
20
33
|
title: {
|
|
21
34
|
type: import("vue").PropType<string>;
|
|
22
35
|
default: undefined;
|
|
@@ -33,7 +46,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
33
46
|
type: import("vue").PropType<string>;
|
|
34
47
|
default: undefined;
|
|
35
48
|
};
|
|
36
|
-
}
|
|
49
|
+
}>> & {
|
|
50
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
51
|
+
onMouseenter?: ((...args: any[]) => any) | undefined;
|
|
52
|
+
onMouseleave?: ((...args: any[]) => any) | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
class: string | false | 0 | ClassNameValue[] | null;
|
|
37
55
|
title: string;
|
|
38
56
|
to: RouteLocationRaw;
|
|
39
57
|
target: "_blank" | "_self" | "_parent" | "_top";
|
package/package.json
CHANGED
|
@@ -105,4 +105,44 @@ const TemplateRouterLink = (args) => ({
|
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
export const RouterLink = TemplateRouterLink.bind({});
|
|
108
|
-
RouterLink.args = {};
|
|
108
|
+
RouterLink.args = {};
|
|
109
|
+
|
|
110
|
+
const TemplateCellClick = (args) => ({
|
|
111
|
+
components: components,
|
|
112
|
+
setup() {
|
|
113
|
+
return { args, options };
|
|
114
|
+
},
|
|
115
|
+
template: `
|
|
116
|
+
<div class="p-6">
|
|
117
|
+
|
|
118
|
+
<p class="mb-3">
|
|
119
|
+
Only the first cell is clickable
|
|
120
|
+
</p>
|
|
121
|
+
|
|
122
|
+
<BaseTable class="" v-bind="args">
|
|
123
|
+
${headTemplate}
|
|
124
|
+
<BaseTableBody>
|
|
125
|
+
<BaseTableRow
|
|
126
|
+
v-for="option in options"
|
|
127
|
+
:key="option.value"
|
|
128
|
+
>
|
|
129
|
+
<BaseTableCell class="font-medium" href="https://google.com">
|
|
130
|
+
{{ option.label }}
|
|
131
|
+
</BaseTableCell>
|
|
132
|
+
<BaseTableCell>
|
|
133
|
+
<BaseBadge class="font-mono">
|
|
134
|
+
{{ option.value ?? 'N/A' }}
|
|
135
|
+
</BaseBadge>
|
|
136
|
+
</BaseTableCell>
|
|
137
|
+
<BaseTableCell>
|
|
138
|
+
{{ option.type ?? 'N/A' }}
|
|
139
|
+
</BaseTableCell>
|
|
140
|
+
</BaseTableRow>
|
|
141
|
+
</BaseTableBody>
|
|
142
|
+
</BaseTable>
|
|
143
|
+
</div>
|
|
144
|
+
`,
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
export const CellClick = TemplateCellClick.bind({});
|
|
148
|
+
CellClick.args = {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<td
|
|
3
|
-
class="p-0 border-b border-slate-200"
|
|
3
|
+
class="p-0 border-b border-slate-200 group-last/row:border-b-0"
|
|
4
4
|
:align="align"
|
|
5
5
|
:colspan="colspan"
|
|
6
6
|
>
|
|
@@ -45,14 +45,14 @@ const props = withDefaults(defineProps<{
|
|
|
45
45
|
target?: '_blank' | '_self' | '_parent' | '_top',
|
|
46
46
|
title?: string,
|
|
47
47
|
align?: 'left' | 'center' | 'right',
|
|
48
|
-
colspan?: number,
|
|
48
|
+
colspan?: number | string,
|
|
49
49
|
class?: ClassNameValue,
|
|
50
50
|
}>(), {
|
|
51
51
|
href: undefined,
|
|
52
52
|
to: undefined,
|
|
53
53
|
target: undefined,
|
|
54
54
|
title: undefined,
|
|
55
|
-
align:
|
|
55
|
+
align: 'left',
|
|
56
56
|
colspan: undefined,
|
|
57
57
|
class: undefined,
|
|
58
58
|
});
|
|
@@ -83,13 +83,29 @@ const componentName = computed(() => {
|
|
|
83
83
|
|
|
84
84
|
const classes = computed(() => {
|
|
85
85
|
const base = cellClasses(cellConfig.value);
|
|
86
|
-
const click =
|
|
86
|
+
const click = clickable.value ? 'cursor-pointer' : '';
|
|
87
|
+
const clickRow = clickableRow.value ? 'group-hover/row:bg-slate-50' : '';
|
|
88
|
+
const clickCell = clickableCell.value ? 'hover:bg-slate-50' : '';
|
|
87
89
|
|
|
88
90
|
return twMerge(
|
|
89
91
|
base,
|
|
90
92
|
click,
|
|
93
|
+
clickRow,
|
|
94
|
+
clickCell,
|
|
91
95
|
props.class,
|
|
92
96
|
);
|
|
93
|
-
})
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const clickable = computed(() => {
|
|
100
|
+
return propsInternal.value.href || propsInternal.value.to;
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const clickableRow = computed(() => {
|
|
104
|
+
return !clickableCell.value && clickable.value;
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const clickableCell = computed(() => {
|
|
108
|
+
return props.href || props.to;
|
|
109
|
+
});
|
|
94
110
|
|
|
95
111
|
</script>
|
|
@@ -1,30 +1,53 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<tr
|
|
2
|
+
<tr
|
|
3
|
+
:class="classes"
|
|
4
|
+
@click="emit('click')"
|
|
5
|
+
@mouseenter="emit('mouseenter')"
|
|
6
|
+
@mouseleave="emit('mouseleave')"
|
|
7
|
+
>
|
|
3
8
|
<slot />
|
|
4
9
|
</tr>
|
|
5
10
|
</template>
|
|
6
11
|
|
|
7
12
|
<script lang="ts" setup>
|
|
13
|
+
import { ClassNameValue, twMerge } from 'tailwind-merge';
|
|
8
14
|
import { RouteLocationRaw } from 'vue-router';
|
|
9
15
|
|
|
16
|
+
defineOptions({
|
|
17
|
+
inheritAttrs: false,
|
|
18
|
+
});
|
|
19
|
+
|
|
10
20
|
const baseTable = inject('BaseTable');
|
|
11
21
|
|
|
12
22
|
if (!baseTable) {
|
|
13
23
|
throw new Error('baseTable must be used within a BaseTable.');
|
|
14
24
|
}
|
|
15
25
|
|
|
26
|
+
const emit = defineEmits(['click', 'mouseenter', 'mouseleave']);
|
|
27
|
+
|
|
16
28
|
const props = withDefaults(defineProps<{
|
|
17
29
|
href?: string,
|
|
18
30
|
to?: RouteLocationRaw,
|
|
19
31
|
target?: '_blank' | '_self' | '_parent' | '_top',
|
|
20
32
|
title?: string,
|
|
33
|
+
class?: ClassNameValue,
|
|
21
34
|
}>(), {
|
|
22
35
|
href: undefined,
|
|
23
36
|
to: undefined,
|
|
24
37
|
target: undefined,
|
|
25
38
|
title: undefined,
|
|
39
|
+
class: undefined,
|
|
26
40
|
});
|
|
27
41
|
|
|
28
42
|
provide('BaseTableRow', computed(() => props));
|
|
29
43
|
|
|
44
|
+
const classes = computed(() => {
|
|
45
|
+
const base = 'group/row';
|
|
46
|
+
|
|
47
|
+
return twMerge(
|
|
48
|
+
base,
|
|
49
|
+
props.class,
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
|
|
30
53
|
</script>
|