simple-table-core 0.8.37 → 1.0.1
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/simple-table/RenderCells.d.ts +3 -4
- package/dist/components/simple-table/SimpleTable.d.ts +3 -1
- package/dist/components/simple-table/TableBody.d.ts +1 -1
- package/dist/components/simple-table/TableContent.d.ts +4 -7
- package/dist/components/simple-table/TableRow.d.ts +4 -5
- package/dist/components/simple-table/TableSection.d.ts +3 -4
- package/dist/context/TableContext.d.ts +14 -10
- package/dist/hooks/useSelection.d.ts +6 -4
- package/dist/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/HandleResizeStartProps.d.ts +0 -1
- package/dist/types/Row.d.ts +1 -11
- package/dist/types/SharedTableProps.d.ts +0 -1
- package/dist/types/TableBodyProps.d.ts +3 -6
- package/dist/types/TableCellProps.d.ts +2 -2
- package/dist/types/{VisibleRow.d.ts → TableRow.d.ts} +5 -4
- package/dist/types/TableRowProps.d.ts +0 -1
- package/dist/utils/infiniteScrollUtils.d.ts +5 -6
- package/dist/utils/resizeUtils.d.ts +1 -1
- package/dist/utils/rowUtils.d.ts +27 -0
- package/package.json +1 -1
- package/dist/helpers/calculateBoundingBoxes.d.ts +0 -11
- package/dist/helpers/shuffleArray.d.ts +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import HeaderObject from "../../types/HeaderObject";
|
|
2
2
|
import { RowId } from "../../types/RowId";
|
|
3
|
-
import
|
|
3
|
+
import type TableRowType from "../../types/TableRow";
|
|
4
4
|
import { Pinned } from "../../types/Pinned";
|
|
5
5
|
import RowIndices from "../../types/RowIndices";
|
|
6
6
|
import ColumnIndices from "../../types/ColumnIndices";
|
|
@@ -9,12 +9,11 @@ interface RenderCellsProps {
|
|
|
9
9
|
columnIndices: ColumnIndices;
|
|
10
10
|
headers: HeaderObject[];
|
|
11
11
|
hiddenColumns: Record<string, boolean>;
|
|
12
|
-
isWidthDragging: boolean;
|
|
13
12
|
onExpandRowClick: (rowId: RowId) => void;
|
|
14
13
|
pinned?: Pinned;
|
|
15
14
|
rowIndex: number;
|
|
16
15
|
rowIndices: RowIndices;
|
|
17
|
-
visibleRow:
|
|
16
|
+
visibleRow: TableRowType;
|
|
18
17
|
}
|
|
19
|
-
declare const RenderCells: ({ columnIndexStart, columnIndices, headers, hiddenColumns,
|
|
18
|
+
declare const RenderCells: ({ columnIndexStart, columnIndices, headers, hiddenColumns, onExpandRowClick, pinned, rowIndex, rowIndices, visibleRow, }: RenderCellsProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
19
|
export default RenderCells;
|
|
@@ -10,7 +10,6 @@ import "../../styles/simple-table.css";
|
|
|
10
10
|
interface SimpleTableProps {
|
|
11
11
|
allowAnimations?: boolean;
|
|
12
12
|
cellUpdateFlash?: boolean;
|
|
13
|
-
collapseIcon?: ReactNode;
|
|
14
13
|
columnEditorPosition?: ColumnEditorPosition;
|
|
15
14
|
columnEditorText?: string;
|
|
16
15
|
columnReordering?: boolean;
|
|
@@ -18,6 +17,7 @@ interface SimpleTableProps {
|
|
|
18
17
|
defaultHeaders: HeaderObject[];
|
|
19
18
|
editColumns?: boolean;
|
|
20
19
|
editColumnsInitOpen?: boolean;
|
|
20
|
+
expandAll?: boolean;
|
|
21
21
|
expandIcon?: ReactNode;
|
|
22
22
|
height?: string;
|
|
23
23
|
hideFooter?: boolean;
|
|
@@ -27,7 +27,9 @@ interface SimpleTableProps {
|
|
|
27
27
|
onGridReady?: () => void;
|
|
28
28
|
onNextPage?: OnNextPage;
|
|
29
29
|
prevIcon?: ReactNode;
|
|
30
|
+
rowGrouping?: string[];
|
|
30
31
|
rowHeight?: number;
|
|
32
|
+
rowIdAccessor: string;
|
|
31
33
|
rows: Row[];
|
|
32
34
|
rowsPerPage?: number;
|
|
33
35
|
selectableCells?: boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import TableBodyProps from "../../types/TableBodyProps";
|
|
2
|
-
declare const TableBody: ({
|
|
2
|
+
declare const TableBody: ({ headerContainerRef, mainTemplateColumns, pinnedLeftColumns, pinnedLeftTemplateColumns, pinnedLeftWidth, pinnedRightColumns, pinnedRightTemplateColumns, pinnedRightWidth, setScrollTop, tableRows, visibleRows, }: TableBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default TableBody;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from "react";
|
|
2
|
-
import Row from "../../types/Row";
|
|
3
2
|
import SortConfig from "../../types/SortConfig";
|
|
4
|
-
import
|
|
3
|
+
import TableRow from "../../types/TableRow";
|
|
5
4
|
interface TableContentLocalProps {
|
|
6
|
-
flattenedRows: Row[];
|
|
7
|
-
isWidthDragging: boolean;
|
|
8
5
|
pinnedLeftWidth: number;
|
|
9
6
|
pinnedRightWidth: number;
|
|
10
|
-
setFlattenedRows: Dispatch<SetStateAction<Row[]>>;
|
|
11
7
|
setScrollTop: Dispatch<SetStateAction<number>>;
|
|
12
8
|
sort: SortConfig | null;
|
|
13
|
-
|
|
9
|
+
tableRows: TableRow[];
|
|
10
|
+
visibleRows: TableRow[];
|
|
14
11
|
}
|
|
15
|
-
declare const TableContent: ({
|
|
12
|
+
declare const TableContent: ({ pinnedLeftWidth, pinnedRightWidth, setScrollTop, sort, tableRows, visibleRows, }: TableContentLocalProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
13
|
export default TableContent;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import VisibleRow from "../../types/VisibleRow";
|
|
1
|
+
import type TableRowType from "../../types/TableRow";
|
|
3
2
|
import { Pinned } from "../../types/Pinned";
|
|
4
3
|
import HeaderObject from "../../types/HeaderObject";
|
|
5
4
|
import ColumnIndices from "../../types/ColumnIndices";
|
|
6
5
|
import RowIndices from "../../types/RowIndices";
|
|
6
|
+
import { RowId } from "../../types/RowId";
|
|
7
7
|
interface TableRowProps {
|
|
8
8
|
columnIndexStart?: number;
|
|
9
9
|
columnIndices: ColumnIndices;
|
|
@@ -12,13 +12,12 @@ interface TableRowProps {
|
|
|
12
12
|
hiddenColumns: Record<string, boolean>;
|
|
13
13
|
hoveredIndex: number | null;
|
|
14
14
|
index: number;
|
|
15
|
-
isWidthDragging: boolean;
|
|
16
15
|
onExpandRowClick: (rowId: RowId) => void;
|
|
17
16
|
pinned?: Pinned;
|
|
18
17
|
rowHeight: number;
|
|
19
18
|
rowIndices: RowIndices;
|
|
20
19
|
setHoveredIndex: (index: number | null) => void;
|
|
21
|
-
visibleRow:
|
|
20
|
+
visibleRow: TableRowType;
|
|
22
21
|
}
|
|
23
|
-
declare const TableRow: ({ columnIndices, columnIndexStart, gridTemplateColumns, headers, hiddenColumns, hoveredIndex, index,
|
|
22
|
+
declare const TableRow: ({ columnIndices, columnIndexStart, gridTemplateColumns, headers, hiddenColumns, hoveredIndex, index, onExpandRowClick, pinned, rowHeight, rowIndices, setHoveredIndex, visibleRow, }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
23
|
export default TableRow;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RefObject } from "react";
|
|
2
|
-
import
|
|
2
|
+
import TableRow from "../../types/TableRow";
|
|
3
3
|
import { RowId } from "../../types/RowId";
|
|
4
4
|
import { Pinned } from "../../types/Pinned";
|
|
5
5
|
import HeaderObject from "../../types/HeaderObject";
|
|
@@ -11,7 +11,6 @@ interface TableSectionProps {
|
|
|
11
11
|
headers: HeaderObject[];
|
|
12
12
|
hiddenColumns: Record<string, boolean>;
|
|
13
13
|
hoveredIndex: number | null;
|
|
14
|
-
isWidthDragging: boolean;
|
|
15
14
|
onExpandRowClick: (rowId: RowId) => void;
|
|
16
15
|
pinned?: Pinned;
|
|
17
16
|
ref?: RefObject<HTMLDivElement | null>;
|
|
@@ -20,8 +19,8 @@ interface TableSectionProps {
|
|
|
20
19
|
setHoveredIndex: (index: number | null) => void;
|
|
21
20
|
templateColumns: string;
|
|
22
21
|
totalHeight: number;
|
|
23
|
-
visibleRows:
|
|
22
|
+
visibleRows: TableRow[];
|
|
24
23
|
width?: number;
|
|
25
24
|
}
|
|
26
|
-
declare const TableSection: ({ columnIndexStart, columnIndices, headers, hiddenColumns, hoveredIndex,
|
|
25
|
+
declare const TableSection: ({ columnIndexStart, columnIndices, headers, hiddenColumns, hoveredIndex, onExpandRowClick, pinned, ref, rowHeight, rowIndices, setHoveredIndex, templateColumns, totalHeight, visibleRows, width, }: TableSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
26
|
export default TableSection;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ReactNode, RefObject, Dispatch, SetStateAction } from "react";
|
|
2
|
+
import { TableFilterState, FilterCondition } from "../types/FilterTypes";
|
|
3
|
+
import TableRow from "../types/TableRow";
|
|
4
|
+
import Cell from "../types/Cell";
|
|
2
5
|
import HeaderObject from "../types/HeaderObject";
|
|
3
6
|
import OnSortProps from "../types/OnSortProps";
|
|
4
|
-
import
|
|
7
|
+
import Theme from "../types/Theme";
|
|
5
8
|
import CellValue from "../types/CellValue";
|
|
6
|
-
import { Theme } from "..";
|
|
7
|
-
import { TableFilterState, FilterCondition } from "../types/FilterTypes";
|
|
8
9
|
export interface CellRegistryEntry {
|
|
9
10
|
updateContent: (newValue: CellValue) => void;
|
|
10
11
|
}
|
|
@@ -12,13 +13,14 @@ interface TableContextType {
|
|
|
12
13
|
allowAnimations?: boolean;
|
|
13
14
|
cellRegistry?: Map<string, CellRegistryEntry>;
|
|
14
15
|
cellUpdateFlash?: boolean;
|
|
15
|
-
collapseIcon?: ReactNode;
|
|
16
16
|
columnReordering: boolean;
|
|
17
17
|
columnResizing: boolean;
|
|
18
18
|
draggedHeaderRef: RefObject<HeaderObject | null>;
|
|
19
19
|
editColumns?: boolean;
|
|
20
20
|
expandIcon?: ReactNode;
|
|
21
|
+
expandedRows: Set<string>;
|
|
21
22
|
filters: TableFilterState;
|
|
23
|
+
tableRows: TableRow[];
|
|
22
24
|
forceUpdate: () => void;
|
|
23
25
|
getBorderClass: (cell: Cell) => string;
|
|
24
26
|
handleApplyFilter: (filter: FilterCondition) => void;
|
|
@@ -40,25 +42,27 @@ interface TableContextType {
|
|
|
40
42
|
pinnedLeftRef: RefObject<HTMLDivElement | null>;
|
|
41
43
|
pinnedRightRef: RefObject<HTMLDivElement | null>;
|
|
42
44
|
prevIcon: ReactNode;
|
|
45
|
+
rowGrouping?: string[];
|
|
43
46
|
rowHeight: number;
|
|
47
|
+
rowIdAccessor: string;
|
|
44
48
|
scrollbarWidth: number;
|
|
45
49
|
selectColumns?: (columnIndices: number[], isShiftKey?: boolean) => void;
|
|
46
50
|
selectableColumns: boolean;
|
|
51
|
+
setExpandedRows: Dispatch<SetStateAction<Set<string>>>;
|
|
47
52
|
setInitialFocusedCell: Dispatch<SetStateAction<Cell | null>>;
|
|
48
|
-
setIsWidthDragging: Dispatch<SetStateAction<boolean>>;
|
|
49
53
|
setMainBodyWidth: Dispatch<SetStateAction<number>>;
|
|
50
54
|
setPinnedLeftWidth: Dispatch<SetStateAction<number>>;
|
|
51
55
|
setPinnedRightWidth: Dispatch<SetStateAction<number>>;
|
|
52
56
|
setSelectedCells: Dispatch<SetStateAction<Set<string>>>;
|
|
53
57
|
setSelectedColumns: Dispatch<SetStateAction<Set<number>>>;
|
|
54
58
|
shouldPaginate: boolean;
|
|
55
|
-
sortDownIcon
|
|
56
|
-
sortUpIcon
|
|
59
|
+
sortDownIcon: ReactNode;
|
|
60
|
+
sortUpIcon: ReactNode;
|
|
57
61
|
tableBodyContainerRef: RefObject<HTMLDivElement | null>;
|
|
58
62
|
theme: Theme;
|
|
59
|
-
useHoverRowBackground
|
|
60
|
-
useOddColumnBackground
|
|
61
|
-
useOddEvenRowBackground
|
|
63
|
+
useHoverRowBackground: boolean;
|
|
64
|
+
useOddColumnBackground: boolean;
|
|
65
|
+
useOddEvenRowBackground: boolean;
|
|
62
66
|
}
|
|
63
67
|
export declare const TableContext: import("react").Context<TableContextType | undefined>;
|
|
64
68
|
export declare const TableProvider: ({ children, value, }: {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import HeaderObject from "../types/HeaderObject";
|
|
3
|
+
import type TableRowType from "../types/TableRow";
|
|
3
4
|
import Cell from "../types/Cell";
|
|
4
|
-
import VisibleRow from "../types/VisibleRow";
|
|
5
5
|
export declare const createSetString: ({ rowIndex, colIndex, rowId }: Cell) => string;
|
|
6
|
-
|
|
6
|
+
interface UseSelectionProps {
|
|
7
7
|
selectableCells: boolean;
|
|
8
8
|
headers: HeaderObject[];
|
|
9
|
-
visibleRows:
|
|
10
|
-
|
|
9
|
+
visibleRows: TableRowType[];
|
|
10
|
+
rowIdAccessor: string;
|
|
11
|
+
}
|
|
12
|
+
declare const useSelection: ({ selectableCells, headers, visibleRows, rowIdAccessor, }: UseSelectionProps) => {
|
|
11
13
|
getBorderClass: ({ colIndex, rowIndex, rowId }: Cell) => string;
|
|
12
14
|
handleMouseDown: ({ colIndex, rowIndex, rowId }: Cell) => void;
|
|
13
15
|
handleMouseOver: ({ colIndex, rowIndex, rowId }: Cell) => void;
|