sprintify-ui 0.6.52 → 0.6.55
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 +3091 -2933
- package/dist/style.css +1 -1
- package/dist/tailwindcss/button.js +18 -18
- package/dist/types/src/components/BaseDataTableTemplate.vue.d.ts +230 -0
- package/dist/types/src/components/BaseTable.vue.d.ts +32 -203
- package/dist/types/src/components/BaseTableBody.vue.d.ts +9 -0
- package/dist/types/src/components/BaseTableCell.vue.d.ts +59 -0
- package/dist/types/src/components/BaseTableColumn.vue.d.ts +3 -3
- package/dist/types/src/components/BaseTableHead.vue.d.ts +21 -0
- package/dist/types/src/components/BaseTableHeader.vue.d.ts +22 -0
- package/dist/types/src/components/BaseTableRow.vue.d.ts +49 -0
- package/dist/types/src/components/index.d.ts +7 -2
- package/dist/types/src/services/table/classes.d.ts +2 -0
- package/dist/types/src/services/table/types.d.ts +15 -0
- package/package.json +1 -1
- package/src/components/BaseBadge.stories.js +1 -1
- package/src/components/BaseButton.stories.js +0 -5
- package/src/components/BaseButton.vue +1 -1
- package/src/components/BaseDataIteratorSectionColumns.vue +2 -2
- package/src/components/BaseDataTable.vue +4 -4
- package/src/components/BaseDataTableTemplate.vue +887 -0
- package/src/components/BaseTable.stories.js +108 -0
- package/src/components/BaseTable.vue +25 -874
- package/src/components/BaseTableBody.vue +15 -0
- package/src/components/BaseTableCell.vue +87 -0
- package/src/components/BaseTableHead.vue +23 -0
- package/src/components/BaseTableHeader.vue +56 -0
- package/src/components/BaseTableRow.vue +30 -0
- package/src/components/index.ts +12 -2
- package/src/services/table/classes.ts +26 -0
- package/src/services/table/types.ts +19 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<td class="p-0 border-b border-slate-200">
|
|
3
|
+
<component
|
|
4
|
+
:is="componentName"
|
|
5
|
+
:class="classes"
|
|
6
|
+
:to="propsInternal.to"
|
|
7
|
+
:href="propsInternal.href"
|
|
8
|
+
:title="propsInternal.title"
|
|
9
|
+
:target="propsInternal.target"
|
|
10
|
+
>
|
|
11
|
+
<slot />
|
|
12
|
+
</component>
|
|
13
|
+
</td>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script lang="ts" setup>
|
|
17
|
+
import { RouteLocationRaw } from 'vue-router';
|
|
18
|
+
import { TableProps, CellConfig, CellProps } from '../services/table/types'
|
|
19
|
+
import { cellClasses } from '../services/table/classes'
|
|
20
|
+
import { ClassNameValue, twMerge } from 'tailwind-merge';
|
|
21
|
+
import { cloneDeep, merge } from 'lodash';
|
|
22
|
+
import { ComputedRef } from 'vue';
|
|
23
|
+
|
|
24
|
+
defineOptions({
|
|
25
|
+
inheritAttrs: false,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const baseTable = inject('BaseTable') as ComputedRef<TableProps> | undefined;
|
|
29
|
+
const baseTableHead = inject('BaseTableHead', undefined);
|
|
30
|
+
const baseTableRow = inject('BaseTableRow', undefined) as ComputedRef<CellProps> | undefined;
|
|
31
|
+
|
|
32
|
+
if (!baseTableRow) {
|
|
33
|
+
throw new Error('BaseTableCell must be used within a BaseTableRow.');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const isHead = computed(() => baseTableHead !== undefined);
|
|
37
|
+
|
|
38
|
+
const props = withDefaults(defineProps<{
|
|
39
|
+
href?: string,
|
|
40
|
+
to?: RouteLocationRaw,
|
|
41
|
+
target?: '_blank' | '_self' | '_parent' | '_top',
|
|
42
|
+
title?: string,
|
|
43
|
+
class?: ClassNameValue,
|
|
44
|
+
}>(), {
|
|
45
|
+
href: undefined,
|
|
46
|
+
to: undefined,
|
|
47
|
+
target: undefined,
|
|
48
|
+
title: undefined,
|
|
49
|
+
class: undefined,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const cellConfig = computed<CellConfig>(() => {
|
|
53
|
+
return {
|
|
54
|
+
spacing: baseTable?.value?.spacing,
|
|
55
|
+
flush: baseTable?.value?.flush,
|
|
56
|
+
head: isHead.value,
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const propsInternal = computed<CellProps>(() => {
|
|
61
|
+
return merge(cloneDeep(baseTableRow.value), props);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const componentName = computed(() => {
|
|
65
|
+
if (propsInternal.value.href) {
|
|
66
|
+
return 'a';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (propsInternal.value.to) {
|
|
70
|
+
return 'router-link';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return 'div';
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const classes = computed(() => {
|
|
77
|
+
const base = cellClasses(cellConfig.value);
|
|
78
|
+
const click = propsInternal.value.href || propsInternal.value.to ? 'cursor-pointer' : '';
|
|
79
|
+
|
|
80
|
+
return twMerge(
|
|
81
|
+
base,
|
|
82
|
+
click,
|
|
83
|
+
props.class,
|
|
84
|
+
);
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
</script>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<thead>
|
|
3
|
+
<slot />
|
|
4
|
+
</thead>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<{
|
|
10
|
+
sticky?: boolean,
|
|
11
|
+
}>(), {
|
|
12
|
+
sticky: false,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const baseTable = inject('BaseTable');
|
|
16
|
+
|
|
17
|
+
if (!baseTable) {
|
|
18
|
+
throw new Error('BaseTableHead must be used within a BaseTable.');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
provide('BaseTableHead', computed(() => props));
|
|
22
|
+
|
|
23
|
+
</script>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<th class="p-0 border-b border-slate-200">
|
|
3
|
+
<div :class="classes">
|
|
4
|
+
<slot />
|
|
5
|
+
</div>
|
|
6
|
+
</th>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
import { cellClasses } from '@/services/table/classes';
|
|
11
|
+
import { CellConfig, TableProps } from '@/services/table/types';
|
|
12
|
+
import { ClassNameValue, twMerge } from 'tailwind-merge';
|
|
13
|
+
import { ComputedRef } from 'vue';
|
|
14
|
+
|
|
15
|
+
const baseTable = inject('BaseTable') as ComputedRef<TableProps> | undefined;
|
|
16
|
+
const baseTableHead = inject('BaseTableHead', undefined);
|
|
17
|
+
const baseTableRow = inject('BaseTableRow');
|
|
18
|
+
|
|
19
|
+
if (!baseTableRow) {
|
|
20
|
+
throw new Error('BaseTableCell must be used within a BaseTableRow.');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!baseTableHead) {
|
|
24
|
+
throw new Error('BaseTableCell must be used within a BaseTableHead.');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
defineOptions({
|
|
28
|
+
inheritAttrs: false,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const props = withDefaults(defineProps<{
|
|
32
|
+
class?: ClassNameValue,
|
|
33
|
+
}>(), {
|
|
34
|
+
class: undefined,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const cellConfig = computed<CellConfig>(() => {
|
|
38
|
+
return {
|
|
39
|
+
spacing: baseTable?.value?.spacing,
|
|
40
|
+
flush: baseTable?.value?.flush,
|
|
41
|
+
head: true,
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const classes = computed(() => {
|
|
46
|
+
const base = cellClasses(cellConfig.value);
|
|
47
|
+
|
|
48
|
+
return twMerge(
|
|
49
|
+
'text-slate-500 font-normal',
|
|
50
|
+
base,
|
|
51
|
+
props.class,
|
|
52
|
+
);
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tr>
|
|
3
|
+
<slot />
|
|
4
|
+
</tr>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { RouteLocationRaw } from 'vue-router';
|
|
9
|
+
|
|
10
|
+
const baseTable = inject('BaseTable');
|
|
11
|
+
|
|
12
|
+
if (!baseTable) {
|
|
13
|
+
throw new Error('baseTable must be used within a BaseTable.');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(defineProps<{
|
|
17
|
+
href?: string,
|
|
18
|
+
to?: RouteLocationRaw,
|
|
19
|
+
target?: '_blank' | '_self' | '_parent' | '_top',
|
|
20
|
+
title?: string,
|
|
21
|
+
}>(), {
|
|
22
|
+
href: undefined,
|
|
23
|
+
to: undefined,
|
|
24
|
+
target: undefined,
|
|
25
|
+
title: undefined,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
provide('BaseTableRow', computed(() => props));
|
|
29
|
+
|
|
30
|
+
</script>
|
package/src/components/index.ts
CHANGED
|
@@ -79,11 +79,16 @@ import BaseStepper from './BaseStepper.vue';
|
|
|
79
79
|
import BaseStepperItem from './BaseStepperItem.vue';
|
|
80
80
|
import BaseSwitch from './BaseSwitch.vue';
|
|
81
81
|
import BaseSystemAlert from './BaseSystemAlert.vue';
|
|
82
|
+
import BaseTable from './BaseTable.vue';
|
|
83
|
+
import BaseTableBody from './BaseTableBody.vue';
|
|
84
|
+
import BaseTableCell from './BaseTableCell.vue';
|
|
85
|
+
import BaseTableHead from './BaseTableHead.vue';
|
|
86
|
+
import BaseTableHeader from './BaseTableHeader.vue';
|
|
87
|
+
import BaseTableRow from './BaseTableRow.vue';
|
|
82
88
|
import BaseTabs from './BaseTabs.vue';
|
|
83
89
|
import BaseTabItem from './BaseTabItem.vue';
|
|
84
90
|
import BaseTagAutocomplete from './BaseTagAutocomplete.vue';
|
|
85
91
|
import BaseTagAutocompleteFetch from './BaseTagAutocompleteFetch.vue';
|
|
86
|
-
import BaseTable from './BaseTable.vue';
|
|
87
92
|
import BaseTableColumn from './BaseTableColumn.vue';
|
|
88
93
|
import BaseTextarea from './BaseTextarea.vue';
|
|
89
94
|
import BaseTextareaAutoresize from './BaseTextareaAutoresize.vue';
|
|
@@ -179,11 +184,16 @@ export {
|
|
|
179
184
|
BaseStepperItem,
|
|
180
185
|
BaseSwitch,
|
|
181
186
|
BaseSystemAlert,
|
|
187
|
+
BaseTable,
|
|
188
|
+
BaseTableBody,
|
|
189
|
+
BaseTableCell,
|
|
190
|
+
BaseTableHead,
|
|
191
|
+
BaseTableHeader,
|
|
192
|
+
BaseTableRow,
|
|
182
193
|
BaseTabs,
|
|
183
194
|
BaseTabItem,
|
|
184
195
|
BaseTagAutocomplete,
|
|
185
196
|
BaseTagAutocompleteFetch,
|
|
186
|
-
BaseTable,
|
|
187
197
|
BaseTableColumn,
|
|
188
198
|
BaseTextarea,
|
|
189
199
|
BaseTextareaAutoresize,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { twMerge } from "tailwind-merge";
|
|
2
|
+
import { CellConfig, CellSpacing } from "./types";
|
|
3
|
+
|
|
4
|
+
export function cellClasses(config: CellConfig): string {
|
|
5
|
+
const base = 'text-left block';
|
|
6
|
+
const space = spacing(config.spacing ?? 'md');
|
|
7
|
+
const flush = config.flush ? 'px-0' : '';
|
|
8
|
+
|
|
9
|
+
return twMerge([base, space, flush]);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function spacing(spacing: CellSpacing): string {
|
|
13
|
+
if (spacing == 'sm') {
|
|
14
|
+
return 'px-1 py-0.5';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (spacing == 'md') {
|
|
18
|
+
return 'px-2 py-2';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (spacing == 'lg') {
|
|
22
|
+
return 'px-4 py-3';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RouteLocationRaw } from "vue-router";
|
|
2
|
+
|
|
3
|
+
export type CellSpacing = 'none' | 'sm' | 'md' | 'lg';
|
|
4
|
+
|
|
5
|
+
export interface TableProps {
|
|
6
|
+
spacing?: CellSpacing;
|
|
7
|
+
flush?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type CellConfig = {
|
|
11
|
+
flush?: boolean;
|
|
12
|
+
} & TableProps;
|
|
13
|
+
|
|
14
|
+
export interface CellProps {
|
|
15
|
+
title?: string;
|
|
16
|
+
href?: string;
|
|
17
|
+
to?: RouteLocationRaw;
|
|
18
|
+
target?: string;
|
|
19
|
+
}
|