@shotleybuilder/svelte-table-kit 0.5.1 → 0.6.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 +31 -0
- package/dist/TableKit.svelte +15 -0
- package/dist/TableKit.svelte.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,6 +60,7 @@ Svelte Table Kit brings Airtable-like functionality to your Svelte applications
|
|
|
60
60
|
- 📦 Built on TanStack Table v8 (battle-tested, powerful)
|
|
61
61
|
- 🔒 Full TypeScript support
|
|
62
62
|
- 🎛️ Feature flags for granular control
|
|
63
|
+
- 🔌 **Toolbar slot** - Add custom controls to the toolbar (v0.6.0+)
|
|
63
64
|
- 🚀 Zero external dependencies (except TanStack Table)
|
|
64
65
|
- ♿ Accessible and keyboard-friendly
|
|
65
66
|
|
|
@@ -258,6 +259,36 @@ Listen to table events:
|
|
|
258
259
|
/>
|
|
259
260
|
```
|
|
260
261
|
|
|
262
|
+
### Custom Toolbar Controls (v0.6.0+)
|
|
263
|
+
|
|
264
|
+
Add custom controls to the left side of the toolbar using the `toolbar-left` slot:
|
|
265
|
+
|
|
266
|
+
```svelte
|
|
267
|
+
<script>
|
|
268
|
+
import { TableKit } from '@shotleybuilder/svelte-table-kit';
|
|
269
|
+
import ViewSelector from './ViewSelector.svelte';
|
|
270
|
+
</script>
|
|
271
|
+
|
|
272
|
+
<TableKit {data} {columns}>
|
|
273
|
+
<!-- Add custom controls to the toolbar -->
|
|
274
|
+
<svelte:fragment slot="toolbar-left">
|
|
275
|
+
<ViewSelector on:viewSelected={handleViewSelected} />
|
|
276
|
+
<button on:click={saveView} class="btn-primary">
|
|
277
|
+
Save View
|
|
278
|
+
</button>
|
|
279
|
+
</svelte:fragment>
|
|
280
|
+
</TableKit>
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Use Cases:**
|
|
284
|
+
- View management controls (save/load table configurations)
|
|
285
|
+
- Custom filter presets
|
|
286
|
+
- Quick action buttons
|
|
287
|
+
- Export/import controls
|
|
288
|
+
- Any custom toolbar buttons that should appear alongside table controls
|
|
289
|
+
|
|
290
|
+
The `toolbar-left` slot is positioned on the left side of the toolbar, while the built-in table controls (Filter, Sort, Group, Columns) automatically align to the right. All controls appear on the same row, creating a unified control bar.
|
|
291
|
+
|
|
261
292
|
---
|
|
262
293
|
|
|
263
294
|
## 🎨 Styling
|
package/dist/TableKit.svelte
CHANGED
|
@@ -303,6 +303,11 @@ $: if (onStateChange) {
|
|
|
303
303
|
<!-- Filters and Controls -->
|
|
304
304
|
{#if features.filtering !== false || features.grouping !== false || features.columnVisibility !== false || (features.sorting !== false && features.sortingMode === 'control')}
|
|
305
305
|
<div class="table-kit-toolbar">
|
|
306
|
+
<!-- Slot for custom left-side controls (e.g., view selector, save buttons) -->
|
|
307
|
+
<div class="table-kit-custom-controls">
|
|
308
|
+
<slot name="toolbar-left" />
|
|
309
|
+
</div>
|
|
310
|
+
|
|
306
311
|
<!-- Filter Controls -->
|
|
307
312
|
{#if features.filtering !== false}
|
|
308
313
|
<div class="table-kit-filters">
|
|
@@ -850,6 +855,16 @@ $: if (onStateChange) {
|
|
|
850
855
|
justify-content: space-between;
|
|
851
856
|
gap: 1rem;
|
|
852
857
|
margin-bottom: 1rem;
|
|
858
|
+
flex-wrap: wrap;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/* Custom controls slot (left side) */
|
|
862
|
+
.table-kit-custom-controls {
|
|
863
|
+
display: flex;
|
|
864
|
+
align-items: center;
|
|
865
|
+
gap: 0.5rem;
|
|
866
|
+
flex-shrink: 0;
|
|
867
|
+
margin-right: auto;
|
|
853
868
|
}
|
|
854
869
|
|
|
855
870
|
.table-kit-filters {
|
package/package.json
CHANGED