compote-ui 0.39.0 → 0.40.1

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.
@@ -27,10 +27,19 @@
27
27
  isRowSelectionEnabled: boolean;
28
28
  table: DataTableInstance<T>;
29
29
  emptyMessage: string;
30
+ onRowClick?: (details: { row: T; event: MouseEvent }) => void;
30
31
  onRowDoubleClick?: (details: { row: T; event: MouseEvent }) => void;
31
32
  };
32
33
 
33
- let { rows, scrollContainer, isRowSelectionEnabled, table, emptyMessage, onRowDoubleClick }: Props = $props();
34
+ let {
35
+ rows,
36
+ scrollContainer,
37
+ isRowSelectionEnabled,
38
+ table,
39
+ emptyMessage,
40
+ onRowClick,
41
+ onRowDoubleClick
42
+ }: Props = $props();
34
43
 
35
44
  const rowVirtualizer = createVirtualizer<HTMLDivElement, HTMLTableRowElement>({
36
45
  get count() {
@@ -76,6 +85,7 @@
76
85
  'bg-well/60 [--row-bg:color-mix(in_srgb,var(--compote-well)_60%,var(--compote-surface-1))]'
77
86
  )}
78
87
  style="display: flex; position: absolute; transform: translateY({virtualRow.start}px); width: 100%"
88
+ onclick={(event) => onRowClick?.({ row: row.original, event })}
79
89
  ondblclick={(event) => onRowDoubleClick?.({ row: row.original, event })}
80
90
  >
81
91
  {#if isRowSelectionEnabled}
@@ -7,6 +7,10 @@ declare function $$render<T extends RowData>(): {
7
7
  isRowSelectionEnabled: boolean;
8
8
  table: DataTableInstance<T>;
9
9
  emptyMessage: string;
10
+ onRowClick?: (details: {
11
+ row: T;
12
+ event: MouseEvent;
13
+ }) => void;
10
14
  onRowDoubleClick?: (details: {
11
15
  row: T;
12
16
  event: MouseEvent;
@@ -16,6 +16,7 @@
16
16
  caption?: string;
17
17
  emptyMessage?: string;
18
18
  class?: ClassValue;
19
+ onRowClick?: (details: { row: T; event: MouseEvent }) => void;
19
20
  onRowDoubleClick?: (details: { row: T; event: MouseEvent }) => void;
20
21
  };
21
22
 
@@ -24,6 +25,7 @@
24
25
  caption,
25
26
  emptyMessage = 'No rows found',
26
27
  class: className,
28
+ onRowClick,
27
29
  onRowDoubleClick,
28
30
  ...rest
29
31
  }: Props = $props();
@@ -88,6 +90,7 @@
88
90
  {isRowSelectionEnabled}
89
91
  {table}
90
92
  {emptyMessage}
93
+ {onRowClick}
91
94
  {onRowDoubleClick}
92
95
  />
93
96
  {/if}
@@ -8,6 +8,10 @@ declare function $$render<T extends RowData>(): {
8
8
  caption?: string;
9
9
  emptyMessage?: string;
10
10
  class?: ClassValue;
11
+ onRowClick?: (details: {
12
+ row: T;
13
+ event: MouseEvent;
14
+ }) => void;
11
15
  onRowDoubleClick?: (details: {
12
16
  row: T;
13
17
  event: MouseEvent;
@@ -28,6 +28,7 @@
28
28
  caption?: string;
29
29
  emptyMessage?: string;
30
30
  class?: ClassValue;
31
+ onRowClick?: (details: { row: T; event: MouseEvent }) => void;
31
32
  onRowDoubleClick?: (details: { row: T; event: MouseEvent }) => void;
32
33
  };
33
34
 
@@ -36,6 +37,7 @@
36
37
  caption,
37
38
  emptyMessage = 'No rows found',
38
39
  class: className,
40
+ onRowClick,
39
41
  onRowDoubleClick,
40
42
  ...rest
41
43
  }: Props = $props();
@@ -117,6 +119,7 @@
117
119
  rowSelected &&
118
120
  'bg-well/60 [--row-bg:color-mix(in_srgb,var(--compote-well)_60%,var(--compote-surface-1))]'
119
121
  )}
122
+ onclick={(event) => onRowClick?.({ row: row.original, event })}
120
123
  ondblclick={(event) => onRowDoubleClick?.({ row: row.original, event })}
121
124
  >
122
125
  {#if isRowSelectionEnabled}
@@ -8,6 +8,10 @@ declare function $$render<T extends RowData>(): {
8
8
  caption?: string;
9
9
  emptyMessage?: string;
10
10
  class?: ClassValue;
11
+ onRowClick?: (details: {
12
+ row: T;
13
+ event: MouseEvent;
14
+ }) => void;
11
15
  onRowDoubleClick?: (details: {
12
16
  row: T;
13
17
  event: MouseEvent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compote-ui",
3
- "version": "0.39.0",
3
+ "version": "0.40.1",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev --open",