Skip to content

Commit b52e3aa

Browse files
committed
feat: enable solid-table publishing and update examples
1 parent 357d582 commit b52e3aa

File tree

32 files changed

+495
-579
lines changed

32 files changed

+495
-579
lines changed

examples/solid/basic-app-table/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
"noUnusedParameters": true,
2222
"noFallthroughCasesInSwitch": true
2323
},
24-
"include": ["src"]
24+
"include": ["src", "vite.config.ts"]
2525
}

examples/solid/basic-external-state/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import {
22
createColumnHelper,
33
createPaginatedRowModel,
44
createSortedRowModel,
5+
createTable,
56
flexRender,
67
rowPaginationFeature,
78
rowSortingFeature,
89
sortFns,
910
tableFeatures,
10-
createTable,
1111
} from '@tanstack/solid-table'
1212
import { For, createSignal } from 'solid-js'
1313
import { makeData } from './makeData'

examples/solid/basic-external-state/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
"noUnusedParameters": true,
2222
"noFallthroughCasesInSwitch": true
2323
},
24-
"include": ["src"]
24+
"include": ["src", "vite.config.ts"]
2525
}

examples/solid/basic-external-store/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
"noUnusedParameters": true,
2222
"noFallthroughCasesInSwitch": true
2323
},
24-
"include": ["src"]
24+
"include": ["src", "vite.config.ts"]
2525
}

examples/solid/basic-use-table/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
"noUnusedParameters": true,
2222
"noFallthroughCasesInSwitch": true
2323
},
24-
"include": ["src"]
24+
"include": ["src", "vite.config.ts"]
2525
}

examples/solid/column-groups/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
"noUnusedParameters": true,
2222
"noFallthroughCasesInSwitch": true
2323
},
24-
"include": ["src"]
24+
"include": ["src", "vite.config.ts"]
2525
}

examples/solid/column-ordering/src/App.tsx

Lines changed: 93 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -87,117 +87,106 @@ function App() {
8787
}
8888

8989
return (
90-
<table.Subscribe
91-
selector={(state) => ({
92-
columnOrder: state.columnOrder,
93-
columnVisibility: state.columnVisibility,
94-
})}
95-
>
96-
{(_state) => (
97-
<div class="p-2">
98-
<div class="inline-block border border-black shadow rounded">
99-
<div class="px-1 border-b border-black">
90+
<div class="p-2">
91+
<div class="inline-block border border-black shadow rounded">
92+
<div class="px-1 border-b border-black">
93+
<label>
94+
<input
95+
checked={table.getIsAllColumnsVisible()}
96+
onChange={table.getToggleAllColumnsVisibilityHandler()}
97+
type="checkbox"
98+
/>{' '}
99+
Toggle All
100+
</label>
101+
</div>
102+
<For each={table.getAllLeafColumns()}>
103+
{(column) => (
104+
<div class="px-1">
100105
<label>
101106
<input
102-
checked={table.getIsAllColumnsVisible()}
103-
onChange={table.getToggleAllColumnsVisibilityHandler()}
107+
checked={column.getIsVisible()}
108+
onChange={column.getToggleVisibilityHandler()}
104109
type="checkbox"
105110
/>{' '}
106-
Toggle All
111+
{column.id}
107112
</label>
108113
</div>
109-
<For each={table.getAllLeafColumns()}>
110-
{(column) => (
111-
<div class="px-1">
112-
<label>
113-
<input
114-
checked={column.getIsVisible()}
115-
onChange={column.getToggleVisibilityHandler()}
116-
type="checkbox"
117-
/>{' '}
118-
{column.id}
119-
</label>
120-
</div>
121-
)}
122-
</For>
123-
</div>
124-
<div class="h-4" />
125-
<div class="flex flex-wrap gap-2">
126-
<button onClick={() => rerender()} class="border p-1">
127-
Regenerate
128-
</button>
129-
<button onClick={() => randomizeColumns()} class="border p-1">
130-
Shuffle Columns
131-
</button>
132-
</div>
133-
<div class="h-4" />
134-
<table>
135-
<thead>
136-
<For each={table.getHeaderGroups()}>
137-
{(headerGroup) => (
138-
<tr>
139-
<For each={headerGroup.headers}>
140-
{(header) => (
141-
<th colSpan={header.colSpan}>
142-
<Show when={!header.isPlaceholder}>
143-
{flexRender(
144-
header.column.columnDef.header,
145-
header.getContext(),
146-
)}
147-
</Show>
148-
</th>
149-
)}
150-
</For>
151-
</tr>
152-
)}
153-
</For>
154-
</thead>
155-
<tbody>
156-
<For each={table.getRowModel().rows}>
157-
{(row) => (
158-
<tr>
159-
<For each={row.getVisibleCells()}>
160-
{(cell) => (
161-
<td>
162-
{flexRender(
163-
cell.column.columnDef.cell,
164-
cell.getContext(),
165-
)}
166-
</td>
114+
)}
115+
</For>
116+
</div>
117+
<div class="h-4" />
118+
<div class="flex flex-wrap gap-2">
119+
<button onClick={() => rerender()} class="border p-1">
120+
Regenerate
121+
</button>
122+
<button onClick={() => randomizeColumns()} class="border p-1">
123+
Shuffle Columns
124+
</button>
125+
</div>
126+
<div class="h-4" />
127+
<table>
128+
<thead>
129+
<For each={table.getHeaderGroups()}>
130+
{(headerGroup) => (
131+
<tr>
132+
<For each={headerGroup.headers}>
133+
{(header) => (
134+
<th colSpan={header.colSpan}>
135+
<Show when={!header.isPlaceholder}>
136+
{flexRender(
137+
header.column.columnDef.header,
138+
header.getContext(),
139+
)}
140+
</Show>
141+
</th>
142+
)}
143+
</For>
144+
</tr>
145+
)}
146+
</For>
147+
</thead>
148+
<tbody>
149+
<For each={table.getRowModel().rows}>
150+
{(row) => (
151+
<tr>
152+
<For each={row.getVisibleCells()}>
153+
{(cell) => (
154+
<td>
155+
{flexRender(
156+
cell.column.columnDef.cell,
157+
cell.getContext(),
167158
)}
168-
</For>
169-
</tr>
170-
)}
171-
</For>
172-
</tbody>
173-
<tfoot>
174-
<For each={table.getFooterGroups()}>
175-
{(footerGroup) => (
176-
<tr>
177-
<For each={footerGroup.headers}>
178-
{(header) => (
179-
<th colSpan={header.colSpan}>
180-
<Show when={!header.isPlaceholder}>
181-
{flexRender(
182-
header.column.columnDef.footer,
183-
header.getContext(),
184-
)}
185-
</Show>
186-
</th>
187-
)}
188-
</For>
189-
</tr>
190-
)}
191-
</For>
192-
</tfoot>
193-
</table>
194-
<div class="h-4" />
195-
<table.Subscribe selector={(state) => state}>
196-
{(state) => <pre>{JSON.stringify(state(), null, 2)}</pre>}
197-
</table.Subscribe>
198-
</div>
199-
)}
200-
</table.Subscribe>
159+
</td>
160+
)}
161+
</For>
162+
</tr>
163+
)}
164+
</For>
165+
</tbody>
166+
<tfoot>
167+
<For each={table.getFooterGroups()}>
168+
{(footerGroup) => (
169+
<tr>
170+
<For each={footerGroup.headers}>
171+
{(header) => (
172+
<th colSpan={header.colSpan}>
173+
<Show when={!header.isPlaceholder}>
174+
{flexRender(
175+
header.column.columnDef.footer,
176+
header.getContext(),
177+
)}
178+
</Show>
179+
</th>
180+
)}
181+
</For>
182+
</tr>
183+
)}
184+
</For>
185+
</tfoot>
186+
</table>
187+
<div class="h-4" />
188+
<pre>{JSON.stringify(table.store.state, null, 2)}</pre>
189+
</div>
201190
)
202191
}
203192

examples/solid/column-ordering/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
"noUnusedParameters": true,
2222
"noFallthroughCasesInSwitch": true
2323
},
24-
"include": ["src"]
24+
"include": ["src", "vite.config.ts"]
2525
}

0 commit comments

Comments
 (0)