@shotleybuilder/svelte-table-kit 0.1.0 → 0.4.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 +42 -12
- package/dist/TableKit.svelte +568 -48
- package/dist/TableKit.svelte.d.ts +4 -0
- package/dist/components/ColumnMenu.svelte +271 -0
- package/dist/components/ColumnMenu.svelte.d.ts +29 -0
- package/dist/components/FilterBar.svelte +12 -5
- package/dist/components/FilterBar.svelte.d.ts +2 -0
- package/dist/components/GroupBar.svelte +12 -5
- package/dist/components/GroupBar.svelte.d.ts +2 -0
- package/dist/components/SortBar.svelte +239 -0
- package/dist/components/SortBar.svelte.d.ts +22 -0
- package/dist/components/SortCondition.svelte +131 -0
- package/dist/components/SortCondition.svelte.d.ts +25 -0
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**A comprehensive, AI-configurable data table component for Svelte and SvelteKit, built on TanStack Table v8.**
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@shotleybuilder/svelte-table-kit)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
|
|
8
8
|
Svelte Table Kit brings Airtable-like functionality to your Svelte applications with a headless, fully customizable table component. Perfect for dashboards, data grids, and complex data visualization needs.
|
|
@@ -13,13 +13,17 @@ Svelte Table Kit brings Airtable-like functionality to your Svelte applications
|
|
|
13
13
|
|
|
14
14
|
**Core Table Features:**
|
|
15
15
|
- 🎯 Column visibility picker with show/hide controls
|
|
16
|
-
- 📏 Column resizing with drag handles
|
|
16
|
+
- 📏 Column resizing with drag handles (62px-1000px range)
|
|
17
17
|
- 🔄 Column reordering via native HTML5 drag & drop
|
|
18
|
+
- 📐 **Row height control** - 4 sizes: short, medium, tall, extra tall
|
|
19
|
+
- ↔️ **Column spacing control** - 3 sizes: narrow, normal, wide
|
|
18
20
|
- 🔍 **Advanced filtering** - 12 operators with AND/OR logic
|
|
19
21
|
- 📊 **Multi-level grouping** - Up to 3 nested levels (like Airtable)
|
|
20
|
-
- ⬆️
|
|
22
|
+
- ⬆️ **Flexible sorting** - Column header or Airtable-style sort control
|
|
21
23
|
- 📄 Pagination with customizable page sizes
|
|
22
24
|
- 💾 LocalStorage persistence for all user preferences
|
|
25
|
+
- ✂️ Text truncation with ellipsis for long content
|
|
26
|
+
- 📋 **Column context menu** - Quick access to sort, filter, group, and hide actions
|
|
23
27
|
|
|
24
28
|
**Advanced Filtering:**
|
|
25
29
|
- 12 filter operators: equals, contains, starts with, greater than, etc.
|
|
@@ -28,6 +32,13 @@ Svelte Table Kit brings Airtable-like functionality to your Svelte applications
|
|
|
28
32
|
- Active filter count badge
|
|
29
33
|
- Real-time filtering as you type
|
|
30
34
|
|
|
35
|
+
**Sorting Options:**
|
|
36
|
+
- **Column header mode** (default) - Click headers to sort with ↑↓↕ indicators
|
|
37
|
+
- **Airtable-style control** - Dedicated sort dropdown with multi-level sorting
|
|
38
|
+
- Choose column and direction (A → Z or Z → A)
|
|
39
|
+
- Multiple sort levels applied top to bottom
|
|
40
|
+
- Collapsible SortBar UI
|
|
41
|
+
|
|
31
42
|
**Grouping & Hierarchy:**
|
|
32
43
|
- Group by up to 3 columns simultaneously
|
|
33
44
|
- Expand/collapse groups with chevron buttons
|
|
@@ -35,6 +46,15 @@ Svelte Table Kit brings Airtable-like functionality to your Svelte applications
|
|
|
35
46
|
- Item count per group
|
|
36
47
|
- Collapsible GroupBar UI
|
|
37
48
|
|
|
49
|
+
**Column Context Menu:**
|
|
50
|
+
- Hover over column headers to reveal menu trigger (chevron icon)
|
|
51
|
+
- **Sort A → Z / Sort Z → A** - Quick sort with active state indication
|
|
52
|
+
- **Filter by this field** - Creates pre-filled filter condition
|
|
53
|
+
- **Group by this field** - Adds column to grouping configuration
|
|
54
|
+
- **Hide field** - Remove column from view
|
|
55
|
+
- Actions conditionally shown based on feature flags
|
|
56
|
+
- Seamlessly integrates with existing controls
|
|
57
|
+
|
|
38
58
|
**Developer Experience:**
|
|
39
59
|
- 🎨 Headless design - style it your way
|
|
40
60
|
- 📦 Built on TanStack Table v8 (battle-tested, powerful)
|
|
@@ -56,13 +76,13 @@ Svelte Table Kit brings Airtable-like functionality to your Svelte applications
|
|
|
56
76
|
## 📦 Installation
|
|
57
77
|
|
|
58
78
|
```bash
|
|
59
|
-
npm install @
|
|
79
|
+
npm install @shotleybuilder/svelte-table-kit
|
|
60
80
|
```
|
|
61
81
|
|
|
62
82
|
Or using pnpm:
|
|
63
83
|
|
|
64
84
|
```bash
|
|
65
|
-
pnpm add @
|
|
85
|
+
pnpm add @shotleybuilder/svelte-table-kit
|
|
66
86
|
```
|
|
67
87
|
|
|
68
88
|
---
|
|
@@ -71,7 +91,7 @@ pnpm add @sertantai/svelte-table-kit
|
|
|
71
91
|
|
|
72
92
|
```svelte
|
|
73
93
|
<script>
|
|
74
|
-
import { TableKit } from '@
|
|
94
|
+
import { TableKit } from '@shotleybuilder/svelte-table-kit';
|
|
75
95
|
|
|
76
96
|
const data = [
|
|
77
97
|
{ id: 1, name: 'Alice', role: 'Developer', age: 28 },
|
|
@@ -104,19 +124,21 @@ The simplest way to use TableKit:
|
|
|
104
124
|
|
|
105
125
|
### With Configuration
|
|
106
126
|
|
|
107
|
-
|
|
127
|
+
Customize initial table state programmatically:
|
|
108
128
|
|
|
109
129
|
```svelte
|
|
110
130
|
<script>
|
|
111
|
-
import { TableKit
|
|
112
|
-
|
|
113
|
-
const config = presets.dashboard; // or generate with AI
|
|
131
|
+
import { TableKit } from '@shotleybuilder/svelte-table-kit';
|
|
114
132
|
</script>
|
|
115
133
|
|
|
116
134
|
<TableKit
|
|
117
135
|
{data}
|
|
118
136
|
{columns}
|
|
119
|
-
{
|
|
137
|
+
config={{
|
|
138
|
+
defaultColumnOrder: ['name', 'role', 'age', 'id'], // Set initial column order
|
|
139
|
+
defaultColumnSizing: { name: 200, role: 150 }, // Set initial column widths
|
|
140
|
+
defaultVisibleColumns: ['name', 'role', 'age'] // Hide 'id' column initially
|
|
141
|
+
}}
|
|
120
142
|
features={{
|
|
121
143
|
columnVisibility: true,
|
|
122
144
|
filtering: true,
|
|
@@ -140,6 +162,7 @@ Control which features are enabled:
|
|
|
140
162
|
columnReordering: true,
|
|
141
163
|
filtering: true,
|
|
142
164
|
sorting: true,
|
|
165
|
+
sortingMode: 'control', // 'header' (default) or 'control' (Airtable-style)
|
|
143
166
|
pagination: true,
|
|
144
167
|
rowSelection: false,
|
|
145
168
|
grouping: false
|
|
@@ -147,6 +170,10 @@ Control which features are enabled:
|
|
|
147
170
|
/>
|
|
148
171
|
```
|
|
149
172
|
|
|
173
|
+
**Sorting Modes:**
|
|
174
|
+
- `sortingMode: 'header'` - Click column headers to sort (default behavior)
|
|
175
|
+
- `sortingMode: 'control'` - Use Airtable-style sort dropdown with multi-level support
|
|
176
|
+
|
|
150
177
|
### Event Handlers
|
|
151
178
|
|
|
152
179
|
Listen to table events:
|
|
@@ -203,6 +230,9 @@ TableKit is headless by default. You can:
|
|
|
203
230
|
| `storageKey` | `string` | `undefined` | LocalStorage key for persistence |
|
|
204
231
|
| `persistState` | `boolean` | `true` | Enable state persistence |
|
|
205
232
|
| `theme` | `'light' \| 'dark' \| 'auto'` | `'light'` | Theme mode |
|
|
233
|
+
| `align` | `'left' \| 'center' \| 'right'` | `'left'` | Column text alignment |
|
|
234
|
+
| `rowHeight` | `'short' \| 'medium' \| 'tall' \| 'extra_tall'` | `'medium'` | Row height preset |
|
|
235
|
+
| `columnSpacing` | `'narrow' \| 'normal' \| 'wide'` | `'normal'` | Column horizontal spacing |
|
|
206
236
|
| `onRowClick` | `(row: T) => void` | `undefined` | Row click handler |
|
|
207
237
|
| `onRowSelect` | `(rows: T[]) => void` | `undefined` | Row selection handler |
|
|
208
238
|
| `onStateChange` | `(state: TableState) => void` | `undefined` | State change handler |
|
|
@@ -234,7 +264,7 @@ MIT © [Sertantai](https://github.com/shotleybuilder)
|
|
|
234
264
|
## 🔗 Links
|
|
235
265
|
|
|
236
266
|
- [GitHub Repository](https://github.com/shotleybuilder/svelte-table-kit)
|
|
237
|
-
- [npm Package](https://www.npmjs.com/package/@
|
|
267
|
+
- [npm Package](https://www.npmjs.com/package/@shotleybuilder/svelte-table-kit)
|
|
238
268
|
- [Issue Tracker](https://github.com/shotleybuilder/svelte-table-kit/issues)
|
|
239
269
|
|
|
240
270
|
---
|