sprintify-ui 0.10.10 → 0.10.12
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 +201 -200
- package/dist/types/components/BaseDataTableTemplate.vue.d.ts +8 -25
- package/dist/types/components/BaseTable.vue.d.ts +6 -17
- package/dist/types/services/table/types.d.ts +8 -2
- package/package.json +1 -1
- package/src/components/BaseTable.stories.js +9 -7
- package/src/components/BaseTable.vue +7 -16
- package/src/components/BaseTableCell.vue +8 -9
- package/src/components/BaseTableHeader.vue +9 -4
- package/src/services/table/classes.ts +8 -0
- package/src/services/table/types.ts +13 -7
|
@@ -22,9 +22,10 @@ declare function __VLS_template(): {
|
|
|
22
22
|
$: import("vue").ComponentInternalInstance;
|
|
23
23
|
$data: {};
|
|
24
24
|
$props: {
|
|
25
|
-
readonly size?:
|
|
25
|
+
readonly size?: import("../services/table/types").CellSize | undefined;
|
|
26
26
|
readonly fixedHeader?: boolean | undefined;
|
|
27
27
|
readonly fixedColumn?: boolean | undefined;
|
|
28
|
+
readonly grid?: boolean | undefined;
|
|
28
29
|
readonly striped?: boolean | undefined;
|
|
29
30
|
readonly flush?: boolean | undefined;
|
|
30
31
|
readonly class?: import("tailwind-merge").ClassNameValue;
|
|
@@ -46,21 +47,12 @@ declare function __VLS_template(): {
|
|
|
46
47
|
$host: Element | null;
|
|
47
48
|
$emit: (event: string, ...args: any[]) => void;
|
|
48
49
|
$el: any;
|
|
49
|
-
$options: import("vue").ComponentOptionsBase<Readonly<{
|
|
50
|
-
size?: Size;
|
|
51
|
-
fixedHeader?: boolean;
|
|
52
|
-
fixedColumn?: boolean;
|
|
53
|
-
striped?: boolean;
|
|
54
|
-
flush?: boolean;
|
|
55
|
-
class?: import("tailwind-merge").ClassNameValue;
|
|
56
|
-
maxHeight?: number;
|
|
57
|
-
loading?: boolean;
|
|
58
|
-
virtualScrolling?: boolean;
|
|
59
|
-
}> & Readonly<{}>, {
|
|
50
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("../services/table/types").TableProps> & Readonly<{}>, {
|
|
60
51
|
scrollTop: () => void;
|
|
61
52
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
62
53
|
class: string | false | 0 | 0n | import("tailwind-merge").ClassNameValue[] | null;
|
|
63
|
-
size:
|
|
54
|
+
size: import("../services/table/types").CellSize;
|
|
55
|
+
grid: boolean;
|
|
64
56
|
loading: boolean;
|
|
65
57
|
fixedHeader: boolean;
|
|
66
58
|
fixedColumn: boolean;
|
|
@@ -90,7 +82,8 @@ declare function __VLS_template(): {
|
|
|
90
82
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
91
83
|
} & Readonly<{
|
|
92
84
|
class: string | false | 0 | 0n | import("tailwind-merge").ClassNameValue[] | null;
|
|
93
|
-
size:
|
|
85
|
+
size: import("../services/table/types").CellSize;
|
|
86
|
+
grid: boolean;
|
|
94
87
|
loading: boolean;
|
|
95
88
|
fixedHeader: boolean;
|
|
96
89
|
fixedColumn: boolean;
|
|
@@ -98,17 +91,7 @@ declare function __VLS_template(): {
|
|
|
98
91
|
flush: boolean;
|
|
99
92
|
maxHeight: number;
|
|
100
93
|
virtualScrolling: boolean;
|
|
101
|
-
}> & Omit<Readonly<{
|
|
102
|
-
size?: Size;
|
|
103
|
-
fixedHeader?: boolean;
|
|
104
|
-
fixedColumn?: boolean;
|
|
105
|
-
striped?: boolean;
|
|
106
|
-
flush?: boolean;
|
|
107
|
-
class?: import("tailwind-merge").ClassNameValue;
|
|
108
|
-
maxHeight?: number;
|
|
109
|
-
loading?: boolean;
|
|
110
|
-
virtualScrolling?: boolean;
|
|
111
|
-
}> & Readonly<{}>, "scrollTop" | ("class" | "size" | "loading" | "fixedHeader" | "fixedColumn" | "striped" | "flush" | "maxHeight" | "virtualScrolling")> & import("vue").ShallowUnwrapRef<{
|
|
94
|
+
}> & Omit<Readonly<import("../services/table/types").TableProps> & Readonly<{}>, "scrollTop" | ("class" | "size" | "grid" | "loading" | "fixedHeader" | "fixedColumn" | "striped" | "flush" | "maxHeight" | "virtualScrolling")> & import("vue").ShallowUnwrapRef<{
|
|
112
95
|
scrollTop: () => void;
|
|
113
96
|
}> & {} & import("vue").ComponentCustomProperties & {} & {
|
|
114
97
|
$slots: {
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Size } from '@/utils/sizes';
|
|
3
|
-
type __VLS_Props = {
|
|
4
|
-
size?: Size;
|
|
5
|
-
fixedHeader?: boolean;
|
|
6
|
-
fixedColumn?: boolean;
|
|
7
|
-
striped?: boolean;
|
|
8
|
-
flush?: boolean;
|
|
9
|
-
class?: ClassNameValue;
|
|
10
|
-
maxHeight?: number;
|
|
11
|
-
loading?: boolean;
|
|
12
|
-
virtualScrolling?: boolean;
|
|
13
|
-
};
|
|
1
|
+
import { TableProps } from '@/services/table/types';
|
|
14
2
|
declare function scrollTop(): void;
|
|
15
3
|
declare function __VLS_template(): {
|
|
16
4
|
attrs: Partial<{}>;
|
|
@@ -24,11 +12,12 @@ declare function __VLS_template(): {
|
|
|
24
12
|
rootEl: any;
|
|
25
13
|
};
|
|
26
14
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
27
|
-
declare const __VLS_component: import("vue").DefineComponent<
|
|
15
|
+
declare const __VLS_component: import("vue").DefineComponent<TableProps, {
|
|
28
16
|
scrollTop: typeof scrollTop;
|
|
29
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<
|
|
30
|
-
class: string | false | 0 | 0n | ClassNameValue[] | null;
|
|
31
|
-
size:
|
|
17
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TableProps> & Readonly<{}>, {
|
|
18
|
+
class: string | false | 0 | 0n | import("tailwind-merge").ClassNameValue[] | null;
|
|
19
|
+
size: import("@/services/table/types").CellSize;
|
|
20
|
+
grid: boolean;
|
|
32
21
|
loading: boolean;
|
|
33
22
|
fixedHeader: boolean;
|
|
34
23
|
fixedColumn: boolean;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import { Size } from "@/utils/sizes";
|
|
2
|
+
import { ClassNameValue } from "tailwind-merge";
|
|
1
3
|
import { RouteLocationRaw } from "vue-router";
|
|
2
|
-
export type CellSize = 'none' |
|
|
4
|
+
export type CellSize = 'none' | Size;
|
|
3
5
|
export interface TableProps {
|
|
4
6
|
size?: CellSize;
|
|
5
|
-
flush?: boolean;
|
|
6
7
|
fixedHeader?: boolean;
|
|
7
8
|
fixedColumn?: boolean;
|
|
9
|
+
grid?: boolean;
|
|
8
10
|
striped?: boolean;
|
|
11
|
+
flush?: boolean;
|
|
12
|
+
class?: ClassNameValue;
|
|
13
|
+
maxHeight?: number;
|
|
14
|
+
loading?: boolean;
|
|
9
15
|
virtualScrolling?: boolean;
|
|
10
16
|
}
|
|
11
17
|
export type CellConfig = TableProps;
|
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@ const headTemplate = `<BaseTableHead>
|
|
|
35
35
|
</BaseTableRow>
|
|
36
36
|
</BaseTableHead>`;
|
|
37
37
|
|
|
38
|
-
const cellsTemplate = `<BaseTableCell
|
|
38
|
+
const cellsTemplate = `<BaseTableCell class="font-medium whitespace-nowrap">
|
|
39
39
|
{{ option.label }}
|
|
40
40
|
</BaseTableCell>
|
|
41
41
|
<BaseTableCell>
|
|
@@ -64,14 +64,11 @@ const components = {
|
|
|
64
64
|
const Template = (args) => ({
|
|
65
65
|
components: components,
|
|
66
66
|
setup() {
|
|
67
|
-
|
|
68
|
-
alert("hover");
|
|
69
|
-
}
|
|
70
|
-
return { args, optionsLarge, showAlert };
|
|
67
|
+
return { args, optionsLarge };
|
|
71
68
|
},
|
|
72
69
|
template: `
|
|
73
|
-
<div class="
|
|
74
|
-
<BaseTable class="w-full
|
|
70
|
+
<div class="">
|
|
71
|
+
<BaseTable class="w-full" v-bind="args">
|
|
75
72
|
${headTemplate}
|
|
76
73
|
<BaseTableBody>
|
|
77
74
|
<BaseTableRow
|
|
@@ -92,6 +89,11 @@ const Template = (args) => ({
|
|
|
92
89
|
export const Demo = Template.bind({});
|
|
93
90
|
Demo.args = {};
|
|
94
91
|
|
|
92
|
+
export const Grid = Template.bind({});
|
|
93
|
+
Grid.args = {
|
|
94
|
+
grid: true,
|
|
95
|
+
};
|
|
96
|
+
|
|
95
97
|
export const Striped = Template.bind({});
|
|
96
98
|
Striped.args = {
|
|
97
99
|
striped: true,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="relative">
|
|
2
|
+
<div class="relative max-w-full">
|
|
3
3
|
<div
|
|
4
4
|
ref="scrollableRef"
|
|
5
|
-
class="overflow-x-auto overflow-y-auto"
|
|
5
|
+
class="overflow-x-auto overflow-y-auto max-w-full"
|
|
6
6
|
data-scroll-lock-scrollable
|
|
7
7
|
:style="{ maxHeight: maxHeight ? maxHeight + 'px' : undefined }"
|
|
8
8
|
>
|
|
@@ -36,30 +36,21 @@
|
|
|
36
36
|
</template>
|
|
37
37
|
|
|
38
38
|
<script lang="ts" setup>
|
|
39
|
-
import {
|
|
39
|
+
import { twMerge } from 'tailwind-merge';
|
|
40
40
|
import { useScroll } from '@vueuse/core';
|
|
41
41
|
import BaseSpinnerLarge from '@/svg/BaseSpinnerLarge.vue';
|
|
42
|
-
import {
|
|
42
|
+
import { TableProps } from '@/services/table/types';
|
|
43
43
|
import { Ref } from 'vue';
|
|
44
44
|
|
|
45
45
|
defineOptions({
|
|
46
46
|
inheritAttrs: false,
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
const props = withDefaults(defineProps<{
|
|
50
|
-
size?: Size,
|
|
51
|
-
fixedHeader?: boolean,
|
|
52
|
-
fixedColumn?: boolean,
|
|
53
|
-
striped?: boolean,
|
|
54
|
-
flush?: boolean,
|
|
55
|
-
class?: ClassNameValue,
|
|
56
|
-
maxHeight?: number,
|
|
57
|
-
loading?: boolean,
|
|
58
|
-
virtualScrolling?: boolean,
|
|
59
|
-
}>(), {
|
|
49
|
+
const props = withDefaults(defineProps<TableProps>(), {
|
|
60
50
|
size: 'md',
|
|
61
51
|
fixedHeader: false,
|
|
62
52
|
fixedColumn: false,
|
|
53
|
+
grid: false,
|
|
63
54
|
striped: false,
|
|
64
55
|
flush: false,
|
|
65
56
|
class: undefined,
|
|
@@ -70,7 +61,7 @@ const props = withDefaults(defineProps<{
|
|
|
70
61
|
|
|
71
62
|
const classes = computed(() => {
|
|
72
63
|
|
|
73
|
-
const base = '
|
|
64
|
+
const base = 'text-sm';
|
|
74
65
|
|
|
75
66
|
if (!props.class) {
|
|
76
67
|
return base;
|
|
@@ -87,6 +87,7 @@ const cellConfig = computed<CellConfig>(() => {
|
|
|
87
87
|
size: baseTable?.value?.size,
|
|
88
88
|
flush: baseTable?.value?.flush,
|
|
89
89
|
head: isHead.value,
|
|
90
|
+
grid: baseTable?.value?.grid,
|
|
90
91
|
}
|
|
91
92
|
});
|
|
92
93
|
|
|
@@ -134,10 +135,11 @@ const classes = computed(() => {
|
|
|
134
135
|
const selected = baseTableRowSelected?.value;
|
|
135
136
|
|
|
136
137
|
const base = cellClasses(cellConfig.value);
|
|
137
|
-
const baseTd = 'relative
|
|
138
|
+
const baseTd = 'relative border-b group-last/row:border-b-0';
|
|
139
|
+
const baseTdGrid = baseTable?.value.grid ? 'border-r last:border-r-0' : '';
|
|
138
140
|
const click = clickable.value ? 'cursor-pointer' : '';
|
|
139
141
|
|
|
140
|
-
let backgroundColor = baseTableStriped.value ? 'group-even/row:bg-slate-
|
|
142
|
+
let backgroundColor = baseTableStriped.value ? 'group-even/row:bg-slate-50 group-odd/row:bg-white' : 'bg-white';
|
|
141
143
|
|
|
142
144
|
if (hovered) {
|
|
143
145
|
backgroundColor = 'bg-slate-100';
|
|
@@ -153,24 +155,21 @@ const classes = computed(() => {
|
|
|
153
155
|
borderColor = 'border-slate-300';
|
|
154
156
|
}
|
|
155
157
|
|
|
156
|
-
let borderColorRight = 'first:border-r-transparent';
|
|
157
|
-
|
|
158
158
|
const hasHorizontalScrolling = baseTable?.value.fixedColumn && baseTableHorizontalScrolling?.value;
|
|
159
|
-
if (hasHorizontalScrolling) {
|
|
160
|
-
borderColorRight = 'first:border-r-slate-200';
|
|
161
|
-
}
|
|
162
159
|
|
|
163
|
-
const horizontalScrolling =
|
|
160
|
+
const horizontalScrolling = baseTable?.value.fixedColumn ? "first:sticky first:z-[1] first:left-0" : '';
|
|
161
|
+
const horizontalScrollingActive = hasHorizontalScrolling ? "first:after:content-[''] first:after:absolute first:after:h-full first:after:w-px first:after:bg-slate-200 first:after:top-0 first:after:-right-px" : '';
|
|
164
162
|
const flush = baseTable?.value.flush ? 'first:pl-0 last:pr-0' : '';
|
|
165
163
|
|
|
166
164
|
const internalClasses = [
|
|
167
165
|
base,
|
|
168
166
|
baseTd,
|
|
167
|
+
baseTdGrid,
|
|
169
168
|
click,
|
|
170
169
|
backgroundColor,
|
|
171
170
|
borderColor,
|
|
172
|
-
borderColorRight,
|
|
173
171
|
horizontalScrolling,
|
|
172
|
+
horizontalScrollingActive,
|
|
174
173
|
flush,
|
|
175
174
|
];
|
|
176
175
|
|
|
@@ -59,18 +59,23 @@ const thRef = ref<HTMLTableCellElement | null>(null);
|
|
|
59
59
|
|
|
60
60
|
const classes = computed(() => {
|
|
61
61
|
const base = cellClasses(cellConfig.value);
|
|
62
|
-
const baseTh = 'bg-white text-slate-500 border-b border-slate-
|
|
62
|
+
const baseTh = 'bg-white text-slate-500 border-b border-slate-200 group before:content-[""] before:absolute before:-bottom-px before:left-0 before:w-full before:h-px before:bg-slate-200 before:z-[1]';
|
|
63
|
+
const baseThGrid = baseTable?.value.grid ? 'border-r last:border-r-0' : '';
|
|
63
64
|
const sticky = baseTable?.value.fixedHeader ? 'sticky top-0 z-[2]' : '';
|
|
64
|
-
|
|
65
|
-
const
|
|
65
|
+
|
|
66
|
+
const hasHorizontalScrolling = baseTable?.value.fixedColumn && baseTableHorizontalScrolling?.value;
|
|
67
|
+
const horizontalScrolling = baseTable?.value.fixedColumn ? "first:sticky first:z-[3] first:left-0" : '';
|
|
68
|
+
const horizontalScrollingActive = hasHorizontalScrolling ? "first:after:content-[''] first:after:absolute first:after:h-full first:after:w-px first:after:bg-slate-200 first:after:top-0 first:after:-right-px" : '';
|
|
69
|
+
|
|
66
70
|
const flush = baseTable?.value.flush ? 'first:pl-0 last:pr-0' : '';
|
|
67
71
|
|
|
68
72
|
const internalClasses = [
|
|
69
73
|
base,
|
|
70
74
|
baseTh,
|
|
75
|
+
baseThGrid,
|
|
71
76
|
sticky,
|
|
72
|
-
firstCol,
|
|
73
77
|
horizontalScrolling,
|
|
78
|
+
horizontalScrollingActive,
|
|
74
79
|
flush,
|
|
75
80
|
];
|
|
76
81
|
|
|
@@ -9,6 +9,10 @@ export function cellClasses(config: CellConfig): string {
|
|
|
9
9
|
|
|
10
10
|
function size(size: CellSize): string {
|
|
11
11
|
|
|
12
|
+
if (size == 'none') {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
if (size == 'xs') {
|
|
13
17
|
return 'px-1 py-0.5';
|
|
14
18
|
}
|
|
@@ -25,5 +29,9 @@ function size(size: CellSize): string {
|
|
|
25
29
|
return 'px-4 py-3';
|
|
26
30
|
}
|
|
27
31
|
|
|
32
|
+
if (size == 'xl') {
|
|
33
|
+
return 'px-6 py-4';
|
|
34
|
+
}
|
|
35
|
+
|
|
28
36
|
return '';
|
|
29
37
|
}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
+
import { Size } from "@/utils/sizes";
|
|
2
|
+
import { ClassNameValue } from "tailwind-merge";
|
|
1
3
|
import { RouteLocationRaw } from "vue-router";
|
|
2
4
|
|
|
3
|
-
export type CellSize = 'none' |
|
|
5
|
+
export type CellSize = 'none' | Size;
|
|
4
6
|
|
|
5
7
|
export interface TableProps {
|
|
6
|
-
size?: CellSize
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
striped?: boolean
|
|
11
|
-
|
|
8
|
+
size?: CellSize,
|
|
9
|
+
fixedHeader?: boolean,
|
|
10
|
+
fixedColumn?: boolean,
|
|
11
|
+
grid?: boolean,
|
|
12
|
+
striped?: boolean,
|
|
13
|
+
flush?: boolean,
|
|
14
|
+
class?: ClassNameValue,
|
|
15
|
+
maxHeight?: number,
|
|
16
|
+
loading?: boolean,
|
|
17
|
+
virtualScrolling?: boolean,
|
|
12
18
|
}
|
|
13
19
|
|
|
14
20
|
export type CellConfig = TableProps;
|