@indico-data/design-system 2.60.11 → 2.60.13

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/lib/index.js CHANGED
@@ -41487,11 +41487,13 @@ const TableBody = ({ table, onRowClick, isLoading, columnsLength, activeRows, })
41487
41487
  };
41488
41488
 
41489
41489
  function TanstackTable(_a) {
41490
- var { columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage = 1000, onChangePage, totalEntriesText, TableActions, error, enableRowSelection = true, clearFilters, hasFilters, showPagination = true, isLoading = false, defaultPinnedColumns, onRowClick, activeRows = [], isStriped = true, actionBarClassName } = _a, rest = __rest(_a, ["columns", "data", "className", "currentPage", "rowCount", "rowsPerPage", "onChangePage", "totalEntriesText", "TableActions", "error", "enableRowSelection", "clearFilters", "hasFilters", "showPagination", "isLoading", "defaultPinnedColumns", "onRowClick", "activeRows", "isStriped", "actionBarClassName"]);
41490
+ var { columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage = 1000, onChangePage, totalEntriesText, TableActions, error, enableRowSelection = true, clearFilters, hasFilters, showPagination = true, isLoading = false, defaultPinnedColumns, onRowClick, activeRows = [], isStriped = true, actionBarClassName, defaultSorting } = _a, rest = __rest(_a, ["columns", "data", "className", "currentPage", "rowCount", "rowsPerPage", "onChangePage", "totalEntriesText", "TableActions", "error", "enableRowSelection", "clearFilters", "hasFilters", "showPagination", "isLoading", "defaultPinnedColumns", "onRowClick", "activeRows", "isStriped", "actionBarClassName", "defaultSorting"]);
41491
41491
  const { columns, defaultData, windowWidth, rowSelection, // This refers to the checkboxes.
41492
41492
  setRowSelection, formattedColumns, setFormattedColumns, } = useTanstackTable({
41493
41493
  defaultColumns,
41494
41494
  });
41495
+ // handles internal sorting state.
41496
+ const [sorting, setSorting] = React.useState(defaultSorting !== null && defaultSorting !== void 0 ? defaultSorting : []);
41495
41497
  const thRefs = React.useRef({});
41496
41498
  // Auto-compute column widths based on current table header cell widths for columns without a defined size.
41497
41499
  React.useEffect(() => {
@@ -41506,7 +41508,8 @@ function TanstackTable(_a) {
41506
41508
  }, [data, columns, windowWidth]);
41507
41509
  const table = useReactTable(Object.assign(Object.assign({}, rest), { data: data !== null && data !== void 0 ? data : defaultData, columns: formattedColumns, state: {
41508
41510
  rowSelection,
41509
- }, enableRowSelection, onRowSelectionChange: setRowSelection, getCoreRowModel: getCoreRowModel(), manualPagination: true, getRowId: (row) => row === null || row === void 0 ? void 0 : row.id, initialState: {
41511
+ sorting,
41512
+ }, enableRowSelection, onRowSelectionChange: setRowSelection, getCoreRowModel: getCoreRowModel(), getSortedRowModel: getSortedRowModel(), onSortingChange: setSorting, manualPagination: true, getRowId: (row) => row === null || row === void 0 ? void 0 : row.id, initialState: {
41510
41513
  columnPinning: {
41511
41514
  left: defaultPinnedColumns,
41512
41515
  },