@tanstack/svelte-table 9.0.0-alpha.4 → 9.0.0-alpha.6
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/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/render-component.d.ts +6 -6
- package/dist/render-component.js +1 -1
- package/dist/table.svelte.d.ts +2 -2
- package/dist/table.svelte.js +4 -4
- package/package.json +4 -4
- package/src/index.ts +1 -1
- package/src/render-component.ts +6 -6
- package/src/table.svelte.ts +4 -4
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Component, ComponentProps } from 'svelte';
|
|
2
2
|
/**
|
|
3
3
|
* A helper class to make it easy to identify Svelte components in `columnDef.cell` and `columnDef.header` properties.
|
|
4
4
|
* @example
|
|
@@ -8,10 +8,10 @@ import type { SvelteComponent, ComponentType, ComponentProps } from 'svelte';
|
|
|
8
8
|
* {/if}
|
|
9
9
|
* ```
|
|
10
10
|
* */
|
|
11
|
-
export declare class RenderComponentConfig<TComponent extends
|
|
12
|
-
component:
|
|
13
|
-
props: ComponentProps<TComponent
|
|
14
|
-
constructor(component:
|
|
11
|
+
export declare class RenderComponentConfig<TComponent extends Component<any>> {
|
|
12
|
+
component: TComponent;
|
|
13
|
+
props: ComponentProps<TComponent>;
|
|
14
|
+
constructor(component: TComponent, props: ComponentProps<TComponent>);
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* A helper function to help create cells from Svelte components through ColumnDef's `cell` and `header` properties.
|
|
@@ -32,4 +32,4 @@ export declare class RenderComponentConfig<TComponent extends SvelteComponent> {
|
|
|
32
32
|
* ```
|
|
33
33
|
* @see {@link https://tanstack.com/table/latest/docs/guide/column-defs}
|
|
34
34
|
*/
|
|
35
|
-
export declare const renderComponent: <TComponent extends
|
|
35
|
+
export declare const renderComponent: <TComponent extends Component<any, {}, string>>(component: TComponent, props: ComponentProps<TComponent>) => RenderComponentConfig<TComponent>;
|
package/dist/render-component.js
CHANGED
package/dist/table.svelte.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type RowData, type TableOptions } from '@tanstack/table-core';
|
|
|
6
6
|
* @example
|
|
7
7
|
* ```svelte
|
|
8
8
|
* <script>
|
|
9
|
-
* const table =
|
|
9
|
+
* const table = createTable({ ... })
|
|
10
10
|
* </script>
|
|
11
11
|
*
|
|
12
12
|
* <table>
|
|
@@ -25,4 +25,4 @@ import { type RowData, type TableOptions } from '@tanstack/table-core';
|
|
|
25
25
|
* </table>
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
export declare function
|
|
28
|
+
export declare function createTable<TData extends RowData>(options: TableOptions<TData>): import("@tanstack/table-core").Table<TData>;
|
package/dist/table.svelte.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _createTable, } from '@tanstack/table-core';
|
|
2
2
|
/**
|
|
3
3
|
* Creates a reactive TanStack table object for Svelte.
|
|
4
4
|
* @param options Table options to create the table with.
|
|
@@ -6,7 +6,7 @@ import { createTable, } from '@tanstack/table-core';
|
|
|
6
6
|
* @example
|
|
7
7
|
* ```svelte
|
|
8
8
|
* <script>
|
|
9
|
-
* const table =
|
|
9
|
+
* const table = createTable({ ... })
|
|
10
10
|
* </script>
|
|
11
11
|
*
|
|
12
12
|
* <table>
|
|
@@ -25,7 +25,7 @@ import { createTable, } from '@tanstack/table-core';
|
|
|
25
25
|
* </table>
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
export function
|
|
28
|
+
export function createTable(options) {
|
|
29
29
|
const resolvedOptions = mergeObjects({
|
|
30
30
|
state: {},
|
|
31
31
|
onStateChange() { },
|
|
@@ -34,7 +34,7 @@ export function createSvelteTable(options) {
|
|
|
34
34
|
return mergeObjects(defaultOptions, options);
|
|
35
35
|
},
|
|
36
36
|
}, options);
|
|
37
|
-
const table =
|
|
37
|
+
const table = _createTable(resolvedOptions);
|
|
38
38
|
let state = $state(table.initialState);
|
|
39
39
|
function updateOptions() {
|
|
40
40
|
table.setOptions(prev => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/svelte-table",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.6",
|
|
4
4
|
"description": "Headless UI for building powerful tables & datagrids for Svelte.",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"src"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@tanstack/table-core": "9.0.0-alpha.
|
|
43
|
+
"@tanstack/table-core": "9.0.0-alpha.6"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@sveltejs/package": "^2.3.
|
|
46
|
+
"@sveltejs/package": "^2.3.2",
|
|
47
47
|
"@sveltejs/vite-plugin-svelte": "^4.0.0-next",
|
|
48
48
|
"svelte": "^5.0.0-next",
|
|
49
|
-
"svelte-check": "^3.
|
|
49
|
+
"svelte-check": "^3.8.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"svelte": "^5.0.0-next"
|
package/src/index.ts
CHANGED
package/src/render-component.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Component, ComponentProps } from 'svelte'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A helper class to make it easy to identify Svelte components in `columnDef.cell` and `columnDef.header` properties.
|
|
@@ -9,10 +9,10 @@ import type { SvelteComponent, ComponentType, ComponentProps } from 'svelte'
|
|
|
9
9
|
* {/if}
|
|
10
10
|
* ```
|
|
11
11
|
* */
|
|
12
|
-
export class RenderComponentConfig<TComponent extends
|
|
12
|
+
export class RenderComponentConfig<TComponent extends Component<any>> {
|
|
13
13
|
constructor(
|
|
14
|
-
public component:
|
|
15
|
-
public props: ComponentProps<TComponent>
|
|
14
|
+
public component: TComponent,
|
|
15
|
+
public props: ComponentProps<TComponent>
|
|
16
16
|
) {}
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -35,7 +35,7 @@ export class RenderComponentConfig<TComponent extends SvelteComponent> {
|
|
|
35
35
|
* ```
|
|
36
36
|
* @see {@link https://tanstack.com/table/latest/docs/guide/column-defs}
|
|
37
37
|
*/
|
|
38
|
-
export const renderComponent = <TComponent extends
|
|
39
|
-
component:
|
|
38
|
+
export const renderComponent = <TComponent extends Component<any>>(
|
|
39
|
+
component: TComponent,
|
|
40
40
|
props: ComponentProps<TComponent>
|
|
41
41
|
) => new RenderComponentConfig(component, props)
|
package/src/table.svelte.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
_createTable,
|
|
3
3
|
type RowData,
|
|
4
4
|
type TableOptions,
|
|
5
5
|
type TableOptionsResolved,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
* @example
|
|
14
14
|
* ```svelte
|
|
15
15
|
* <script>
|
|
16
|
-
* const table =
|
|
16
|
+
* const table = createTable({ ... })
|
|
17
17
|
* </script>
|
|
18
18
|
*
|
|
19
19
|
* <table>
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
* </table>
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
|
-
export function
|
|
35
|
+
export function createTable<TData extends RowData>(
|
|
36
36
|
options: TableOptions<TData>
|
|
37
37
|
) {
|
|
38
38
|
const resolvedOptions: TableOptionsResolved<TData> = mergeObjects(
|
|
@@ -50,7 +50,7 @@ export function createSvelteTable<TData extends RowData>(
|
|
|
50
50
|
options
|
|
51
51
|
)
|
|
52
52
|
|
|
53
|
-
const table =
|
|
53
|
+
const table = _createTable(resolvedOptions)
|
|
54
54
|
let state = $state<Partial<TableState>>(table.initialState)
|
|
55
55
|
|
|
56
56
|
function updateOptions() {
|