gantri-components 2.40.0-beta.6 → 2.40.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/custom-columns-wrapper/custom-columns-wrapper.d.ts +2 -2
- package/dist/components/table/components/custom-columns-wrapper/custom-columns-wrapper.types.d.ts +6 -6
- package/dist/components/table/components/custom-columns-wrapper/helpers/get-custom-column-initial-visibility/get-custom-column-initial-visibility.d.ts +29 -0
- package/dist/components/table/components/custom-columns-wrapper/helpers/get-custom-column-options/get-custom-column-options.d.ts +2 -2
- package/dist/components/table/components/custom-columns-wrapper/helpers/get-custom-column-options/get-custom-column-options.types.d.ts +3 -3
- package/dist/components/table/components/table-actions-wrapper/hooks/use-confirm-interaction/use-confirm-interaction.d.ts +2 -2
- package/dist/components/table/components/table-actions-wrapper/hooks/use-confirm-interaction/use-confirm-interaction.types.d.ts +2 -2
- package/dist/components/table/components/table-actions-wrapper/table-actions-wrapper.d.ts +2 -2
- package/dist/components/table/components/table-actions-wrapper/table-actions-wrapper.types.d.ts +5 -5
- 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 +3 -3
- 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 +4 -4
- package/dist/components/table/helpers/add-missing-ids/add-missing-ids.d.ts +3 -2
- package/dist/components/table/helpers/add-missing-ids/add-missing-ids.types.d.ts +4 -0
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/table.d.ts +2 -2
- package/dist/components/table/table.types.d.ts +15 -15
- 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,7 +1,7 @@
|
|
|
1
1
|
import { RowData } from '@tanstack/react-table';
|
|
2
2
|
import { CustomColumnsWrapperProps } from './custom-columns-wrapper.types';
|
|
3
|
-
export declare const CustomColumnsWrapper: <
|
|
3
|
+
export declare const CustomColumnsWrapper: <TData extends RowData<{
|
|
4
4
|
[key: string]: unknown;
|
|
5
5
|
id?: string | number | undefined;
|
|
6
6
|
subRows?: any[] | undefined;
|
|
7
|
-
}>>(props: CustomColumnsWrapperProps<
|
|
7
|
+
}>>(props: CustomColumnsWrapperProps<TData>) => JSX.Element;
|
package/dist/components/table/components/custom-columns-wrapper/custom-columns-wrapper.types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RowData, Table } from '@tanstack/react-table';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
export interface CustomColumnsProps<
|
|
4
|
-
disabledColumns: (keyof
|
|
5
|
-
hiddenColumns: (keyof
|
|
3
|
+
export interface CustomColumnsProps<TData extends RowData> {
|
|
4
|
+
disabledColumns: (keyof TData | string)[];
|
|
5
|
+
hiddenColumns: (keyof TData | string)[];
|
|
6
6
|
onUpdateHiddenColumns: (columnsToHide: string[]) => Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
export interface CustomColumnOption {
|
|
@@ -12,8 +12,8 @@ export interface CustomColumnOption {
|
|
|
12
12
|
onChange: (event: unknown) => void;
|
|
13
13
|
value: string;
|
|
14
14
|
}
|
|
15
|
-
export type CustomColumnsWrapperProps<
|
|
16
|
-
customColumns: CustomColumnsProps<
|
|
17
|
-
table: Table<
|
|
15
|
+
export type CustomColumnsWrapperProps<TData extends RowData> = PropsWithChildren<{
|
|
16
|
+
customColumns: CustomColumnsProps<TData> | undefined;
|
|
17
|
+
table: Table<TData>;
|
|
18
18
|
tableContainerEl: HTMLDivElement | null;
|
|
19
19
|
}>;
|
|
@@ -1 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Used to mark the starting hidden columns when using custom columns.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* const [hiddenColumns, setHiddenColumns] = useState<string[]>(STARTING_HIDDEN_COLUMNS);
|
|
6
|
+
* const initialColumnVisibility = getCustomColumnInitialVisibility(hiddenColumns);
|
|
7
|
+
* const [columnVisibility, setColumnVisibility] = useState(initialColumnVisibility);
|
|
8
|
+
*
|
|
9
|
+
* return (
|
|
10
|
+
* <TableComponent
|
|
11
|
+
* data={tableData}
|
|
12
|
+
* columns={tableColumns}
|
|
13
|
+
* options={{
|
|
14
|
+
* state: {
|
|
15
|
+
* columnVisibility,
|
|
16
|
+
* },
|
|
17
|
+
* onColumnVisibilityChange: setColumnVisibility,
|
|
18
|
+
* }}
|
|
19
|
+
* customColumns={{
|
|
20
|
+
* disabledColumns: [DISABLED_COLUMNS],
|
|
21
|
+
* onUpdateHiddenColumns: async columns => {
|
|
22
|
+
* // REQUEST API HIDE COLUMNS
|
|
23
|
+
* setHiddenColumns(columns);
|
|
24
|
+
* },
|
|
25
|
+
* hiddenColumns: hiddenColumns,
|
|
26
|
+
* }}
|
|
27
|
+
* />
|
|
28
|
+
* )
|
|
29
|
+
*/
|
|
1
30
|
export declare const getCustomColumnInitialVisibility: (hiddenColumns: string[]) => {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RowData } from '@tanstack/react-table';
|
|
2
2
|
import { CustomColumnOption } from '../../custom-columns-wrapper.types';
|
|
3
3
|
import { GetCustomColumnOptionsArgs } from './get-custom-column-options.types';
|
|
4
|
-
export declare const getCustomColumnOptions: <
|
|
4
|
+
export declare const getCustomColumnOptions: <TData extends RowData<{
|
|
5
5
|
[key: string]: unknown;
|
|
6
6
|
id?: string | number | undefined;
|
|
7
7
|
subRows?: any[] | undefined;
|
|
8
|
-
}>>(args: GetCustomColumnOptionsArgs<
|
|
8
|
+
}>>(args: GetCustomColumnOptionsArgs<TData>) => CustomColumnOption[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData, Table } from '@tanstack/react-table';
|
|
2
2
|
import { CustomColumnsProps } from '../../custom-columns-wrapper.types';
|
|
3
|
-
export interface GetCustomColumnOptionsArgs<
|
|
4
|
-
customColumns: CustomColumnsProps<
|
|
5
|
-
table: Table<
|
|
3
|
+
export interface GetCustomColumnOptionsArgs<TData extends RowData> {
|
|
4
|
+
customColumns: CustomColumnsProps<TData> | undefined;
|
|
5
|
+
table: Table<TData>;
|
|
6
6
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RowData } from '@tanstack/react-table';
|
|
2
2
|
import { UseConfirmInteractionProps, OnConfirmInteraction } from './use-confirm-interaction.types';
|
|
3
|
-
export declare const useConfirmInteraction: <
|
|
3
|
+
export declare const useConfirmInteraction: <TData extends RowData<{
|
|
4
4
|
[key: string]: unknown;
|
|
5
5
|
id?: string | number | undefined;
|
|
6
6
|
subRows?: any[] | undefined;
|
|
7
|
-
}>>(props: UseConfirmInteractionProps<
|
|
7
|
+
}>>(props: UseConfirmInteractionProps<TData>) => {
|
|
8
8
|
/** Not necessary for `onConfirmInteraction`. Only provided in case additional logic is needed. */
|
|
9
9
|
confirmAllInteractions: boolean;
|
|
10
10
|
/** If applicable, renders a discard selections confirmation modal when called. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData, Table } from '@tanstack/react-table';
|
|
2
2
|
export type TableInteraction = 'FOCUS_SEARCH' | 'OPEN_FILTERS' | 'OPEN_SORT' | 'USE_PAGING' | 'CUSTOM_ACTION';
|
|
3
|
-
export interface UseConfirmInteractionProps<
|
|
4
|
-
table: Table<
|
|
3
|
+
export interface UseConfirmInteractionProps<TData extends RowData> {
|
|
4
|
+
table: Table<TData>;
|
|
5
5
|
}
|
|
6
6
|
export type OnConfirmInteraction = (interaction: TableInteraction) => Promise<boolean>;
|
|
@@ -2,8 +2,8 @@ import React, { PropsWithChildren } from 'react';
|
|
|
2
2
|
import { RowData } from '@tanstack/react-table';
|
|
3
3
|
import { TableActionsWrapperProps } from './table-actions-wrapper.types';
|
|
4
4
|
/** Wraps the table with relevant components for paging, filters, sort, and table actions. */
|
|
5
|
-
export declare const TableActionsWrapper: <
|
|
5
|
+
export declare const TableActionsWrapper: <TData extends RowData<{
|
|
6
6
|
[key: string]: unknown;
|
|
7
7
|
id?: string | number | undefined;
|
|
8
8
|
subRows?: any[] | undefined;
|
|
9
|
-
}>>(props: React.PropsWithChildren<TableActionsWrapperProps<
|
|
9
|
+
}>>(props: React.PropsWithChildren<TableActionsWrapperProps<TData>>) => JSX.Element;
|
package/dist/components/table/components/table-actions-wrapper/table-actions-wrapper.types.d.ts
CHANGED
|
@@ -15,19 +15,19 @@ export interface SearchProps {
|
|
|
15
15
|
placeholder?: string;
|
|
16
16
|
value: string;
|
|
17
17
|
}
|
|
18
|
-
export interface CustomActionProps<
|
|
18
|
+
export interface CustomActionProps<TData extends RowData> {
|
|
19
19
|
Component: JSXElementConstructor<{
|
|
20
20
|
onConfirmInteraction: () => Promise<boolean>;
|
|
21
|
-
table: Table<
|
|
21
|
+
table: Table<TData>;
|
|
22
22
|
}>;
|
|
23
23
|
position: 'left' | 'right' | 'bottom';
|
|
24
24
|
}
|
|
25
|
-
export interface TableActionsWrapperProps<
|
|
25
|
+
export interface TableActionsWrapperProps<TData extends RowData> {
|
|
26
26
|
className: string | undefined;
|
|
27
|
-
customAction: CustomActionProps<
|
|
27
|
+
customAction: CustomActionProps<TData> | undefined;
|
|
28
28
|
filters: FiltersProps | undefined;
|
|
29
29
|
paging: PagingProps | undefined;
|
|
30
30
|
search: SearchProps | undefined;
|
|
31
31
|
sorting: SortProps | undefined;
|
|
32
|
-
table: Table<
|
|
32
|
+
table: Table<TData>;
|
|
33
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RowData } from '@tanstack/react-table';
|
|
2
2
|
import { TableFooterProps } from './table-footer.types';
|
|
3
|
-
export declare const TableFooter: <
|
|
3
|
+
export declare const TableFooter: <TData extends RowData<{
|
|
4
4
|
[key: string]: unknown;
|
|
5
5
|
id?: string | number | undefined;
|
|
6
6
|
subRows?: any[] | undefined;
|
|
7
|
-
}>>(props: TableFooterProps<
|
|
7
|
+
}>>(props: TableFooterProps<TData>) => JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RowData } from '@tanstack/react-table';
|
|
2
2
|
import { TableHeaderProps } from './table-header.types';
|
|
3
|
-
export declare const TableHeader: <
|
|
3
|
+
export declare const TableHeader: <TData extends RowData<{
|
|
4
4
|
[key: string]: unknown;
|
|
5
5
|
id?: string | number | undefined;
|
|
6
6
|
subRows?: any[] | undefined;
|
|
7
|
-
}>>(props: TableHeaderProps<
|
|
7
|
+
}>>(props: TableHeaderProps<TData>) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData, Table } from '@tanstack/react-table';
|
|
2
2
|
import { GetHeaderCellProps } from '../../table.types';
|
|
3
|
-
export type TableHeaderProps<
|
|
4
|
-
getHeaderCellProps: GetHeaderCellProps<
|
|
5
|
-
table: Table<
|
|
3
|
+
export type TableHeaderProps<TData extends RowData> = {
|
|
4
|
+
getHeaderCellProps: GetHeaderCellProps<TData> | undefined;
|
|
5
|
+
table: Table<TData>;
|
|
6
6
|
};
|
package/dist/components/table/components/table-row/hooks/use-drag-and-drop/use-drag-and-drop.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { RowData } from '@tanstack/react-table';
|
|
3
3
|
import { UseDragAndDropProps } from './use-drag-and-drop.types';
|
|
4
|
-
export declare const useDragAndDrop: <
|
|
4
|
+
export declare const useDragAndDrop: <TData extends RowData<{
|
|
5
5
|
[key: string]: unknown;
|
|
6
6
|
id?: string | number | undefined;
|
|
7
7
|
subRows?: any[] | undefined;
|
|
8
|
-
}>>(props: UseDragAndDropProps<
|
|
8
|
+
}>>(props: UseDragAndDropProps<TData>) => {
|
|
9
9
|
dragAndDropRef: import("react").RefObject<HTMLTableRowElement>;
|
|
10
10
|
isDragging: boolean;
|
|
11
11
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Row, RowData } from '@tanstack/react-table';
|
|
2
|
-
export interface UseDragAndDropProps<
|
|
2
|
+
export interface UseDragAndDropProps<TData extends RowData> {
|
|
3
3
|
enableReordering: boolean;
|
|
4
4
|
handleOnReorder: () => Promise<void>;
|
|
5
5
|
index: number;
|
|
6
6
|
isSubRow: boolean;
|
|
7
7
|
moveRow: (startIndex: number, endIndex: number) => void;
|
|
8
|
-
row: Row<
|
|
8
|
+
row: Row<TData>;
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RowData } from '@tanstack/react-table';
|
|
2
2
|
import { TableRowProps } from './table-row.types';
|
|
3
|
-
export declare const TableRow: <
|
|
3
|
+
export declare const TableRow: <TData extends RowData<{
|
|
4
4
|
[key: string]: unknown;
|
|
5
5
|
id?: string | number | undefined;
|
|
6
6
|
subRows?: any[] | undefined;
|
|
7
|
-
}>>(props: TableRowProps<
|
|
7
|
+
}>>(props: TableRowProps<TData>) => JSX.Element;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Row, RowData } from '@tanstack/react-table';
|
|
2
2
|
import { CustomRowProps, GetCellProps, OnRowClick } from '../../table.types';
|
|
3
|
-
export interface TableRowProps<
|
|
3
|
+
export interface TableRowProps<TData extends RowData> {
|
|
4
4
|
customRowProps: CustomRowProps;
|
|
5
5
|
enableReordering: boolean;
|
|
6
|
-
getCellProps: GetCellProps<
|
|
6
|
+
getCellProps: GetCellProps<TData> | undefined;
|
|
7
7
|
handleOnReorder: () => Promise<void>;
|
|
8
8
|
index: number;
|
|
9
9
|
moveRow: (startIndex: number, endIndex: number) => void;
|
|
10
|
-
onRowClick?: OnRowClick<
|
|
11
|
-
row: Row<
|
|
10
|
+
onRowClick?: OnRowClick<TData>;
|
|
11
|
+
row: Row<TData>;
|
|
12
12
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { RowData } from '@tanstack/react-table';
|
|
2
|
+
import { TDataWithId } from './add-missing-ids.types';
|
|
2
3
|
/** If an index does not contain an `id` value, one is added using uuid. */
|
|
3
|
-
export declare const addMissingIds: <
|
|
4
|
+
export declare const addMissingIds: <TData extends RowData<{
|
|
4
5
|
[key: string]: unknown;
|
|
5
6
|
id?: string | number | undefined;
|
|
6
7
|
subRows?: any[] | undefined;
|
|
7
|
-
}>>(data:
|
|
8
|
+
}>>(data: TData[]) => TDataWithId<TData>[];
|
|
@@ -2,10 +2,10 @@ import { RowData } from '@tanstack/react-table';
|
|
|
2
2
|
import { TableProps } from './table.types';
|
|
3
3
|
/** Official docs: https://tanstack.com/table/v8/docs/guide/overview */
|
|
4
4
|
export declare const Table: {
|
|
5
|
-
<
|
|
5
|
+
<TData extends RowData<{
|
|
6
6
|
[key: string]: unknown;
|
|
7
7
|
id?: string | number | undefined;
|
|
8
8
|
subRows?: any[] | undefined;
|
|
9
|
-
}>>(props: TableProps<
|
|
9
|
+
}>>(props: TableProps<TData>): JSX.Element;
|
|
10
10
|
defaultProps: import("./table.types").TableDefaultProps;
|
|
11
11
|
};
|
|
@@ -4,29 +4,29 @@ import { PagingProps } from './components/table-actions-wrapper/components/pagin
|
|
|
4
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
6
|
import { CustomColumnsProps } from './components/custom-columns-wrapper/custom-columns-wrapper.types';
|
|
7
|
-
export interface TableProps<
|
|
7
|
+
export interface TableProps<TData extends RowData> extends Partial<TableDefaultProps> {
|
|
8
8
|
className?: string;
|
|
9
|
-
columns: ColumnDef<
|
|
10
|
-
customAction?: CustomActionProps<
|
|
11
|
-
customColumns?: CustomColumnsProps<
|
|
9
|
+
columns: ColumnDef<TData, any>[];
|
|
10
|
+
customAction?: CustomActionProps<TData>;
|
|
11
|
+
customColumns?: CustomColumnsProps<TData>;
|
|
12
12
|
/**
|
|
13
13
|
* For each index, if no `id` key exists, one will be assigned.
|
|
14
14
|
*
|
|
15
15
|
* To create collapsable rows, optionally provide the index with a `subRows` key. It should be an array of objects matching the expected data type.
|
|
16
16
|
*/
|
|
17
|
-
data:
|
|
17
|
+
data: TData[];
|
|
18
18
|
filters?: FiltersProps;
|
|
19
|
-
getCellProps?: GetCellProps<
|
|
20
|
-
getHeaderCellProps?: GetHeaderCellProps<
|
|
19
|
+
getCellProps?: GetCellProps<TData>;
|
|
20
|
+
getHeaderCellProps?: GetHeaderCellProps<TData>;
|
|
21
21
|
/** Include `status` in the returned value to set the row status color. */
|
|
22
|
-
getRowProps?: GetRowProps<
|
|
23
|
-
onRowClick?: OnRowClick<
|
|
22
|
+
getRowProps?: GetRowProps<TData>;
|
|
23
|
+
onRowClick?: OnRowClick<TData>;
|
|
24
24
|
/** Any options provided are passed to `useReactTable` and may override default values. */
|
|
25
|
-
options?: Partial<TableOptions<
|
|
25
|
+
options?: Partial<TableOptions<TData>>;
|
|
26
26
|
paging?: PagingProps;
|
|
27
27
|
reordering?: {
|
|
28
28
|
enable: boolean;
|
|
29
|
-
onReorder: (data:
|
|
29
|
+
onReorder: (data: TData[]) => Promise<void>;
|
|
30
30
|
};
|
|
31
31
|
search?: SearchProps;
|
|
32
32
|
sorting?: SortProps;
|
|
@@ -34,13 +34,13 @@ export interface TableProps<DataType extends RowData> extends Partial<TableDefau
|
|
|
34
34
|
export interface TableDefaultProps {
|
|
35
35
|
stickyFirstColumn: boolean;
|
|
36
36
|
}
|
|
37
|
-
export type GetHeaderCellProps<
|
|
38
|
-
export type GetRowProps<
|
|
37
|
+
export type GetHeaderCellProps<TData extends RowData> = (cell?: Header<TData, unknown>) => CustomCellProps;
|
|
38
|
+
export type GetRowProps<TData extends RowData> = (row?: Row<TData>, rows?: Row<TData>[]) => CustomRowProps;
|
|
39
39
|
export interface CustomRowProps extends Record<string, unknown>, HTMLAttributes<HTMLTableRowElement> {
|
|
40
40
|
status?: RowStatusValue | undefined;
|
|
41
41
|
}
|
|
42
42
|
export type RowStatusValue = 'handled' | 'next' | 'error' | 'warning';
|
|
43
|
-
export type GetCellProps<
|
|
44
|
-
export type OnRowClick<
|
|
43
|
+
export type GetCellProps<TData extends RowData> = (cell?: Cell<TData, unknown>) => CustomCellProps;
|
|
44
|
+
export type OnRowClick<TData extends RowData> = (data: Row<TData>, event: MouseEvent<HTMLTableRowElement>) => void;
|
|
45
45
|
export interface CustomCellProps extends Record<string, unknown>, HTMLAttributes<HTMLTableCellElement> {
|
|
46
46
|
}
|