@tanstack/svelte-table 9.0.0-alpha.2 → 9.0.0-alpha.5
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/flex-render.svelte
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
<script
|
|
2
2
|
lang="ts"
|
|
3
3
|
generics="TData, TValue, TContext extends HeaderContext<TData, TValue> | CellContext<TData, TValue>"
|
|
4
|
-
>
|
|
5
|
-
|
|
4
|
+
>
|
|
5
|
+
import type {
|
|
6
|
+
CellContext,
|
|
7
|
+
ColumnDefTemplate,
|
|
8
|
+
HeaderContext,
|
|
9
|
+
} from '@tanstack/table-core'
|
|
10
|
+
import { RenderComponentConfig } from './render-component'
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
/** The cell or header field of the current cell's column definition. */
|
|
14
|
+
content?: TContext extends HeaderContext<TData, TValue>
|
|
15
|
+
? ColumnDefTemplate<HeaderContext<TData, TValue>>
|
|
16
|
+
: TContext extends CellContext<TData, TValue>
|
|
17
|
+
? ColumnDefTemplate<CellContext<TData, TValue>>
|
|
18
|
+
: never
|
|
19
|
+
/** The result of the `getContext()` function of the header or cell */
|
|
20
|
+
context: TContext
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let { content, context }: Props = $props()
|
|
6
24
|
</script>
|
|
7
25
|
|
|
8
26
|
{#if typeof content === 'string'}
|
|
@@ -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
|
@@ -26,11 +26,3 @@ import { type RowData, type TableOptions } from '@tanstack/table-core';
|
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
export declare function createSvelteTable<TData extends RowData>(options: TableOptions<TData>): import("@tanstack/table-core").Table<TData>;
|
|
29
|
-
/**
|
|
30
|
-
* Merges objects together while keeping their getters alive.
|
|
31
|
-
* Taken from SolidJS: {@link https://github.com/solidjs/solid/blob/24abc825c0996fd2bc8c1de1491efe9a7e743aff/packages/solid/src/server/rendering.ts#L82-L115}
|
|
32
|
-
* */
|
|
33
|
-
export declare function mergeObjects<T>(source: T): T;
|
|
34
|
-
export declare function mergeObjects<T, U>(source: T, source1: U): T & U;
|
|
35
|
-
export declare function mergeObjects<T, U, V>(source: T, source1: U, source2: V): T & U & V;
|
|
36
|
-
export declare function mergeObjects<T, U, V, W>(source: T, source1: U, source2: V, source3: W): T & U & V & W;
|
package/dist/table.svelte.js
CHANGED
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.5",
|
|
4
4
|
"description": "Headless UI for building powerful tables & datagrids for Svelte.",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"src"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@tanstack/table-core": "9.0.0-alpha.
|
|
43
|
+
"@tanstack/table-core": "9.0.0-alpha.4"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@sveltejs/package": "^2.3.
|
|
46
|
+
"@sveltejs/package": "^2.3.2",
|
|
47
|
+
"@sveltejs/vite-plugin-svelte": "^4.0.0-next",
|
|
48
|
+
"svelte": "^5.0.0-next",
|
|
49
|
+
"svelte-check": "^3.8.0"
|
|
47
50
|
},
|
|
48
51
|
"peerDependencies": {
|
|
49
|
-
"svelte": "^5.0.0-next"
|
|
50
|
-
"@sveltejs/vite-plugin-svelte": "^3.0.2",
|
|
51
|
-
"svelte-check": "^3.6.8",
|
|
52
|
-
"svelte-eslint-parser": "^0.33.1"
|
|
52
|
+
"svelte": "^5.0.0-next"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {}
|
|
55
55
|
}
|
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
|
@@ -80,20 +80,16 @@ export function createSvelteTable<TData extends RowData>(
|
|
|
80
80
|
* Merges objects together while keeping their getters alive.
|
|
81
81
|
* Taken from SolidJS: {@link https://github.com/solidjs/solid/blob/24abc825c0996fd2bc8c1de1491efe9a7e743aff/packages/solid/src/server/rendering.ts#L82-L115}
|
|
82
82
|
* */
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
source1: U,
|
|
88
|
-
source2: V
|
|
89
|
-
): T & U & V
|
|
90
|
-
export function mergeObjects<T, U, V, W>(
|
|
83
|
+
function mergeObjects<T>(source: T): T
|
|
84
|
+
function mergeObjects<T, U>(source: T, source1: U): T & U
|
|
85
|
+
function mergeObjects<T, U, V>(source: T, source1: U, source2: V): T & U & V
|
|
86
|
+
function mergeObjects<T, U, V, W>(
|
|
91
87
|
source: T,
|
|
92
88
|
source1: U,
|
|
93
89
|
source2: V,
|
|
94
90
|
source3: W
|
|
95
91
|
): T & U & V & W
|
|
96
|
-
|
|
92
|
+
function mergeObjects(...sources: any): any {
|
|
97
93
|
const target = {}
|
|
98
94
|
for (let i = 0; i < sources.length; i++) {
|
|
99
95
|
let source = sources[i]
|