@sqlrooms/data-table 0.5.1 → 0.7.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/README.md +123 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
A high-performance data table component library for SQLRooms applications. This package provides flexible and feature-rich table components for displaying and interacting with large datasets, with special support for Apache Arrow data structures.
|
|
2
|
+
|
|
3
|
+
## Features
|
|
4
|
+
|
|
5
|
+
- 📊 **Multiple Table Variants**: Paginated, virtualized, and query-specific tables
|
|
6
|
+
- 🚀 **High Performance**: Optimized for handling large datasets efficiently
|
|
7
|
+
- 🏹 **Arrow Integration**: Native support for Apache Arrow data structures
|
|
8
|
+
- 🔍 **Sorting & Filtering**: Built-in data manipulation capabilities
|
|
9
|
+
- 📱 **Responsive Design**: Tables that work well on all screen sizes
|
|
10
|
+
- 🎨 **Customizable**: Flexible styling and configuration options
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @sqlrooms/data-table
|
|
16
|
+
# or
|
|
17
|
+
yarn add @sqlrooms/data-table
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Basic Usage
|
|
21
|
+
|
|
22
|
+
### Paginated Data Table
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import {DataTablePaginated} from '@sqlrooms/data-table';
|
|
26
|
+
|
|
27
|
+
function MyDataTable() {
|
|
28
|
+
const data = [
|
|
29
|
+
{id: 1, name: 'Alice', age: 28},
|
|
30
|
+
{id: 2, name: 'Bob', age: 34},
|
|
31
|
+
{id: 3, name: 'Charlie', age: 42},
|
|
32
|
+
// More data...
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
const columns = [
|
|
36
|
+
{accessorKey: 'id', header: 'ID'},
|
|
37
|
+
{accessorKey: 'name', header: 'Name'},
|
|
38
|
+
{accessorKey: 'age', header: 'Age'},
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<DataTablePaginated
|
|
43
|
+
data={data}
|
|
44
|
+
columns={columns}
|
|
45
|
+
pageSize={10}
|
|
46
|
+
enableSorting
|
|
47
|
+
enableFiltering
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Virtualized Data Table for Large Datasets
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import {DataTableVirtualized} from '@sqlrooms/data-table';
|
|
57
|
+
|
|
58
|
+
function LargeDataTable() {
|
|
59
|
+
// Imagine this is a very large dataset
|
|
60
|
+
const largeDataset = generateLargeDataset(10000);
|
|
61
|
+
|
|
62
|
+
const columns = [
|
|
63
|
+
{accessorKey: 'id', header: 'ID'},
|
|
64
|
+
{accessorKey: 'name', header: 'Name'},
|
|
65
|
+
{accessorKey: 'email', header: 'Email'},
|
|
66
|
+
{accessorKey: 'status', header: 'Status'},
|
|
67
|
+
{accessorKey: 'lastActive', header: 'Last Active'},
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<DataTableVirtualized
|
|
72
|
+
data={largeDataset}
|
|
73
|
+
columns={columns}
|
|
74
|
+
height={500}
|
|
75
|
+
width="100%"
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Working with SQL Query Results
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
import {QueryDataTable} from '@sqlrooms/data-table';
|
|
85
|
+
import {useSql} from '@sqlrooms/duckdb';
|
|
86
|
+
|
|
87
|
+
function QueryResultsTable() {
|
|
88
|
+
const {data, isLoading, error} = useSql({
|
|
89
|
+
query:
|
|
90
|
+
'SELECT id, name, email, created_at FROM users ORDER BY created_at DESC',
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
if (isLoading) return <div>Loading...</div>;
|
|
94
|
+
if (error) return <div>Error: {error.message}</div>;
|
|
95
|
+
if (!data) return null;
|
|
96
|
+
|
|
97
|
+
return <QueryDataTable data={data} />;
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Using with Apache Arrow
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import {useArrowDataTable} from '@sqlrooms/data-table';
|
|
105
|
+
import {Table} from 'apache-arrow';
|
|
106
|
+
|
|
107
|
+
function ArrowTable({arrowTable}: {arrowTable: Table}) {
|
|
108
|
+
const {columns, data} = useArrowDataTable(arrowTable);
|
|
109
|
+
|
|
110
|
+
return <DataTablePaginated columns={columns} data={data} pageSize={25} />;
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Advanced Features
|
|
115
|
+
|
|
116
|
+
- **Custom Cell Rendering**: Define custom renderers for specific cell types
|
|
117
|
+
- **Row Selection**: Enable row selection with checkboxes
|
|
118
|
+
- **Expandable Rows**: Show additional details in expandable row sections
|
|
119
|
+
- **Column Resizing**: Allow users to resize columns
|
|
120
|
+
- **Export Options**: Export table data to CSV or other formats
|
|
121
|
+
- **Theming**: Customize the appearance to match your application
|
|
122
|
+
|
|
123
|
+
For more information, visit the SQLRooms documentation.
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3D,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAC,OAAO,IAAI,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3D,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAC,OAAO,IAAI,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3D,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAC,OAAO,IAAI,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,qBAAqB,CAAC","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3D,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAC,OAAO,IAAI,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,qBAAqB,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\n\nexport {default as DataTableModal} from './DataTableModal';\nexport * from './DataTablePaginated';\nexport {default as DataTablePaginated} from './DataTablePaginated';\nexport {default as DataTableVirtualized} from './DataTableVirtualized';\nexport {default as QueryDataTable} from './QueryDataTable';\nexport {default as useArrowDataTable} from './useArrowDataTable';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/data-table",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@heroicons/react": "*",
|
|
23
|
-
"@sqlrooms/duckdb": "0.
|
|
24
|
-
"@sqlrooms/ui": "0.
|
|
25
|
-
"@sqlrooms/utils": "0.
|
|
23
|
+
"@sqlrooms/duckdb": "0.7.0",
|
|
24
|
+
"@sqlrooms/ui": "0.7.0",
|
|
25
|
+
"@sqlrooms/utils": "0.7.0",
|
|
26
26
|
"@tanstack/react-table": "^8.10.7",
|
|
27
27
|
"@tanstack/table-core": "^8.10.7",
|
|
28
28
|
"react-virtual": "2.10.4"
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"lint": "eslint .",
|
|
39
39
|
"typedoc": "typedoc"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "8be65f051c588d3a963f721322429657913b6c63"
|
|
42
42
|
}
|