simple-table-core 0.6.7 → 0.6.9
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.d.ts +17 -0
- package/dist/components/Checkbox.d.ts +8 -0
- package/dist/components/SimpleTable/EditableCell/BooleanEdit.d.ts +7 -0
- package/dist/components/SimpleTable/EditableCell/EditableCell.d.ts +8 -0
- package/dist/components/SimpleTable/EditableCell/NumberEdit.d.ts +7 -0
- package/dist/components/SimpleTable/EditableCell/StringEdit.d.ts +7 -0
- package/dist/components/SimpleTable/PinnedLeftColumns.d.ts +2 -0
- package/dist/components/SimpleTable/PinnedRightColumns.d.ts +2 -0
- package/dist/components/SimpleTable/RenderCells.d.ts +16 -0
- package/dist/components/SimpleTable/SimpleTable.d.ts +60 -0
- package/dist/components/SimpleTable/TableBody.d.ts +3 -0
- package/dist/components/SimpleTable/TableCell.d.ts +4 -0
- package/dist/components/SimpleTable/TableColumnEditor/TableColumnEditor.d.ts +17 -0
- package/dist/components/SimpleTable/TableColumnEditor/TableColumnEditorPopout.d.ts +16 -0
- package/dist/components/SimpleTable/TableContent.d.ts +13 -0
- package/dist/components/SimpleTable/TableFooter.d.ts +13 -0
- package/dist/components/SimpleTable/TableHeader.d.ts +3 -0
- package/dist/components/SimpleTable/TableHeaderCell.d.ts +26 -0
- package/dist/components/SimpleTable/TableHorizontalScrollbar.d.ts +11 -0
- package/dist/components/SimpleTable/TableLastColumnCell.d.ts +5 -0
- package/dist/components/SimpleTable/TableRow.d.ts +14 -0
- package/dist/components/SimpleTable/TableRowSeparator.d.ts +4 -0
- package/dist/components/SimpleTable/TableSection.d.ts +13 -0
- package/dist/consts/general-consts.d.ts +1 -0
- package/dist/context/TableContext.d.ts +7 -0
- package/dist/helpers/calculateBoundingBoxes.d.ts +11 -0
- package/dist/helpers/shuffleArray.d.ts +1 -0
- package/dist/hooks/useDragHandler.d.ts +12 -0
- package/dist/hooks/usePrevious.d.ts +2 -0
- package/dist/hooks/useScrollSync.d.ts +3 -0
- package/dist/hooks/useScrollbarVisibility.d.ts +8 -0
- package/dist/hooks/useSelection.d.ts +23 -0
- package/dist/hooks/useSortableData.d.ts +12 -0
- package/dist/hooks/useWidthSync.d.ts +7 -0
- package/dist/icons/AngleDownIcon.d.ts +4 -0
- package/dist/icons/AngleLeftIcon.d.ts +4 -0
- package/dist/icons/AngleRightIcon.d.ts +4 -0
- package/dist/icons/AngleUpIcon.d.ts +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +2 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/types/BoundingBox.d.ts +11 -0
- package/dist/types/Cell.d.ts +5 -0
- package/dist/types/CellChangeProps.d.ts +10 -0
- package/dist/types/CellValue.d.ts +2 -0
- package/dist/types/DragHandlerProps.d.ts +9 -0
- package/dist/types/GroupedRow.d.ts +8 -0
- package/dist/types/HeaderObject.d.ts +16 -0
- package/dist/types/OnSortProps.d.ts +2 -0
- package/dist/types/Row.d.ts +12 -0
- package/dist/types/SharedTableProps.d.ts +21 -0
- package/dist/types/SortConfig.d.ts +6 -0
- package/dist/types/TableBodyProps.d.ts +24 -0
- package/dist/types/TableCellProps.d.ts +28 -0
- package/dist/types/TableHeaderProps.d.ts +21 -0
- package/dist/types/TableRowProps.d.ts +31 -0
- package/dist/types/Theme.d.ts +2 -0
- package/dist/utils/cellUtils.d.ts +10 -0
- package/dist/utils/formatters.d.ts +3 -0
- package/dist/utils/performanceUtils.d.ts +7 -0
- package/dist/utils/sortUtils.d.ts +20 -0
- package/package.json +13 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { RefObject } from "react";
|
|
2
|
+
import HeaderObject from "../types/HeaderObject";
|
|
3
|
+
export declare const TEST_KEY = "productId";
|
|
4
|
+
interface AnimateProps {
|
|
5
|
+
allowHorizontalAnimate?: boolean;
|
|
6
|
+
children: React.ReactNode | React.ReactNode[];
|
|
7
|
+
draggedHeaderRef?: RefObject<HeaderObject | null>;
|
|
8
|
+
headersRef: RefObject<HeaderObject[]>;
|
|
9
|
+
isBody?: boolean;
|
|
10
|
+
mainBodyRef: RefObject<HTMLDivElement | null>;
|
|
11
|
+
pauseAnimation?: boolean;
|
|
12
|
+
rowIndex: number;
|
|
13
|
+
}
|
|
14
|
+
declare const AnimateWrapper: ({ allowAnimations, children, ...props }: AnimateProps & {
|
|
15
|
+
allowAnimations: boolean;
|
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default AnimateWrapper;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
interface CheckboxProps {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
onChange?: (checked: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const Checkbox: ({ checked, children, onChange }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default Checkbox;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface BooleanSelectProps {
|
|
2
|
+
value: boolean;
|
|
3
|
+
onBlur: () => void;
|
|
4
|
+
onChange: (value: boolean) => void;
|
|
5
|
+
}
|
|
6
|
+
declare const BooleanSelect: ({ value, onBlur, onChange }: BooleanSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default BooleanSelect;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import CellValue from "../../../types/CellValue";
|
|
2
|
+
interface EditableCellProps {
|
|
3
|
+
onChange: (newValue: CellValue) => void;
|
|
4
|
+
setIsEditing: (isEditing: boolean) => void;
|
|
5
|
+
value: CellValue;
|
|
6
|
+
}
|
|
7
|
+
declare const EditableCell: ({ onChange, setIsEditing, value }: EditableCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default EditableCell;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface NumberInputProps {
|
|
2
|
+
defaultValue: number;
|
|
3
|
+
onBlur: () => void;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
}
|
|
6
|
+
declare const NumberEdit: ({ defaultValue, onBlur, onChange }: NumberInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default NumberEdit;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface TextInputProps {
|
|
2
|
+
defaultValue: string | null | undefined;
|
|
3
|
+
onBlur: () => void;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
}
|
|
6
|
+
declare const StringEdit: ({ defaultValue, onBlur, onChange }: TextInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default StringEdit;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Row from "../../types/Row";
|
|
2
|
+
import HeaderObject from "../../types/HeaderObject";
|
|
3
|
+
import TableBodyProps from "../../types/TableBodyProps";
|
|
4
|
+
declare const RenderCells: ({ getBorderClass, handleMouseDown, handleMouseOver, headers, hiddenColumns, isRowExpanded, isSelected, isTopLeftCell, lastGroupRow, onExpandRowClick, pinned, row, rowIndex, shouldDisplayLastColumnCell, ...props }: {
|
|
5
|
+
depth: number;
|
|
6
|
+
headers: HeaderObject[];
|
|
7
|
+
hiddenColumns: Record<string, boolean>;
|
|
8
|
+
isRowExpanded: (rowId: string | number) => boolean;
|
|
9
|
+
lastGroupRow?: boolean | undefined;
|
|
10
|
+
onExpandRowClick: (rowIndex: number) => void;
|
|
11
|
+
pinned?: "left" | "right" | undefined;
|
|
12
|
+
row: Row;
|
|
13
|
+
rowIndex: number;
|
|
14
|
+
shouldDisplayLastColumnCell: boolean;
|
|
15
|
+
} & Omit<TableBodyProps, "currentRows" | "headerContainerRef">) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default RenderCells;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import HeaderObject from "../../types/HeaderObject";
|
|
3
|
+
import CellChangeProps from "../../types/CellChangeProps";
|
|
4
|
+
import "../../styles/simple-table.css";
|
|
5
|
+
import Theme from "../../types/Theme";
|
|
6
|
+
import Row from "../../types/Row";
|
|
7
|
+
declare enum ColumnEditorPosition {
|
|
8
|
+
Left = "left",
|
|
9
|
+
Right = "right"
|
|
10
|
+
}
|
|
11
|
+
interface SimpleTableProps {
|
|
12
|
+
allowAnimations?: boolean;
|
|
13
|
+
columnEditorPosition?: ColumnEditorPosition;
|
|
14
|
+
columnEditorText?: string;
|
|
15
|
+
columnResizing?: boolean;
|
|
16
|
+
defaultHeaders: HeaderObject[];
|
|
17
|
+
draggable?: boolean;
|
|
18
|
+
editColumns?: boolean;
|
|
19
|
+
editColumnsInitOpen?: boolean;
|
|
20
|
+
height?: string;
|
|
21
|
+
hideFooter?: boolean;
|
|
22
|
+
nextIcon?: ReactNode;
|
|
23
|
+
onCellChange?: ({ accessor, newValue, originalRowIndex, row }: CellChangeProps) => void;
|
|
24
|
+
prevIcon?: ReactNode;
|
|
25
|
+
rows: Row[];
|
|
26
|
+
rowsPerPage?: number;
|
|
27
|
+
selectableCells?: boolean;
|
|
28
|
+
selectableColumns?: boolean;
|
|
29
|
+
shouldPaginate?: boolean;
|
|
30
|
+
sortDownIcon?: ReactNode;
|
|
31
|
+
sortUpIcon?: ReactNode;
|
|
32
|
+
theme?: Theme;
|
|
33
|
+
}
|
|
34
|
+
declare const _default: import("react").MemoExoticComponent<{
|
|
35
|
+
({ allowAnimations, columnEditorPosition, columnEditorText, columnResizing, defaultHeaders, draggable, editColumns, editColumnsInitOpen, height, hideFooter, nextIcon, onCellChange, prevIcon, rows, rowsPerPage, selectableCells, selectableColumns, shouldPaginate, sortDownIcon, sortUpIcon, theme, }: SimpleTableProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
defaultProps: {
|
|
37
|
+
allowAnimations: boolean;
|
|
38
|
+
columnEditorPosition: ColumnEditorPosition;
|
|
39
|
+
columnEditorText: string;
|
|
40
|
+
columnResizing: boolean;
|
|
41
|
+
defaultHeaders: never[];
|
|
42
|
+
draggable: boolean;
|
|
43
|
+
editColumns: boolean;
|
|
44
|
+
editColumnsInitOpen: boolean;
|
|
45
|
+
height: string;
|
|
46
|
+
hideFooter: boolean;
|
|
47
|
+
nextIcon: import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
onCellChange: () => void;
|
|
49
|
+
prevIcon: import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
rows: never[];
|
|
51
|
+
rowsPerPage: number;
|
|
52
|
+
selectableCells: boolean;
|
|
53
|
+
selectableColumns: boolean;
|
|
54
|
+
shouldPaginate: boolean;
|
|
55
|
+
sortDownIcon: import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
sortUpIcon: import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
theme: string;
|
|
58
|
+
};
|
|
59
|
+
}>;
|
|
60
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import HeaderObject from "../../../types/HeaderObject";
|
|
3
|
+
type TableColumnEditorProps = {
|
|
4
|
+
headers: HeaderObject[];
|
|
5
|
+
columnEditorText: string;
|
|
6
|
+
editColumns: boolean;
|
|
7
|
+
editColumnsInitOpen: boolean;
|
|
8
|
+
position: "left" | "right";
|
|
9
|
+
setHiddenColumns: Dispatch<SetStateAction<{
|
|
10
|
+
[key: string]: boolean;
|
|
11
|
+
}>>;
|
|
12
|
+
hiddenColumns: {
|
|
13
|
+
[key: string]: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
declare const TableColumnEditor: ({ columnEditorText, editColumns, editColumnsInitOpen, headers, position, setHiddenColumns, hiddenColumns, }: TableColumnEditorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
export default TableColumnEditor;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import HeaderObject from "../../../types/HeaderObject";
|
|
3
|
+
type TableColumnEditorPopoutProps = {
|
|
4
|
+
headers: HeaderObject[];
|
|
5
|
+
open: boolean;
|
|
6
|
+
position: "left" | "right";
|
|
7
|
+
setOpen: (open: boolean) => void;
|
|
8
|
+
setHiddenColumns: Dispatch<SetStateAction<{
|
|
9
|
+
[key: string]: boolean;
|
|
10
|
+
}>>;
|
|
11
|
+
hiddenColumns: {
|
|
12
|
+
[key: string]: boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
declare const TableColumnEditorPopout: ({ headers, open, position, setOpen, setHiddenColumns, hiddenColumns, }: TableColumnEditorPopoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default TableColumnEditorPopout;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
import TableBodyProps from "../../types/TableBodyProps";
|
|
3
|
+
import TableHeaderProps from "../../types/TableHeaderProps";
|
|
4
|
+
type OmittedTableProps = "headerContainerRef" | "shouldDisplayLastColumnCell" | "pinnedLeftColumns" | "pinnedRightColumns" | "mainTemplateColumns" | "pinnedLeftTemplateColumns" | "pinnedRightTemplateColumns";
|
|
5
|
+
interface TableContentProps extends Omit<TableHeaderProps, OmittedTableProps>, Omit<TableBodyProps, OmittedTableProps> {
|
|
6
|
+
editColumns: boolean;
|
|
7
|
+
pinnedLeftRef: RefObject<HTMLDivElement | null>;
|
|
8
|
+
pinnedRightRef: RefObject<HTMLDivElement | null>;
|
|
9
|
+
isRowExpanded: (rowId: string | number) => boolean;
|
|
10
|
+
onExpandRowClick: (rowIndex: number) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const TableContent: ({ allowAnimations, columnResizing, currentRows, draggable, draggedHeaderRef, editColumns, forceUpdate, getBorderClass, handleMouseDown, handleMouseOver, headersRef, hiddenColumns, hoveredHeaderRef, isRowExpanded, isSelected, isTopLeftCell, isWidthDragging, mainBodyRef, onCellChange, onExpandRowClick, onSort, onTableHeaderDragEnd, pinnedLeftRef, pinnedRightRef, scrollbarHorizontalRef, scrollbarWidth, selectableColumns, setIsWidthDragging, setSelectedCells, shouldPaginate, sort, sortDownIcon, sortUpIcon, tableBodyContainerRef, }: TableContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default TableContent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
interface TableFooterProps {
|
|
3
|
+
currentPage: number;
|
|
4
|
+
hideFooter?: boolean;
|
|
5
|
+
nextIcon?: ReactNode;
|
|
6
|
+
onPageChange: (page: number) => void;
|
|
7
|
+
prevIcon?: ReactNode;
|
|
8
|
+
rowsPerPage: number;
|
|
9
|
+
shouldPaginate?: boolean;
|
|
10
|
+
totalRows: number;
|
|
11
|
+
}
|
|
12
|
+
declare const TableFooter: ({ currentPage, hideFooter, nextIcon, onPageChange, prevIcon, rowsPerPage, shouldPaginate, totalRows, }: TableFooterProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
export default TableFooter;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import TableHeaderProps from "../../types/TableHeaderProps";
|
|
2
|
+
declare const TableHeader: ({ allowAnimations, columnResizing, currentRows, draggable, draggedHeaderRef, forceUpdate, headerContainerRef, headersRef, hiddenColumns, hoveredHeaderRef, isWidthDragging, mainTemplateColumns, onSort, onTableHeaderDragEnd, pinnedLeftColumns, pinnedLeftTemplateColumns, pinnedRightColumns, pinnedRightTemplateColumns, selectableColumns, setIsWidthDragging, setSelectedCells, shouldDisplayLastColumnCell, sort, sortDownIcon, sortUpIcon, mainBodyRef, }: TableHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default TableHeader;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SetStateAction, Dispatch, ReactNode } from "react";
|
|
2
|
+
import HeaderObject from "../../types/HeaderObject";
|
|
3
|
+
import SortConfig from "../../types/SortConfig";
|
|
4
|
+
import OnSortProps from "../../types/OnSortProps";
|
|
5
|
+
import Row from "../../types/Row";
|
|
6
|
+
interface TableHeaderCellProps {
|
|
7
|
+
columnResizing: boolean;
|
|
8
|
+
currentRows: Row[];
|
|
9
|
+
draggable: boolean;
|
|
10
|
+
draggedHeaderRef: React.MutableRefObject<HeaderObject | null>;
|
|
11
|
+
forceUpdate: () => void;
|
|
12
|
+
headersRef: React.RefObject<HeaderObject[]>;
|
|
13
|
+
hoveredHeaderRef: React.MutableRefObject<HeaderObject | null>;
|
|
14
|
+
index: number;
|
|
15
|
+
onSort: OnSortProps;
|
|
16
|
+
onTableHeaderDragEnd: (newHeaders: HeaderObject[]) => void;
|
|
17
|
+
reverse?: boolean;
|
|
18
|
+
selectableColumns: boolean;
|
|
19
|
+
setIsWidthDragging: Dispatch<SetStateAction<boolean>>;
|
|
20
|
+
setSelectedCells: Dispatch<React.SetStateAction<Set<string>>>;
|
|
21
|
+
sort: SortConfig | null;
|
|
22
|
+
sortDownIcon?: ReactNode;
|
|
23
|
+
sortUpIcon?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
declare const TableHeaderCell: import("react").ForwardRefExoticComponent<TableHeaderCellProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
|
+
export default TableHeaderCell;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
import HeaderObject from "../../types/HeaderObject";
|
|
3
|
+
declare const TableHorizontalScrollbar: ({ headersRef, mainBodyRef, pinnedLeftRef, pinnedRightRef, scrollbarHorizontalRef, tableContentWidth, }: {
|
|
4
|
+
headersRef: RefObject<HeaderObject[]>;
|
|
5
|
+
mainBodyRef: RefObject<HTMLDivElement | null>;
|
|
6
|
+
pinnedLeftRef: RefObject<HTMLDivElement | null>;
|
|
7
|
+
pinnedRightRef: RefObject<HTMLDivElement | null>;
|
|
8
|
+
scrollbarHorizontalRef: RefObject<HTMLDivElement | null>;
|
|
9
|
+
tableContentWidth: number;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export default TableHorizontalScrollbar;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Row from "../../types/Row";
|
|
2
|
+
import TableBodyProps from "../../types/TableBodyProps";
|
|
3
|
+
declare const TableRow: ({ depth, getNextRowIndex, index, lastGroupRow, pinned, props, row, }: {
|
|
4
|
+
depth?: number | undefined;
|
|
5
|
+
getNextRowIndex: () => number;
|
|
6
|
+
index: number;
|
|
7
|
+
lastGroupRow?: boolean | undefined;
|
|
8
|
+
pinned?: "left" | "right" | undefined;
|
|
9
|
+
props: Omit<TableBodyProps, "currentRows" | "headerContainerRef"> & {
|
|
10
|
+
onExpandRowClick: (rowIndex: number) => void;
|
|
11
|
+
};
|
|
12
|
+
row: Row;
|
|
13
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default TableRow;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Row from "../../types/Row";
|
|
2
|
+
import { RefObject } from "react";
|
|
3
|
+
import TableBodyProps from "../../types/TableBodyProps";
|
|
4
|
+
declare const TableSection: ({ headerContainerRef, isRowExpanded, onExpandRowClick, pinned, rows, sectionRef, templateColumns, ...props }: {
|
|
5
|
+
headerContainerRef: RefObject<HTMLDivElement | null>;
|
|
6
|
+
isRowExpanded: (rowId: string | number) => boolean;
|
|
7
|
+
onExpandRowClick: (rowIndex: number) => void;
|
|
8
|
+
pinned?: "left" | "right" | undefined;
|
|
9
|
+
rows: Row[];
|
|
10
|
+
sectionRef?: RefObject<HTMLDivElement | null> | undefined;
|
|
11
|
+
templateColumns: string;
|
|
12
|
+
} & Omit<TableBodyProps, "currentRows">) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default TableSection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DRAG_THROTTLE_LIMIT = 50;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MutableRefObject } from "react";
|
|
2
|
+
import BoundingBox from "../types/BoundingBox";
|
|
3
|
+
import HeaderObject from "../types/HeaderObject";
|
|
4
|
+
declare const calculateBoundingBoxes: ({ currentHeaders, draggedHeaderRef, rowIndex, }: {
|
|
5
|
+
currentHeaders: HeaderObject[];
|
|
6
|
+
draggedHeaderRef?: MutableRefObject<HeaderObject | null> | undefined;
|
|
7
|
+
rowIndex: number;
|
|
8
|
+
}) => {
|
|
9
|
+
[key: string]: false | BoundingBox;
|
|
10
|
+
};
|
|
11
|
+
export default calculateBoundingBoxes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function shuffleArray(array: any[]): any[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DragEvent } from "react";
|
|
2
|
+
import HeaderObject from "../types/HeaderObject";
|
|
3
|
+
import DragHandlerProps from "../types/DragHandlerProps";
|
|
4
|
+
declare const useDragHandler: ({ draggedHeaderRef, headersRef, hoveredHeaderRef, onTableHeaderDragEnd, }: DragHandlerProps) => {
|
|
5
|
+
handleDragStart: (header: HeaderObject) => void;
|
|
6
|
+
handleDragOver: ({ event, hoveredHeader, }: {
|
|
7
|
+
event: DragEvent<HTMLDivElement>;
|
|
8
|
+
hoveredHeader: HeaderObject;
|
|
9
|
+
}) => void;
|
|
10
|
+
handleDragEnd: () => void;
|
|
11
|
+
};
|
|
12
|
+
export default useDragHandler;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
declare const useScrollbarVisibility: ({ headerContainerRef, mainSectionRef, scrollbarHorizontalRef, scrollbarWidth, }: {
|
|
3
|
+
headerContainerRef?: RefObject<HTMLElement | null> | undefined;
|
|
4
|
+
mainSectionRef?: RefObject<HTMLElement | null> | undefined;
|
|
5
|
+
scrollbarHorizontalRef?: RefObject<HTMLElement | null> | undefined;
|
|
6
|
+
scrollbarWidth: number;
|
|
7
|
+
}) => void;
|
|
8
|
+
export default useScrollbarVisibility;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import HeaderObject from "../types/HeaderObject";
|
|
3
|
+
export type MouseDownProps = {
|
|
4
|
+
rowIndex: number;
|
|
5
|
+
colIndex: number;
|
|
6
|
+
};
|
|
7
|
+
declare const useSelection: ({ selectableCells, headers, rows, }: {
|
|
8
|
+
selectableCells: boolean;
|
|
9
|
+
headers: HeaderObject[];
|
|
10
|
+
rows: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}[];
|
|
13
|
+
}) => {
|
|
14
|
+
selectedCells: Set<string>;
|
|
15
|
+
handleMouseDown: ({ colIndex, rowIndex }: MouseDownProps) => void;
|
|
16
|
+
handleMouseOver: (rowIndex: number, colIndex: number) => void;
|
|
17
|
+
handleMouseUp: () => void;
|
|
18
|
+
isSelected: (rowIndex: number, colIndex: number) => boolean;
|
|
19
|
+
getBorderClass: (rowIndex: number, colIndex: number) => string;
|
|
20
|
+
isTopLeftCell: (rowIndex: number, colIndex: number) => boolean;
|
|
21
|
+
setSelectedCells: import("react").Dispatch<import("react").SetStateAction<Set<string>>>;
|
|
22
|
+
};
|
|
23
|
+
export default useSelection;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import HeaderObject from "../types/HeaderObject";
|
|
3
|
+
import Row from "../types/Row";
|
|
4
|
+
import SortConfig from "../types/SortConfig";
|
|
5
|
+
declare const useSortableData: (tableRows: Row[], headers: HeaderObject[]) => {
|
|
6
|
+
sort: SortConfig | null;
|
|
7
|
+
setSort: import("react").Dispatch<import("react").SetStateAction<SortConfig | null>>;
|
|
8
|
+
sortedRows: Row[];
|
|
9
|
+
hiddenColumns: Record<string, boolean>;
|
|
10
|
+
setHiddenColumns: import("react").Dispatch<import("react").SetStateAction<Record<string, boolean>>>;
|
|
11
|
+
};
|
|
12
|
+
export default useSortableData;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
declare const useWidthSync: ({ callback, ref, widthAttribute, }: {
|
|
3
|
+
callback: (width: number) => void;
|
|
4
|
+
ref: RefObject<HTMLElement | null>;
|
|
5
|
+
widthAttribute: "offsetWidth" | "scrollWidth";
|
|
6
|
+
}) => void;
|
|
7
|
+
export default useWidthSync;
|
package/dist/index.d.ts
ADDED