@takaro/lib-components 0.2.1 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takaro/lib-components",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "private": false,
5
5
  "description": "Takaro UI is a simple and customizable component library to build React apps faster within the Takaro eco system",
6
6
  "license": "AGPL-3.0-or-later",
@@ -88,6 +88,9 @@ export interface TableProps<DataType extends object> {
88
88
  columnSearchState: ColumnFilter[];
89
89
  setColumnSearchState: OnChangeFn<ColumnFilter[]>;
90
90
  };
91
+
92
+ /// Custom function to get row ID from data
93
+ getRowId?: (row: DataType) => string;
91
94
  }
92
95
 
93
96
  export function Table<DataType extends object>({
@@ -107,6 +110,7 @@ export function Table<DataType extends object>({
107
110
  canExpand = () => false,
108
111
  renderRowSelectionActions,
109
112
  isLoading = false,
113
+ getRowId,
110
114
  }: TableProps<DataType>) {
111
115
  const [columnVisibility, setColumnVisibility] = useState<VisibilityState>(() => {
112
116
  return columns.reduce(
@@ -206,6 +210,7 @@ export function Table<DataType extends object>({
206
210
  enableHiding: !!columnVisibility,
207
211
  enableRowSelection: !!rowSelection,
208
212
  getRowCanExpand: canExpand,
213
+ getRowId,
209
214
  autoResetPageIndex: false,
210
215
 
211
216
  columnResizeMode: 'onChange',