@rozie-ui/data-table-solid 0.3.1 → 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 CHANGED
@@ -399,6 +399,47 @@ export function Demo() {
399
399
  }
400
400
  ```
401
401
 
402
+ ### Per-column slot families (`cell-<id>` / `colHeader-<id>` / `filter-<id>` / `editor-<id>`)
403
+
404
+ ```tsx
405
+ import { DataTable, Column } from '@rozie-ui/data-table-solid';
406
+
407
+ export function Demo() {
408
+ // A family fill is a STATIC per-column override — the additive `slots` record prop,
409
+ // NOT an extension of cellSlot/colHeaderSlot/filterSlot/editorSlot. Precedence per
410
+ // seam: slots['<seam>-<id>'] → the generic <seam>Slot prop → the built-in render.
411
+ // editor-<id> only reaches a column declared editor="custom"; filter-<id> only reaches
412
+ // a column declared filterable (shown on `category` below); cell-<id> / colHeader-<id>
413
+ // have no gate. A misspelled key silently no-ops — it typechecks (a trailing catch-all
414
+ // index signature) but is never invoked.
415
+ const rows = [
416
+ { id: 1, name: 'Alpha', category: 'Hardware', price: 30 },
417
+ { id: 2, name: 'Beta', category: 'Software', price: 90 },
418
+ { id: 3, name: 'Gamma', category: 'Hardware', price: 10 },
419
+ { id: 4, name: 'Delta', category: 'Service', price: 50 },
420
+ ];
421
+ return (
422
+ <DataTable
423
+ data={rows}
424
+ slots={{
425
+ 'cell-price': ({ value }) => <>💲 {value}</>,
426
+ 'colHeader-price': ({ label }) => <>🏷️ {label}</>,
427
+ 'filter-category': ({ columnId, uniqueValues, setFilter }) => (
428
+ <select onChange={(e) => setFilter(columnId, e.currentTarget.value || null)}>
429
+ <option value="">All</option>
430
+ {uniqueValues.map((v) => <option value={String(v)}>{String(v)}</option>)}
431
+ </select>
432
+ ),
433
+ }}
434
+ >
435
+ <Column field="name" header="Name" />
436
+ <Column field="category" header="Category" filterable />
437
+ <Column field="price" header="Price" />
438
+ </DataTable>
439
+ );
440
+ }
441
+ ```
442
+
402
443
  ## Theming
403
444
 
404
445
  Every visual value is a `--rozie-data-table-*` CSS custom property — override any of them at any ancestor scope. Ready-made design-system bridges ship in the package (import `base.css` first, then a bridge):
@@ -523,14 +564,22 @@ All rendering slots live on the parent `<DataTable>` (a `<Column>` carries metad
523
564
 
524
565
  The `detail` (expandable rows), `groupBar` (grouping) and `filter` (faceted filtering) scoped slots follow the SAME render-prop convention: on React they are `renderDetail` / `renderGroupBar` / `renderFilter`; on Solid they are `detailSlot` / `groupBarSlot` / `filterSlot`; on Lit they are the `.detail` / `.groupBar` / `.filter` properties — the documented React render-prop edge (per the cross-framework compatibility bar). On Vue / Svelte / Angular they are ordinary named scoped slots (`#detail` / `#groupBar` / `#filter`). The `groupBar` and `filter` slots are HEADLESS — the component ships NO built-in group-bar / facet control, so the consumer builds the UI purely from the exposed slot props.
525
566
 
567
+ `cell`, `colHeader`, `filter` and `editor` each also have a **per-column slot family** — a statically-named fill per `columnId` (`cell-price`, `colHeader-price`, `filter-category`, `editor-score`, …) that takes precedence OVER the matching generic slot above it: `<seam>-<id>` → the generic `<seam>` slot → the built-in render. `editor-<id>` (and `editor`) only render on a column declared `editor="custom"`; `filter-<id>` (and `filter`) only render on a column declared `filterable`; `cell-<id>` / `colHeader-<id>` have no gate. The auto-injected row-select / row-expander chrome columns never reach any family — they are excluded structurally. On Solid the family is the additive **`slots`** record prop — `slots={{ 'cell-price': (ctx) => … }}` — keyed by the exact `<seam>-<id>` string.
568
+
569
+ A misspelled family key does not fail to compile — the emitted type carries a trailing catch-all index signature alongside the templated key, so it typechecks but is simply never invoked. See the "Per-column slot families" example in Usage above for the full per-target syntax.
570
+
526
571
  | Slot | Params |
527
572
  | --- | --- |
528
573
  | (default) | |
529
574
  | groupBar | grouping, groupableColumns, applyGrouping, clearGrouping |
530
575
  | selectAll | checked, indeterminate, toggle |
576
+ | colHeader-<id> | columnId, column, label |
577
+ | filter-<id> | columnId, value, uniqueValues, minMax, setFilter |
578
+ | selectCell | row, checked, toggle |
579
+ | cell-<id> | columnId, column, row, value |
580
+ | editor-<id> | columnId, column, row, value, commit, cancel, autofocus |
581
+ | detail | row |
531
582
  | colHeader | columnId, column, label |
532
583
  | filter | columnId, value, uniqueValues, minMax, setFilter |
533
- | selectCell | row, checked, toggle |
534
584
  | cell | columnId, column, row, value |
535
585
  | editor | columnId, column, row, value, commit, cancel, autofocus |
536
- | detail | row |