gantri-components 3.0.0-beta.3 → 3.0.0-beta.5
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/cell-reorder-wrapper/cell-reorder-wrapper.d.ts +8 -0
- package/dist/components/table/components/cell-reorder-wrapper/cell-reorder-wrapper.types.d.ts +10 -0
- package/dist/components/table/components/cell-reorder-wrapper/index.d.ts +1 -0
- package/dist/components/table/components/custom-columns-wrapper/custom-columns-wrapper.styles.d.ts +1 -0
- package/dist/components/table/components/custom-columns-wrapper/custom-columns-wrapper.types.d.ts +0 -1
- package/dist/components/table/components/index.d.ts +1 -0
- package/dist/components/table/components/table-actions-wrapper/components/sort/sort.types.d.ts +4 -4
- package/dist/components/table/components/table-actions-wrapper/table-actions-wrapper.types.d.ts +5 -4
- package/dist/components/table/components/table-header/table-header.styles.d.ts +2 -1
- package/dist/components/table/components/table-header/table-header.types.d.ts +2 -3
- package/dist/components/table/components/table-row/table-row.types.d.ts +2 -3
- package/dist/components/table/components/table-row-cells/table-row-cells.types.d.ts +1 -1
- package/dist/components/table/hooks/useTrackStickyCells.d.ts +1 -0
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/table.d.ts +5 -1
- package/dist/components/table/table.styles.d.ts +0 -1
- package/dist/components/table/table.types.d.ts +17 -10
- package/dist/helpers/mark-sticky-elements/helpers/get-intersection-observer-callback/get-intersection-observer-callback.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/dist/setupTests.d.ts +0 -1
- package/package.json +2 -9
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RowData } from '@tanstack/react-table';
|
|
2
|
+
import { CellReorderWrapperProps } from './cell-reorder-wrapper.types';
|
|
3
|
+
/** When reordering is provided, wraps the first column in the provided props. */
|
|
4
|
+
export declare const CellReorderWrapper: <TData extends RowData<{
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
id?: string | number | undefined;
|
|
7
|
+
subRows?: any[] | undefined;
|
|
8
|
+
}>>(props: CellReorderWrapperProps<TData>) => JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import { RowData } from '@tanstack/react-table';
|
|
3
|
+
import { ReorderingProps } from '../../table.types';
|
|
4
|
+
export type CellReorderWrapperProps<TData extends RowData> = PropsWithChildren<{
|
|
5
|
+
FirstColumnContent: JSX.Element | ReactNode;
|
|
6
|
+
/** Rendered when `reordering` is provided, but `reordering.isAvailable === false`. */
|
|
7
|
+
FirstColumnFallback: JSX.Element | ReactNode;
|
|
8
|
+
index: number;
|
|
9
|
+
reordering: ReorderingProps<TData> | undefined;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cell-reorder-wrapper';
|
package/dist/components/table/components/custom-columns-wrapper/custom-columns-wrapper.styles.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const StyledTableContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
1
2
|
export declare const StyledToggleWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
2
3
|
isScrolling: boolean;
|
|
3
4
|
}, never>;
|
package/dist/components/table/components/table-actions-wrapper/components/sort/sort.types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OnConfirmInteraction } from '../../hooks';
|
|
2
|
-
export interface SortProps {
|
|
3
|
-
current: SortInfo;
|
|
2
|
+
export interface SortProps<SortingField = string> {
|
|
3
|
+
current: SortInfo<SortingField> | SortingField;
|
|
4
4
|
disabled?: boolean;
|
|
5
|
-
fields: TableSortField<
|
|
6
|
-
onSort: (sortInfo: SortInfo) => void;
|
|
5
|
+
fields: TableSortField<SortingField>[];
|
|
6
|
+
onSort: (sortInfo: SortInfo<SortingField> | SortingField) => void;
|
|
7
7
|
}
|
|
8
8
|
export interface SortComponentProps extends SortProps {
|
|
9
9
|
confirmAllInteractions: boolean;
|
package/dist/components/table/components/table-actions-wrapper/table-actions-wrapper.types.d.ts
CHANGED
|
@@ -15,11 +15,12 @@ export interface SearchProps {
|
|
|
15
15
|
placeholder?: string;
|
|
16
16
|
value: string;
|
|
17
17
|
}
|
|
18
|
+
export interface CustomActionComponentProps<TData extends RowData> {
|
|
19
|
+
onConfirmInteraction: () => Promise<boolean>;
|
|
20
|
+
table: Table<TData>;
|
|
21
|
+
}
|
|
18
22
|
export interface CustomActionProps<TData extends RowData> {
|
|
19
|
-
Component: JSXElementConstructor<
|
|
20
|
-
onConfirmInteraction: () => Promise<boolean>;
|
|
21
|
-
table: Table<TData>;
|
|
22
|
-
}>;
|
|
23
|
+
Component: JSXElementConstructor<CustomActionComponentProps<TData>>;
|
|
23
24
|
position: 'left' | 'right' | 'bottom';
|
|
24
25
|
}
|
|
25
26
|
export interface TableActionsWrapperProps<TData extends RowData> {
|
|
@@ -2,5 +2,6 @@ export declare const StyledTH: import("styled-components").StyledComponent<"th",
|
|
|
2
2
|
size: number;
|
|
3
3
|
}, never>;
|
|
4
4
|
export declare const StyledReorderWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
5
|
-
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
isActive: boolean;
|
|
6
7
|
}, never>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { RowData, Table } from '@tanstack/react-table';
|
|
2
|
-
import { GetHeaderCellProps } from '../../table.types';
|
|
2
|
+
import { GetHeaderCellProps, ReorderingProps } from '../../table.types';
|
|
3
3
|
export type TableHeaderProps<TData extends RowData> = {
|
|
4
4
|
getHeaderCellProps: GetHeaderCellProps<TData> | undefined;
|
|
5
|
-
|
|
6
|
-
reorderable: boolean;
|
|
5
|
+
reordering: ReorderingProps<TData> | undefined;
|
|
7
6
|
table: Table<TData>;
|
|
8
7
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Row, RowData } from '@tanstack/react-table';
|
|
2
|
-
import { CustomRowProps, GetCellProps, OnRowClick } from '../../table.types';
|
|
2
|
+
import { CustomRowProps, GetCellProps, OnRowClick, ReorderingProps } from '../../table.types';
|
|
3
3
|
export interface TableRowProps<TData extends RowData> {
|
|
4
4
|
customRowProps: CustomRowProps;
|
|
5
5
|
getCellProps: GetCellProps<TData> | undefined;
|
|
6
6
|
index?: number;
|
|
7
7
|
onRowClick?: OnRowClick<TData>;
|
|
8
|
-
|
|
9
|
-
reorderable?: boolean;
|
|
8
|
+
reordering: ReorderingProps<TData> | undefined;
|
|
10
9
|
row: Row<TData>;
|
|
11
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RowData } from '@tanstack/react-table';
|
|
2
2
|
import { TableRowProps } from '../table-row/table-row.types';
|
|
3
|
-
export interface TableRowCellsProps<TData extends RowData> extends Pick<TableRowProps<TData>, 'row' | 'getCellProps' | '
|
|
3
|
+
export interface TableRowCellsProps<TData extends RowData> extends Pick<TableRowProps<TData>, 'row' | 'getCellProps' | 'reordering'> {
|
|
4
4
|
size?: number;
|
|
5
5
|
}
|
|
@@ -6,6 +6,7 @@ export interface UseTrackStickyCellsProps<TData extends RowData> {
|
|
|
6
6
|
/** The containing element that the child will intersect with. */
|
|
7
7
|
root: Element | null;
|
|
8
8
|
stickyFirstColumn: boolean | undefined;
|
|
9
|
+
stickyFooter: boolean | undefined;
|
|
9
10
|
stickyLastColumn: boolean | undefined;
|
|
10
11
|
}
|
|
11
12
|
/** Mark table if header and/or first column cells are sticky. */
|
|
@@ -3,3 +3,4 @@ export * from './table.types';
|
|
|
3
3
|
export * from './components/table-row/table-row.constants';
|
|
4
4
|
export * from './components/custom-columns-wrapper/helpers/get-custom-column-initial-visibility';
|
|
5
5
|
export * from './helpers';
|
|
6
|
+
export * from './components/table-actions-wrapper/table-actions-wrapper.types';
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { RowData } from '@tanstack/react-table';
|
|
2
2
|
import { TableProps } from './table.types';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* See https://components.gantri.com/?path=/story/core-table for usage examples.
|
|
5
|
+
*
|
|
6
|
+
* Official docs: https://tanstack.com/table/v8/docs/guide/overview
|
|
7
|
+
*/
|
|
4
8
|
export declare const Table: {
|
|
5
9
|
<TData extends RowData<{
|
|
6
10
|
[key: string]: unknown;
|
|
@@ -7,7 +7,6 @@ export declare const getTableRowBackgroundColors: (theme: DefaultTheme) => {
|
|
|
7
7
|
readonly statusWarningClickableHoverColor: string;
|
|
8
8
|
readonly statusWarningColor: string;
|
|
9
9
|
};
|
|
10
|
-
export declare const StyledTableWrapper: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
11
10
|
export declare const StyledTableContainer: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
|
|
12
11
|
export declare const StyledTable: import("styled-components").StyledComponent<"table", DefaultTheme, {
|
|
13
12
|
isCustomColumnsEnabled: boolean;
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import { Cell, ColumnDef, Header, Row, RowData, TableOptions } from '@tanstack/react-table';
|
|
2
|
-
import { HTMLAttributes, MouseEvent } from 'react';
|
|
2
|
+
import { Dispatch, HTMLAttributes, MouseEvent, SetStateAction } from 'react';
|
|
3
3
|
import { PagingProps } from './components/table-actions-wrapper/components/paging/paging.types';
|
|
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
|
+
import { OverlayPosition } from '../overlay/overlay.types';
|
|
8
|
+
export interface ReorderingProps<TData extends RowData> {
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
isAvailable: boolean;
|
|
12
|
+
/** Is fired when the dragged element is dropped. */
|
|
13
|
+
onReorder: (data: TData[], oldIndex?: number, newIndex?: number) => Promise<void>;
|
|
14
|
+
setIsActive: Dispatch<SetStateAction<boolean>>;
|
|
15
|
+
tooltipPosition?: OverlayPosition;
|
|
16
|
+
tooltipText?: string;
|
|
17
|
+
}
|
|
7
18
|
export interface TableProps<TData extends RowData> extends Partial<TableDefaultProps> {
|
|
8
19
|
className?: string;
|
|
9
20
|
columns: ColumnDef<TData, any>[];
|
|
@@ -16,7 +27,7 @@ export interface TableProps<TData extends RowData> extends Partial<TableDefaultP
|
|
|
16
27
|
*/
|
|
17
28
|
data: TData[];
|
|
18
29
|
filters?: FiltersProps;
|
|
19
|
-
/** Include `
|
|
30
|
+
/** Include `isClickable` in the returned object to apply appropriate cell styling. Text styling must be applied within the column. */
|
|
20
31
|
getCellProps?: GetCellProps<TData>;
|
|
21
32
|
getHeaderCellProps?: GetHeaderCellProps<TData>;
|
|
22
33
|
/** Include `status` in the returned object to set the row status color. */
|
|
@@ -25,13 +36,10 @@ export interface TableProps<TData extends RowData> extends Partial<TableDefaultP
|
|
|
25
36
|
/** Any options provided are passed to `useReactTable` and may override default values. */
|
|
26
37
|
options?: Partial<TableOptions<TData>>;
|
|
27
38
|
paging?: PagingProps;
|
|
28
|
-
reordering?:
|
|
29
|
-
enable: boolean;
|
|
30
|
-
/** Is fired when the dragged element is dropped. */
|
|
31
|
-
onReorder: (data: TData[], oldIndex?: number, newIndex?: number) => Promise<void>;
|
|
32
|
-
};
|
|
39
|
+
reordering?: ReorderingProps<TData>;
|
|
33
40
|
search?: SearchProps;
|
|
34
41
|
sorting?: SortProps;
|
|
42
|
+
stickyFooter?: boolean;
|
|
35
43
|
stickyLastColumn?: boolean;
|
|
36
44
|
}
|
|
37
45
|
export interface TableDefaultProps {
|
|
@@ -44,10 +52,9 @@ export interface CustomRowProps extends HTMLAttributes<HTMLTableRowElement>, Rec
|
|
|
44
52
|
status?: RowStatusValue | undefined;
|
|
45
53
|
}
|
|
46
54
|
export type RowStatusValue = 'handled' | 'next' | 'error' | 'warning';
|
|
47
|
-
/** Include `
|
|
55
|
+
/** Include `isClickable` in the returned object to apply appropriate cell styling. Text styling must be applied within the column. */
|
|
48
56
|
export type GetCellProps<TData extends RowData, TValue = unknown> = (cell?: Cell<TData, TValue>) => CustomCellProps;
|
|
49
57
|
export type OnRowClick<TData extends RowData> = (data: Row<TData>, event: MouseEvent<HTMLTableRowElement>) => void;
|
|
50
58
|
export interface CustomCellProps extends HTMLAttributes<HTMLTableCellElement>, Record<string, unknown> {
|
|
51
|
-
|
|
52
|
-
target?: '_blank';
|
|
59
|
+
isClickable?: boolean;
|
|
53
60
|
}
|
|
@@ -3,6 +3,6 @@ export interface GetIntersectionObserverCallbackArgs {
|
|
|
3
3
|
/** If not provided, the `dataAttrIsSticky` variable value will be used. If `stickyTo` is provided, it will apply that value as a suffix to the attr (ie `${dataAttrIsSticky}-${stickyTo}`). */
|
|
4
4
|
attrToApply?: string;
|
|
5
5
|
elementsToMark: Element[];
|
|
6
|
-
/** If not provided, an intersection in any direction mark the elements. */
|
|
6
|
+
/** If not provided, an intersection in any direction will mark the elements. */
|
|
7
7
|
stickyTo?: StickyTo;
|
|
8
8
|
}
|