gantri-components 2.90.0-beta.6 → 2.90.0-beta.7

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.
@@ -0,0 +1,6 @@
1
+ export declare const customActionPositions: {
2
+ readonly bottom: "bottom";
3
+ readonly handleSelections: "handle-selections";
4
+ readonly left: "left";
5
+ readonly right: "right";
6
+ };
@@ -3,6 +3,7 @@ import { RowData, Table } from '@tanstack/react-table';
3
3
  import { PagingProps } from './components/paging/paging.types';
4
4
  import { SortProps } from './components/sort/sort.types';
5
5
  import { SearchProps } from './components/search/search.types';
6
+ import { customActionPositions } from './table-actions-wrapper.constants';
6
7
  export type { SearchProps };
7
8
  export type FiltersProps = {
8
9
  count: number;
@@ -18,7 +19,7 @@ export interface CustomActionComponentProps<TData extends RowData> {
18
19
  }
19
20
  export interface CustomActionProps<TData extends RowData> {
20
21
  Component: JSXElementConstructor<CustomActionComponentProps<TData>>;
21
- position: 'left' | 'right' | 'bottom' | 'clear-selected';
22
+ position: typeof customActionPositions[keyof typeof customActionPositions];
22
23
  }
23
24
  export interface TableActionsWrapperProps<TData extends RowData> {
24
25
  className: string | undefined;
@@ -1,2 +1,3 @@
1
+ import { PropsWithChildren } from 'react';
1
2
  import { SelectableRowFooterProps } from './selectable-table-row-footer.types';
2
- export declare const SelectableRowFooter: (props: SelectableRowFooterProps) => JSX.Element;
3
+ export declare const SelectableRowFooter: (props: PropsWithChildren<SelectableRowFooterProps>) => JSX.Element;
@@ -1,5 +1,3 @@
1
- import { JSXElementConstructor } from 'react';
2
- export type SelectableRowFooterTypeDef = JSXElementConstructor<SelectableRowFooterProps>;
3
1
  export interface SelectableRowFooterProps {
4
- text: string;
2
+ index: number;
5
3
  }
@@ -1,6 +1,9 @@
1
+ import { RowData } from '@tanstack/react-table';
1
2
  import { rowSelectionTypes } from './use-selectable-table-rows.constants';
2
- export interface RowSelection {
3
+ export interface RowSelection<TData extends RowData> {
3
4
  disabled?: boolean;
5
+ idProperty?: keyof TData;
6
+ onSelect?: (selectedRecords: TData[]) => void;
4
7
  type: RowSelectionType;
5
8
  }
6
9
  export type RowSelectionType = typeof rowSelectionTypes[keyof typeof rowSelectionTypes];
@@ -4,21 +4,25 @@ export declare const RowSelectionProviders: ({ children, }: PropsWithChildren<Re
4
4
  /** If you need to call any of these helpers outside of the `Table` component, you must wrap your code in `RowSelectionProviders` at a higher level */
5
5
  export declare const useTableContext: () => {
6
6
  clearSelectedRows: () => void;
7
- deselectRows: (rowIds: (string | number)[]) => void;
8
- getIsRowSelected: (rowId: number | string) => boolean;
9
- getSelectedRowData: <TData extends RowData<import("./table.types").CustomTData>>(props: {
10
- idProperty: keyof TData;
11
- records: TData[];
12
- }) => (TData | undefined)[];
13
7
  /** Can be used to deselect rows outside of the default behavior. */
14
8
  isRowSelectionCheckboxes: boolean;
15
9
  isRowSelectionDisabled: boolean;
16
10
  lastSelectedId: string;
17
11
  rowSelectionState: RowSelectionState;
18
- selectRows: (rowIds: (string | number)[]) => void;
19
12
  /** Can be used to select rows outside of the default behavior. */
20
13
  setIsRowSelectionCheckboxes: React.Dispatch<React.SetStateAction<boolean>>;
21
14
  setIsRowSelectionDisabled: React.Dispatch<React.SetStateAction<boolean>>;
22
15
  setLastSelectedId: React.Dispatch<React.SetStateAction<string>>;
23
16
  setRowSelectionState: React.Dispatch<React.SetStateAction<RowSelectionState>>;
24
17
  };
18
+ export declare const useGetSelectedRowData: () => <TData extends RowData<import("./table.types").CustomTData>>(props: {
19
+ idProperty?: keyof TData | undefined;
20
+ records: TData[];
21
+ }) => TData[];
22
+ export declare const useRowSelection: () => {
23
+ /** Can be used to deselect rows outside of the default behavior. */
24
+ deselectRows: (rowIds: (string | number)[]) => void;
25
+ getIsRowSelected: (rowId: number | string) => boolean;
26
+ /** Can be used to select rows outside of the default behavior. */
27
+ selectRows: (rowIds: (string | number)[]) => void;
28
+ };
@@ -64,7 +64,7 @@ export interface TableProps<TData extends RowData> extends Partial<TableDefaultP
64
64
  options?: Partial<TableOptions<TData>>;
65
65
  paging?: PagingProps;
66
66
  reordering?: RowReorderingProps<TData>;
67
- rowSelection?: RowSelection;
67
+ rowSelection?: RowSelection<TData>;
68
68
  search?: SearchProps;
69
69
  sorting?: SortProps;
70
70
  syncState?: SyncState;