gantri-components 2.34.0-beta.2 → 2.34.0-beta.20
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-actions-wrapper/table-actions-wrapper.d.ts +2 -28
- package/dist/components/table/components/table-actions-wrapper/table-actions-wrapper.types.d.ts +28 -0
- package/dist/components/table/components/table-footer/table-footer.d.ts +6 -2
- package/dist/components/table/components/table-footer/table-footer.types.d.ts +2 -3
- package/dist/components/table/components/table-header/table-header.d.ts +6 -2
- package/dist/components/table/components/table-header/table-header.styles.d.ts +3 -0
- package/dist/components/table/components/table-header/table-header.types.d.ts +4 -3
- package/dist/components/table/components/table-row/hooks/use-drag-and-drop/use-drag-and-drop.d.ts +6 -2
- package/dist/components/table/components/table-row/hooks/use-drag-and-drop/use-drag-and-drop.types.d.ts +2 -3
- package/dist/components/table/components/table-row/table-row.d.ts +6 -2
- package/dist/components/table/components/table-row/table-row.types.d.ts +5 -5
- package/dist/components/table/helpers/add-missing-ids/index.d.ts +6 -2
- package/dist/components/table/helpers/hyphenate-column-id/hyphenate-column-id.d.ts +1 -0
- package/dist/components/table/helpers/hyphenate-column-id/index.d.ts +1 -0
- package/dist/components/table/hooks/use-move-row/index.d.ts +1 -0
- package/dist/components/table/hooks/use-move-row/use-move-row.d.ts +9 -0
- package/dist/components/table/hooks/use-move-row/use-move-row.types.d.ts +5 -0
- package/dist/components/table/hooks/use-track-sticky-cells/index.d.ts +1 -0
- package/dist/components/table/hooks/use-track-sticky-cells/use-track-sticky-cells.d.ts +3 -0
- package/dist/components/table/hooks/use-track-sticky-cells/use-track-sticky-cells.types.d.ts +7 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/table.d.ts +7 -2
- package/dist/components/table/table.styles.d.ts +1 -0
- package/dist/components/table/table.types.d.ts +25 -13
- package/dist/helpers/mark-sticky-elements/mark-sticky-elements.d.ts +2 -0
- package/dist/helpers/mark-sticky-elements/mark-sticky-elements.types.d.ts +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1,30 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { SortProps } from './components/sort/sort.types';
|
|
4
|
-
export type FiltersProps = {
|
|
5
|
-
FiltersContent: JSX.Element;
|
|
6
|
-
count: number;
|
|
7
|
-
numActive: number;
|
|
8
|
-
onApply: () => void;
|
|
9
|
-
onClose: () => void;
|
|
10
|
-
onReset: () => void;
|
|
11
|
-
};
|
|
12
|
-
export interface SearchProps {
|
|
13
|
-
onSearch: (value: string) => void;
|
|
14
|
-
placeholder?: string;
|
|
15
|
-
value: string;
|
|
16
|
-
}
|
|
17
|
-
export interface CustomActionProps {
|
|
18
|
-
Component: JSXElementConstructor<Record<never, never>>;
|
|
19
|
-
position?: 'left' | 'right';
|
|
20
|
-
}
|
|
21
|
-
interface TableActionsWrapperProps {
|
|
22
|
-
customAction: CustomActionProps | undefined;
|
|
23
|
-
filters: FiltersProps | undefined;
|
|
24
|
-
paging: PagingProps | undefined;
|
|
25
|
-
search: SearchProps | undefined;
|
|
26
|
-
sorting: SortProps | undefined;
|
|
27
|
-
}
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { TableActionsWrapperProps } from './table-actions-wrapper.types';
|
|
28
3
|
/** Wraps the table with relevant components for paging, filters, sort, and table actions. */
|
|
29
4
|
export declare const TableActionsWrapper: (props: PropsWithChildren<TableActionsWrapperProps>) => JSX.Element;
|
|
30
|
-
export {};
|
package/dist/components/table/components/table-actions-wrapper/table-actions-wrapper.types.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { JSXElementConstructor } from 'react';
|
|
2
|
+
import { PagingProps } from '../../../paging/paging.types';
|
|
3
|
+
import { SortProps } from './components/sort/sort.types';
|
|
4
|
+
export type FiltersProps = {
|
|
5
|
+
count: number;
|
|
6
|
+
filtersContent: JSX.Element;
|
|
7
|
+
numActive: number;
|
|
8
|
+
onApply: () => void;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
onReset: () => void;
|
|
11
|
+
};
|
|
12
|
+
export interface SearchProps {
|
|
13
|
+
onSearch: (value: string) => void;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}
|
|
17
|
+
export interface CustomActionProps {
|
|
18
|
+
Component: JSXElementConstructor<Record<never, never>>;
|
|
19
|
+
position?: 'left' | 'right';
|
|
20
|
+
}
|
|
21
|
+
export interface TableActionsWrapperProps {
|
|
22
|
+
className: string | undefined;
|
|
23
|
+
customAction: CustomActionProps | undefined;
|
|
24
|
+
filters: FiltersProps | undefined;
|
|
25
|
+
paging: PagingProps | undefined;
|
|
26
|
+
search: SearchProps | undefined;
|
|
27
|
+
sorting: SortProps | undefined;
|
|
28
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RowData } from '@tanstack/react-table';
|
|
2
2
|
import { TableFooterProps } from './table-footer.types';
|
|
3
|
-
export declare const TableFooter: <DataType extends
|
|
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
|
-
|
|
3
|
-
export type TableFooterProps<DataType extends BaseDataType> = {
|
|
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 {
|
|
1
|
+
import { RowData } from '@tanstack/react-table';
|
|
2
2
|
import { TableHeaderProps } from './table-header.types';
|
|
3
|
-
export declare const TableHeader: <DataType extends
|
|
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,5 +1,6 @@
|
|
|
1
|
-
import { Table } from '@tanstack/react-table';
|
|
2
|
-
import {
|
|
3
|
-
export type TableHeaderProps<DataType extends
|
|
1
|
+
import { RowData, Table } from '@tanstack/react-table';
|
|
2
|
+
import { GetHeaderCellProps } from '../../table.types';
|
|
3
|
+
export type TableHeaderProps<DataType extends RowData> = {
|
|
4
|
+
getHeaderCellProps: GetHeaderCellProps<DataType> | undefined;
|
|
4
5
|
table: Table<DataType>;
|
|
5
6
|
};
|
package/dist/components/table/components/table-row/hooks/use-drag-and-drop/use-drag-and-drop.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { RowData } from '@tanstack/react-table';
|
|
3
3
|
import { UseDragAndDropProps } from './use-drag-and-drop.types';
|
|
4
|
-
export declare const useDragAndDrop: <DataType extends
|
|
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
|
-
|
|
3
|
-
export interface UseDragAndDropProps<DataType extends BaseDataType> {
|
|
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 {
|
|
1
|
+
import { RowData } from '@tanstack/react-table';
|
|
2
2
|
import { TableRowProps } from './table-row.types';
|
|
3
|
-
export declare const TableRow: <DataType extends
|
|
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,12 +1,12 @@
|
|
|
1
|
-
import { Row } from '@tanstack/react-table';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export interface TableRowProps<DataType extends BaseDataType> {
|
|
1
|
+
import { Row, RowData } from '@tanstack/react-table';
|
|
2
|
+
import { CustomRowProps, GetCellProps, OnRowClick } from '../../table.types';
|
|
3
|
+
export interface TableRowProps<DataType extends RowData> {
|
|
5
4
|
customRowProps: CustomRowProps;
|
|
6
5
|
enableReordering: boolean;
|
|
6
|
+
getCellProps: GetCellProps<DataType> | undefined;
|
|
7
7
|
handleOnReorder: () => Promise<void>;
|
|
8
8
|
index: number;
|
|
9
9
|
moveRow: (startIndex: number, endIndex: number) => void;
|
|
10
|
-
onRowClick?:
|
|
10
|
+
onRowClick?: OnRowClick<DataType>;
|
|
11
11
|
row: Row<DataType>;
|
|
12
12
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import {
|
|
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
|
|
3
|
+
export declare const addMissingIds: <DataType extends RowData<{
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
id: string | number;
|
|
6
|
+
subRows?: any[] | undefined;
|
|
7
|
+
}>>(data: DataType[]) => DataType[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const hyphenateColumnId: ((id: string) => string) & import("lodash").MemoizedFunction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hyphenate-column-id';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-move-row';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RowData } from '@tanstack/react-table';
|
|
2
|
+
import { UseMoveRowProps } from './use-move-row.types';
|
|
3
|
+
export declare const useMoveRow: <TData extends RowData<{
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
id: string | number;
|
|
6
|
+
subRows?: any[] | undefined;
|
|
7
|
+
}>>(props: UseMoveRowProps<TData>) => {
|
|
8
|
+
moveRow: (startIndex: number, endIndex: number) => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-track-sticky-cells';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
export interface UseTrackStickyCellsProps {
|
|
3
|
+
columns: ColumnDef<any, any>[];
|
|
4
|
+
/** The containing element that the child will intersect with. */
|
|
5
|
+
root: Element | null;
|
|
6
|
+
stickyFirstColumn: boolean | undefined;
|
|
7
|
+
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RowData } from '@tanstack/react-table';
|
|
2
|
+
import { TableProps } from './table.types';
|
|
2
3
|
export declare const Table: {
|
|
3
|
-
<DataType extends
|
|
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,3 +1,4 @@
|
|
|
1
|
+
export declare const StyledTableContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
1
2
|
export declare const StyledTable: import("styled-components").StyledComponent<"table", import("styled-components").DefaultTheme, {
|
|
2
3
|
stickyFirstColumn: boolean | undefined;
|
|
3
4
|
}, never>;
|
|
@@ -1,32 +1,44 @@
|
|
|
1
|
-
import { ColumnDef, 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 interface
|
|
7
|
-
|
|
8
|
-
id?: string | number;
|
|
9
|
-
subRows?: BaseDataType[];
|
|
10
|
-
}
|
|
11
|
-
export interface TableProps<DataType extends BaseDataType> extends Partial<TableDefaultProps> {
|
|
6
|
+
export interface TableProps<DataType extends RowData> extends Partial<TableDefaultProps> {
|
|
7
|
+
className?: string;
|
|
12
8
|
columns: ColumnDef<DataType, any>[];
|
|
13
9
|
customAction?: CustomActionProps;
|
|
10
|
+
/**
|
|
11
|
+
* For each index, if no `id` key exists, one will be assigned.
|
|
12
|
+
*
|
|
13
|
+
* To create collapsable rows, optionally provide the index with a `subRows` key. It should be an array of objects matching the expected data type.
|
|
14
|
+
*/
|
|
14
15
|
data: DataType[];
|
|
15
|
-
enableReordering?: boolean;
|
|
16
16
|
filters?: FiltersProps;
|
|
17
|
+
getCellProps?: GetCellProps<DataType>;
|
|
18
|
+
getHeaderCellProps?: GetHeaderCellProps<DataType>;
|
|
17
19
|
/** Include `status` in the returned value to set the row status color. */
|
|
18
|
-
getRowProps?:
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
getRowProps?: GetRowProps<DataType>;
|
|
21
|
+
onRowClick?: OnRowClick<DataType>;
|
|
22
|
+
/** Any options provided are passed to `useReactTable` and may override default values. */
|
|
21
23
|
options?: Partial<TableOptions<DataType>>;
|
|
22
24
|
paging?: PagingProps;
|
|
25
|
+
reordering?: {
|
|
26
|
+
enable: boolean;
|
|
27
|
+
onReorder: (data: DataType[]) => Promise<void>;
|
|
28
|
+
};
|
|
23
29
|
search?: SearchProps;
|
|
24
30
|
sorting?: SortProps;
|
|
25
31
|
}
|
|
26
32
|
export interface TableDefaultProps {
|
|
27
33
|
stickyFirstColumn: boolean;
|
|
28
34
|
}
|
|
29
|
-
export
|
|
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;
|
|
39
|
+
export interface CustomRowProps extends Record<string, unknown>, HTMLAttributes<HTMLTableRowElement> {
|
|
30
40
|
status?: RowStatusValue | undefined;
|
|
31
41
|
}
|
|
42
|
+
export interface CustomCellProps extends Record<string, unknown>, HTMLAttributes<HTMLTableCellElement> {
|
|
43
|
+
}
|
|
32
44
|
export type RowStatusValue = 'handled' | 'next' | 'error' | 'warning';
|
|
@@ -7,12 +7,14 @@ import { MarkStickyElementsArgs } from './mark-sticky-elements.types';
|
|
|
7
7
|
* const elementsToObserve = Array.from(
|
|
8
8
|
* document.querySelectorAll('tr td:first-child'),
|
|
9
9
|
* );
|
|
10
|
+
* const root = [document.querySelector('[data-table-container]')];
|
|
10
11
|
* const stickyTo = 'left';
|
|
11
12
|
*
|
|
12
13
|
* const { cleanupUseEffect } = markStickyElements({
|
|
13
14
|
* attrToApply: `${dataAttrIsSticky}-${stickyTo}`,
|
|
14
15
|
* elementsToMark,
|
|
15
16
|
* elementsToObserve,
|
|
17
|
+
* root,
|
|
16
18
|
* stickyTo,
|
|
17
19
|
* });
|
|
18
20
|
*
|
|
@@ -16,7 +16,7 @@ export interface StickyElementsDetails {
|
|
|
16
16
|
*/
|
|
17
17
|
elementsToObserve: Element[];
|
|
18
18
|
/**
|
|
19
|
-
* Value passed to IntersectionObserver options.
|
|
19
|
+
* The containing element that the child will intersect with. Value is passed to IntersectionObserver options.
|
|
20
20
|
*
|
|
21
21
|
* https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/root
|
|
22
22
|
* */
|