Skip to content

Commit 3f5e95d

Browse files
chore: wip
1 parent 6cff6e2 commit 3f5e95d

File tree

5 files changed

+541
-236
lines changed

5 files changed

+541
-236
lines changed

resources/views/table/index.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script setup lang="ts">
2+
import TableV2 from '../../../storage/framework/core/components/table/src/components/MainTable.vue'
3+
</script>
4+
5+
<template>
6+
<TableV2 columns="id, name, email, job_title" type="users" />
7+
</template>

storage/framework/core/components/table/src/components/MainTable.vue

Lines changed: 44 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import type { Hits, SearchResponse } from '@stacksjs/types'
33
import { isString } from '@stacksjs/validation'
4-
import { useTable } from '../functions/table'
4+
import test from '../functions/table'
55
66
interface Props {
77
type: string // the Meilisearch index you would like to use for this table
@@ -50,87 +50,68 @@ const {
5050
selectedAll = false,
5151
} = defineProps<Props>()
5252
53-
const parsedColumns = computed((): string[] => {
54-
if (isString(columns))
55-
return (columns as string).split(',').map(col => col.trim())
53+
// const parsedColumns = computed((): string[] => {
54+
// if (isString(columns))
55+
// return (columns as string).split(',').map(col => col.trim())
5656
57-
return columns as string[]
58-
})
57+
// return columns as string[]
58+
// })
5959
60-
const parsedSorts = computed((): string[] => {
61-
if (isString(sorts))
62-
return (sorts as string).split(',').map(col => col.trim())
60+
// const parsedSorts = computed((): string[] => {
61+
// if (isString(sorts))
62+
// return (sorts as string).split(',').map(col => col.trim())
6363
64-
return sorts as string[]
65-
})
64+
// return sorts as string[]
65+
// })
6666
67-
const parsedFilters = computed((): string[] => {
68-
if (isString(filters))
69-
return (filters as string).split(',').map(col => col.trim())
67+
// const parsedFilters = computed((): string[] => {
68+
// if (isString(filters))
69+
// return (filters as string).split(',').map(col => col.trim())
7070
71-
return filters as string[]
72-
})
71+
// return filters as string[]
72+
// })
7373
74-
const itemsPerPage = computed((): number => {
75-
if (isString(perPage))
76-
return Number.parseInt(perPage as string)
74+
// const itemsPerPage = computed((): number => {
75+
// if (isString(perPage))
76+
// return Number.parseInt(perPage as string)
7777
78-
return perPage as number
79-
})
78+
// return perPage as number
79+
// })
8080
8181
// let's use (init) the table by passing the default state
82-
const { table, search, columnName } = await useTable({
83-
source,
84-
password,
85-
type,
86-
columns: parsedColumns.value,
87-
searchable,
88-
query,
89-
sortable,
90-
sort,
91-
sorts: parsedSorts.value,
92-
filterable,
93-
filters: parsedFilters.value,
94-
actionable,
95-
actions,
96-
perPage: itemsPerPage.value,
97-
currentPage: 1,
98-
selectable: true,
99-
selectedRows: [],
100-
selectedAll: false,
101-
})
82+
// const { test } = await useTable()
10283
10384
// let's run the initial search upon page view/load
10485
10586
// console.log('running initial search')
106-
const results = await search()
87+
// const results = await search()
10788
// eslint-disable-next-line no-console
108-
console.log('initial search complete', results)
89+
// console.log('initial search complete', results)
10990
11091
// now that we have the search results, let's update/set the state of the table
111-
table.source = source
112-
table.password = password
113-
table.hits = results?.hits
114-
table.type = type
115-
table.columns = parsedColumns.value
116-
table.searchable = searchable
117-
table.query = query
118-
table.filterable = filterable
119-
table.filters = parsedFilters.value
120-
table.sortable = sortable
121-
table.sort = sort
122-
table.sorts = parsedSorts.value
123-
table.perPage = itemsPerPage.value
124-
table.actionable = actionable
125-
table.actions = actions
126-
table.selectable = selectable
127-
table.selectedRows = selectedRows
128-
table.selectedAll = selectedAll
129-
table.results = results as SearchResponse
92+
// table.source = source
93+
// table.password = password
94+
// table.hits = results?.hits
95+
// table.type = type
96+
// table.columns = parsedColumns.value
97+
// table.searchable = searchable
98+
// table.query = query
99+
// table.filterable = filterable
100+
// table.filters = parsedFilters.value
101+
// table.sortable = sortable
102+
// table.sort = sort
103+
// table.sorts = parsedSorts.value
104+
// table.perPage = itemsPerPage.value
105+
// table.actionable = actionable
106+
// table.actions = actions
107+
// table.selectable = selectable
108+
// table.selectedRows = selectedRows
109+
// table.selectedAll = selectedAll
110+
// table.results = results as SearchResponse
130111
</script>
131112

132113
<template>
133-
<div class="px-4 lg:px-8 sm:px-6">
114+
<div class="px-4 lg:px-8 sm:px-6">
134115
<div class="mt-8 flex flex-col">
135116
<div class="overflow-x-auto -mx-4 -my-2 lg:-mx-8 sm:-mx-6">
136117
<div class="inline-block min-w-full py-2 align-middle lg:px-8 md:px-6">

0 commit comments

Comments
 (0)