@trackunit/react-table 1.13.25 → 1.13.27

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/index.cjs.js CHANGED
@@ -959,13 +959,21 @@ const ColumnSorting = ({ canSort, sortingState = false }) => {
959
959
  };
960
960
 
961
961
  /**
962
- * Table component for displaying large sets of data in tables with infinite scroll, sorting, filtering and others.
962
+ * Table displays large data sets with virtual scrolling, column sorting, filtering, resizing, drag-and-drop column reordering,
963
+ * and row selection. It extends `@tanstack/react-table` and uses `useTable` to create the table instance.
964
+ * Infinite scroll pagination is handled via `RelayPagination` from `usePaginationQuery`.
963
965
  *
964
- * @param {ReactTable} props - The props for the Table component
966
+ * For the full TanStack Table API, see [TanStack Table docs](https://tanstack.com/table/v8/docs/guide/introduction).
967
+ *
968
+ * ### When to use
969
+ * Use Table for displaying structured data with sorting, pagination, or row actions — for example, asset lists, event logs, or user management views.
970
+ *
971
+ * ### When not to use
972
+ * Do not use Table for simple key-value displays — use a layout with `Text` components.
973
+ * Do not use Table for small card-based lists — use `List`.
974
+ *
975
+ * @param {TableProps} props - The props for the Table component
965
976
  * @returns {ReactElement} Table component
966
- * Table component for displaying large sets of data in tables with infinite scroll, sorting, filtering and others.
967
- * Table is extending the `@tanstack/react-table` Table component.
968
- * For more information about the `@tanstack/react-table` Table component, visit [https://tanstack.com/table/v8/docs/guide/introduction](https://tanstack.com/table/v8/docs/guide/introduction).
969
977
  * @example
970
978
  * ```tsx
971
979
  * import { createColumnHelper, Table, useTable } from "@trackunit/react-table";
@@ -1434,14 +1442,18 @@ const useTable = ({ onTableStateChange, initialState, columns, ...reactTableProp
1434
1442
  };
1435
1443
 
1436
1444
  /**
1437
- * `useTableSelection` is a custom hook that provides functionality for row selection in a table.
1438
- * It returns an object containing methods and values related to row selection.
1445
+ * `useTableSelection` provides row selection state management for the Table component.
1446
+ * It returns a selection checkbox column definition, row selection state, and props to spread onto `useTable`.
1447
+ *
1448
+ * ### When to use
1449
+ * Use useTableSelection when your Table needs checkbox-based row selection — for example, bulk actions on selected assets.
1450
+ *
1451
+ * ### When not to use
1452
+ * Do not use useTableSelection if your table does not need row selection. For single-row actions, use `onRowClick` on the Table instead.
1439
1453
  *
1440
- * @template TData - The type of data in the table. It must extend `selectableTableData`, which means it should at least have an `id` field.
1441
- * @returns {TableSelectionReturn<TData>} An object containing:
1442
- * - `selectionColumn`: A `ColumnDef` object for the selection column, which includes a checkbox in each cell and header.
1443
- * - `rowSelection`: The current state of row selection.
1444
- * - `setRowSelection`: A function to update the row selection state.
1454
+ * @template TData - The type of data in the table. It must extend `SelectableTableData`.
1455
+ * @param {TableSelectionProps} props - Configuration for selection behavior including data, idKey, and defaults
1456
+ * @returns {TableSelectionReturn<TData>} Selection column, state, setters, and props to spread onto useTable
1445
1457
  * @example
1446
1458
  * const {
1447
1459
  * selectionColumn,
package/index.esm.js CHANGED
@@ -958,13 +958,21 @@ const ColumnSorting = ({ canSort, sortingState = false }) => {
958
958
  };
959
959
 
960
960
  /**
961
- * Table component for displaying large sets of data in tables with infinite scroll, sorting, filtering and others.
961
+ * Table displays large data sets with virtual scrolling, column sorting, filtering, resizing, drag-and-drop column reordering,
962
+ * and row selection. It extends `@tanstack/react-table` and uses `useTable` to create the table instance.
963
+ * Infinite scroll pagination is handled via `RelayPagination` from `usePaginationQuery`.
962
964
  *
963
- * @param {ReactTable} props - The props for the Table component
965
+ * For the full TanStack Table API, see [TanStack Table docs](https://tanstack.com/table/v8/docs/guide/introduction).
966
+ *
967
+ * ### When to use
968
+ * Use Table for displaying structured data with sorting, pagination, or row actions — for example, asset lists, event logs, or user management views.
969
+ *
970
+ * ### When not to use
971
+ * Do not use Table for simple key-value displays — use a layout with `Text` components.
972
+ * Do not use Table for small card-based lists — use `List`.
973
+ *
974
+ * @param {TableProps} props - The props for the Table component
964
975
  * @returns {ReactElement} Table component
965
- * Table component for displaying large sets of data in tables with infinite scroll, sorting, filtering and others.
966
- * Table is extending the `@tanstack/react-table` Table component.
967
- * For more information about the `@tanstack/react-table` Table component, visit [https://tanstack.com/table/v8/docs/guide/introduction](https://tanstack.com/table/v8/docs/guide/introduction).
968
976
  * @example
969
977
  * ```tsx
970
978
  * import { createColumnHelper, Table, useTable } from "@trackunit/react-table";
@@ -1433,14 +1441,18 @@ const useTable = ({ onTableStateChange, initialState, columns, ...reactTableProp
1433
1441
  };
1434
1442
 
1435
1443
  /**
1436
- * `useTableSelection` is a custom hook that provides functionality for row selection in a table.
1437
- * It returns an object containing methods and values related to row selection.
1444
+ * `useTableSelection` provides row selection state management for the Table component.
1445
+ * It returns a selection checkbox column definition, row selection state, and props to spread onto `useTable`.
1446
+ *
1447
+ * ### When to use
1448
+ * Use useTableSelection when your Table needs checkbox-based row selection — for example, bulk actions on selected assets.
1449
+ *
1450
+ * ### When not to use
1451
+ * Do not use useTableSelection if your table does not need row selection. For single-row actions, use `onRowClick` on the Table instead.
1438
1452
  *
1439
- * @template TData - The type of data in the table. It must extend `selectableTableData`, which means it should at least have an `id` field.
1440
- * @returns {TableSelectionReturn<TData>} An object containing:
1441
- * - `selectionColumn`: A `ColumnDef` object for the selection column, which includes a checkbox in each cell and header.
1442
- * - `rowSelection`: The current state of row selection.
1443
- * - `setRowSelection`: A function to update the row selection state.
1453
+ * @template TData - The type of data in the table. It must extend `SelectableTableData`.
1454
+ * @param {TableSelectionProps} props - Configuration for selection behavior including data, idKey, and defaults
1455
+ * @returns {TableSelectionReturn<TData>} Selection column, state, setters, and props to spread onto useTable
1444
1456
  * @example
1445
1457
  * const {
1446
1458
  * selectionColumn,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table",
3
- "version": "1.13.25",
3
+ "version": "1.13.27",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -14,12 +14,12 @@
14
14
  "react-dnd-html5-backend": "16.0.1",
15
15
  "@tanstack/react-router": "1.114.29",
16
16
  "tailwind-merge": "^2.0.0",
17
- "@trackunit/react-components": "1.17.22",
17
+ "@trackunit/react-components": "1.17.24",
18
18
  "@trackunit/shared-utils": "1.13.43",
19
19
  "@trackunit/css-class-variance-utilities": "1.11.43",
20
20
  "@trackunit/ui-icons": "1.11.42",
21
- "@trackunit/react-table-base-components": "1.13.25",
22
- "@trackunit/react-form-components": "1.14.25",
21
+ "@trackunit/react-table-base-components": "1.13.27",
22
+ "@trackunit/react-form-components": "1.14.27",
23
23
  "@trackunit/i18n-library-translation": "1.12.28",
24
24
  "@trackunit/iris-app-runtime-core-api": "1.12.24",
25
25
  "graphql": "^16.10.0"
package/src/Table.d.ts CHANGED
@@ -69,16 +69,28 @@ export interface TableProps<TData extends object> extends ReactTable<TData>, Com
69
69
  * When provided, only rows returning true will have pointer cursor and trigger `onRowClick`.
70
70
  */
71
71
  isRowClickable?: (row: TData) => boolean;
72
+ /**
73
+ * Callback fired when a column drag operation begins. Receives the column ID being dragged.
74
+ * Used for custom column reorder logic or analytics.
75
+ */
72
76
  onColumnDragStart?: (columnId: string) => void;
73
77
  }
74
78
  /**
75
- * Table component for displaying large sets of data in tables with infinite scroll, sorting, filtering and others.
79
+ * Table displays large data sets with virtual scrolling, column sorting, filtering, resizing, drag-and-drop column reordering,
80
+ * and row selection. It extends `@tanstack/react-table` and uses `useTable` to create the table instance.
81
+ * Infinite scroll pagination is handled via `RelayPagination` from `usePaginationQuery`.
82
+ *
83
+ * For the full TanStack Table API, see [TanStack Table docs](https://tanstack.com/table/v8/docs/guide/introduction).
84
+ *
85
+ * ### When to use
86
+ * Use Table for displaying structured data with sorting, pagination, or row actions — for example, asset lists, event logs, or user management views.
87
+ *
88
+ * ### When not to use
89
+ * Do not use Table for simple key-value displays — use a layout with `Text` components.
90
+ * Do not use Table for small card-based lists — use `List`.
76
91
  *
77
- * @param {ReactTable} props - The props for the Table component
92
+ * @param {TableProps} props - The props for the Table component
78
93
  * @returns {ReactElement} Table component
79
- * Table component for displaying large sets of data in tables with infinite scroll, sorting, filtering and others.
80
- * Table is extending the `@tanstack/react-table` Table component.
81
- * For more information about the `@tanstack/react-table` Table component, visit [https://tanstack.com/table/v8/docs/guide/introduction](https://tanstack.com/table/v8/docs/guide/introduction).
82
94
  * @example
83
95
  * ```tsx
84
96
  * import { createColumnHelper, Table, useTable } from "@trackunit/react-table";
@@ -56,14 +56,18 @@ export interface TableSelectionReturn<TData extends SelectableTableData> {
56
56
  toggleRowSelectionState: (id: TData[keyof TData]) => void;
57
57
  }
58
58
  /**
59
- * `useTableSelection` is a custom hook that provides functionality for row selection in a table.
60
- * It returns an object containing methods and values related to row selection.
59
+ * `useTableSelection` provides row selection state management for the Table component.
60
+ * It returns a selection checkbox column definition, row selection state, and props to spread onto `useTable`.
61
61
  *
62
- * @template TData - The type of data in the table. It must extend `selectableTableData`, which means it should at least have an `id` field.
63
- * @returns {TableSelectionReturn<TData>} An object containing:
64
- * - `selectionColumn`: A `ColumnDef` object for the selection column, which includes a checkbox in each cell and header.
65
- * - `rowSelection`: The current state of row selection.
66
- * - `setRowSelection`: A function to update the row selection state.
62
+ * ### When to use
63
+ * Use useTableSelection when your Table needs checkbox-based row selection — for example, bulk actions on selected assets.
64
+ *
65
+ * ### When not to use
66
+ * Do not use useTableSelection if your table does not need row selection. For single-row actions, use `onRowClick` on the Table instead.
67
+ *
68
+ * @template TData - The type of data in the table. It must extend `SelectableTableData`.
69
+ * @param {TableSelectionProps} props - Configuration for selection behavior including data, idKey, and defaults
70
+ * @returns {TableSelectionReturn<TData>} Selection column, state, setters, and props to spread onto useTable
67
71
  * @example
68
72
  * const {
69
73
  * selectionColumn,