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

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];
@@ -1,24 +1,28 @@
1
1
  import { RowData, RowSelectionState } from '@tanstack/react-table';
2
2
  import React, { PropsWithChildren } from 'react';
3
- export declare const RowSelectionProviders: ({ children, }: PropsWithChildren<Record<never, never>>) => JSX.Element;
3
+ export declare const RowSelectionContext: React.Context<import("../../hooks/use-provider/use-provider.types").GenericContextValue<RowSelectionState>>;
4
+ export declare const LastSelectedIdContext: React.Context<import("../../hooks/use-provider/use-provider.types").GenericContextValue<string>>;
5
+ export declare const IsRowSelectionDisabledContext: React.Context<import("../../hooks/use-provider/use-provider.types").GenericContextValue<boolean>>;
6
+ export declare const IsRowSelectionCheckboxesContext: React.Context<import("../../hooks/use-provider/use-provider.types").GenericContextValue<boolean>>;
7
+ export declare const RowSelectionProviders: React.MemoExoticComponent<({ children }: PropsWithChildren<Record<never, never>>) => JSX.Element>;
4
8
  /** 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
9
  export declare const useTableContext: () => {
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
- /** Can be used to deselect rows outside of the default behavior. */
14
10
  isRowSelectionCheckboxes: boolean;
15
11
  isRowSelectionDisabled: boolean;
16
12
  lastSelectedId: string;
17
13
  rowSelectionState: RowSelectionState;
18
- selectRows: (rowIds: (string | number)[]) => void;
19
- /** Can be used to select rows outside of the default behavior. */
20
14
  setIsRowSelectionCheckboxes: React.Dispatch<React.SetStateAction<boolean>>;
21
15
  setIsRowSelectionDisabled: React.Dispatch<React.SetStateAction<boolean>>;
22
16
  setLastSelectedId: React.Dispatch<React.SetStateAction<string>>;
23
17
  setRowSelectionState: React.Dispatch<React.SetStateAction<RowSelectionState>>;
24
18
  };
19
+ export declare const useRowSelection: () => {
20
+ clearSelectedRows: () => void;
21
+ deselectRows: (rowIds: (string | number)[]) => void;
22
+ getIsRowSelected: (rowId: number | string) => boolean;
23
+ getSelectedRowsData: <TData extends RowData<import("./table.types").CustomTData>>(props: {
24
+ idProperty: keyof TData | undefined;
25
+ records: TData[];
26
+ }) => TData[];
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;
@@ -30,4 +30,4 @@ export declare const createGenericContext: <Type>(defaultValue: Type) => React.C
30
30
  export declare const useProvider: <Type>(props: {
31
31
  Context: React.Context<GenericContextValue<Type>>;
32
32
  defaultValue: Type;
33
- }) => ({ children }: PropsWithChildren<Record<never, never>>) => JSX.Element;
33
+ }) => React.MemoExoticComponent<({ children }: PropsWithChildren<Record<never, never>>) => JSX.Element>;