@likable-hair/svelte 3.0.33 → 3.0.34

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.
@@ -91,6 +91,7 @@ function handleFiltersChange() {
91
91
  bind:sortedBy
92
92
  bind:sortDirection
93
93
  on:sort
94
+ on:rowClick
94
95
  >
95
96
  <svelte:fragment slot="header" let:head>
96
97
  <slot name="header" {head} >
@@ -31,6 +31,11 @@ declare const __propDef: {
31
31
  sortedBy: string | undefined;
32
32
  sortDirection: string;
33
33
  }>;
34
+ rowClick: CustomEvent<{
35
+ item: {
36
+ [key: string]: any;
37
+ };
38
+ }>;
34
39
  } & {
35
40
  [evt: string]: CustomEvent<any>;
36
41
  };
@@ -24,6 +24,11 @@ function handleHeaderClick(header) {
24
24
  sortDirection
25
25
  });
26
26
  }
27
+ function handleRowClick(item) {
28
+ dispatch("rowClick", {
29
+ item
30
+ });
31
+ }
27
32
  function formatDate(dateTime, dateFormat) {
28
33
  return dateTime.setLocale(dateFormat.locale).toFormat(dateFormat.format);
29
34
  }
@@ -73,7 +78,10 @@ function formatDate(dateTime, dateFormat) {
73
78
  </thead>
74
79
  <tbody>
75
80
  {#each items as item, i}
76
- <tr class="item-tr {clazz.row || ''}">
81
+ <tr
82
+ class="item-tr {clazz.row || ''}"
83
+ on:click={() => handleRowClick(item)}
84
+ >
77
85
  {#each headers as header, j}
78
86
  <td class="{clazz.cell || ''}">
79
87
  {#if header.type.key == "custom"}
@@ -34,6 +34,11 @@ declare const __propDef: {
34
34
  sortedBy: string | undefined;
35
35
  sortDirection: string;
36
36
  }>;
37
+ rowClick: CustomEvent<{
38
+ item: {
39
+ [key: string]: any;
40
+ };
41
+ }>;
37
42
  } & {
38
43
  [evt: string]: CustomEvent<any>;
39
44
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likable-hair/svelte",
3
3
  "description": "A Svelte component for likablehair",
4
- "version": "3.0.33",
4
+ "version": "3.0.34",
5
5
  "scripts": {
6
6
  "host": "vite --host",
7
7
  "dev": "vite dev",