@infinite-table/infinite-react 6.0.20 → 6.1.0-canary.0
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/index.css +3 -1
- package/index.d.ts +143 -97
- package/index.dev.js +1302 -886
- package/index.dev.mjs +1307 -891
- package/index.js +1302 -886
- package/index.mjs +1307 -891
- package/package.json +2 -2
package/index.css
CHANGED
|
@@ -1798,9 +1798,11 @@
|
|
|
1798
1798
|
height: var(--infinite-header-cell-icon-size);
|
|
1799
1799
|
}
|
|
1800
1800
|
|
|
1801
|
-
/* vanilla-extract-css-ns:src/components/InfiniteTable/components/icons/ExpandCollapseIcon.css.ts.vanilla.css?source=
|
|
1801
|
+
/* vanilla-extract-css-ns:src/components/InfiniteTable/components/icons/ExpandCollapseIcon.css.ts.vanilla.css?source=LkV4cGFuZENvbGxhcHNlSWNvbl9FeHBhbmRlckljb25DbHNfXzZyZG15ZzAgewogIGZpbGw6IHZhcigtLWluZmluaXRlLWV4cGFuZC1jb2xsYXBzZS1pY29uLWNvbG9yKTsKICBkaXNwbGF5OiBpbmxpbmUtYmxvY2s7CiAgdmVydGljYWwtYWxpZ246IGJvdHRvbTsKfQouRXhwYW5kQ29sbGFwc2VJY29uX0V4cGFuZGVySWNvbkNsc1ZhcmlhbnRzX2Rpc2FibGVkX3RydWVfXzZyZG15ZzYgewogIGN1cnNvcjogYXV0bzsKICBvcGFjaXR5OiAwLjQ7Cn0= */
|
|
1802
1802
|
.ExpandCollapseIcon_ExpanderIconCls__6rdmyg0 {
|
|
1803
1803
|
fill: var(--infinite-expand-collapse-icon-color);
|
|
1804
|
+
display: inline-block;
|
|
1805
|
+
vertical-align: bottom;
|
|
1804
1806
|
}
|
|
1805
1807
|
.ExpandCollapseIcon_ExpanderIconClsVariants_disabled_true__6rdmyg6 {
|
|
1806
1808
|
cursor: auto;
|
package/index.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ declare type Pair<KeyType, ValueType> = {
|
|
|
78
78
|
length: number;
|
|
79
79
|
revision?: number;
|
|
80
80
|
};
|
|
81
|
-
declare type DeepMapVisitFn<KeyType, ValueType> = (pair: Pair<KeyType, ValueType>, keys: KeyType[], next: VoidFn$1) =>
|
|
81
|
+
declare type DeepMapVisitFn<KeyType, ValueType, ReturnType = void> = (pair: Pair<KeyType, ValueType>, keys: KeyType[], next: VoidFn$1) => ReturnType;
|
|
82
82
|
declare class DeepMap<KeyType, ValueType> {
|
|
83
83
|
private map;
|
|
84
84
|
private length;
|
|
@@ -105,9 +105,11 @@ declare class DeepMap<KeyType, ValueType> {
|
|
|
105
105
|
has(keys: KeyType[]): boolean;
|
|
106
106
|
private visitKey;
|
|
107
107
|
visit: (fn: DeepMapVisitFn<KeyType, ValueType>) => void;
|
|
108
|
+
visitSome: (fn: (value: ValueType, keys: KeyType[], indexInGroup: number, next?: VoidFn$1 | undefined) => boolean) => void;
|
|
108
109
|
visitDepthFirst: (fn: (value: ValueType, keys: KeyType[], indexInGroup: number, next?: VoidFn$1 | undefined) => void) => void;
|
|
109
110
|
private visitWithNext;
|
|
110
111
|
private getArray;
|
|
112
|
+
rawKeysAt(keys: KeyType[]): KeyType[];
|
|
111
113
|
valuesAt(keys: KeyType[]): ValueType[];
|
|
112
114
|
values(): Generator<ValueType, void, unknown>;
|
|
113
115
|
keys(): Generator<KeyType[], void, unknown>;
|
|
@@ -1522,86 +1524,6 @@ declare class RowDetailState<KeyType = any> extends BooleanCollectionState<RowDe
|
|
|
1522
1524
|
toggleRowDetails(key: KeyType): void;
|
|
1523
1525
|
}
|
|
1524
1526
|
|
|
1525
|
-
declare type SubscriptionCallbackOnChangeFn<T> = (node: T | null) => void;
|
|
1526
|
-
interface SubscriptionCallback<T> {
|
|
1527
|
-
(node: T, callback?: () => void): void;
|
|
1528
|
-
get: () => T | null;
|
|
1529
|
-
destroy: VoidFn;
|
|
1530
|
-
onChange: (fn: SubscriptionCallbackOnChangeFn<T>) => VoidFn;
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
/**
|
|
1534
|
-
* This class abstracts the following behavior:
|
|
1535
|
-
*
|
|
1536
|
-
* in the DOM, we have a list (flat, so no nesting) of elements that represent table cells
|
|
1537
|
-
* At any one time, just a fraction of all table cells are rendered/present in the DOM
|
|
1538
|
-
* and we need to keep track and know for each element what cell represents and for each
|
|
1539
|
-
* rendered cell, to what element it is currently mapped (so we need a bi-directional mapping)
|
|
1540
|
-
*
|
|
1541
|
-
* This class has tests - see tests/mapped-cells.spec.ts
|
|
1542
|
-
*/
|
|
1543
|
-
declare class MappedCells<T_ADDITIONAL_CELL_INFO = any> extends Logger {
|
|
1544
|
-
/**
|
|
1545
|
-
* This is the mapping from element index to cell info.
|
|
1546
|
-
* The index in the array is the element index while the value at the position is an array where
|
|
1547
|
-
* the first number is the row index and the second number is the column index.
|
|
1548
|
-
*/
|
|
1549
|
-
private elementIndexToCell;
|
|
1550
|
-
/**
|
|
1551
|
-
* This is the mapping from cell address to element index.
|
|
1552
|
-
* The key in the map is the cell address (built like this: `${rowIndex}:${columnIndex}`)
|
|
1553
|
-
* while the value is the element index it is being rendered to.
|
|
1554
|
-
*/
|
|
1555
|
-
private cellToElementIndex;
|
|
1556
|
-
private cellAdditionalInfo;
|
|
1557
|
-
/**
|
|
1558
|
-
* Keeps the JSX of rendered elements in memory, so we can possibly reuse it later.
|
|
1559
|
-
*/
|
|
1560
|
-
private renderedElements;
|
|
1561
|
-
private withCellAdditionalInfo;
|
|
1562
|
-
constructor(opts?: {
|
|
1563
|
-
withCellAdditionalInfo: boolean;
|
|
1564
|
-
});
|
|
1565
|
-
getElementFromListForColumn: (elementsOutsideItemRange: number[], colIndex: number) => number | undefined;
|
|
1566
|
-
getElementFromListForRow: (elementsOutsideItemRange: number[], _rowIndex: number) => number | undefined;
|
|
1567
|
-
init(): void;
|
|
1568
|
-
reset(): void;
|
|
1569
|
-
destroy(): void;
|
|
1570
|
-
/**
|
|
1571
|
-
* Retrieves the elements that contain rendered cells that are outside
|
|
1572
|
-
* of the specified range
|
|
1573
|
-
*
|
|
1574
|
-
* @param start in [rowIndex, colIndex] format - represents the topmost-leftmost cell visible of the render range
|
|
1575
|
-
* @param end in [rowIndex, colIndex] format - represents the bottom-right corner of the visible range. The end is not inclusive,
|
|
1576
|
-
* so the last visible cell will be [rowIndex-1, colIndex-1]
|
|
1577
|
-
*
|
|
1578
|
-
* @returns an array of element indexes that are outside the specified range
|
|
1579
|
-
*/
|
|
1580
|
-
getElementsOutsideRenderRange: (range: TableRenderRange) => number[];
|
|
1581
|
-
isCellRendered: (rowIndex: number, columnIndex: number) => boolean;
|
|
1582
|
-
getCellAdditionalInfo: (rowIndex: number, columnIndex: number) => T_ADDITIONAL_CELL_INFO | undefined;
|
|
1583
|
-
isElementRendered: (elementIndex: number) => boolean;
|
|
1584
|
-
getElementsForRowIndex: (rowIndex: number) => number[];
|
|
1585
|
-
getAdditionalInfoForRowIndex: (rowIndex: number) => T_ADDITIONAL_CELL_INFO[];
|
|
1586
|
-
getRenderedNodeAtElement: (elementIndex: number) => Renderable | null;
|
|
1587
|
-
getRenderedCellAtElement: (elementIndex: number) => [
|
|
1588
|
-
number,
|
|
1589
|
-
number
|
|
1590
|
-
] | null;
|
|
1591
|
-
getRenderedNodeForCell: (rowIndex: number, columnIndex: number) => Renderable | null;
|
|
1592
|
-
getElementIndexForCell: (rowIndex: number, columnIndex: number) => number | null;
|
|
1593
|
-
renderCellAtElement: (rowIndex: number, colIndex: number, elementIndex: number, renderNode: Renderable | undefined, cellAdditionalInfo?: T_ADDITIONAL_CELL_INFO | undefined) => void;
|
|
1594
|
-
discardCell: (rowIndex: number, colIndex: number) => void;
|
|
1595
|
-
discardElement: (elementIndex: number) => [
|
|
1596
|
-
number,
|
|
1597
|
-
number
|
|
1598
|
-
] | null;
|
|
1599
|
-
discardElementsStartingWith: (elIndex: number, callback?: ((index: number, cell: [
|
|
1600
|
-
number,
|
|
1601
|
-
number
|
|
1602
|
-
] | null) => void) | undefined) => boolean;
|
|
1603
|
-
}
|
|
1604
|
-
|
|
1605
1527
|
declare type TableRenderCellFnParam = {
|
|
1606
1528
|
domRef: RefCallback<HTMLElement>;
|
|
1607
1529
|
rowIndex: number;
|
|
@@ -1638,25 +1560,140 @@ declare type RenderRangeOptions = {
|
|
|
1638
1560
|
declare type HorizontalLayoutColVisibilityOptions = {
|
|
1639
1561
|
horizontalLayoutPageIndex?: number;
|
|
1640
1562
|
};
|
|
1641
|
-
|
|
1563
|
+
|
|
1564
|
+
interface GridCellInterface<T_ADDITIONAL_CELL_INFO = any> {
|
|
1565
|
+
debugId: string;
|
|
1566
|
+
update(content: Renderable, additionalInfo?: T_ADDITIONAL_CELL_INFO): void;
|
|
1567
|
+
getElement(): HTMLElement | null;
|
|
1568
|
+
getNode(): Renderable;
|
|
1569
|
+
destroy(): void;
|
|
1570
|
+
onMount(callback: (cell: GridCellInterface<T_ADDITIONAL_CELL_INFO>) => void): void;
|
|
1571
|
+
getAdditionalInfo(): T_ADDITIONAL_CELL_INFO | undefined;
|
|
1572
|
+
ref: (htmlElement: HTMLElement) => void;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
declare type CellPos = [number, number];
|
|
1576
|
+
|
|
1577
|
+
declare class GridCellManager<T_ADDITIONAL_CELL_INFO> extends Logger {
|
|
1578
|
+
private matrix;
|
|
1579
|
+
private matrixWithHistory;
|
|
1580
|
+
private cellToMatrixPosition;
|
|
1581
|
+
private pool;
|
|
1582
|
+
debugId: string;
|
|
1583
|
+
private offRemoveCell;
|
|
1584
|
+
constructor(debugId: string);
|
|
1585
|
+
private onRemoveCell;
|
|
1586
|
+
set poolSize(cellCount: number);
|
|
1587
|
+
get poolSize(): number;
|
|
1588
|
+
getDetachedCell(): GridCellInterface<T_ADDITIONAL_CELL_INFO>;
|
|
1589
|
+
private setCellPositionInMatrix;
|
|
1590
|
+
renderNodeAtCell(node: Renderable, cell: GridCellInterface<T_ADDITIONAL_CELL_INFO>, cellPos: CellPos, additionalInfo?: T_ADDITIONAL_CELL_INFO): GridCellInterface<T_ADDITIONAL_CELL_INFO>;
|
|
1591
|
+
getCellPosition(cell: GridCellInterface<T_ADDITIONAL_CELL_INFO>): CellPos | null;
|
|
1592
|
+
getCellAt(cellPos: CellPos): GridCellInterface<T_ADDITIONAL_CELL_INFO> | undefined;
|
|
1593
|
+
/**
|
|
1594
|
+
* This gets a cell for a given position.
|
|
1595
|
+
* If there's already a cell currently attached at that position, it will be returned.
|
|
1596
|
+
*
|
|
1597
|
+
* Otherwise, we try to return the most optimal cell to use for that position.
|
|
1598
|
+
* If the optimise parameter is set to 'row', we will try to return a detached cell
|
|
1599
|
+
* that was last rendered in that row.
|
|
1600
|
+
*
|
|
1601
|
+
* If the optimise parameter is set to 'column', we will try to return a detached cell
|
|
1602
|
+
* that was last rendered in that column.
|
|
1603
|
+
*
|
|
1604
|
+
* @param cellPos [rowIndex, colIndex]
|
|
1605
|
+
* @param optimise 'row' | 'column'
|
|
1606
|
+
*/
|
|
1607
|
+
getCellFor(cellPos: CellPos, optimise: 'row' | 'column'): GridCellInterface<T_ADDITIONAL_CELL_INFO>;
|
|
1608
|
+
isCellAttached(cell: GridCellInterface<T_ADDITIONAL_CELL_INFO>): boolean;
|
|
1609
|
+
isCellAttachedAt(cellPos: CellPos): boolean;
|
|
1610
|
+
getMatrix(): Renderable[][];
|
|
1611
|
+
getAllCells(): GridCellInterface<T_ADDITIONAL_CELL_INFO>[];
|
|
1612
|
+
getCellsForRow(rowIndex: number): GridCellInterface<T_ADDITIONAL_CELL_INFO>[];
|
|
1613
|
+
getOneAttachedCell(): any;
|
|
1614
|
+
getRowsWithCells(): number[];
|
|
1615
|
+
getColumnsWithCells(): number[];
|
|
1616
|
+
isRowAttached(rowIndex: number): boolean;
|
|
1617
|
+
isColumnAttached(colIndex: number): boolean;
|
|
1618
|
+
detachRow(rowIndex: number): void;
|
|
1619
|
+
detachCol(colIndex: number): void;
|
|
1620
|
+
detachCell(cell: GridCellInterface<T_ADDITIONAL_CELL_INFO>): void;
|
|
1621
|
+
detachCells(cells: Set<GridCellInterface<T_ADDITIONAL_CELL_INFO>>): void;
|
|
1622
|
+
detachRowsStartingWith(rowIndex: number): void;
|
|
1623
|
+
detachColsStartingWith(colIndex: number): void;
|
|
1624
|
+
detachCellsStartingAt(cellPos: CellPos): void;
|
|
1625
|
+
detachCellAt(cellPos: CellPos): void;
|
|
1626
|
+
getCellsOutsideRenderRange: (range: TableRenderRange) => Set<GridCellInterface<T_ADDITIONAL_CELL_INFO>>;
|
|
1627
|
+
getCellFromListForRow(cells: Set<GridCellInterface<T_ADDITIONAL_CELL_INFO>>, rowIndex: number): GridCellInterface<T_ADDITIONAL_CELL_INFO> | undefined;
|
|
1628
|
+
getCellFromListForColumn(cells: Set<GridCellInterface<T_ADDITIONAL_CELL_INFO>>, colIndex: number): GridCellInterface<T_ADDITIONAL_CELL_INFO> | undefined;
|
|
1629
|
+
getCellCountInMatrix(): number;
|
|
1630
|
+
destroy(): void;
|
|
1631
|
+
reset(): void;
|
|
1632
|
+
makeDetachedCellsEmpty(): void;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
/**
|
|
1636
|
+
* This is only used for rendering Detail rows in a master-detail DataGrid
|
|
1637
|
+
*/
|
|
1638
|
+
interface ListRowInterface {
|
|
1639
|
+
debugId: string;
|
|
1640
|
+
update(content: Renderable): void;
|
|
1641
|
+
getElement(): HTMLElement | null;
|
|
1642
|
+
getNode(): Renderable;
|
|
1643
|
+
destroy(): void;
|
|
1644
|
+
onMount(callback: (row: ListRowInterface) => void): void;
|
|
1645
|
+
ref: (htmlElement: HTMLElement) => void;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
declare class ListRowManager extends Logger {
|
|
1649
|
+
private pool;
|
|
1650
|
+
private indexToRow;
|
|
1651
|
+
private rowToIndex;
|
|
1652
|
+
debugId: string;
|
|
1653
|
+
private offRemoveRow;
|
|
1654
|
+
constructor(debugId: string);
|
|
1655
|
+
private onRemoveRow;
|
|
1656
|
+
set poolSize(rowCount: number);
|
|
1657
|
+
get poolSize(): number;
|
|
1658
|
+
getDetachedRow(): ListRowInterface;
|
|
1659
|
+
/**
|
|
1660
|
+
* This gets a row for a given position.
|
|
1661
|
+
* If there's already a row currently attached at that position, it will be returned.
|
|
1662
|
+
*
|
|
1663
|
+
* Otherwise, we return another row.
|
|
1664
|
+
* @param rowIndex
|
|
1665
|
+
*/
|
|
1666
|
+
getRowFor(rowIndex: number): ListRowInterface;
|
|
1667
|
+
private setRowIndexInList;
|
|
1668
|
+
detachStartingWith(rowIndex: number): void;
|
|
1669
|
+
getRowAt(rowPos: number): ListRowInterface | undefined;
|
|
1670
|
+
getRowIndex(row: ListRowInterface): number | undefined;
|
|
1671
|
+
isRowAttached(row: ListRowInterface): boolean;
|
|
1672
|
+
isRowAttachedAt(rowIndex: number): boolean;
|
|
1673
|
+
getList(): Renderable[];
|
|
1674
|
+
getAttachedCount(): number;
|
|
1675
|
+
forEachAttachedRow(fn: (row: ListRowInterface) => void): void;
|
|
1676
|
+
getAttachedIndexes(): number[];
|
|
1677
|
+
getAllRows(): ListRowInterface[];
|
|
1678
|
+
detachRowAt(rowIndex: number): void;
|
|
1679
|
+
detachRow(row: ListRowInterface): void;
|
|
1680
|
+
renderNodeAtRow(node: Renderable, row: ListRowInterface, rowIndex: number): ListRowInterface;
|
|
1681
|
+
makeDetachedRowsEmpty(): void;
|
|
1682
|
+
destroy(): void;
|
|
1683
|
+
reset(): void;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
declare class GridRenderer extends Logger {
|
|
1642
1687
|
protected brain: MatrixBrain;
|
|
1643
1688
|
debugId: string;
|
|
1644
1689
|
protected destroyed: boolean;
|
|
1645
1690
|
private scrolling;
|
|
1646
1691
|
cellHoverClassNames: string[];
|
|
1647
|
-
|
|
1648
|
-
protected itemDOMRefs: RefCallback<HTMLElement>[];
|
|
1649
|
-
protected updaters: SubscriptionCallback<Renderable>[];
|
|
1650
|
-
private detailRowDOMElements;
|
|
1651
|
-
private detailRowDOMRefs;
|
|
1652
|
-
private detailRowUpdaters;
|
|
1653
|
-
protected mappedCells: MappedCells<{
|
|
1692
|
+
protected cellManager: GridCellManager<{
|
|
1654
1693
|
renderRowIndex: number;
|
|
1655
1694
|
renderColIndex: number;
|
|
1656
1695
|
}>;
|
|
1657
|
-
|
|
1658
|
-
private items;
|
|
1659
|
-
private detailItems;
|
|
1696
|
+
protected rowManager: ListRowManager;
|
|
1660
1697
|
private lastEnteredRow;
|
|
1661
1698
|
private lastExitedRow;
|
|
1662
1699
|
private onDestroy;
|
|
@@ -1710,8 +1747,6 @@ declare class ReactHeadlessTableRenderer extends Logger {
|
|
|
1710
1747
|
mapped: boolean;
|
|
1711
1748
|
};
|
|
1712
1749
|
renderRange(range: TableRenderRange, { renderCell, renderDetailRow, force, onRender }: RenderRangeOptions): Renderable[];
|
|
1713
|
-
private renderElement;
|
|
1714
|
-
private renderDetailElement;
|
|
1715
1750
|
getFixedRanges: (currentRenderRange: TableRenderRange) => TableRenderRange[];
|
|
1716
1751
|
protected isCellFixed: (rowIndex: number, colIndex: number) => {
|
|
1717
1752
|
row: FixedPosition;
|
|
@@ -1723,13 +1758,16 @@ declare class ReactHeadlessTableRenderer extends Logger {
|
|
|
1723
1758
|
rowIndex: number;
|
|
1724
1759
|
colIndex: number;
|
|
1725
1760
|
};
|
|
1726
|
-
protected
|
|
1761
|
+
protected renderCellAt(rowIndex: number, colIndex: number, cell: GridCellInterface, renderCell: TableRenderCellFn): void;
|
|
1727
1762
|
protected onMouseEnter: (rowIndex: number) => void;
|
|
1728
1763
|
private addHoverClass;
|
|
1729
1764
|
protected onMouseLeave: (rowIndex: number) => void;
|
|
1730
1765
|
private removeHoverClass;
|
|
1731
1766
|
protected updateHoverClassNamesForRow: (rowIndex: number) => void;
|
|
1732
|
-
protected updateElementPosition: (
|
|
1767
|
+
protected updateElementPosition: (cell: GridCellInterface<{
|
|
1768
|
+
renderRowIndex: number;
|
|
1769
|
+
renderColIndex: number;
|
|
1770
|
+
}>, options?: {
|
|
1733
1771
|
hidden: boolean;
|
|
1734
1772
|
rowspan: number;
|
|
1735
1773
|
colspan: number;
|
|
@@ -1742,6 +1780,14 @@ declare class ReactHeadlessTableRenderer extends Logger {
|
|
|
1742
1780
|
reset(): void;
|
|
1743
1781
|
}
|
|
1744
1782
|
|
|
1783
|
+
declare type SubscriptionCallbackOnChangeFn<T> = (node: T | null) => void;
|
|
1784
|
+
interface SubscriptionCallback<T> {
|
|
1785
|
+
(node: T, callback?: () => void): void;
|
|
1786
|
+
get: () => T | null;
|
|
1787
|
+
destroy: VoidFn;
|
|
1788
|
+
onChange: (fn: SubscriptionCallbackOnChangeFn<T>) => VoidFn;
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1745
1791
|
declare class ScrollListener {
|
|
1746
1792
|
private scrollPosition;
|
|
1747
1793
|
private onScrollFns;
|
|
@@ -1769,7 +1815,7 @@ declare type ContextMenuLocationWithEvent = Partial<CellContextMenuLocation> & {
|
|
|
1769
1815
|
interface InfiniteTableSetupState<T> {
|
|
1770
1816
|
brain: MatrixBrain;
|
|
1771
1817
|
headerBrain: MatrixBrain;
|
|
1772
|
-
renderer:
|
|
1818
|
+
renderer: GridRenderer;
|
|
1773
1819
|
onRenderUpdater: SubscriptionCallback<Renderable>;
|
|
1774
1820
|
forceBodyRerenderTimestamp: number;
|
|
1775
1821
|
lastRowToExpandRef: MutableRefObject<any | null>;
|