@classic-homes/theme-svelte 1.43.0 → 1.44.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.
|
@@ -637,6 +637,8 @@
|
|
|
637
637
|
>
|
|
638
638
|
{#if canEdit && column.enableEditing}
|
|
639
639
|
<DataTableEditableCell {row} {column} onSave={handleCellEdit} />
|
|
640
|
+
{:else if column.cell}
|
|
641
|
+
{@render column.cell(value, row.original)}
|
|
640
642
|
{:else}
|
|
641
643
|
{table.getFormattedCellValue(row.original, column)}
|
|
642
644
|
{/if}
|
|
@@ -146,12 +146,20 @@
|
|
|
146
146
|
onkeydown={(e: KeyboardEvent) => e.key === 'Enter' && startEditing()}
|
|
147
147
|
>
|
|
148
148
|
<span class="border-b border-dashed border-transparent hover:border-primary">
|
|
149
|
-
{
|
|
149
|
+
{#if column.cell}
|
|
150
|
+
{@render column.cell(getColumnValue(row.original, column), row.original)}
|
|
151
|
+
{:else}
|
|
152
|
+
{displayValue}
|
|
153
|
+
{/if}
|
|
150
154
|
</span>
|
|
151
155
|
<span class="sr-only">(double-click to edit)</span>
|
|
152
156
|
</button>
|
|
153
157
|
{:else}
|
|
154
158
|
<span class={cn('relative', className)}>
|
|
155
|
-
{
|
|
159
|
+
{#if column.cell}
|
|
160
|
+
{@render column.cell(getColumnValue(row.original, column), row.original)}
|
|
161
|
+
{:else}
|
|
162
|
+
{displayValue}
|
|
163
|
+
{/if}
|
|
156
164
|
</span>
|
|
157
165
|
{/if}
|
|
@@ -243,7 +243,11 @@
|
|
|
243
243
|
style={column.width ? `width: ${column.width}` : 'flex: 1'}
|
|
244
244
|
role="cell"
|
|
245
245
|
>
|
|
246
|
-
{
|
|
246
|
+
{#if column.cell}
|
|
247
|
+
{@render column.cell(getColumnValue(row.original, column), row.original)}
|
|
248
|
+
{:else}
|
|
249
|
+
{table.getFormattedCellValue(row.original, column)}
|
|
250
|
+
{/if}
|
|
247
251
|
</div>
|
|
248
252
|
{/each}
|
|
249
253
|
</div>
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* These types are exported from components but need to be
|
|
5
5
|
* re-exported from a TypeScript file for proper type inference.
|
|
6
6
|
*/
|
|
7
|
+
import type { Snippet } from 'svelte';
|
|
7
8
|
import type { IconName } from '../components/Icon.svelte';
|
|
8
9
|
/**
|
|
9
10
|
* Dropdown Menu Types
|
|
@@ -102,8 +103,18 @@ export interface DataTableColumn<T = object> {
|
|
|
102
103
|
* mirror the guard themselves so cell counts stay in sync.
|
|
103
104
|
*/
|
|
104
105
|
hideBelow?: 'sm' | 'md' | 'lg';
|
|
105
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* Custom cell text. Global search matches it, and it stays the cell's text
|
|
108
|
+
* (e.g. for `getFormattedCellValue` and exports) when `cell` renders it.
|
|
109
|
+
*/
|
|
106
110
|
format?: (value: unknown, row: T) => string;
|
|
111
|
+
/**
|
|
112
|
+
* Custom cell content (e.g. a value with its change underneath). Rendered
|
|
113
|
+
* in place of the formatted text whenever the cell is not being edited
|
|
114
|
+
* (editable cells still edit the raw value); `format` still supplies the
|
|
115
|
+
* cell's text for search and exports.
|
|
116
|
+
*/
|
|
117
|
+
cell?: Snippet<[value: unknown, row: T]>;
|
|
107
118
|
/** Filter function type or custom filter function */
|
|
108
119
|
filterFn?: DataTableFilterFn<T>;
|
|
109
120
|
/** Options for select/faceted filters */
|