@kikiloaw/simple-table 1.0.0
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/LICENSE +21 -0
- package/README.md +731 -0
- package/package.json +32 -0
- package/src/SimpleTable.vue +795 -0
- package/src/components/table/Table.vue +25 -0
- package/src/components/table/TableBody.vue +23 -0
- package/src/components/table/TableCell.vue +23 -0
- package/src/components/table/TableHead.vue +28 -0
- package/src/components/table/TableHeader.vue +20 -0
- package/src/components/table/TableRow.vue +28 -0
- package/src/components/table/index.ts +6 -0
- package/src/index.d.ts +6 -0
- package/src/index.js +33 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { type HTMLAttributes, computed } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes['class']
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const delegatedProps = computed(() => {
|
|
10
|
+
const { class: _, ...delegated } = props
|
|
11
|
+
|
|
12
|
+
return delegated
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div class="relative w-full overflow-auto">
|
|
18
|
+
<table
|
|
19
|
+
:class="cn('w-full caption-bottom text-sm', props.class)"
|
|
20
|
+
v-bind="delegatedProps"
|
|
21
|
+
>
|
|
22
|
+
<slot />
|
|
23
|
+
</table>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { type HTMLAttributes, computed } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes['class']
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const delegatedProps = computed(() => {
|
|
10
|
+
const { class: _, ...delegated } = props
|
|
11
|
+
|
|
12
|
+
return delegated
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<tbody
|
|
18
|
+
:class="cn('[&_tr:last-child]:border-0', props.class)"
|
|
19
|
+
v-bind="delegatedProps"
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</tbody>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { type HTMLAttributes, computed } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes['class']
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const delegatedProps = computed(() => {
|
|
10
|
+
const { class: _, ...delegated } = props
|
|
11
|
+
|
|
12
|
+
return delegated
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<td
|
|
18
|
+
:class="cn('p-4 align-middle [&:has([role=checkbox])]:pr-0', props.class)"
|
|
19
|
+
v-bind="delegatedProps"
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</td>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { type HTMLAttributes, computed } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes['class']
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const delegatedProps = computed(() => {
|
|
10
|
+
const { class: _, ...delegated } = props
|
|
11
|
+
|
|
12
|
+
return delegated
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<th
|
|
18
|
+
:class="
|
|
19
|
+
cn(
|
|
20
|
+
'h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0',
|
|
21
|
+
props.class,
|
|
22
|
+
)
|
|
23
|
+
"
|
|
24
|
+
v-bind="delegatedProps"
|
|
25
|
+
>
|
|
26
|
+
<slot />
|
|
27
|
+
</th>
|
|
28
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { type HTMLAttributes, computed } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes['class']
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const delegatedProps = computed(() => {
|
|
10
|
+
const { class: _, ...delegated } = props
|
|
11
|
+
|
|
12
|
+
return delegated
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<thead :class="cn('[&_tr]:border-b', props.class)" v-bind="delegatedProps">
|
|
18
|
+
<slot />
|
|
19
|
+
</thead>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { type HTMLAttributes, computed } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes['class']
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const delegatedProps = computed(() => {
|
|
10
|
+
const { class: _, ...delegated } = props
|
|
11
|
+
|
|
12
|
+
return delegated
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<tr
|
|
18
|
+
:class="
|
|
19
|
+
cn(
|
|
20
|
+
'border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted',
|
|
21
|
+
props.class,
|
|
22
|
+
)
|
|
23
|
+
"
|
|
24
|
+
v-bind="delegatedProps"
|
|
25
|
+
>
|
|
26
|
+
<slot />
|
|
27
|
+
</tr>
|
|
28
|
+
</template>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Table } from './Table.vue'
|
|
2
|
+
export { default as TableBody } from './TableBody.vue'
|
|
3
|
+
export { default as TableCell } from './TableCell.vue'
|
|
4
|
+
export { default as TableHead } from './TableHead.vue'
|
|
5
|
+
export { default as TableHeader } from './TableHeader.vue'
|
|
6
|
+
export { default as TableRow } from './TableRow.vue'
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Main entry point for SimpleTable package
|
|
2
|
+
import SimpleTable from './SimpleTable.vue'
|
|
3
|
+
import Table from './components/table/Table.vue'
|
|
4
|
+
import TableBody from './components/table/TableBody.vue'
|
|
5
|
+
import TableCell from './components/table/TableCell.vue'
|
|
6
|
+
import TableHead from './components/table/TableHead.vue'
|
|
7
|
+
import TableHeader from './components/table/TableHeader.vue'
|
|
8
|
+
import TableRow from './components/table/TableRow.vue'
|
|
9
|
+
|
|
10
|
+
// Export the main component
|
|
11
|
+
export default SimpleTable
|
|
12
|
+
|
|
13
|
+
// Named exports for flexibility
|
|
14
|
+
export {
|
|
15
|
+
SimpleTable,
|
|
16
|
+
Table,
|
|
17
|
+
TableBody,
|
|
18
|
+
TableCell,
|
|
19
|
+
TableHead,
|
|
20
|
+
TableHeader,
|
|
21
|
+
TableRow
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Vue plugin install function
|
|
25
|
+
export function install(app) {
|
|
26
|
+
app.component('SimpleTable', SimpleTable)
|
|
27
|
+
app.component('Table', Table)
|
|
28
|
+
app.component('TableBody', TableBody)
|
|
29
|
+
app.component('TableCell', TableCell)
|
|
30
|
+
app.component('TableHead', TableHead)
|
|
31
|
+
app.component('TableHeader', TableHeader)
|
|
32
|
+
app.component('TableRow', TableRow)
|
|
33
|
+
}
|