@invopop/popui 0.1.85 → 0.1.86
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.
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
focusedRowIndex,
|
|
13
13
|
loading = false,
|
|
14
14
|
onRowClick,
|
|
15
|
+
onFocusRow,
|
|
15
16
|
getRowClassName,
|
|
16
17
|
getRowState,
|
|
17
18
|
StickyCellWrapper
|
|
@@ -42,7 +43,11 @@
|
|
|
42
43
|
}),
|
|
43
44
|
getRowClassName?.(row.original as TData)
|
|
44
45
|
)}
|
|
45
|
-
onclick={() =>
|
|
46
|
+
onclick={() => {
|
|
47
|
+
if (loading) return
|
|
48
|
+
onFocusRow?.()
|
|
49
|
+
onRowClick?.(row.original as TData)
|
|
50
|
+
}}
|
|
46
51
|
>
|
|
47
52
|
{#each row.getVisibleCells() as cell, index (cell.id)}
|
|
48
53
|
<DataTableCell
|
|
@@ -102,6 +102,7 @@ export interface DataTableRowProps<TData> {
|
|
|
102
102
|
focusedRowIndex: number;
|
|
103
103
|
loading?: boolean;
|
|
104
104
|
onRowClick?: (row: TData) => void;
|
|
105
|
+
onFocusRow?: () => void;
|
|
105
106
|
getRowClassName?: (row: TData) => string;
|
|
106
107
|
getRowState?: (row: TData) => {
|
|
107
108
|
isSuccess?: boolean;
|
|
@@ -134,6 +135,7 @@ export interface DataTableProps<TData> {
|
|
|
134
135
|
pageSizeOptions?: number[];
|
|
135
136
|
emptyState?: Omit<EmptyStateProps, 'children' | 'check'>;
|
|
136
137
|
onRowClick?: (row: TData) => void;
|
|
138
|
+
onRowFocus?: (row: TData) => void;
|
|
137
139
|
onSelectionChange?: (selectedRows: TData[]) => void;
|
|
138
140
|
filters?: Snippet;
|
|
139
141
|
paginationSlot?: Snippet;
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
description: 'Try adjusting your filters or search query'
|
|
61
61
|
},
|
|
62
62
|
onRowClick,
|
|
63
|
+
onRowFocus,
|
|
63
64
|
onSelectionChange,
|
|
64
65
|
filters,
|
|
65
66
|
paginationSlot,
|
|
@@ -159,6 +160,14 @@
|
|
|
159
160
|
}
|
|
160
161
|
})
|
|
161
162
|
|
|
163
|
+
// Track focused row changes (keyboard navigation or row click)
|
|
164
|
+
$effect(() => {
|
|
165
|
+
if (!onRowFocus || focusedRowIndex < 0) return
|
|
166
|
+
const rows = table.getRowModel().rows
|
|
167
|
+
const focusedRow = rows[focusedRowIndex]
|
|
168
|
+
if (focusedRow) onRowFocus(focusedRow.original)
|
|
169
|
+
})
|
|
170
|
+
|
|
162
171
|
// Track column order changes
|
|
163
172
|
$effect(() => {
|
|
164
173
|
if (onColumnOrderChange && columnOrder.length > 0) {
|
|
@@ -410,6 +419,7 @@
|
|
|
410
419
|
{focusedRowIndex}
|
|
411
420
|
{loading}
|
|
412
421
|
{onRowClick}
|
|
422
|
+
onFocusRow={() => (focusedRowIndex = rowIndex)}
|
|
413
423
|
{getRowClassName}
|
|
414
424
|
{getRowState}
|
|
415
425
|
{StickyCellWrapper}
|