simple-table-core 4.1.6 → 4.1.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/README.md +15 -7
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/styles.css +1 -1
- package/dist/consts/general-consts.d.ts +0 -4
- package/dist/core/SimpleTableVanilla.d.ts +19 -275
- package/dist/core/api/TableAPIContext.d.ts +74 -0
- package/dist/core/api/TableAPIImpl.d.ts +2 -74
- package/dist/core/api/buildTableAPIContext.d.ts +61 -0
- package/dist/core/dev/UnvirtualizedRowsWarning.d.ts +20 -0
- package/dist/core/initialization/createDataManagers.d.ts +37 -0
- package/dist/core/initialization/wireMountManagers.d.ts +43 -0
- package/dist/core/pipeline/syncPivotPipeline.d.ts +41 -0
- package/dist/core/rendering/RenderContext.d.ts +125 -0
- package/dist/core/rendering/RenderOrchestrator.d.ts +8 -119
- package/dist/core/rendering/SectionRenderer.d.ts +21 -15
- package/dist/core/rendering/TableRenderer.d.ts +6 -98
- package/dist/core/rendering/TableRendererDeps.d.ts +98 -0
- package/dist/core/rendering/buildRenderContext.d.ts +94 -0
- package/dist/core/rendering/cellRenderContexts.d.ts +11 -0
- package/dist/core/rendering/renderBodySections.d.ts +14 -0
- package/dist/core/rendering/renderHeaderSections.d.ts +13 -0
- package/dist/core/rendering/sectionCaches.d.ts +24 -0
- package/dist/core/rendering/sectionExtraRows.d.ts +19 -0
- package/dist/core/rendering/sectionLayout.d.ts +42 -0
- package/dist/core/vanilla/VanillaLiveHost.d.ts +103 -0
- package/dist/core/vanilla/applyTableUpdate.d.ts +10 -0
- package/dist/core/vanilla/createVanillaRenderContext.d.ts +4 -0
- package/dist/core/vanilla/destroyTableResources.d.ts +26 -0
- package/dist/core/vanilla/syncRowSelectionManager.d.ts +13 -0
- package/dist/core/vanilla/tableContainers.d.ts +5 -0
- package/dist/core/vanilla/toTableAPIContextHost.d.ts +3 -0
- package/dist/hooks/contentHeight.d.ts +3 -1
- package/dist/hooks/scrollbarWidth.d.ts +0 -43
- package/dist/hooks/useAggregatedRows.d.ts +0 -2
- package/dist/index.es.js +1 -1
- package/dist/managers/AccordionController.d.ts +39 -0
- package/dist/managers/AnimationCoordinator.d.ts +15 -1
- package/dist/managers/AutoSizeManager.d.ts +64 -0
- package/dist/managers/CellSlideAnimator.d.ts +54 -0
- package/dist/managers/DragHandlerManager.d.ts +4 -26
- package/dist/managers/ExternalScrollController.d.ts +68 -0
- package/dist/managers/ScrollRenderCoalescer.d.ts +32 -0
- package/dist/managers/SelectionManager/mouseUtils.d.ts +3 -3
- package/dist/styles.css +1 -1
- package/dist/utils/accordionAnimation.d.ts +0 -5
- package/dist/utils/bodyCell/editing.d.ts +1 -1
- package/dist/utils/bodyCell/editors/booleanDropdown.d.ts +1 -1
- package/dist/utils/bodyCell/editors/datePicker.d.ts +1 -1
- package/dist/utils/bodyCell/editors/enumDropdown.d.ts +1 -1
- package/dist/utils/bodyCell/selection.d.ts +0 -1
- package/dist/utils/bodyCell/styling.d.ts +2 -0
- package/dist/utils/cellScrollUtils.d.ts +1 -1
- package/dist/utils/cellUtils.d.ts +0 -4
- package/dist/utils/collapseUtils.d.ts +0 -10
- package/dist/utils/externalScroll.d.ts +0 -10
- package/dist/utils/formatters.d.ts +0 -2
- package/dist/utils/headerCell/eventTracking.d.ts +2 -2
- package/dist/utils/headerCell/styling.d.ts +0 -1
- package/dist/utils/headerWidthUtils.d.ts +2 -2
- package/dist/utils/infiniteScrollUtils.d.ts +0 -1
- package/dist/utils/parkAndStagger.d.ts +44 -0
- package/dist/utils/resizeUtils/domUpdates.d.ts +1 -1
- package/dist/utils/resizeUtils/maxWidth.d.ts +2 -1
- package/dist/utils/rowSelectionUtils.d.ts +0 -4
- package/dist/utils/rowSeparatorRenderer.d.ts +0 -1
- package/dist/utils/rowUtils.d.ts +1 -27
- package/dist/utils/setAbsoluteCellPosition.d.ts +31 -0
- package/dist/utils/stateRowRenderer.d.ts +0 -1
- package/dist/utils/tableDomScope.d.ts +20 -0
- package/package.json +4 -3
- package/src/styles/base.css +40 -147
- package/dist/managers/ColumnManager.d.ts +0 -42
- package/dist/managers/RowManager.d.ts +0 -56
- package/dist/managers/TableManager.d.ts +0 -72
- package/dist/types/BoundingBox.d.ts +0 -11
- package/dist/types/DragHandlerProps.d.ts +0 -14
- package/dist/types/OnSortProps.d.ts +0 -3
- package/dist/types/SharedTableProps.d.ts +0 -24
- package/dist/types/TableBodyProps.d.ts +0 -20
- package/dist/types/TableHeaderProps.d.ts +0 -17
- package/dist/types/TableHeaderSectionProps.d.ts +0 -19
- package/dist/types/TableRowProps.d.ts +0 -29
- package/dist/utils/columnIndicesUtils.d.ts +0 -15
- package/dist/utils/columnVirtualizationUtils.d.ts +0 -128
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Pinned } from "./Pinned";
|
|
2
|
-
import SortColumn from "./SortColumn";
|
|
3
|
-
import { ColumnDef } from "..";
|
|
4
|
-
import { ColumnIndices } from "../utils/columnIndicesUtils";
|
|
5
|
-
interface TableHeaderSectionProps {
|
|
6
|
-
calculatedHeaderHeight: number;
|
|
7
|
-
columnIndices: ColumnIndices;
|
|
8
|
-
handleScroll?: (event: UIEvent) => void;
|
|
9
|
-
headers: ColumnDef[];
|
|
10
|
-
leftOffset?: number;
|
|
11
|
-
maxDepth: number;
|
|
12
|
-
pinned?: Pinned;
|
|
13
|
-
sectionRef: {
|
|
14
|
-
current: HTMLDivElement | null;
|
|
15
|
-
};
|
|
16
|
-
sort: SortColumn | null;
|
|
17
|
-
width?: number;
|
|
18
|
-
}
|
|
19
|
-
export default TableHeaderSectionProps;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import CellChangeProps from "./CellChangeProps";
|
|
2
|
-
import ColumnDef from "./ColumnDef";
|
|
3
|
-
import Row from "./Row";
|
|
4
|
-
import Cell from "./Cell";
|
|
5
|
-
type TableRowProps = {
|
|
6
|
-
currentRows: Row[];
|
|
7
|
-
draggedHeaderRef: {
|
|
8
|
-
current: ColumnDef | null;
|
|
9
|
-
};
|
|
10
|
-
getBorderClass: (rowIndex: number, columnIndex: number) => string;
|
|
11
|
-
handleMouseDown: (props: Cell) => void;
|
|
12
|
-
handleMouseOver: (rowIndex: number, columnIndex: number) => void;
|
|
13
|
-
headers: ColumnDef[];
|
|
14
|
-
hoveredHeaderRef: {
|
|
15
|
-
current: ColumnDef | null;
|
|
16
|
-
};
|
|
17
|
-
isSelected: (rowIndex: number, columnIndex: number) => boolean;
|
|
18
|
-
isInitialFocusedCell: (rowIndex: number, columnIndex: number) => boolean;
|
|
19
|
-
onCellEdit?: (props: CellChangeProps) => void;
|
|
20
|
-
onTableHeaderDragEnd: (newHeaders: ColumnDef[]) => void;
|
|
21
|
-
onToggleGroup: (rowId: number) => void;
|
|
22
|
-
row: Row;
|
|
23
|
-
rowIndex: number;
|
|
24
|
-
enablePagination: boolean;
|
|
25
|
-
tableRef: {
|
|
26
|
-
current: HTMLDivElement | null;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
export default TableRowProps;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import ColumnDef, { Accessor } from "../types/ColumnDef";
|
|
2
|
-
export type ColumnIndices = Record<string, number>;
|
|
3
|
-
/**
|
|
4
|
-
* Calculates column indices for all headers to ensure consistent colIndex values
|
|
5
|
-
* This function is used in both TableBody and TableHeader components
|
|
6
|
-
*
|
|
7
|
-
* Note: In hierarchical headers, a parent header and its first child can share
|
|
8
|
-
* the same column index, which is needed for proper alignment in the grid.
|
|
9
|
-
*/
|
|
10
|
-
export declare function calculateColumnIndices({ headers, pinnedLeftColumns, pinnedRightColumns, collapsedHeaders, }: {
|
|
11
|
-
headers: ColumnDef[];
|
|
12
|
-
pinnedLeftColumns: ColumnDef[];
|
|
13
|
-
pinnedRightColumns: ColumnDef[];
|
|
14
|
-
collapsedHeaders?: Set<Accessor>;
|
|
15
|
-
}): ColumnIndices;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import ColumnDef, { Accessor } from "../types/ColumnDef";
|
|
2
|
-
import { Pinned } from "../types/Pinned";
|
|
3
|
-
/**
|
|
4
|
-
* Precomputed cumulative width data structure for O(1) column position lookups
|
|
5
|
-
* and O(log n) viewport calculations (analogous to CumulativeHeightMap for rows)
|
|
6
|
-
*/
|
|
7
|
-
export interface CumulativeWidthMap {
|
|
8
|
-
/** Array where index i contains the left pixel position of leaf column i */
|
|
9
|
-
columnLeftPositions: number[];
|
|
10
|
-
/** Total width of all columns combined */
|
|
11
|
-
totalWidth: number;
|
|
12
|
-
/** Ordered array of leaf headers (actual columns that render) */
|
|
13
|
-
leafHeaders: ColumnDef[];
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Get all leaf headers (actual columns that render) from a header tree
|
|
17
|
-
* Handles nested headers, collapsed state, showWhen logic, and pinned sections
|
|
18
|
-
*
|
|
19
|
-
* Uses the existing displayCell utility to respect all visibility rules
|
|
20
|
-
*
|
|
21
|
-
* @param headers - Array of header objects (can be nested)
|
|
22
|
-
* @param pinned - The pinned state for this section
|
|
23
|
-
* @param allHeaders - All headers in the table (for displayCell context)
|
|
24
|
-
* @param collapsedHeaders - Set of collapsed header accessors
|
|
25
|
-
* @returns Flat array of leaf headers in order
|
|
26
|
-
*/
|
|
27
|
-
export declare const getLeafHeaders: (headers: ColumnDef[], pinned: Pinned | undefined, allHeaders: ColumnDef[], collapsedHeaders?: Set<Accessor>) => ColumnDef[];
|
|
28
|
-
/**
|
|
29
|
-
* Build a cumulative width map for efficient viewport calculations
|
|
30
|
-
* This precomputes the left position of every column, enabling:
|
|
31
|
-
* - O(1) lookup of column left position
|
|
32
|
-
* - O(log n) binary search to find columns in viewport
|
|
33
|
-
*
|
|
34
|
-
* Similar to buildCumulativeHeightMap for rows
|
|
35
|
-
*
|
|
36
|
-
* @param headers - Array of header objects for a section
|
|
37
|
-
* @param pinned - The pinned state for this section
|
|
38
|
-
* @param allHeaders - All headers in the table (for displayCell context)
|
|
39
|
-
* @param collapsedHeaders - Set of collapsed header accessors
|
|
40
|
-
* @returns Cumulative width map with column positions
|
|
41
|
-
*/
|
|
42
|
-
export declare const buildCumulativeWidthMap: (headers: ColumnDef[], pinned: Pinned | undefined, allHeaders: ColumnDef[], collapsedHeaders?: Set<Accessor>) => CumulativeWidthMap;
|
|
43
|
-
/**
|
|
44
|
-
* Find the column index at a given scroll position using binary search
|
|
45
|
-
* Returns the index of the column that contains or is closest to the scroll position
|
|
46
|
-
*
|
|
47
|
-
* Similar to findRowAtScrollPosition for rows
|
|
48
|
-
*
|
|
49
|
-
* @param scrollLeft - The horizontal scroll position in pixels
|
|
50
|
-
* @param widthMap - Precomputed cumulative width map
|
|
51
|
-
* @returns Column index at the scroll position
|
|
52
|
-
*/
|
|
53
|
-
export declare const findColumnAtScrollPosition: (scrollLeft: number, widthMap: CumulativeWidthMap) => number;
|
|
54
|
-
/**
|
|
55
|
-
* Calculate visible columns for viewport with overscan buffer
|
|
56
|
-
* Returns column indices and the actual leaf header objects to render
|
|
57
|
-
*
|
|
58
|
-
* Similar to getViewportCalculations for rows
|
|
59
|
-
*
|
|
60
|
-
* @param scrollLeft - Current horizontal scroll position
|
|
61
|
-
* @param viewportWidth - Width of the visible viewport
|
|
62
|
-
* @param bufferColumnCount - Number of columns to render outside viewport (overscan)
|
|
63
|
-
* @param scrollDirection - Direction of scroll for asymmetric overscan
|
|
64
|
-
* @param widthMap - Precomputed cumulative width map
|
|
65
|
-
* @returns Object with startIndex, endIndex, and columns array (leaf columns only)
|
|
66
|
-
*/
|
|
67
|
-
export declare const getVisibleColumns: ({ scrollLeft, viewportWidth, bufferColumnCount, scrollDirection, widthMap, }: {
|
|
68
|
-
scrollLeft: number;
|
|
69
|
-
viewportWidth: number;
|
|
70
|
-
bufferColumnCount: number;
|
|
71
|
-
scrollDirection?: "left" | "right" | "none";
|
|
72
|
-
widthMap: CumulativeWidthMap;
|
|
73
|
-
}) => {
|
|
74
|
-
startIndex: number;
|
|
75
|
-
endIndex: number;
|
|
76
|
-
columns: ColumnDef[];
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* Build parent-child relationship maps for the header hierarchy
|
|
80
|
-
* This enables efficient lookup of ancestors for visible leaf columns
|
|
81
|
-
*
|
|
82
|
-
* @param headers - Array of top-level header objects
|
|
83
|
-
* @param pinned - The pinned state for this section
|
|
84
|
-
* @param allHeaders - All headers in the table (for displayCell context)
|
|
85
|
-
* @param collapsedHeaders - Set of collapsed header accessors
|
|
86
|
-
* @returns Maps for leaf-to-parents and parent-to-leaves relationships
|
|
87
|
-
*/
|
|
88
|
-
export declare const buildColumnHierarchy: (headers: ColumnDef[], pinned: Pinned | undefined, allHeaders: ColumnDef[], collapsedHeaders?: Set<Accessor>) => {
|
|
89
|
-
leafToParents: Map<Accessor, Accessor[]>;
|
|
90
|
-
parentToLeaves: Map<Accessor, Accessor[]>;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Get all headers to render (visible leaves + their ancestors)
|
|
94
|
-
*
|
|
95
|
-
* Strategy: Include a parent header if ANY of its children are visible
|
|
96
|
-
*
|
|
97
|
-
* @param visibleLeafColumns - Array of visible leaf header objects
|
|
98
|
-
* @param leafToParents - Map from leaf accessor to parent accessor chain
|
|
99
|
-
* @returns Set of all header accessors to render (leaves + ancestors)
|
|
100
|
-
*/
|
|
101
|
-
export declare const getHeadersToRender: (visibleLeafColumns: ColumnDef[], leafToParents: Map<Accessor, Accessor[]>) => Set<Accessor>;
|
|
102
|
-
/**
|
|
103
|
-
* GridCell type (matches TableHeaderSection.tsx)
|
|
104
|
-
* Represents a single header cell in the grid with its positioning
|
|
105
|
-
*/
|
|
106
|
-
export type GridCell = {
|
|
107
|
-
header: ColumnDef;
|
|
108
|
-
gridColumnStart: number;
|
|
109
|
-
gridColumnEnd: number;
|
|
110
|
-
gridRowStart: number;
|
|
111
|
-
gridRowEnd: number;
|
|
112
|
-
colIndex: number;
|
|
113
|
-
parentHeader?: ColumnDef;
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* Recalculate grid column positions for visible headers
|
|
117
|
-
* Adjusts gridColumnStart/End to account for hidden columns before the viewport
|
|
118
|
-
*
|
|
119
|
-
* This is the key function that makes virtualization work - it offsets the grid
|
|
120
|
-
* positions so that the visible subset appears correctly positioned
|
|
121
|
-
*
|
|
122
|
-
* @param originalGridCells - All grid cells from the full header tree
|
|
123
|
-
* @param headersToRender - Set of header accessors that should be rendered
|
|
124
|
-
* @param visibleLeafColumns - Array of visible leaf columns (for determining offset)
|
|
125
|
-
* @param startColumnIndex - Index of first visible leaf column in the full leaf array
|
|
126
|
-
* @returns Filtered and repositioned grid cells
|
|
127
|
-
*/
|
|
128
|
-
export declare const recalculateGridPositions: (originalGridCells: GridCell[], headersToRender: Set<Accessor>, visibleLeafColumns: ColumnDef[], startColumnIndex: number) => GridCell[];
|