simple-table-core 1.2.2 → 1.2.4
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/animate/Animate.d.ts +13 -0
- package/dist/components/animate/animation-utils.d.ts +70 -0
- package/dist/components/animate/types.d.ts +26 -0
- package/dist/components/dropdown/Dropdown.d.ts +1 -1
- package/dist/components/filters/shared/FilterInput.d.ts +1 -0
- package/dist/components/scroll-sync/ScrollSyncPane.d.ts +2 -2
- package/dist/components/simple-table/RenderCells.d.ts +2 -2
- package/dist/components/simple-table/SimpleTable.d.ts +4 -4
- package/dist/components/simple-table/TableBody.d.ts +1 -1
- package/dist/components/simple-table/TableCell.d.ts +1 -12
- package/dist/components/simple-table/TableContent.d.ts +4 -4
- package/dist/components/simple-table/TableHeader.d.ts +1 -1
- package/dist/components/simple-table/TableHeaderCell.d.ts +3 -4
- package/dist/components/simple-table/TableHorizontalScrollbar.d.ts +2 -2
- package/dist/components/simple-table/TableRow.d.ts +2 -2
- package/dist/components/simple-table/TableSection.d.ts +3 -4
- package/dist/context/TableContext.d.ts +15 -9
- package/dist/hooks/useExternalFilters.d.ts +6 -0
- package/dist/hooks/useExternalSort.d.ts +6 -0
- package/dist/hooks/useFilterableData.d.ts +17 -0
- package/dist/hooks/useOnGridReady.d.ts +4 -0
- package/dist/hooks/useScrollbarWidth.d.ts +9 -0
- package/dist/hooks/useSortableData.d.ts +5 -6
- package/dist/hooks/useTableAPI.d.ts +10 -0
- package/dist/hooks/useTableRowProcessing.d.ts +27 -0
- package/dist/hooks/useWindowResize.d.ts +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/DragHandlerProps.d.ts +3 -3
- package/dist/types/HandleResizeStartProps.d.ts +4 -3
- package/dist/types/OnSortProps.d.ts +1 -1
- package/dist/types/SharedTableProps.d.ts +9 -9
- package/dist/types/SortConfig.d.ts +3 -2
- package/dist/types/TableBodyProps.d.ts +2 -4
- package/dist/types/TableCellProps.d.ts +5 -14
- package/dist/types/TableHeaderProps.d.ts +3 -4
- package/dist/types/TableHeaderSectionProps.d.ts +3 -3
- package/dist/types/TableRow.d.ts +2 -2
- package/dist/types/TableRowProps.d.ts +4 -4
- package/dist/utils/cellUtils.d.ts +2 -2
- package/dist/utils/infiniteScrollUtils.d.ts +2 -2
- package/dist/utils/refUtils.d.ts +7 -0
- package/dist/utils/resizeUtils.d.ts +1 -1
- package/dist/utils/rowUtils.d.ts +5 -2
- package/dist/utils/sortUtils.d.ts +6 -5
- package/package.json +1 -2
- package/dist/hooks/useTableFilters.d.ts +0 -15
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { ReactNode, MutableRefObject } from "react";
|
|
2
|
+
import TableRow from "../../types/TableRow";
|
|
3
|
+
interface AnimateProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "id"> {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
id: string;
|
|
6
|
+
parentRef?: MutableRefObject<HTMLDivElement | null>;
|
|
7
|
+
tableRow?: TableRow;
|
|
8
|
+
}
|
|
9
|
+
export declare const Animate: {
|
|
10
|
+
({ children, id, parentRef, tableRow, ...props }: AnimateProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export default Animate;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { AnimationConfig, FlipAnimationOptions, CustomAnimationOptions } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Check if user prefers reduced motion
|
|
4
|
+
*/
|
|
5
|
+
export declare const prefersReducedMotion: () => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Animation configs for different types of movements
|
|
8
|
+
*/
|
|
9
|
+
export declare const ANIMATION_CONFIGS: {
|
|
10
|
+
readonly COLUMN_REORDER: {
|
|
11
|
+
readonly duration: 180;
|
|
12
|
+
readonly easing: "cubic-bezier(0.2, 0.0, 0.2, 1)";
|
|
13
|
+
readonly delay: 0;
|
|
14
|
+
};
|
|
15
|
+
readonly ROW_REORDER: {
|
|
16
|
+
readonly duration: 10000;
|
|
17
|
+
readonly easing: "cubic-bezier(0.2, 0.0, 0.2, 1)";
|
|
18
|
+
readonly delay: 0;
|
|
19
|
+
};
|
|
20
|
+
readonly REDUCED_MOTION: {
|
|
21
|
+
readonly duration: 150;
|
|
22
|
+
readonly easing: "ease-out";
|
|
23
|
+
readonly delay: 0;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Create a custom animation config with smart defaults
|
|
28
|
+
*/
|
|
29
|
+
export declare const createAnimationConfig: (overrides?: Partial<AnimationConfig>) => AnimationConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Calculates the invert values for FLIP animation
|
|
32
|
+
*/
|
|
33
|
+
export declare const calculateInvert: (fromBounds: DOMRect | {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
}, toBounds: DOMRect) => {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Applies initial transform to element for FLIP animation
|
|
42
|
+
*/
|
|
43
|
+
export declare const applyInitialTransform: (element: HTMLElement, invert: {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
}) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Get appropriate animation config based on movement type and user preferences
|
|
49
|
+
*/
|
|
50
|
+
export declare const getAnimationConfig: (options?: FlipAnimationOptions, movementType?: "column" | "row") => AnimationConfig;
|
|
51
|
+
/**
|
|
52
|
+
* Performs FLIP animation on a single element
|
|
53
|
+
* This function can be called multiple times on the same element - it will automatically
|
|
54
|
+
* interrupt any ongoing animation and start a new one.
|
|
55
|
+
*/
|
|
56
|
+
export declare const flipElement: ({ element, finalConfig, fromBounds, toBounds, }: {
|
|
57
|
+
element: HTMLElement;
|
|
58
|
+
finalConfig: FlipAnimationOptions;
|
|
59
|
+
fromBounds: DOMRect;
|
|
60
|
+
toBounds: DOMRect;
|
|
61
|
+
}) => Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Performs custom coordinate animation with absolute position control
|
|
64
|
+
* This allows you to animate an element from one Y coordinate to another,
|
|
65
|
+
* completely independent of the element's actual DOM position.
|
|
66
|
+
*/
|
|
67
|
+
export declare const animateWithCustomCoordinates: ({ element, options, }: {
|
|
68
|
+
element: HTMLElement;
|
|
69
|
+
options: CustomAnimationOptions;
|
|
70
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface AnimationConfig {
|
|
2
|
+
duration: number;
|
|
3
|
+
easing: string;
|
|
4
|
+
delay?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface FlipAnimationOptions {
|
|
7
|
+
duration?: number;
|
|
8
|
+
easing?: string;
|
|
9
|
+
delay?: number;
|
|
10
|
+
maxX?: number;
|
|
11
|
+
maxY?: number;
|
|
12
|
+
maxYLeavingRatio?: number;
|
|
13
|
+
maxYEnteringRatio?: number;
|
|
14
|
+
onComplete?: () => void;
|
|
15
|
+
respectReducedMotion?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface CustomAnimationOptions {
|
|
18
|
+
startY: number;
|
|
19
|
+
endY: number;
|
|
20
|
+
finalY?: number;
|
|
21
|
+
duration?: number;
|
|
22
|
+
easing?: string;
|
|
23
|
+
delay?: number;
|
|
24
|
+
onComplete?: () => void;
|
|
25
|
+
respectReducedMotion?: boolean;
|
|
26
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
export interface DropdownProps {
|
|
3
3
|
children: ReactNode;
|
|
4
|
-
containerRef?: React.
|
|
4
|
+
containerRef?: React.MutableRefObject<HTMLElement>;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
open?: boolean;
|
|
7
7
|
overflow?: "auto" | "visible";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FC, ReactElement,
|
|
1
|
+
import { FC, ReactElement, MutableRefObject } from "react";
|
|
2
2
|
interface ScrollSyncPaneProps {
|
|
3
|
-
childRef:
|
|
3
|
+
childRef: MutableRefObject<HTMLElement | null>;
|
|
4
4
|
children: ReactElement<any>;
|
|
5
5
|
}
|
|
6
6
|
export declare const ScrollSyncPane: FC<ScrollSyncPaneProps>;
|
|
@@ -10,7 +10,7 @@ interface RenderCellsProps {
|
|
|
10
10
|
pinned?: Pinned;
|
|
11
11
|
rowIndex: number;
|
|
12
12
|
rowIndices: RowIndices;
|
|
13
|
-
|
|
13
|
+
tableRow: TableRowType;
|
|
14
14
|
}
|
|
15
|
-
declare const RenderCells: ({ columnIndexStart, columnIndices, headers, pinned, rowIndex, rowIndices,
|
|
15
|
+
declare const RenderCells: ({ columnIndexStart, columnIndices, headers, pinned, rowIndex, rowIndices, tableRow, }: RenderCellsProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export default RenderCells;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode,
|
|
1
|
+
import { ReactNode, MutableRefObject } from "react";
|
|
2
2
|
import HeaderObject from "../../types/HeaderObject";
|
|
3
3
|
import CellChangeProps from "../../types/CellChangeProps";
|
|
4
4
|
import Theme from "../../types/Theme";
|
|
@@ -8,7 +8,7 @@ import TableRefType from "../../types/TableRefType";
|
|
|
8
8
|
import OnNextPage from "../../types/OnNextPage";
|
|
9
9
|
import "../../styles/simple-table.css";
|
|
10
10
|
import { TableFilterState } from "../../types/FilterTypes";
|
|
11
|
-
import
|
|
11
|
+
import { SortColumn } from "../../types/SortConfig";
|
|
12
12
|
interface SimpleTableProps {
|
|
13
13
|
allowAnimations?: boolean;
|
|
14
14
|
cellUpdateFlash?: boolean;
|
|
@@ -32,7 +32,7 @@ interface SimpleTableProps {
|
|
|
32
32
|
onGridReady?: () => void;
|
|
33
33
|
onLoadMore?: () => void;
|
|
34
34
|
onNextPage?: OnNextPage;
|
|
35
|
-
onSortChange?: (sort:
|
|
35
|
+
onSortChange?: (sort: SortColumn | null) => void;
|
|
36
36
|
prevIcon?: ReactNode;
|
|
37
37
|
rowGrouping?: string[];
|
|
38
38
|
rowHeight?: number;
|
|
@@ -44,7 +44,7 @@ interface SimpleTableProps {
|
|
|
44
44
|
shouldPaginate?: boolean;
|
|
45
45
|
sortDownIcon?: ReactNode;
|
|
46
46
|
sortUpIcon?: ReactNode;
|
|
47
|
-
tableRef?:
|
|
47
|
+
tableRef?: MutableRefObject<TableRefType | null>;
|
|
48
48
|
theme?: Theme;
|
|
49
49
|
useOddColumnBackground?: boolean;
|
|
50
50
|
useHoverRowBackground?: boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import TableBodyProps from "../../types/TableBodyProps";
|
|
2
|
-
declare const TableBody: ({
|
|
2
|
+
declare const TableBody: ({ mainTemplateColumns, pinnedLeftColumns, pinnedLeftTemplateColumns, pinnedLeftWidth, pinnedRightColumns, pinnedRightTemplateColumns, pinnedRightWidth, rowsToRender, setScrollTop, tableRows, }: TableBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default TableBody;
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import TableCellProps from "../../types/TableCellProps";
|
|
3
|
-
|
|
4
|
-
borderClass: string;
|
|
5
|
-
colIndex: number;
|
|
6
|
-
header: TableCellProps["header"];
|
|
7
|
-
isHighlighted: boolean;
|
|
8
|
-
isInitialFocused: boolean;
|
|
9
|
-
nestedIndex: number;
|
|
10
|
-
rowIndex: number;
|
|
11
|
-
visibleRow: TableCellProps["visibleRow"];
|
|
12
|
-
}
|
|
13
|
-
declare const TableCell: import("react").ForwardRefExoticComponent<CellProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
2
|
+
declare const TableCell: ({ borderClass, colIndex, header, isHighlighted, isInitialFocused, nestedIndex, rowIndex, tableRow, }: TableCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
3
|
export default TableCell;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from "react";
|
|
2
|
-
import
|
|
2
|
+
import { SortColumn } from "../../types/SortConfig";
|
|
3
3
|
import TableRow from "../../types/TableRow";
|
|
4
4
|
interface TableContentLocalProps {
|
|
5
5
|
pinnedLeftWidth: number;
|
|
6
6
|
pinnedRightWidth: number;
|
|
7
7
|
setScrollTop: Dispatch<SetStateAction<number>>;
|
|
8
|
-
sort:
|
|
8
|
+
sort: SortColumn | null;
|
|
9
9
|
tableRows: TableRow[];
|
|
10
|
-
|
|
10
|
+
rowsToRender: TableRow[];
|
|
11
11
|
}
|
|
12
|
-
declare const TableContent: ({ pinnedLeftWidth, pinnedRightWidth, setScrollTop, sort, tableRows,
|
|
12
|
+
declare const TableContent: ({ pinnedLeftWidth, pinnedRightWidth, setScrollTop, sort, tableRows, rowsToRender, }: TableContentLocalProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export default TableContent;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import TableHeaderProps from "../../types/TableHeaderProps";
|
|
2
|
-
declare const TableHeader: ({ centerHeaderRef,
|
|
2
|
+
declare const TableHeader: ({ centerHeaderRef, headers, mainTemplateColumns, pinnedLeftColumns, pinnedLeftTemplateColumns, pinnedRightColumns, pinnedRightTemplateColumns, sort, pinnedLeftWidth, pinnedRightWidth, }: TableHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default TableHeader;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import HeaderObject from "../../types/HeaderObject";
|
|
3
|
-
import
|
|
2
|
+
import { SortColumn } from "../../types/SortConfig";
|
|
4
3
|
interface HeaderCellProps {
|
|
5
4
|
colIndex: number;
|
|
6
5
|
gridColumnEnd: number;
|
|
@@ -9,7 +8,7 @@ interface HeaderCellProps {
|
|
|
9
8
|
gridRowStart: number;
|
|
10
9
|
header: HeaderObject;
|
|
11
10
|
reverse?: boolean;
|
|
12
|
-
sort:
|
|
11
|
+
sort: SortColumn | null;
|
|
13
12
|
}
|
|
14
|
-
declare const TableHeaderCell:
|
|
13
|
+
declare const TableHeaderCell: ({ colIndex, gridColumnEnd, gridColumnStart, gridRowEnd, gridRowStart, header, reverse, sort, }: HeaderCellProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
15
14
|
export default TableHeaderCell;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RefObject } from "react";
|
|
2
2
|
declare const TableHorizontalScrollbar: ({ mainBodyWidth, mainBodyRef, pinnedLeftWidth, pinnedRightWidth, tableBodyContainerRef, }: {
|
|
3
|
-
mainBodyRef: RefObject<HTMLDivElement
|
|
3
|
+
mainBodyRef: RefObject<HTMLDivElement>;
|
|
4
4
|
mainBodyWidth: number;
|
|
5
5
|
pinnedLeftWidth: number;
|
|
6
6
|
pinnedRightWidth: number;
|
|
7
|
-
tableBodyContainerRef: RefObject<HTMLDivElement
|
|
7
|
+
tableBodyContainerRef: RefObject<HTMLDivElement>;
|
|
8
8
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
9
|
export default TableHorizontalScrollbar;
|
|
@@ -14,7 +14,7 @@ interface TableRowProps {
|
|
|
14
14
|
rowHeight: number;
|
|
15
15
|
rowIndices: RowIndices;
|
|
16
16
|
setHoveredIndex: (index: number | null) => void;
|
|
17
|
-
|
|
17
|
+
tableRow: TableRowType;
|
|
18
18
|
}
|
|
19
|
-
declare const TableRow: ({ columnIndices, columnIndexStart, gridTemplateColumns, headers, hoveredIndex, index, pinned, rowHeight, rowIndices, setHoveredIndex,
|
|
19
|
+
declare const TableRow: ({ columnIndices, columnIndexStart, gridTemplateColumns, headers, hoveredIndex, index, pinned, rowHeight, rowIndices, setHoveredIndex, tableRow, }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
export default TableRow;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import TableRowType from "../../types/TableRow";
|
|
3
3
|
import { Pinned } from "../../types/Pinned";
|
|
4
4
|
import HeaderObject from "../../types/HeaderObject";
|
|
@@ -10,14 +10,13 @@ interface TableSectionProps {
|
|
|
10
10
|
headers: HeaderObject[];
|
|
11
11
|
hoveredIndex: number | null;
|
|
12
12
|
pinned?: Pinned;
|
|
13
|
-
ref?: RefObject<HTMLDivElement | null>;
|
|
14
13
|
rowHeight: number;
|
|
15
14
|
rowIndices: RowIndices;
|
|
15
|
+
rowsToRender: TableRowType[];
|
|
16
16
|
setHoveredIndex: (index: number | null) => void;
|
|
17
17
|
templateColumns: string;
|
|
18
18
|
totalHeight: number;
|
|
19
|
-
visibleRows: TableRowType[];
|
|
20
19
|
width?: number;
|
|
21
20
|
}
|
|
22
|
-
declare const TableSection: (
|
|
21
|
+
declare const TableSection: import("react").ForwardRefExoticComponent<TableSectionProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
23
22
|
export default TableSection;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode, RefObject, Dispatch, SetStateAction } from "react";
|
|
1
|
+
import { ReactNode, RefObject, MutableRefObject, Dispatch, SetStateAction } from "react";
|
|
2
2
|
import { TableFilterState, FilterCondition } from "../types/FilterTypes";
|
|
3
3
|
import TableRow from "../types/TableRow";
|
|
4
4
|
import Cell from "../types/Cell";
|
|
@@ -15,10 +15,9 @@ interface TableContextType {
|
|
|
15
15
|
cellUpdateFlash?: boolean;
|
|
16
16
|
columnReordering: boolean;
|
|
17
17
|
columnResizing: boolean;
|
|
18
|
-
draggedHeaderRef:
|
|
18
|
+
draggedHeaderRef: MutableRefObject<HeaderObject | null>;
|
|
19
19
|
editColumns?: boolean;
|
|
20
20
|
expandIcon?: ReactNode;
|
|
21
|
-
unexpandedRows: Set<string>;
|
|
22
21
|
filters: TableFilterState;
|
|
23
22
|
forceUpdate: () => void;
|
|
24
23
|
getBorderClass: (cell: Cell) => string;
|
|
@@ -27,21 +26,25 @@ interface TableContextType {
|
|
|
27
26
|
handleClearFilter: (accessor: string) => void;
|
|
28
27
|
handleMouseDown: (cell: Cell) => void;
|
|
29
28
|
handleMouseOver: (cell: Cell) => void;
|
|
29
|
+
headerContainerRef: RefObject<HTMLDivElement>;
|
|
30
30
|
headers: HeaderObject[];
|
|
31
|
-
hoveredHeaderRef:
|
|
31
|
+
hoveredHeaderRef: MutableRefObject<HeaderObject | null>;
|
|
32
|
+
isAnimating: boolean;
|
|
32
33
|
isCopyFlashing: (cell: Cell) => boolean;
|
|
33
34
|
isInitialFocusedCell: (cell: Cell) => boolean;
|
|
35
|
+
isResizing: boolean;
|
|
36
|
+
isScrolling: boolean;
|
|
34
37
|
isSelected: (cell: Cell) => boolean;
|
|
35
38
|
isWarningFlashing: (cell: Cell) => boolean;
|
|
36
|
-
mainBodyRef: RefObject<HTMLDivElement
|
|
39
|
+
mainBodyRef: RefObject<HTMLDivElement>;
|
|
37
40
|
nextIcon: ReactNode;
|
|
38
41
|
onCellEdit?: (props: any) => void;
|
|
39
42
|
onColumnOrderChange?: (newHeaders: HeaderObject[]) => void;
|
|
40
43
|
onLoadMore?: () => void;
|
|
41
44
|
onSort: OnSortProps;
|
|
42
45
|
onTableHeaderDragEnd: (newHeaders: HeaderObject[]) => void;
|
|
43
|
-
pinnedLeftRef: RefObject<HTMLDivElement
|
|
44
|
-
pinnedRightRef: RefObject<HTMLDivElement
|
|
46
|
+
pinnedLeftRef: RefObject<HTMLDivElement>;
|
|
47
|
+
pinnedRightRef: RefObject<HTMLDivElement>;
|
|
45
48
|
prevIcon: ReactNode;
|
|
46
49
|
rowGrouping?: string[];
|
|
47
50
|
rowHeight: number;
|
|
@@ -49,17 +52,20 @@ interface TableContextType {
|
|
|
49
52
|
scrollbarWidth: number;
|
|
50
53
|
selectColumns?: (columnIndices: number[], isShiftKey?: boolean) => void;
|
|
51
54
|
selectableColumns: boolean;
|
|
52
|
-
setUnexpandedRows: Dispatch<SetStateAction<Set<string>>>;
|
|
53
55
|
setHeaders: Dispatch<SetStateAction<HeaderObject[]>>;
|
|
54
56
|
setInitialFocusedCell: Dispatch<SetStateAction<Cell | null>>;
|
|
57
|
+
setIsResizing: Dispatch<SetStateAction<boolean>>;
|
|
58
|
+
setIsScrolling: Dispatch<SetStateAction<boolean>>;
|
|
55
59
|
setSelectedCells: Dispatch<SetStateAction<Set<string>>>;
|
|
56
60
|
setSelectedColumns: Dispatch<SetStateAction<Set<number>>>;
|
|
61
|
+
setUnexpandedRows: Dispatch<SetStateAction<Set<string>>>;
|
|
57
62
|
shouldPaginate: boolean;
|
|
58
63
|
sortDownIcon: ReactNode;
|
|
59
64
|
sortUpIcon: ReactNode;
|
|
60
|
-
tableBodyContainerRef: RefObject<HTMLDivElement
|
|
65
|
+
tableBodyContainerRef: RefObject<HTMLDivElement>;
|
|
61
66
|
tableRows: TableRow[];
|
|
62
67
|
theme: Theme;
|
|
68
|
+
unexpandedRows: Set<string>;
|
|
63
69
|
useHoverRowBackground: boolean;
|
|
64
70
|
useOddColumnBackground: boolean;
|
|
65
71
|
useOddEvenRowBackground: boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TableFilterState } from "../types/FilterTypes";
|
|
2
|
+
declare const useExternalFilters: ({ filters, onFilterChange, }: {
|
|
3
|
+
filters: TableFilterState;
|
|
4
|
+
onFilterChange?: ((filters: TableFilterState) => void) | undefined;
|
|
5
|
+
}) => void;
|
|
6
|
+
export default useExternalFilters;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TableFilterState, FilterCondition } from "../types/FilterTypes";
|
|
2
|
+
import Row from "../types/Row";
|
|
3
|
+
interface UseFilterableDataProps {
|
|
4
|
+
rows: Row[];
|
|
5
|
+
externalFilterHandling: boolean;
|
|
6
|
+
onFilterChange?: (filters: TableFilterState) => void;
|
|
7
|
+
}
|
|
8
|
+
interface UseFilterableDataReturn {
|
|
9
|
+
filteredRows: Row[];
|
|
10
|
+
updateFilter: (filter: FilterCondition) => void;
|
|
11
|
+
clearFilter: (accessor: string) => void;
|
|
12
|
+
clearAllFilters: () => void;
|
|
13
|
+
filters: TableFilterState;
|
|
14
|
+
computeFilteredRowsPreview: (filter: FilterCondition) => Row[];
|
|
15
|
+
}
|
|
16
|
+
declare const useFilterableData: ({ rows, externalFilterHandling, onFilterChange, }: UseFilterableDataProps) => UseFilterableDataReturn;
|
|
17
|
+
export default useFilterableData;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
declare const useScrollbarWidth: ({ tableBodyContainerRef, }: {
|
|
3
|
+
tableBodyContainerRef: RefObject<HTMLDivElement>;
|
|
4
|
+
}) => {
|
|
5
|
+
setScrollbarWidth: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
6
|
+
scrollbarWidth: number;
|
|
7
|
+
tableBodyContainerRef: RefObject<HTMLDivElement>;
|
|
8
|
+
};
|
|
9
|
+
export default useScrollbarWidth;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import HeaderObject from "../types/HeaderObject";
|
|
3
2
|
import Row from "../types/Row";
|
|
4
|
-
import
|
|
3
|
+
import { SortColumn } from "../types/SortConfig";
|
|
5
4
|
declare const useSortableData: ({ headers, tableRows, externalSortHandling, onSortChange, rowGrouping, }: {
|
|
6
5
|
headers: HeaderObject[];
|
|
7
6
|
tableRows: Row[];
|
|
8
7
|
externalSortHandling: boolean;
|
|
9
|
-
onSortChange?: ((sort:
|
|
8
|
+
onSortChange?: ((sort: SortColumn | null) => void) | undefined;
|
|
10
9
|
rowGrouping?: string[] | undefined;
|
|
11
10
|
}) => {
|
|
12
|
-
|
|
13
|
-
sort: SortConfig | null;
|
|
11
|
+
sort: SortColumn | null;
|
|
14
12
|
sortedRows: Row[];
|
|
15
|
-
updateSort: (
|
|
13
|
+
updateSort: (accessor: string) => void;
|
|
14
|
+
computeSortedRowsPreview: (accessor: string) => Row[];
|
|
16
15
|
};
|
|
17
16
|
export default useSortableData;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MutableRefObject } from "react";
|
|
2
|
+
import { Row, TableRefType } from "..";
|
|
3
|
+
import { CellRegistryEntry } from "../context/TableContext";
|
|
4
|
+
declare const useTableAPI: ({ tableRef, rows, rowIdAccessor, cellRegistryRef, }: {
|
|
5
|
+
tableRef?: MutableRefObject<TableRefType | null> | undefined;
|
|
6
|
+
rows: Row[];
|
|
7
|
+
rowIdAccessor: string;
|
|
8
|
+
cellRegistryRef: MutableRefObject<Map<string, CellRegistryEntry>>;
|
|
9
|
+
}) => void;
|
|
10
|
+
export default useTableAPI;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Row from "../types/Row";
|
|
2
|
+
interface UseTableRowProcessingProps {
|
|
3
|
+
allowAnimations: boolean;
|
|
4
|
+
sortedRows: Row[];
|
|
5
|
+
originalRows: Row[];
|
|
6
|
+
currentPage: number;
|
|
7
|
+
rowsPerPage: number;
|
|
8
|
+
shouldPaginate: boolean;
|
|
9
|
+
rowGrouping?: string[];
|
|
10
|
+
rowIdAccessor: string;
|
|
11
|
+
unexpandedRows: Set<string>;
|
|
12
|
+
expandAll: boolean;
|
|
13
|
+
contentHeight: number;
|
|
14
|
+
rowHeight: number;
|
|
15
|
+
scrollTop: number;
|
|
16
|
+
computeFilteredRowsPreview: (filter: any) => Row[];
|
|
17
|
+
computeSortedRowsPreview: (accessor: string) => Row[];
|
|
18
|
+
}
|
|
19
|
+
declare const useTableRowProcessing: ({ allowAnimations, sortedRows, originalRows, currentPage, rowsPerPage, shouldPaginate, rowGrouping, rowIdAccessor, unexpandedRows, expandAll, contentHeight, rowHeight, scrollTop, computeFilteredRowsPreview, computeSortedRowsPreview, }: UseTableRowProcessingProps) => {
|
|
20
|
+
currentTableRows: import("../types/TableRow").default[];
|
|
21
|
+
currentVisibleRows: import("../types/TableRow").default[];
|
|
22
|
+
isAnimating: boolean;
|
|
23
|
+
prepareForFilterChange: (filter: any) => void;
|
|
24
|
+
prepareForSortChange: (accessor: string) => void;
|
|
25
|
+
rowsToRender: any[];
|
|
26
|
+
};
|
|
27
|
+
export default useTableRowProcessing;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RefObject } from "react";
|
|
2
2
|
declare const useWindowResize: ({ forceUpdate, tableBodyContainerRef, setScrollbarWidth, }: {
|
|
3
3
|
forceUpdate: () => void;
|
|
4
|
-
tableBodyContainerRef: RefObject<HTMLDivElement
|
|
4
|
+
tableBodyContainerRef: RefObject<HTMLDivElement>;
|
|
5
5
|
setScrollbarWidth: (width: number) => void;
|
|
6
6
|
}) => void;
|
|
7
7
|
export default useWindowResize;
|