@indico-data/design-system 2.60.12 → 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.
@@ -1,4 +1,4 @@
1
- import { Row, ColumnDef } from '@tanstack/react-table';
1
+ import { Row, ColumnDef, SortingState } from '@tanstack/react-table';
2
2
  export type WithPaginationProps = {
3
3
  rowsPerPage: number;
4
4
  rowCount: number;
@@ -43,4 +43,5 @@ export type Props<T extends object> = {
43
43
  rowSelection?: Record<string, boolean>;
44
44
  onRowSelectionChange?: (updater: Record<string, boolean>) => void;
45
45
  onSelectAllChange?: (isSelected: boolean) => void;
46
+ defaultSorting?: SortingState;
46
47
  } & PaginationProps;
@@ -1,4 +1,4 @@
1
1
  import { Props } from './TankstackTable.types';
2
- export declare function TanstackTable<T extends object>({ columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage, onChangePage, totalEntriesText, TableActions, error, enableRowSelection, clearFilters, hasFilters, showPagination, isLoading, defaultPinnedColumns, onRowClick, activeRows, isStriped, actionBarClassName, ...rest }: Props<T & {
2
+ export declare function TanstackTable<T extends object>({ columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage, onChangePage, totalEntriesText, TableActions, error, enableRowSelection, clearFilters, hasFilters, showPagination, isLoading, defaultPinnedColumns, onRowClick, activeRows, isStriped, actionBarClassName, defaultSorting, ...rest }: Props<T & {
3
3
  id: string;
4
4
  }>): import("react/jsx-runtime").JSX.Element;
package/lib/index.d.ts CHANGED
@@ -10,7 +10,7 @@ import { Props as Props$4 } from 'react-select';
10
10
  import { DateRange, OnSelectHandler, Mode, CustomComponents, Matcher, Formatters, MonthChangeEventHandler, DayEventHandler } from 'react-day-picker';
11
11
  export { DateRange } from 'react-day-picker';
12
12
  import { IconName as IconName$2 } from '@/types';
13
- import { ColumnDef, Row as Row$1 } from '@tanstack/react-table';
13
+ import { ColumnDef, Row as Row$1, SortingState } from '@tanstack/react-table';
14
14
  export { ColumnDef, SortingFn, SortingState, Column as TanstackTableColumnType, Row as TanstackTableRowType, Table as TanstackTableType, flexRender, getCoreRowModel, getSortedRowModel, useReactTable } from '@tanstack/react-table';
15
15
  import { PlacesType } from 'react-tooltip';
16
16
  export { ToastContainer, toast } from 'react-toastify';
@@ -607,9 +607,10 @@ type Props<T extends object> = {
607
607
  rowSelection?: Record<string, boolean>;
608
608
  onRowSelectionChange?: (updater: Record<string, boolean>) => void;
609
609
  onSelectAllChange?: (isSelected: boolean) => void;
610
+ defaultSorting?: SortingState;
610
611
  } & PaginationProps$1;
611
612
 
612
- declare function TanstackTable<T extends object>({ columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage, onChangePage, totalEntriesText, TableActions, error, enableRowSelection, clearFilters, hasFilters, showPagination, isLoading, defaultPinnedColumns, onRowClick, activeRows, isStriped, actionBarClassName, ...rest }: Props<T & {
613
+ declare function TanstackTable<T extends object>({ columns: defaultColumns, data, className, currentPage, rowCount, rowsPerPage, onChangePage, totalEntriesText, TableActions, error, enableRowSelection, clearFilters, hasFilters, showPagination, isLoading, defaultPinnedColumns, onRowClick, activeRows, isStriped, actionBarClassName, defaultSorting, ...rest }: Props<T & {
613
614
  id: string;
614
615
  }>): react_jsx_runtime.JSX.Element;
615
616
 
package/lib/index.esm.js CHANGED
@@ -41462,13 +41462,13 @@ const TableBody = ({ table, onRowClick, isLoading, columnsLength, activeRows, })
41462
41462
  };
41463
41463
 
41464
41464
  function TanstackTable(_a) {
41465
- 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"]);
41465
+ 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"]);
41466
41466
  const { columns, defaultData, windowWidth, rowSelection, // This refers to the checkboxes.
41467
41467
  setRowSelection, formattedColumns, setFormattedColumns, } = useTanstackTable({
41468
41468
  defaultColumns,
41469
41469
  });
41470
41470
  // handles internal sorting state.
41471
- const [sorting, setSorting] = useState([]);
41471
+ const [sorting, setSorting] = useState(defaultSorting !== null && defaultSorting !== void 0 ? defaultSorting : []);
41472
41472
  const thRefs = useRef({});
41473
41473
  // Auto-compute column widths based on current table header cell widths for columns without a defined size.
41474
41474
  useEffect(() => {