@svgrid/grid 2.0.2 → 2.1.0
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/FlexRender.svelte +96 -96
- package/dist/GridFooter.svelte +178 -178
- package/dist/SvGrid.css +2377 -2376
- package/dist/SvGrid.svelte +2764 -2764
- package/dist/SvGridBoard.svelte +2281 -2281
- package/dist/SvGridDropdown.svelte +666 -666
- package/dist/cdn/svgrid.js +3 -3
- package/dist/cdn/svgrid.svelte-external.js +3 -3
- package/dist/themes/index.d.ts +45 -0
- package/dist/themes/index.js +132 -0
- package/package.json +92 -85
- package/src/FlexRender.svelte +96 -96
- package/src/GridFooter.svelte +178 -178
- package/src/SvGrid.controller.svelte.ts +2553 -2553
- package/src/SvGrid.css +2377 -2376
- package/src/SvGrid.svelte +2764 -2764
- package/src/SvGrid.types.ts +944 -944
- package/src/SvGridBoard.svelte +2281 -2281
- package/src/SvGridDropdown.svelte +666 -666
- package/src/a11y.contract.test.ts +49 -49
- package/src/a11y.test.ts +59 -59
- package/src/a11y.ts +61 -61
- package/src/build-api.ts +798 -798
- package/src/cell-formatting.ts +169 -169
- package/src/cell-render.ts +469 -469
- package/src/collaboration.test.ts +104 -104
- package/src/collaboration.ts +167 -167
- package/src/core.performance.test.ts +30 -30
- package/src/core.ts +1111 -1111
- package/src/createGrid.svelte.ts +42 -42
- package/src/createGrid.test.ts +10 -10
- package/src/createGridState.svelte.ts +17 -17
- package/src/editing.test.ts +859 -859
- package/src/editing.ts +675 -675
- package/src/export-data-api.test.ts +126 -126
- package/src/export-format.test.ts +107 -107
- package/src/export-format.ts +598 -598
- package/src/flex-render.ts +3 -3
- package/src/index.ts +463 -463
- package/src/keyboard.test.ts +59 -59
- package/src/keyboard.ts +97 -97
- package/src/menus.ts +582 -582
- package/src/merge-objects.ts +48 -48
- package/src/render-component.ts +28 -28
- package/src/selection.test.ts +754 -754
- package/src/selection.ts +600 -600
- package/src/server-data-source.test.ts +289 -289
- package/src/server-data-source.ts +413 -413
- package/src/sparkline.test.ts +68 -68
- package/src/sparkline.ts +169 -169
- package/src/spreadsheet.test.ts +489 -489
- package/src/spreadsheet.ts +304 -304
- package/src/static-functions.ts +11 -11
- package/src/subscribe.ts +38 -38
- package/src/svgrid-wrapper.types.ts +439 -439
- package/src/svgrid.behavior.test.ts +706 -706
- package/src/svgrid.features.test.ts +157 -157
- package/src/svgrid.new-features.wrapper.test.ts +251 -251
- package/src/svgrid.wrapper.test.ts +40 -40
- package/src/themes/index.ts +159 -0
- package/src/virtualization/column-virtualizer.test.ts +27 -27
- package/src/virtualization/column-virtualizer.ts +30 -30
- package/src/virtualization/svelte-virtualizer.svelte.ts +26 -26
- package/src/virtualization/types.ts +30 -30
- package/src/virtualization/virtualizer.test.ts +47 -47
- package/src/virtualization/virtualizer.ts +296 -296
- package/themes/ag-alpine.css +59 -0
- package/themes/antd.css +59 -0
- package/themes/atlassian.css +59 -0
- package/themes/bootstrap.css +59 -0
- package/themes/carbon.css +59 -0
- package/themes/catppuccin.css +59 -0
- package/themes/dracula.css +59 -0
- package/themes/excel.css +59 -0
- package/themes/fluent.css +59 -0
- package/themes/github.css +59 -0
- package/themes/linear.css +59 -0
- package/themes/material.css +59 -0
- package/themes/nord.css +59 -0
- package/themes/notion.css +59 -0
- package/themes/salesforce.css +59 -0
- package/themes/sap.css +59 -0
- package/themes/shadcn.css +59 -0
- package/themes/tailwind.css +59 -0
- package/themes/vercel.css +59 -0
package/package.json
CHANGED
|
@@ -1,85 +1,92 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@svgrid/grid",
|
|
3
|
-
"version": "2.0
|
|
4
|
-
"description": "SvGrid - a headless-first, Svelte 5-native data grid engine and render component.",
|
|
5
|
-
"author": "jQWidgets <boikom@jqwidgets.com>",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/sv-grid/sv-grid.git",
|
|
10
|
-
"directory": "packages/grid"
|
|
11
|
-
},
|
|
12
|
-
"homepage": "https://svgrid.com",
|
|
13
|
-
"keywords": [
|
|
14
|
-
"svelte",
|
|
15
|
-
"grid",
|
|
16
|
-
"table",
|
|
17
|
-
"headless",
|
|
18
|
-
"datagrid"
|
|
19
|
-
],
|
|
20
|
-
"type": "module",
|
|
21
|
-
"types": "dist/index.d.ts",
|
|
22
|
-
"module": "dist/index.js",
|
|
23
|
-
"svelte": "./dist/index.js",
|
|
24
|
-
"unpkg": "./dist/cdn/svgrid.js",
|
|
25
|
-
"jsdelivr": "./dist/cdn/svgrid.js",
|
|
26
|
-
"exports": {
|
|
27
|
-
".": {
|
|
28
|
-
"types": "./dist/index.d.ts",
|
|
29
|
-
"svelte": "./dist/index.js",
|
|
30
|
-
"import": "./dist/index.js"
|
|
31
|
-
},
|
|
32
|
-
"./cdn": {
|
|
33
|
-
"import": "./dist/cdn/svgrid.js",
|
|
34
|
-
"default": "./dist/cdn/svgrid.js"
|
|
35
|
-
},
|
|
36
|
-
"./cdn/svelte-external": {
|
|
37
|
-
"import": "./dist/cdn/svgrid.svelte-external.js",
|
|
38
|
-
"default": "./dist/cdn/svgrid.svelte-external.js"
|
|
39
|
-
},
|
|
40
|
-
"./static-functions": {
|
|
41
|
-
"types": "./dist/static-functions.d.ts",
|
|
42
|
-
"svelte": "./dist/static-functions.js",
|
|
43
|
-
"import": "./dist/static-functions.js"
|
|
44
|
-
},
|
|
45
|
-
"./format": {
|
|
46
|
-
"types": "./dist/export-format.d.ts",
|
|
47
|
-
"svelte": "./dist/export-format.js",
|
|
48
|
-
"import": "./dist/export-format.js"
|
|
49
|
-
},
|
|
50
|
-
"./flex-render": {
|
|
51
|
-
"types": "./dist/flex-render.d.ts",
|
|
52
|
-
"svelte": "./dist/flex-render.js",
|
|
53
|
-
"import": "./dist/flex-render.js"
|
|
54
|
-
},
|
|
55
|
-
"./
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
"svelte": "^
|
|
84
|
-
|
|
85
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@svgrid/grid",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "SvGrid - a headless-first, Svelte 5-native data grid engine and render component.",
|
|
5
|
+
"author": "jQWidgets <boikom@jqwidgets.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/sv-grid/sv-grid.git",
|
|
10
|
+
"directory": "packages/grid"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://svgrid.com",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"svelte",
|
|
15
|
+
"grid",
|
|
16
|
+
"table",
|
|
17
|
+
"headless",
|
|
18
|
+
"datagrid"
|
|
19
|
+
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
|
+
"module": "dist/index.js",
|
|
23
|
+
"svelte": "./dist/index.js",
|
|
24
|
+
"unpkg": "./dist/cdn/svgrid.js",
|
|
25
|
+
"jsdelivr": "./dist/cdn/svgrid.js",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"svelte": "./dist/index.js",
|
|
30
|
+
"import": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./cdn": {
|
|
33
|
+
"import": "./dist/cdn/svgrid.js",
|
|
34
|
+
"default": "./dist/cdn/svgrid.js"
|
|
35
|
+
},
|
|
36
|
+
"./cdn/svelte-external": {
|
|
37
|
+
"import": "./dist/cdn/svgrid.svelte-external.js",
|
|
38
|
+
"default": "./dist/cdn/svgrid.svelte-external.js"
|
|
39
|
+
},
|
|
40
|
+
"./static-functions": {
|
|
41
|
+
"types": "./dist/static-functions.d.ts",
|
|
42
|
+
"svelte": "./dist/static-functions.js",
|
|
43
|
+
"import": "./dist/static-functions.js"
|
|
44
|
+
},
|
|
45
|
+
"./format": {
|
|
46
|
+
"types": "./dist/export-format.d.ts",
|
|
47
|
+
"svelte": "./dist/export-format.js",
|
|
48
|
+
"import": "./dist/export-format.js"
|
|
49
|
+
},
|
|
50
|
+
"./flex-render": {
|
|
51
|
+
"types": "./dist/flex-render.d.ts",
|
|
52
|
+
"svelte": "./dist/flex-render.js",
|
|
53
|
+
"import": "./dist/flex-render.js"
|
|
54
|
+
},
|
|
55
|
+
"./themes": {
|
|
56
|
+
"types": "./dist/themes/index.d.ts",
|
|
57
|
+
"svelte": "./dist/themes/index.js",
|
|
58
|
+
"import": "./dist/themes/index.js"
|
|
59
|
+
},
|
|
60
|
+
"./themes/*.css": "./themes/*.css",
|
|
61
|
+
"./package.json": "./package.json"
|
|
62
|
+
},
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=16"
|
|
65
|
+
},
|
|
66
|
+
"files": [
|
|
67
|
+
"dist",
|
|
68
|
+
"src",
|
|
69
|
+
"themes"
|
|
70
|
+
],
|
|
71
|
+
"scripts": {
|
|
72
|
+
"clean": "rimraf ./build && rimraf ./dist",
|
|
73
|
+
"test:eslint": "eslint ./src",
|
|
74
|
+
"test:types": "svelte-check --tsconfig ./tsconfig.json",
|
|
75
|
+
"test:lib": "vitest run --coverage",
|
|
76
|
+
"test:build": "publint --strict",
|
|
77
|
+
"build": "svelte-package --input ./src --output ./dist && node ../../tools/strip-dist-tests.mjs ./dist && node ./scripts/build-cdn.mjs && node ./scripts/build-themes.mjs"
|
|
78
|
+
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"@sveltejs/package": "^2.5.7",
|
|
81
|
+
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
82
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
83
|
+
"eslint-plugin-svelte": "^3.17.1",
|
|
84
|
+
"jsdom": "^29.1.1",
|
|
85
|
+
"publint": "^0.3.21",
|
|
86
|
+
"svelte": "^5.55.5",
|
|
87
|
+
"svelte-check": "^4.4.6"
|
|
88
|
+
},
|
|
89
|
+
"peerDependencies": {
|
|
90
|
+
"svelte": "^5.0.0"
|
|
91
|
+
}
|
|
92
|
+
}
|
package/src/FlexRender.svelte
CHANGED
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
<script
|
|
2
|
-
lang="ts"
|
|
3
|
-
generics="TData extends RowData"
|
|
4
|
-
>
|
|
5
|
-
import { isFunction } from './core'
|
|
6
|
-
import {
|
|
7
|
-
RenderComponentConfig,
|
|
8
|
-
RenderSnippetConfig,
|
|
9
|
-
} from './render-component'
|
|
10
|
-
import type {
|
|
11
|
-
Cell,
|
|
12
|
-
CellContext,
|
|
13
|
-
ColumnDefTemplate,
|
|
14
|
-
Header,
|
|
15
|
-
HeaderContext,
|
|
16
|
-
RowData,
|
|
17
|
-
} from './core'
|
|
18
|
-
|
|
19
|
-
type Props =
|
|
20
|
-
| {
|
|
21
|
-
content?: ColumnDefTemplate<
|
|
22
|
-
| HeaderContext<TData>
|
|
23
|
-
| CellContext<TData>
|
|
24
|
-
>
|
|
25
|
-
context:
|
|
26
|
-
| HeaderContext<TData>
|
|
27
|
-
| CellContext<TData>
|
|
28
|
-
cell?: never
|
|
29
|
-
header?: never
|
|
30
|
-
footer?: never
|
|
31
|
-
}
|
|
32
|
-
| {
|
|
33
|
-
cell: Cell<TData>
|
|
34
|
-
content?: never
|
|
35
|
-
context?: never
|
|
36
|
-
header?: never
|
|
37
|
-
footer?: never
|
|
38
|
-
}
|
|
39
|
-
| {
|
|
40
|
-
header: Header<TData>
|
|
41
|
-
content?: never
|
|
42
|
-
context?: never
|
|
43
|
-
cell?: never
|
|
44
|
-
footer?: never
|
|
45
|
-
}
|
|
46
|
-
| {
|
|
47
|
-
footer: Header<TData>
|
|
48
|
-
content?: never
|
|
49
|
-
context?: never
|
|
50
|
-
cell?: never
|
|
51
|
-
header?: never
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
let props: Props = $props()
|
|
55
|
-
|
|
56
|
-
const resolved = $derived.by(() => {
|
|
57
|
-
if ('cell' in props && props.cell) {
|
|
58
|
-
return {
|
|
59
|
-
content: props.cell.column.columnDef.cell,
|
|
60
|
-
context: props.cell.getContext(),
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if ('header' in props && props.header) {
|
|
64
|
-
return {
|
|
65
|
-
content: props.header.column.columnDef.header,
|
|
66
|
-
context: props.header.getContext(),
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if ('footer' in props && props.footer) {
|
|
70
|
-
return {
|
|
71
|
-
content: props.footer.column.columnDef.footer,
|
|
72
|
-
context: props.footer.getContext(),
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
content: props.content,
|
|
77
|
-
context: props.context,
|
|
78
|
-
}
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
const result = $derived(
|
|
82
|
-
isFunction(resolved.content)
|
|
83
|
-
? resolved.content(resolved.context as any)
|
|
84
|
-
: undefined,
|
|
85
|
-
)
|
|
86
|
-
</script>
|
|
87
|
-
|
|
88
|
-
{#if typeof resolved.content === 'string'}
|
|
89
|
-
{resolved.content}
|
|
90
|
-
{:else if result instanceof RenderComponentConfig}
|
|
91
|
-
<result.component {...result.props} />
|
|
92
|
-
{:else if result instanceof RenderSnippetConfig}
|
|
93
|
-
{@render result.snippet(result.params)}
|
|
94
|
-
{:else if result !== undefined}
|
|
95
|
-
{result}
|
|
96
|
-
{/if}
|
|
1
|
+
<script
|
|
2
|
+
lang="ts"
|
|
3
|
+
generics="TData extends RowData"
|
|
4
|
+
>
|
|
5
|
+
import { isFunction } from './core'
|
|
6
|
+
import {
|
|
7
|
+
RenderComponentConfig,
|
|
8
|
+
RenderSnippetConfig,
|
|
9
|
+
} from './render-component'
|
|
10
|
+
import type {
|
|
11
|
+
Cell,
|
|
12
|
+
CellContext,
|
|
13
|
+
ColumnDefTemplate,
|
|
14
|
+
Header,
|
|
15
|
+
HeaderContext,
|
|
16
|
+
RowData,
|
|
17
|
+
} from './core'
|
|
18
|
+
|
|
19
|
+
type Props =
|
|
20
|
+
| {
|
|
21
|
+
content?: ColumnDefTemplate<
|
|
22
|
+
| HeaderContext<TData>
|
|
23
|
+
| CellContext<TData>
|
|
24
|
+
>
|
|
25
|
+
context:
|
|
26
|
+
| HeaderContext<TData>
|
|
27
|
+
| CellContext<TData>
|
|
28
|
+
cell?: never
|
|
29
|
+
header?: never
|
|
30
|
+
footer?: never
|
|
31
|
+
}
|
|
32
|
+
| {
|
|
33
|
+
cell: Cell<TData>
|
|
34
|
+
content?: never
|
|
35
|
+
context?: never
|
|
36
|
+
header?: never
|
|
37
|
+
footer?: never
|
|
38
|
+
}
|
|
39
|
+
| {
|
|
40
|
+
header: Header<TData>
|
|
41
|
+
content?: never
|
|
42
|
+
context?: never
|
|
43
|
+
cell?: never
|
|
44
|
+
footer?: never
|
|
45
|
+
}
|
|
46
|
+
| {
|
|
47
|
+
footer: Header<TData>
|
|
48
|
+
content?: never
|
|
49
|
+
context?: never
|
|
50
|
+
cell?: never
|
|
51
|
+
header?: never
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let props: Props = $props()
|
|
55
|
+
|
|
56
|
+
const resolved = $derived.by(() => {
|
|
57
|
+
if ('cell' in props && props.cell) {
|
|
58
|
+
return {
|
|
59
|
+
content: props.cell.column.columnDef.cell,
|
|
60
|
+
context: props.cell.getContext(),
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if ('header' in props && props.header) {
|
|
64
|
+
return {
|
|
65
|
+
content: props.header.column.columnDef.header,
|
|
66
|
+
context: props.header.getContext(),
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if ('footer' in props && props.footer) {
|
|
70
|
+
return {
|
|
71
|
+
content: props.footer.column.columnDef.footer,
|
|
72
|
+
context: props.footer.getContext(),
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
content: props.content,
|
|
77
|
+
context: props.context,
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const result = $derived(
|
|
82
|
+
isFunction(resolved.content)
|
|
83
|
+
? resolved.content(resolved.context as any)
|
|
84
|
+
: undefined,
|
|
85
|
+
)
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
{#if typeof resolved.content === 'string'}
|
|
89
|
+
{resolved.content}
|
|
90
|
+
{:else if result instanceof RenderComponentConfig}
|
|
91
|
+
<result.component {...result.props} />
|
|
92
|
+
{:else if result instanceof RenderSnippetConfig}
|
|
93
|
+
{@render result.snippet(result.params)}
|
|
94
|
+
{:else if result !== undefined}
|
|
95
|
+
{result}
|
|
96
|
+
{/if}
|