gantri-components 2.34.0-beta.18 → 2.34.0-beta.19

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,3 +1,7 @@
1
- import { BaseTableDataType } from '../../table.types';
1
+ import { RowData } from '@tanstack/react-table';
2
2
  import { TableFooterProps } from './table-footer.types';
3
- export declare const TableFooter: <DataType extends BaseTableDataType>(props: TableFooterProps<DataType>) => JSX.Element;
3
+ export declare const TableFooter: <DataType extends RowData<{
4
+ [key: string]: unknown;
5
+ id: string | number;
6
+ subRows?: any[] | undefined;
7
+ }>>(props: TableFooterProps<DataType>) => JSX.Element;
@@ -1,5 +1,4 @@
1
- import { Table } from '@tanstack/react-table';
2
- import { BaseTableDataType } from '../../table.types';
3
- export type TableFooterProps<DataType extends BaseTableDataType> = {
1
+ import { RowData, Table } from '@tanstack/react-table';
2
+ export type TableFooterProps<DataType extends RowData> = {
4
3
  table: Table<DataType>;
5
4
  };
@@ -1,3 +1,7 @@
1
- import { BaseTableDataType } from '../../table.types';
1
+ import { RowData } from '@tanstack/react-table';
2
2
  import { TableHeaderProps } from './table-header.types';
3
- export declare const TableHeader: <DataType extends BaseTableDataType>(props: TableHeaderProps<DataType>) => JSX.Element;
3
+ export declare const TableHeader: <DataType extends RowData<{
4
+ [key: string]: unknown;
5
+ id: string | number;
6
+ subRows?: any[] | undefined;
7
+ }>>(props: TableHeaderProps<DataType>) => JSX.Element;
@@ -1,6 +1,6 @@
1
- import { Table } from '@tanstack/react-table';
2
- import { BaseTableDataType, GetHeaderCellProps } from '../../table.types';
3
- export type TableHeaderProps<DataType extends BaseTableDataType> = {
1
+ import { RowData, Table } from '@tanstack/react-table';
2
+ import { GetHeaderCellProps } from '../../table.types';
3
+ export type TableHeaderProps<DataType extends RowData> = {
4
4
  getHeaderCellProps: GetHeaderCellProps<DataType> | undefined;
5
5
  table: Table<DataType>;
6
6
  };
@@ -1,7 +1,11 @@
1
1
  /// <reference types="react" />
2
- import { BaseTableDataType } from '../../../../table.types';
2
+ import { RowData } from '@tanstack/react-table';
3
3
  import { UseDragAndDropProps } from './use-drag-and-drop.types';
4
- export declare const useDragAndDrop: <DataType extends BaseTableDataType>(props: UseDragAndDropProps<DataType>) => {
4
+ export declare const useDragAndDrop: <DataType extends RowData<{
5
+ [key: string]: unknown;
6
+ id: string | number;
7
+ subRows?: any[] | undefined;
8
+ }>>(props: UseDragAndDropProps<DataType>) => {
5
9
  dragAndDropRef: import("react").RefObject<HTMLTableRowElement>;
6
10
  isDragging: boolean;
7
11
  };
@@ -1,6 +1,5 @@
1
- import { Row } from '@tanstack/react-table';
2
- import { BaseTableDataType } from '../../../../table.types';
3
- export interface UseDragAndDropProps<DataType extends BaseTableDataType> {
1
+ import { Row, RowData } from '@tanstack/react-table';
2
+ export interface UseDragAndDropProps<DataType extends RowData> {
4
3
  enableReordering: boolean;
5
4
  handleOnReorder: () => Promise<void>;
6
5
  index: number;
@@ -1,3 +1,7 @@
1
- import { BaseTableDataType } from '../../table.types';
1
+ import { RowData } from '@tanstack/react-table';
2
2
  import { TableRowProps } from './table-row.types';
3
- export declare const TableRow: <DataType extends BaseTableDataType>(props: TableRowProps<DataType>) => JSX.Element;
3
+ export declare const TableRow: <DataType extends RowData<{
4
+ [key: string]: unknown;
5
+ id: string | number;
6
+ subRows?: any[] | undefined;
7
+ }>>(props: TableRowProps<DataType>) => JSX.Element;
@@ -1,6 +1,6 @@
1
- import { Row } from '@tanstack/react-table';
2
- import { BaseTableDataType, CustomRowProps, GetCellProps, OnRowClick } from '../../table.types';
3
- export interface TableRowProps<DataType extends BaseTableDataType> {
1
+ import { Row, RowData } from '@tanstack/react-table';
2
+ import { CustomRowProps, GetCellProps, OnRowClick } from '../../table.types';
3
+ export interface TableRowProps<DataType extends RowData> {
4
4
  customRowProps: CustomRowProps;
5
5
  enableReordering: boolean;
6
6
  getCellProps: GetCellProps<DataType> | undefined;
@@ -1,3 +1,7 @@
1
- import { BaseTableDataType } from '../../table.types';
1
+ import { RowData } from '@tanstack/react-table';
2
2
  /** If an index does not contain an `id` value, one is added using uuid. */
3
- export declare const addMissingIds: <DataType extends BaseTableDataType>(data: DataType[]) => DataType[];
3
+ export declare const addMissingIds: <DataType extends RowData<{
4
+ [key: string]: unknown;
5
+ id: string | number;
6
+ subRows?: any[] | undefined;
7
+ }>>(data: DataType[]) => DataType[];
@@ -1,4 +1,9 @@
1
+ import { RowData } from '@tanstack/react-table';
1
2
  import { UseMoveRowProps } from './use-move-row.types';
2
- export declare const useMoveRow: (props: UseMoveRowProps) => {
3
+ export declare const useMoveRow: <TData extends RowData<{
4
+ [key: string]: unknown;
5
+ id: string | number;
6
+ subRows?: any[] | undefined;
7
+ }>>(props: UseMoveRowProps<TData>) => {
3
8
  moveRow: (startIndex: number, endIndex: number) => void;
4
9
  };
@@ -1,5 +1,5 @@
1
+ import { RowData } from '@tanstack/react-table';
1
2
  import { Dispatch, SetStateAction } from 'react';
2
- import { BaseTableDataType } from '../../table.types';
3
- export interface UseMoveRowProps {
4
- setData: Dispatch<SetStateAction<BaseTableDataType[]>>;
3
+ export interface UseMoveRowProps<TData extends RowData> {
4
+ setData: Dispatch<SetStateAction<TData[]>>;
5
5
  }
@@ -1,5 +1,10 @@
1
- import { BaseTableDataType, TableProps } from './table.types';
1
+ import { RowData } from '@tanstack/react-table';
2
+ import { TableProps } from './table.types';
2
3
  export declare const Table: {
3
- <DataType extends BaseTableDataType>(props: TableProps<DataType>): JSX.Element;
4
+ <DataType extends RowData<{
5
+ [key: string]: unknown;
6
+ id: string | number;
7
+ subRows?: any[] | undefined;
8
+ }>>(props: TableProps<DataType>): JSX.Element;
4
9
  defaultProps: import("./table.types").TableDefaultProps;
5
10
  };
@@ -1,10 +1,9 @@
1
- import { Cell, ColumnDef, Header, Row, TableOptions } from '@tanstack/react-table';
1
+ import { Cell, ColumnDef, Header, Row, RowData, TableOptions } from '@tanstack/react-table';
2
2
  import { HTMLAttributes, MouseEvent } from 'react';
3
3
  import { PagingProps } from '../paging/paging.types';
4
- import { CustomActionProps, FiltersProps, SearchProps } from './components/table-actions-wrapper';
4
+ import { CustomActionProps, FiltersProps, SearchProps } from './components/table-actions-wrapper/table-actions-wrapper.types';
5
5
  import { SortProps } from './components/table-actions-wrapper/components/sort/sort.types';
6
- export type BaseTableDataType = Record<any, any>;
7
- export interface TableProps<DataType extends BaseTableDataType> extends Partial<TableDefaultProps> {
6
+ export interface TableProps<DataType extends RowData> extends Partial<TableDefaultProps> {
8
7
  className?: string;
9
8
  columns: ColumnDef<DataType, any>[];
10
9
  customAction?: CustomActionProps;
@@ -33,10 +32,10 @@ export interface TableProps<DataType extends BaseTableDataType> extends Partial<
33
32
  export interface TableDefaultProps {
34
33
  stickyFirstColumn: boolean;
35
34
  }
36
- export type GetHeaderCellProps<DataType extends BaseTableDataType> = (cell?: Header<DataType, unknown>) => CustomCellProps;
37
- export type GetRowProps<DataType extends BaseTableDataType> = (row?: Row<DataType>, rows?: Row<DataType>[]) => CustomRowProps;
38
- export type GetCellProps<DataType extends BaseTableDataType> = (cell?: Cell<DataType, unknown>) => CustomCellProps;
39
- export type OnRowClick<DataType extends BaseTableDataType> = (data: Row<DataType>, event: MouseEvent<HTMLTableRowElement>) => void;
35
+ export type GetHeaderCellProps<DataType extends RowData> = (cell?: Header<DataType, unknown>) => CustomCellProps;
36
+ export type GetRowProps<DataType extends RowData> = (row?: Row<DataType>, rows?: Row<DataType>[]) => CustomRowProps;
37
+ export type GetCellProps<DataType extends RowData> = (cell?: Cell<DataType, unknown>) => CustomCellProps;
38
+ export type OnRowClick<DataType extends RowData> = (data: Row<DataType>, event: MouseEvent<HTMLTableRowElement>) => void;
40
39
  export interface CustomRowProps extends Record<string, unknown>, HTMLAttributes<HTMLTableRowElement> {
41
40
  status?: RowStatusValue | undefined;
42
41
  }