gantri-components 2.34.0-beta.5 → 2.34.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.
- package/dist/components/table/components/table-footer/table-footer.d.ts +2 -2
- package/dist/components/table/components/table-footer/table-footer.types.d.ts +2 -2
- package/dist/components/table/components/table-header/table-header.d.ts +2 -2
- package/dist/components/table/components/table-header/table-header.types.d.ts +2 -2
- package/dist/components/table/components/table-row/hooks/use-drag-and-drop/use-drag-and-drop.d.ts +2 -2
- package/dist/components/table/components/table-row/hooks/use-drag-and-drop/use-drag-and-drop.types.d.ts +2 -2
- package/dist/components/table/components/table-row/table-row.d.ts +2 -2
- package/dist/components/table/components/table-row/table-row.types.d.ts +2 -2
- package/dist/components/table/helpers/add-missing-ids/index.d.ts +2 -2
- package/dist/components/table/table.d.ts +2 -2
- package/dist/components/table/table.types.d.ts +11 -10
- package/package.json +2 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseTableDataType } from '../../table.types';
|
|
2
2
|
import { TableFooterProps } from './table-footer.types';
|
|
3
|
-
export declare const TableFooter: <DataType extends
|
|
3
|
+
export declare const TableFooter: <DataType extends BaseTableDataType>(props: TableFooterProps<DataType>) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Table } from '@tanstack/react-table';
|
|
2
|
-
import {
|
|
3
|
-
export type TableFooterProps<DataType extends
|
|
2
|
+
import { BaseTableDataType } from '../../table.types';
|
|
3
|
+
export type TableFooterProps<DataType extends BaseTableDataType> = {
|
|
4
4
|
table: Table<DataType>;
|
|
5
5
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseTableDataType } from '../../table.types';
|
|
2
2
|
import { TableHeaderProps } from './table-header.types';
|
|
3
|
-
export declare const TableHeader: <DataType extends
|
|
3
|
+
export declare const TableHeader: <DataType extends BaseTableDataType>(props: TableHeaderProps<DataType>) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Table } from '@tanstack/react-table';
|
|
2
|
-
import {
|
|
3
|
-
export type TableHeaderProps<DataType extends
|
|
2
|
+
import { BaseTableDataType, GetHeaderCellProps } from '../../table.types';
|
|
3
|
+
export type TableHeaderProps<DataType extends BaseTableDataType> = {
|
|
4
4
|
getHeaderCellProps: GetHeaderCellProps<DataType> | undefined;
|
|
5
5
|
table: Table<DataType>;
|
|
6
6
|
};
|
package/dist/components/table/components/table-row/hooks/use-drag-and-drop/use-drag-and-drop.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { BaseTableDataType } from '../../../../table.types';
|
|
3
3
|
import { UseDragAndDropProps } from './use-drag-and-drop.types';
|
|
4
|
-
export declare const useDragAndDrop: <DataType extends
|
|
4
|
+
export declare const useDragAndDrop: <DataType extends BaseTableDataType>(props: UseDragAndDropProps<DataType>) => {
|
|
5
5
|
dragAndDropRef: import("react").RefObject<HTMLTableRowElement>;
|
|
6
6
|
isDragging: boolean;
|
|
7
7
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Row } from '@tanstack/react-table';
|
|
2
|
-
import {
|
|
3
|
-
export interface UseDragAndDropProps<DataType extends
|
|
2
|
+
import { BaseTableDataType } from '../../../../table.types';
|
|
3
|
+
export interface UseDragAndDropProps<DataType extends BaseTableDataType> {
|
|
4
4
|
enableReordering: boolean;
|
|
5
5
|
handleOnReorder: () => Promise<void>;
|
|
6
6
|
index: number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseTableDataType } from '../../table.types';
|
|
2
2
|
import { TableRowProps } from './table-row.types';
|
|
3
|
-
export declare const TableRow: <DataType extends
|
|
3
|
+
export declare const TableRow: <DataType extends BaseTableDataType>(props: TableRowProps<DataType>) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Row } from '@tanstack/react-table';
|
|
2
|
-
import {
|
|
3
|
-
export interface TableRowProps<DataType extends
|
|
2
|
+
import { BaseTableDataType, CustomRowProps, GetCellProps, OnRowClick } from '../../table.types';
|
|
3
|
+
export interface TableRowProps<DataType extends BaseTableDataType> {
|
|
4
4
|
customRowProps: CustomRowProps;
|
|
5
5
|
enableReordering: boolean;
|
|
6
6
|
getCellProps: GetCellProps<DataType> | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseTableDataType } from '../../table.types';
|
|
2
2
|
/** If an index does not contain an `id` value, one is added using uuid. */
|
|
3
|
-
export declare const addMissingIds: <DataType extends
|
|
3
|
+
export declare const addMissingIds: <DataType extends BaseTableDataType>(data: DataType[]) => DataType[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseTableDataType, TableProps } from './table.types';
|
|
2
2
|
export declare const Table: {
|
|
3
|
-
<DataType extends
|
|
3
|
+
<DataType extends BaseTableDataType>(props: TableProps<DataType>): JSX.Element;
|
|
4
4
|
defaultProps: import("./table.types").TableDefaultProps;
|
|
5
5
|
};
|
|
@@ -3,15 +3,16 @@ import { HTMLAttributes, MouseEvent } from 'react';
|
|
|
3
3
|
import { PagingProps } from '../paging/paging.types';
|
|
4
4
|
import { CustomActionProps, FiltersProps, SearchProps } from './components/table-actions-wrapper';
|
|
5
5
|
import { SortProps } from './components/table-actions-wrapper/components/sort/sort.types';
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
id?: string | number;
|
|
9
|
-
subRows?: BaseDataType[];
|
|
10
|
-
}
|
|
11
|
-
export interface TableProps<DataType extends BaseDataType> extends Partial<TableDefaultProps> {
|
|
6
|
+
export type BaseTableDataType = Record<any, any>;
|
|
7
|
+
export interface TableProps<DataType extends BaseTableDataType> extends Partial<TableDefaultProps> {
|
|
12
8
|
className?: string;
|
|
13
9
|
columns: ColumnDef<DataType, any>[];
|
|
14
10
|
customAction?: CustomActionProps;
|
|
11
|
+
/**
|
|
12
|
+
* For each index, if no `id` key exists, one will be assigned.
|
|
13
|
+
*
|
|
14
|
+
* To create collapsable rows, optionally provide the index with a `subRows` key. It should be an array of objects matching the expected data type.
|
|
15
|
+
*/
|
|
15
16
|
data: DataType[];
|
|
16
17
|
enableReordering?: boolean;
|
|
17
18
|
filters?: FiltersProps;
|
|
@@ -29,10 +30,10 @@ export interface TableProps<DataType extends BaseDataType> extends Partial<Table
|
|
|
29
30
|
export interface TableDefaultProps {
|
|
30
31
|
stickyFirstColumn: boolean;
|
|
31
32
|
}
|
|
32
|
-
export type GetHeaderCellProps<DataType extends
|
|
33
|
-
export type GetRowProps<DataType extends
|
|
34
|
-
export type GetCellProps<DataType extends
|
|
35
|
-
export type OnRowClick<DataType extends
|
|
33
|
+
export type GetHeaderCellProps<DataType extends BaseTableDataType> = (cell: Header<DataType, unknown>) => CustomCellProps;
|
|
34
|
+
export type GetRowProps<DataType extends BaseTableDataType> = (row: Row<DataType>, rows: Row<DataType>[]) => CustomRowProps;
|
|
35
|
+
export type GetCellProps<DataType extends BaseTableDataType> = (cell: Cell<DataType, unknown>) => CustomCellProps;
|
|
36
|
+
export type OnRowClick<DataType extends BaseTableDataType> = (data: Row<DataType>, event: MouseEvent<HTMLTableRowElement>) => void;
|
|
36
37
|
export interface CustomRowProps extends Record<string, unknown>, HTMLAttributes<HTMLTableRowElement> {
|
|
37
38
|
status?: RowStatusValue | undefined;
|
|
38
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gantri-components",
|
|
3
|
-
"version": "2.34.0-beta.
|
|
3
|
+
"version": "2.34.0-beta.7",
|
|
4
4
|
"main": "dist/index.cjs.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"umd": "dist/index.umd.js",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"@storybook/testing-library": "^0.0.13",
|
|
65
65
|
"@storybook/theming": "^6.5.12",
|
|
66
66
|
"@svgr/cli": "^6.2.1",
|
|
67
|
+
"@tanstack/react-table": "^8.9.1",
|
|
67
68
|
"@testing-library/dom": "^8.17.1",
|
|
68
69
|
"@testing-library/jest-dom": "^5.16.5",
|
|
69
70
|
"@testing-library/react": "^12.1.5",
|
|
@@ -126,7 +127,6 @@
|
|
|
126
127
|
},
|
|
127
128
|
"dependencies": {
|
|
128
129
|
"@cloudinary/url-gen": "^1.7.0",
|
|
129
|
-
"@tanstack/react-table": "^8.9.1",
|
|
130
130
|
"@types/lodash": "^4.14.182",
|
|
131
131
|
"@types/react-dom": "^17.0.17",
|
|
132
132
|
"formik": "^2.2.9",
|