Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinVandy committed Feb 23, 2024
1 parent 4c89350 commit a9f5483
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
39 changes: 23 additions & 16 deletions examples/svelte/filtering/src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<script lang="ts">
import './index.css';
import { writable } from 'svelte/store';
import './index.css'
import { writable } from 'svelte/store'
import './index.css';
import './index.css'
import {
createSvelteTable,
flexRender,
getCoreRowModel,
getFilteredRowModel,
getPaginationRowModel,
type FilterFn
} from '@tanstack/svelte-table';
getFilteredRowModel,
getPaginationRowModel,
type FilterFn,
} from '@tanstack/svelte-table'
import { type RankingInfo, rankItem } from '@tanstack/match-sorter-utils';
import { type RankingInfo, rankItem } from '@tanstack/match-sorter-utils'
import { makeData, type Person } from './makeData';
import { makeData, type Person } from './makeData'
declare module '@tanstack/table-core' {
interface FilterFns {
fuzzy: FilterFn<unknown>;
fuzzy: FilterFn<unknown>
}
interface FilterMeta {
itemRank: RankingInfo;
itemRank: RankingInfo
}
}
Expand All @@ -43,11 +43,11 @@ import './index.css';
data: makeData(25),
columns: [
{
accessorFn: (row) => `${row.firstName} ${row.lastName}`,
accessorFn: row => `${row.firstName} ${row.lastName}`,
id: 'fullName',
header: 'Name',
cell: (info) => info.getValue(),
footer: (props) => props.column.id,
cell: info => info.getValue(),
footer: props => props.column.id,
filterFn: 'fuzzy',
},
],
Expand All @@ -63,7 +63,14 @@ import './index.css';
const table = createSvelteTable(options)
</script>
<input type="text" placeholder="Global filter" class="border w-full p-1" bind:value={globalFilter} on:keyup={(e) => $table.setGlobalFilter(String(e.target.value))} />

<input
type="text"
placeholder="Global filter"
class="border w-full p-1"
bind:value={globalFilter}
on:keyup={e => $table.setGlobalFilter(String(e.target.value))}
/>
<div class="h-2" />
<table class="w-full">
<thead>
Expand Down Expand Up @@ -99,4 +106,4 @@ import './index.css';
</tbody>
</table>
<div class="h-2" />
<pre>"globalFilter": "{$table.getState().globalFilter}"</pre>
<pre>"globalFilter": "{$table.getState().globalFilter}"</pre>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@
"typescript": "5.3.3",
"vitest": "^1.2.0"
}
}
}

0 comments on commit a9f5483

Please sign in to comment.