@infinite-table/infinite-react 0.2.6 → 0.2.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/index.d.ts +12 -5
- package/index.esm.js +115 -64
- package/index.js +99 -48
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -839,6 +839,7 @@ declare module "utils/groupAndPivot/index" {
|
|
|
839
839
|
collapsedGroupsCount?: number;
|
|
840
840
|
groupNesting?: number;
|
|
841
841
|
groupKeys?: any[];
|
|
842
|
+
flatRowInfoList?: (InfiniteTableRowInfo<T> | InfiniteTableEnhancedGroupInfo<T>)[];
|
|
842
843
|
parents?: InfiniteTableEnhancedGroupInfo<T>[];
|
|
843
844
|
indexInParentGroups?: number[];
|
|
844
845
|
indexInGroup: number;
|
|
@@ -852,6 +853,7 @@ declare module "utils/groupAndPivot/index" {
|
|
|
852
853
|
export type InfiniteTableEnhancedGroupInfo<T> = InfiniteTableRowInfo<T> & {
|
|
853
854
|
data: Partial<T> | null;
|
|
854
855
|
groupData: T[];
|
|
856
|
+
flatRowInfoList: (InfiniteTableRowInfo<T> | InfiniteTableEnhancedGroupInfo<T>)[];
|
|
855
857
|
value: any;
|
|
856
858
|
isGroupRow: true;
|
|
857
859
|
collapsedChildrenCount: number;
|
|
@@ -1448,9 +1450,11 @@ declare module "components/InfiniteTable/types/InfiniteTableAction" {
|
|
|
1448
1450
|
};
|
|
1449
1451
|
}
|
|
1450
1452
|
declare module "components/InfiniteTable/types/InfiniteTableComputedValues" {
|
|
1453
|
+
import type { VirtualBrainOptions } from "components/VirtualBrain/index";
|
|
1451
1454
|
import type { InfiniteTableComputedColumn } from "components/InfiniteTable/types/InfiniteTableColumn";
|
|
1452
1455
|
import type { InfiniteTablePropColumnOrderNormalized, InfiniteTablePropColumnVisibility } from "components/InfiniteTable/types/InfiniteTableProps";
|
|
1453
1456
|
export interface InfiniteTableComputedValues<T> {
|
|
1457
|
+
rowSpan?: VirtualBrainOptions['itemSpan'];
|
|
1454
1458
|
computedPinnedStartOverflow: boolean;
|
|
1455
1459
|
computedPinnedEndOverflow: boolean;
|
|
1456
1460
|
computedPinnedStartColumns: InfiniteTableComputedColumn<T>[];
|
|
@@ -1489,11 +1493,11 @@ declare module "components/InfiniteTable/types/index" {
|
|
|
1489
1493
|
import type { InfiniteTableAction } from "components/InfiniteTable/types/InfiniteTableAction";
|
|
1490
1494
|
import type { InfiniteTableActionType } from "components/InfiniteTable/types/InfiniteTableActionType";
|
|
1491
1495
|
import type { InfiniteTableProps, InfiniteTableImperativeApi, InfiniteTablePropColumnOrder, InfiniteTablePropColumnVisibility, InfiniteTablePropColumnPinning, InfiniteTableColumnAggregator, InfiniteTableColumnGroup, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropColumnGroups, InfiniteTablePropRowStyle, InfiniteTableRowStyleFn, InfiniteTableRowClassNameFn, InfiniteTablePropRowClassName, InfiniteTablePropColumns, InfiniteTablePropColumnsMap, InfiniteTablePropComponents, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTablePropColumnSizingMap, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnTypesMap, InfiniteTableColumnSizingOptions, Scrollbars, InfiniteTableGroupColumnBase, InfiniteTablePropGroupColumn } from "components/InfiniteTable/types/InfiniteTableProps";
|
|
1492
|
-
import type { InfiniteTableColumn, InfiniteTableColumnComparer, InfiniteTableComputedColumn, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam } from "components/InfiniteTable/types/InfiniteTableColumn";
|
|
1496
|
+
import type { InfiniteTableColumn, InfiniteTableColumnComparer, InfiniteTableComputedColumn, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanFnParams } from "components/InfiniteTable/types/InfiniteTableColumn";
|
|
1493
1497
|
import type { InfiniteTableComputedValues } from "components/InfiniteTable/types/InfiniteTableComputedValues";
|
|
1494
1498
|
import type { InfiniteTableContextValue } from "components/InfiniteTable/types/InfiniteTableContextValue";
|
|
1495
1499
|
import type { InfiniteTableRowInfo } from "utils/groupAndPivot/index";
|
|
1496
|
-
export type { Scrollbars, InfiniteTableColumnAggregator, InfiniteTableComputedValues, InfiniteTablePropColumns, InfiniteTablePropGroupColumn, InfiniteTablePropColumnsMap, InfiniteTableRowInfo, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnBase, InfiniteTablePropColumnOrder, InfiniteTablePropComponents, InfiniteTablePropColumnVisibility as InfiniteTablePropColumnVisibility, InfiniteTablePropColumnPinning, InfiniteTableColumnGroup, InfiniteTableColumn, InfiniteTableColumnComparer, InfiniteTableComputedColumn, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableContextValue, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropColumnGroups, InfiniteTablePropColumnSizing, InfiniteTablePropColumnSizingMap, InfiniteTableColumnSizingOptions, InfiniteTableState, InfiniteTableAction, InfiniteTableProps, InfiniteTablePropColumnTypes, InfiniteTablePropColumnTypesMap, InfiniteTableImperativeApi, InfiniteTableActionType, InfiniteTablePropRowStyle, InfiniteTablePropRowClassName, InfiniteTableRowStyleFn, InfiniteTableRowClassNameFn, InfiniteTableGroupColumnGetterOptions, };
|
|
1500
|
+
export type { Scrollbars, InfiniteTableColumnAggregator, InfiniteTableComputedValues, InfiniteTableColumnRowspanFnParams, InfiniteTablePropColumns, InfiniteTablePropGroupColumn, InfiniteTablePropColumnsMap, InfiniteTableRowInfo, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnBase, InfiniteTablePropColumnOrder, InfiniteTablePropComponents, InfiniteTablePropColumnVisibility as InfiniteTablePropColumnVisibility, InfiniteTablePropColumnPinning, InfiniteTableColumnGroup, InfiniteTableColumn, InfiniteTableColumnComparer, InfiniteTableComputedColumn, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableContextValue, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropColumnGroups, InfiniteTablePropColumnSizing, InfiniteTablePropColumnSizingMap, InfiniteTableColumnSizingOptions, InfiniteTableState, InfiniteTableAction, InfiniteTableProps, InfiniteTablePropColumnTypes, InfiniteTablePropColumnTypesMap, InfiniteTableImperativeApi, InfiniteTableActionType, InfiniteTablePropRowStyle, InfiniteTablePropRowClassName, InfiniteTableRowStyleFn, InfiniteTableRowClassNameFn, InfiniteTableGroupColumnGetterOptions, };
|
|
1497
1501
|
}
|
|
1498
1502
|
declare module "components/InfiniteTable/InfiniteTableContext" {
|
|
1499
1503
|
import { InfiniteTableContextValue } from "components/InfiniteTable/types/InfiniteTableContextValue";
|
|
@@ -2532,7 +2536,7 @@ declare module "components/VirtualList/VirtualRowList" {
|
|
|
2532
2536
|
export const VirtualRowList: (props: VirtualRowListProps & HTMLProps<HTMLDivElement>) => JSX.Element;
|
|
2533
2537
|
}
|
|
2534
2538
|
declare module "components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowTypes" {
|
|
2535
|
-
import type { VirtualBrain } from "components/VirtualBrain/index";
|
|
2539
|
+
import type { VirtualBrain, VirtualBrainOptions } from "components/VirtualBrain/index";
|
|
2536
2540
|
import type { ScrollPosition } from "components/types/ScrollPosition";
|
|
2537
2541
|
import type { InfiniteTableComputedColumn, InfiniteTableRowInfo } from "components/InfiniteTable/types/index";
|
|
2538
2542
|
import { InfiniteTableToggleGroupRowFn } from "components/InfiniteTable/types/InfiniteTableColumn";
|
|
@@ -2547,6 +2551,7 @@ declare module "components/InfiniteTable/components/InfiniteTableRow/InfiniteTab
|
|
|
2547
2551
|
getData: () => InfiniteTableRowInfo<T>[];
|
|
2548
2552
|
toggleGroupRow: InfiniteTableToggleGroupRowFn;
|
|
2549
2553
|
repaintId?: number | string;
|
|
2554
|
+
rowSpan?: VirtualBrainOptions['itemSpan'];
|
|
2550
2555
|
virtualizeColumns: boolean;
|
|
2551
2556
|
showZebraRows?: boolean;
|
|
2552
2557
|
showHoverRows?: boolean;
|
|
@@ -2606,7 +2611,7 @@ declare module "components/InfiniteTable/components/InfiniteTableRow/InfiniteTab
|
|
|
2606
2611
|
export const TableRowUnvirtualized: typeof TableRowUnvirtualizedFn;
|
|
2607
2612
|
}
|
|
2608
2613
|
declare module "components/InfiniteTable/hooks/useUnpinnedRendering" {
|
|
2609
|
-
import type { VirtualBrain } from "components/VirtualBrain/index";
|
|
2614
|
+
import type { VirtualBrain, VirtualBrainOptions } from "components/VirtualBrain/index";
|
|
2610
2615
|
import type { Size } from "components/types/Size";
|
|
2611
2616
|
import type { InfiniteTableComputedColumn, InfiniteTableRowInfo } from "components/InfiniteTable/types/index";
|
|
2612
2617
|
import { InfiniteTableState } from "components/InfiniteTable/types/InfiniteTableState";
|
|
@@ -2628,6 +2633,7 @@ declare module "components/InfiniteTable/hooks/useUnpinnedRendering" {
|
|
|
2628
2633
|
computedUnpinnedColumnsWidth: number;
|
|
2629
2634
|
computedPinnedStartWidth: number;
|
|
2630
2635
|
computedPinnedEndWidth: number;
|
|
2636
|
+
rowSpan?: VirtualBrainOptions['itemSpan'];
|
|
2631
2637
|
getState: () => InfiniteTableState<T>;
|
|
2632
2638
|
};
|
|
2633
2639
|
export function useUnpinnedRendering<T>(params: UnpinnedRenderingParams<T>): JSX.Element | null;
|
|
@@ -2675,7 +2681,7 @@ declare module "components/VirtualList/RowListWithExternalScrolling" {
|
|
|
2675
2681
|
export const RowListWithExternalScrolling: (props: RowListWithExternalScrollingListProps) => JSX.Element;
|
|
2676
2682
|
}
|
|
2677
2683
|
declare module "components/InfiniteTable/hooks/usePinnedRendering" {
|
|
2678
|
-
import { VirtualBrain } from "components/VirtualBrain/index";
|
|
2684
|
+
import { VirtualBrain, VirtualBrainOptions } from "components/VirtualBrain/index";
|
|
2679
2685
|
import type { InfiniteTableComputedColumn, InfiniteTableRowInfo, Scrollbars } from "components/InfiniteTable/types/index";
|
|
2680
2686
|
import type { Size } from "components/types/Size";
|
|
2681
2687
|
import type { RenderRow } from "components/VirtualList/types";
|
|
@@ -2701,6 +2707,7 @@ declare module "components/InfiniteTable/hooks/usePinnedRendering" {
|
|
|
2701
2707
|
toggleGroupRow: InfiniteTableToggleGroupRowFn;
|
|
2702
2708
|
computedPinnedStartColumnsWidth: number;
|
|
2703
2709
|
computedPinnedStartColumns: InfiniteTableComputedColumn<T>[];
|
|
2710
|
+
rowSpan?: VirtualBrainOptions['itemSpan'];
|
|
2704
2711
|
};
|
|
2705
2712
|
export function usePinnedRenderingForSide<T>(side: 'start' | 'end', params: UsePinnedParams<T>): {
|
|
2706
2713
|
renderRowPinned: RenderRow;
|
package/index.esm.js
CHANGED
|
@@ -1649,7 +1649,7 @@ var useComputedVisibleColumns = ({
|
|
|
1649
1649
|
var sortAscending = (a, b) => a - b;
|
|
1650
1650
|
|
|
1651
1651
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
1652
|
-
import { useCallback as useCallback5, useEffect as useEffect10, useState as useState5 } from "react";
|
|
1652
|
+
import { useCallback as useCallback5, useEffect as useEffect10, useMemo as useMemo6, useState as useState5 } from "react";
|
|
1653
1653
|
|
|
1654
1654
|
// src/components/hooks/useComponentState.tsx
|
|
1655
1655
|
import {
|
|
@@ -2857,6 +2857,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
2857
2857
|
id: `${groupKeys}`,
|
|
2858
2858
|
collapsed,
|
|
2859
2859
|
parents,
|
|
2860
|
+
flatRowInfoList: [],
|
|
2860
2861
|
collapsedChildrenCount: 0,
|
|
2861
2862
|
collapsedGroupsCount: 0,
|
|
2862
2863
|
indexInParentGroups: options.indexInParentGroups,
|
|
@@ -2919,9 +2920,14 @@ function enhancedFlatten(param) {
|
|
|
2919
2920
|
}
|
|
2920
2921
|
if (collapsed) {
|
|
2921
2922
|
parents.forEach((parent) => {
|
|
2923
|
+
parent.flatRowInfoList.push(enhancedGroupData);
|
|
2922
2924
|
parent.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
2923
2925
|
parent.collapsedGroupsCount += 1;
|
|
2924
2926
|
});
|
|
2927
|
+
} else {
|
|
2928
|
+
parents.forEach((parent) => {
|
|
2929
|
+
parent.flatRowInfoList.push(enhancedGroupData);
|
|
2930
|
+
});
|
|
2925
2931
|
}
|
|
2926
2932
|
indexInParentGroups.push(indexInGroup);
|
|
2927
2933
|
parents.push(enhancedGroupData);
|
|
@@ -4222,13 +4228,43 @@ function useHideColumns(groupByMap) {
|
|
|
4222
4228
|
componentState: {
|
|
4223
4229
|
columnTypes,
|
|
4224
4230
|
computedColumns,
|
|
4225
|
-
columnsWhenGrouping: generatedColumns,
|
|
4226
4231
|
hideEmptyGroupColumns,
|
|
4227
4232
|
groupRenderStrategy
|
|
4228
4233
|
}
|
|
4229
4234
|
} = useComponentState();
|
|
4235
|
+
const prevHideEmptyGroupColumns = usePrevious(hideEmptyGroupColumns);
|
|
4230
4236
|
useEffect9(() => {
|
|
4231
|
-
if (groupRenderStrategy !== "multi-column"
|
|
4237
|
+
if (groupRenderStrategy !== "multi-column") {
|
|
4238
|
+
return;
|
|
4239
|
+
}
|
|
4240
|
+
const currentState = getComponentState();
|
|
4241
|
+
const computedGroupColumns = new Map();
|
|
4242
|
+
computedColumns.forEach((column, colId) => {
|
|
4243
|
+
if (typeof column.groupByField !== "string") {
|
|
4244
|
+
return;
|
|
4245
|
+
}
|
|
4246
|
+
const { groupByField } = column;
|
|
4247
|
+
const field = groupByField;
|
|
4248
|
+
const groupInfoForColumn = groupByMap.get(field);
|
|
4249
|
+
if (!groupInfoForColumn) {
|
|
4250
|
+
return;
|
|
4251
|
+
}
|
|
4252
|
+
computedGroupColumns.set(colId, column);
|
|
4253
|
+
});
|
|
4254
|
+
if (!hideEmptyGroupColumns) {
|
|
4255
|
+
if (prevHideEmptyGroupColumns) {
|
|
4256
|
+
let updated2 = false;
|
|
4257
|
+
const columnVisibility2 = __spreadValues({}, currentState.columnVisibility);
|
|
4258
|
+
computedGroupColumns.forEach((_column, colId) => {
|
|
4259
|
+
if (columnVisibility2[colId] === false) {
|
|
4260
|
+
updated2 = true;
|
|
4261
|
+
delete columnVisibility2[colId];
|
|
4262
|
+
}
|
|
4263
|
+
});
|
|
4264
|
+
if (updated2) {
|
|
4265
|
+
componentActions.columnVisibility = columnVisibility2;
|
|
4266
|
+
}
|
|
4267
|
+
}
|
|
4232
4268
|
return;
|
|
4233
4269
|
}
|
|
4234
4270
|
const groupsLength = groupBy.length;
|
|
@@ -4241,23 +4277,24 @@ function useHideColumns(groupByMap) {
|
|
|
4241
4277
|
break;
|
|
4242
4278
|
}
|
|
4243
4279
|
}
|
|
4244
|
-
const currentState = getComponentState();
|
|
4245
|
-
const { computedColumns: computedColumns2 } = currentState;
|
|
4246
4280
|
let updated = false;
|
|
4247
4281
|
const columnVisibility = __spreadValues({}, currentState.columnVisibility);
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
const
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
return;
|
|
4254
|
-
}
|
|
4282
|
+
computedGroupColumns.forEach((column, colId) => {
|
|
4283
|
+
const { groupByField } = column;
|
|
4284
|
+
const field = groupByField;
|
|
4285
|
+
const groupInfoForColumn = groupByMap.get(field);
|
|
4286
|
+
const index = groupInfoForColumn.groupIndex;
|
|
4255
4287
|
const shouldBeHidden = index > expandedGroupsLevel && hideEmptyGroupColumns;
|
|
4256
|
-
updated = true;
|
|
4257
4288
|
if (shouldBeHidden) {
|
|
4258
|
-
columnVisibility[colId]
|
|
4289
|
+
if (columnVisibility[colId] !== false) {
|
|
4290
|
+
updated = true;
|
|
4291
|
+
columnVisibility[colId] = false;
|
|
4292
|
+
}
|
|
4259
4293
|
} else {
|
|
4260
|
-
|
|
4294
|
+
if (columnVisibility.hasOwnProperty(colId)) {
|
|
4295
|
+
updated = true;
|
|
4296
|
+
delete columnVisibility[colId];
|
|
4297
|
+
}
|
|
4261
4298
|
}
|
|
4262
4299
|
});
|
|
4263
4300
|
if (updated) {
|
|
@@ -4266,9 +4303,10 @@ function useHideColumns(groupByMap) {
|
|
|
4266
4303
|
}, [
|
|
4267
4304
|
getDataSourceState,
|
|
4268
4305
|
groupRenderStrategy,
|
|
4269
|
-
generatedColumns,
|
|
4270
4306
|
originalLazyGroupDataChangeDetect,
|
|
4271
4307
|
groupBy,
|
|
4308
|
+
groupByMap,
|
|
4309
|
+
computedColumns,
|
|
4272
4310
|
hideEmptyGroupColumns ? dataArray : null,
|
|
4273
4311
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
4274
4312
|
hideEmptyGroupColumns
|
|
@@ -4448,6 +4486,32 @@ function useComputed() {
|
|
|
4448
4486
|
columnSizing,
|
|
4449
4487
|
columnTypes
|
|
4450
4488
|
});
|
|
4489
|
+
const rowSpan = useMemo6(() => {
|
|
4490
|
+
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
4491
|
+
return colsWithRowspan.length ? ({ itemIndex }) => {
|
|
4492
|
+
let maxSpan = 1;
|
|
4493
|
+
const dataArray = getDataSourceState().dataArray;
|
|
4494
|
+
const rowInfo = dataArray[itemIndex];
|
|
4495
|
+
const data = rowInfo.data;
|
|
4496
|
+
colsWithRowspan.forEach((column) => {
|
|
4497
|
+
if (!column.rowspan) {
|
|
4498
|
+
return;
|
|
4499
|
+
}
|
|
4500
|
+
const span = column.rowspan({
|
|
4501
|
+
column,
|
|
4502
|
+
data,
|
|
4503
|
+
dataArray,
|
|
4504
|
+
groupRowInfo: null,
|
|
4505
|
+
rowInfo,
|
|
4506
|
+
rowIndex: itemIndex
|
|
4507
|
+
});
|
|
4508
|
+
if (span > maxSpan) {
|
|
4509
|
+
maxSpan = span;
|
|
4510
|
+
}
|
|
4511
|
+
});
|
|
4512
|
+
return maxSpan;
|
|
4513
|
+
} : void 0;
|
|
4514
|
+
}, [computedVisibleColumns]);
|
|
4451
4515
|
const unpinnedColumnWidths = computedUnpinnedColumns.map((c) => c.computedWidth);
|
|
4452
4516
|
let sortedUnpinnedColumnWidths = [...unpinnedColumnWidths].sort(sortAscending);
|
|
4453
4517
|
let unpinnedColumnRenderCount = 0;
|
|
@@ -4474,6 +4538,7 @@ function useComputed() {
|
|
|
4474
4538
|
const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
|
|
4475
4539
|
const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
|
|
4476
4540
|
return {
|
|
4541
|
+
rowSpan,
|
|
4477
4542
|
toggleGroupRow,
|
|
4478
4543
|
computedPinnedStartOverflow,
|
|
4479
4544
|
computedPinnedEndOverflow,
|
|
@@ -4665,7 +4730,7 @@ var InfiniteTableCell = memo3(InfiniteTableCellFn);
|
|
|
4665
4730
|
var import_binary_search = __toModule(require_binary_search());
|
|
4666
4731
|
import {
|
|
4667
4732
|
useCallback as useCallback6,
|
|
4668
|
-
useMemo as
|
|
4733
|
+
useMemo as useMemo7,
|
|
4669
4734
|
useRef as useRef7,
|
|
4670
4735
|
useState as useState6
|
|
4671
4736
|
} from "react";
|
|
@@ -4712,8 +4777,8 @@ var useColumnPointerEvents = ({
|
|
|
4712
4777
|
const dragging = draggingDiff != null;
|
|
4713
4778
|
const { componentActions, computed } = useInfiniteTable();
|
|
4714
4779
|
const { computedColumnOrder } = computed;
|
|
4715
|
-
const column =
|
|
4716
|
-
const { columnIndex, columnWidth, columnsArray } =
|
|
4780
|
+
const column = useMemo7(() => columns.get(columnId), [columnId, columns]);
|
|
4781
|
+
const { columnIndex, columnWidth, columnsArray } = useMemo7(() => {
|
|
4717
4782
|
const columnsArray2 = Array.from(columns.values());
|
|
4718
4783
|
return {
|
|
4719
4784
|
columnsArray: columnsArray2,
|
|
@@ -5050,7 +5115,7 @@ function AvoidReactDiffFn(props) {
|
|
|
5050
5115
|
var AvoidReactDiff = memo4(AvoidReactDiffFn);
|
|
5051
5116
|
|
|
5052
5117
|
// src/components/RawList/useVirtualRenderer.ts
|
|
5053
|
-
import { useMemo as
|
|
5118
|
+
import { useMemo as useMemo8 } from "react";
|
|
5054
5119
|
|
|
5055
5120
|
// src/components/RawList/ReactVirtualRenderer.tsx
|
|
5056
5121
|
import {
|
|
@@ -5366,7 +5431,7 @@ function createRenderer(brain) {
|
|
|
5366
5431
|
function useVirtualRenderer({
|
|
5367
5432
|
brain
|
|
5368
5433
|
}) {
|
|
5369
|
-
return
|
|
5434
|
+
return useMemo8(() => {
|
|
5370
5435
|
return createRenderer(brain);
|
|
5371
5436
|
}, [brain]);
|
|
5372
5437
|
}
|
|
@@ -5458,7 +5523,7 @@ var InfiniteTableHeader = memo6(InfiniteTableHeaderFn);
|
|
|
5458
5523
|
import {
|
|
5459
5524
|
createElement as createElement17,
|
|
5460
5525
|
memo as memo7,
|
|
5461
|
-
useMemo as
|
|
5526
|
+
useMemo as useMemo9,
|
|
5462
5527
|
useRef as useRef10
|
|
5463
5528
|
} from "react";
|
|
5464
5529
|
|
|
@@ -5672,7 +5737,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5672
5737
|
} = useInfiniteTable();
|
|
5673
5738
|
const domRef = useRef10(null);
|
|
5674
5739
|
const hasColumnGroups = computedColumnGroups.size > 0;
|
|
5675
|
-
const columnHeaderGroups =
|
|
5740
|
+
const columnHeaderGroups = useMemo9(() => {
|
|
5676
5741
|
return hasColumnGroups ? renderColumnHeaderGroups({
|
|
5677
5742
|
columnGroups: computedColumnGroups,
|
|
5678
5743
|
columnGroupsDepthsMap,
|
|
@@ -5909,7 +5974,7 @@ function SpacePlaceholderFn(props) {
|
|
|
5909
5974
|
var SpacePlaceholder = memo8(SpacePlaceholderFn);
|
|
5910
5975
|
|
|
5911
5976
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
5912
|
-
import { useEffect as useEffect22, useMemo as
|
|
5977
|
+
import { useEffect as useEffect22, useMemo as useMemo12, useRef as useRef17 } from "react";
|
|
5913
5978
|
|
|
5914
5979
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
5915
5980
|
import {
|
|
@@ -6192,7 +6257,8 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
6192
6257
|
showHoverRows = false,
|
|
6193
6258
|
rowIndex,
|
|
6194
6259
|
domRef: domRefFromProps,
|
|
6195
|
-
rowInfo
|
|
6260
|
+
rowInfo,
|
|
6261
|
+
rowSpan
|
|
6196
6262
|
} = props;
|
|
6197
6263
|
const domRef = useRef13(null);
|
|
6198
6264
|
const rowDOMRef = useCallback10((node) => {
|
|
@@ -6212,7 +6278,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
6212
6278
|
if (rowStyle) {
|
|
6213
6279
|
style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
|
|
6214
6280
|
}
|
|
6215
|
-
if (inlineGroupRoot) {
|
|
6281
|
+
if (inlineGroupRoot || rowSpan) {
|
|
6216
6282
|
style = style || {};
|
|
6217
6283
|
style.zIndex = 2e6 - rowInfo.indexInAll;
|
|
6218
6284
|
}
|
|
@@ -6399,6 +6465,7 @@ function useUnpinnedRendering(params) {
|
|
|
6399
6465
|
computedPinnedStartWidth,
|
|
6400
6466
|
computedPinnedEndWidth,
|
|
6401
6467
|
computedUnpinnedColumns,
|
|
6468
|
+
rowSpan,
|
|
6402
6469
|
getState
|
|
6403
6470
|
} = params;
|
|
6404
6471
|
const { virtualizeColumns } = getState();
|
|
@@ -6412,6 +6479,7 @@ function useUnpinnedRendering(params) {
|
|
|
6412
6479
|
showZebraRows,
|
|
6413
6480
|
showHoverRows,
|
|
6414
6481
|
getData,
|
|
6482
|
+
rowSpan,
|
|
6415
6483
|
toggleGroupRow,
|
|
6416
6484
|
virtualizeColumns: shouldVirtualizeColumns,
|
|
6417
6485
|
brain: null,
|
|
@@ -6428,6 +6496,7 @@ function useUnpinnedRendering(params) {
|
|
|
6428
6496
|
}, [
|
|
6429
6497
|
repaintId,
|
|
6430
6498
|
rowHeight,
|
|
6499
|
+
rowSpan,
|
|
6431
6500
|
computedUnpinnedColumns,
|
|
6432
6501
|
computedUnpinnedColumnsWidth,
|
|
6433
6502
|
shouldVirtualizeColumns,
|
|
@@ -6593,7 +6662,7 @@ var useOnContainerScroll = ({
|
|
|
6593
6662
|
// src/components/InfiniteTable/hooks/usePinnedRendering.tsx
|
|
6594
6663
|
import {
|
|
6595
6664
|
createElement as createElement28,
|
|
6596
|
-
useMemo as
|
|
6665
|
+
useMemo as useMemo10
|
|
6597
6666
|
} from "react";
|
|
6598
6667
|
import { useCallback as useCallback15 } from "react";
|
|
6599
6668
|
|
|
@@ -6699,7 +6768,7 @@ function PinnedRowsContainer(props) {
|
|
|
6699
6768
|
brain,
|
|
6700
6769
|
renderRow
|
|
6701
6770
|
} = props;
|
|
6702
|
-
const style =
|
|
6771
|
+
const style = useMemo10(() => {
|
|
6703
6772
|
const result = pinning === "end" ? {
|
|
6704
6773
|
width: rowWidth,
|
|
6705
6774
|
height,
|
|
@@ -6755,7 +6824,7 @@ function PinnedRowsContainer(props) {
|
|
|
6755
6824
|
return /* @__PURE__ */ createElement28(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
|
|
6756
6825
|
}
|
|
6757
6826
|
function useRenderPinnedRow(params) {
|
|
6758
|
-
const { getData, getState, columnsWidth, columns, verticalBrain } = params;
|
|
6827
|
+
const { getData, getState, columnsWidth, columns, rowSpan, verticalBrain } = params;
|
|
6759
6828
|
const renderPinnedRow = useCallback15((rowParams) => {
|
|
6760
6829
|
const dataArray = getData();
|
|
6761
6830
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
@@ -6769,6 +6838,7 @@ function useRenderPinnedRow(params) {
|
|
|
6769
6838
|
virtualizeColumns: false,
|
|
6770
6839
|
verticalBrain,
|
|
6771
6840
|
brain: null,
|
|
6841
|
+
rowSpan,
|
|
6772
6842
|
rowWidth: columnsWidth,
|
|
6773
6843
|
columns
|
|
6774
6844
|
}, rowParams);
|
|
@@ -6793,6 +6863,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
6793
6863
|
computedPinnedStartOverflow,
|
|
6794
6864
|
pinnedStartScrollListener,
|
|
6795
6865
|
pinnedEndScrollListener,
|
|
6866
|
+
rowSpan,
|
|
6796
6867
|
repaintId,
|
|
6797
6868
|
toggleGroupRow,
|
|
6798
6869
|
scrollbars: {
|
|
@@ -6811,6 +6882,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
6811
6882
|
getData,
|
|
6812
6883
|
getState,
|
|
6813
6884
|
toggleGroupRow,
|
|
6885
|
+
rowSpan,
|
|
6814
6886
|
verticalBrain: verticalVirtualBrain,
|
|
6815
6887
|
columns,
|
|
6816
6888
|
columnsWidth
|
|
@@ -6873,9 +6945,9 @@ function usePinnedStartRendering(params) {
|
|
|
6873
6945
|
import { useEffect as useEffect21 } from "react";
|
|
6874
6946
|
|
|
6875
6947
|
// src/components/hooks/useOnce.ts
|
|
6876
|
-
import { useMemo as
|
|
6948
|
+
import { useMemo as useMemo11 } from "react";
|
|
6877
6949
|
function useOnce(fn) {
|
|
6878
|
-
const onceFn =
|
|
6950
|
+
const onceFn = useMemo11(() => {
|
|
6879
6951
|
return once(fn);
|
|
6880
6952
|
}, []);
|
|
6881
6953
|
return onceFn();
|
|
@@ -7174,7 +7246,7 @@ var VirtualBrain = class extends Logger {
|
|
|
7174
7246
|
this.computeCacheFor(lastSizeIndex);
|
|
7175
7247
|
_prev = lastOffset;
|
|
7176
7248
|
lastOffset = this.itemOffsetCache[lastSizeIndex];
|
|
7177
|
-
if (_prev === lastOffset) {
|
|
7249
|
+
if (_prev === lastOffset && _prev != 0) {
|
|
7178
7250
|
return count - 1;
|
|
7179
7251
|
}
|
|
7180
7252
|
}
|
|
@@ -7366,6 +7438,10 @@ function useYourBrain(param) {
|
|
|
7366
7438
|
}, []);
|
|
7367
7439
|
horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
|
|
7368
7440
|
verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
|
|
7441
|
+
if (true) {
|
|
7442
|
+
globalThis.verticalVirtualBrain = verticalVirtualBrain;
|
|
7443
|
+
globalThis.horizontalVirtualBrain = horizontalVirtualBrain;
|
|
7444
|
+
}
|
|
7369
7445
|
useEffect21(() => {
|
|
7370
7446
|
verticalVirtualBrain.setAvailableSize({
|
|
7371
7447
|
height: bodySize.height,
|
|
@@ -7397,7 +7473,7 @@ function useListRendering(param) {
|
|
|
7397
7473
|
computedUnpinnedColumnsWidth,
|
|
7398
7474
|
computedPinnedStartOverflow,
|
|
7399
7475
|
computedPinnedEndOverflow,
|
|
7400
|
-
|
|
7476
|
+
rowSpan,
|
|
7401
7477
|
toggleGroupRow
|
|
7402
7478
|
} = computed;
|
|
7403
7479
|
const { componentState: dataSourceState, getState: getDataSourceState } = useDataSourceContextValue();
|
|
@@ -7416,32 +7492,6 @@ function useListRendering(param) {
|
|
|
7416
7492
|
repaintIdRef.current++;
|
|
7417
7493
|
}
|
|
7418
7494
|
const repaintId = repaintIdRef.current;
|
|
7419
|
-
const rowSpan = useMemo11(() => {
|
|
7420
|
-
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
7421
|
-
return colsWithRowspan.length ? ({ itemIndex }) => {
|
|
7422
|
-
let maxSpan = 1;
|
|
7423
|
-
const dataArray2 = getData();
|
|
7424
|
-
const rowInfo = dataArray2[itemIndex];
|
|
7425
|
-
const data = rowInfo.data;
|
|
7426
|
-
colsWithRowspan.forEach((column) => {
|
|
7427
|
-
if (!column.rowspan) {
|
|
7428
|
-
return;
|
|
7429
|
-
}
|
|
7430
|
-
const span = column.rowspan({
|
|
7431
|
-
column,
|
|
7432
|
-
data,
|
|
7433
|
-
dataArray: dataArray2,
|
|
7434
|
-
groupRowInfo: null,
|
|
7435
|
-
rowInfo,
|
|
7436
|
-
rowIndex: itemIndex
|
|
7437
|
-
});
|
|
7438
|
-
if (span > maxSpan) {
|
|
7439
|
-
maxSpan = span;
|
|
7440
|
-
}
|
|
7441
|
-
});
|
|
7442
|
-
return maxSpan;
|
|
7443
|
-
} : void 0;
|
|
7444
|
-
}, [computedVisibleColumns]);
|
|
7445
7495
|
const { horizontalVirtualBrain, verticalVirtualBrain } = useYourBrain({
|
|
7446
7496
|
computedPinnedStartWidth: computed.computedPinnedStartWidth,
|
|
7447
7497
|
computedPinnedEndWidth: computed.computedPinnedEndWidth,
|
|
@@ -7454,7 +7504,7 @@ function useListRendering(param) {
|
|
|
7454
7504
|
const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
|
|
7455
7505
|
const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
7456
7506
|
const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
|
|
7457
|
-
const scrollbars =
|
|
7507
|
+
const scrollbars = useMemo12(() => ({
|
|
7458
7508
|
vertical: hasVerticalScrollbar,
|
|
7459
7509
|
horizontal: hasHorizontalScrollbar
|
|
7460
7510
|
}), [hasVerticalScrollbar, hasHorizontalScrollbar]);
|
|
@@ -7502,7 +7552,8 @@ function useListRendering(param) {
|
|
|
7502
7552
|
rowHeight,
|
|
7503
7553
|
verticalVirtualBrain,
|
|
7504
7554
|
pinnedStartScrollListener,
|
|
7505
|
-
pinnedEndScrollListener
|
|
7555
|
+
pinnedEndScrollListener,
|
|
7556
|
+
rowSpan
|
|
7506
7557
|
};
|
|
7507
7558
|
const centerRenderingParams = __spreadProps(__spreadValues({}, pinnedRenderingParams), {
|
|
7508
7559
|
columnShifts,
|
|
@@ -7618,7 +7669,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
7618
7669
|
});
|
|
7619
7670
|
|
|
7620
7671
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
7621
|
-
import { useMemo as
|
|
7672
|
+
import { useMemo as useMemo13 } from "react";
|
|
7622
7673
|
|
|
7623
7674
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
7624
7675
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -7768,10 +7819,10 @@ var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
|
7768
7819
|
var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
|
|
7769
7820
|
var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
|
|
7770
7821
|
var useLicense = (licenseKey = "") => {
|
|
7771
|
-
const valid =
|
|
7822
|
+
const valid = useMemo13(() => {
|
|
7772
7823
|
let valid2 = isValidLicense(licenseKey, {
|
|
7773
7824
|
publishedAt: 1624970570587,
|
|
7774
|
-
version: "0.2.
|
|
7825
|
+
version: "0.2.7"
|
|
7775
7826
|
});
|
|
7776
7827
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
7777
7828
|
return true;
|
package/index.js
CHANGED
|
@@ -2843,6 +2843,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
2843
2843
|
id: `${groupKeys}`,
|
|
2844
2844
|
collapsed,
|
|
2845
2845
|
parents,
|
|
2846
|
+
flatRowInfoList: [],
|
|
2846
2847
|
collapsedChildrenCount: 0,
|
|
2847
2848
|
collapsedGroupsCount: 0,
|
|
2848
2849
|
indexInParentGroups: options.indexInParentGroups,
|
|
@@ -2905,9 +2906,14 @@ function enhancedFlatten(param) {
|
|
|
2905
2906
|
}
|
|
2906
2907
|
if (collapsed) {
|
|
2907
2908
|
parents.forEach((parent) => {
|
|
2909
|
+
parent.flatRowInfoList.push(enhancedGroupData);
|
|
2908
2910
|
parent.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
2909
2911
|
parent.collapsedGroupsCount += 1;
|
|
2910
2912
|
});
|
|
2913
|
+
} else {
|
|
2914
|
+
parents.forEach((parent) => {
|
|
2915
|
+
parent.flatRowInfoList.push(enhancedGroupData);
|
|
2916
|
+
});
|
|
2911
2917
|
}
|
|
2912
2918
|
indexInParentGroups.push(indexInGroup);
|
|
2913
2919
|
parents.push(enhancedGroupData);
|
|
@@ -4208,13 +4214,43 @@ function useHideColumns(groupByMap) {
|
|
|
4208
4214
|
componentState: {
|
|
4209
4215
|
columnTypes,
|
|
4210
4216
|
computedColumns,
|
|
4211
|
-
columnsWhenGrouping: generatedColumns,
|
|
4212
4217
|
hideEmptyGroupColumns,
|
|
4213
4218
|
groupRenderStrategy
|
|
4214
4219
|
}
|
|
4215
4220
|
} = useComponentState();
|
|
4221
|
+
const prevHideEmptyGroupColumns = usePrevious(hideEmptyGroupColumns);
|
|
4216
4222
|
(0, import_react17.useEffect)(() => {
|
|
4217
|
-
if (groupRenderStrategy !== "multi-column"
|
|
4223
|
+
if (groupRenderStrategy !== "multi-column") {
|
|
4224
|
+
return;
|
|
4225
|
+
}
|
|
4226
|
+
const currentState = getComponentState();
|
|
4227
|
+
const computedGroupColumns = new Map();
|
|
4228
|
+
computedColumns.forEach((column, colId) => {
|
|
4229
|
+
if (typeof column.groupByField !== "string") {
|
|
4230
|
+
return;
|
|
4231
|
+
}
|
|
4232
|
+
const { groupByField } = column;
|
|
4233
|
+
const field = groupByField;
|
|
4234
|
+
const groupInfoForColumn = groupByMap.get(field);
|
|
4235
|
+
if (!groupInfoForColumn) {
|
|
4236
|
+
return;
|
|
4237
|
+
}
|
|
4238
|
+
computedGroupColumns.set(colId, column);
|
|
4239
|
+
});
|
|
4240
|
+
if (!hideEmptyGroupColumns) {
|
|
4241
|
+
if (prevHideEmptyGroupColumns) {
|
|
4242
|
+
let updated2 = false;
|
|
4243
|
+
const columnVisibility2 = __spreadValues({}, currentState.columnVisibility);
|
|
4244
|
+
computedGroupColumns.forEach((_column, colId) => {
|
|
4245
|
+
if (columnVisibility2[colId] === false) {
|
|
4246
|
+
updated2 = true;
|
|
4247
|
+
delete columnVisibility2[colId];
|
|
4248
|
+
}
|
|
4249
|
+
});
|
|
4250
|
+
if (updated2) {
|
|
4251
|
+
componentActions.columnVisibility = columnVisibility2;
|
|
4252
|
+
}
|
|
4253
|
+
}
|
|
4218
4254
|
return;
|
|
4219
4255
|
}
|
|
4220
4256
|
const groupsLength = groupBy.length;
|
|
@@ -4227,23 +4263,24 @@ function useHideColumns(groupByMap) {
|
|
|
4227
4263
|
break;
|
|
4228
4264
|
}
|
|
4229
4265
|
}
|
|
4230
|
-
const currentState = getComponentState();
|
|
4231
|
-
const { computedColumns: computedColumns2 } = currentState;
|
|
4232
4266
|
let updated = false;
|
|
4233
4267
|
const columnVisibility = __spreadValues({}, currentState.columnVisibility);
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
const
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
return;
|
|
4240
|
-
}
|
|
4268
|
+
computedGroupColumns.forEach((column, colId) => {
|
|
4269
|
+
const { groupByField } = column;
|
|
4270
|
+
const field = groupByField;
|
|
4271
|
+
const groupInfoForColumn = groupByMap.get(field);
|
|
4272
|
+
const index = groupInfoForColumn.groupIndex;
|
|
4241
4273
|
const shouldBeHidden = index > expandedGroupsLevel && hideEmptyGroupColumns;
|
|
4242
|
-
updated = true;
|
|
4243
4274
|
if (shouldBeHidden) {
|
|
4244
|
-
columnVisibility[colId]
|
|
4275
|
+
if (columnVisibility[colId] !== false) {
|
|
4276
|
+
updated = true;
|
|
4277
|
+
columnVisibility[colId] = false;
|
|
4278
|
+
}
|
|
4245
4279
|
} else {
|
|
4246
|
-
|
|
4280
|
+
if (columnVisibility.hasOwnProperty(colId)) {
|
|
4281
|
+
updated = true;
|
|
4282
|
+
delete columnVisibility[colId];
|
|
4283
|
+
}
|
|
4247
4284
|
}
|
|
4248
4285
|
});
|
|
4249
4286
|
if (updated) {
|
|
@@ -4252,9 +4289,10 @@ function useHideColumns(groupByMap) {
|
|
|
4252
4289
|
}, [
|
|
4253
4290
|
getDataSourceState,
|
|
4254
4291
|
groupRenderStrategy,
|
|
4255
|
-
generatedColumns,
|
|
4256
4292
|
originalLazyGroupDataChangeDetect,
|
|
4257
4293
|
groupBy,
|
|
4294
|
+
groupByMap,
|
|
4295
|
+
computedColumns,
|
|
4258
4296
|
hideEmptyGroupColumns ? dataArray : null,
|
|
4259
4297
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
4260
4298
|
hideEmptyGroupColumns
|
|
@@ -4434,6 +4472,32 @@ function useComputed() {
|
|
|
4434
4472
|
columnSizing,
|
|
4435
4473
|
columnTypes
|
|
4436
4474
|
});
|
|
4475
|
+
const rowSpan = (0, import_react18.useMemo)(() => {
|
|
4476
|
+
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
4477
|
+
return colsWithRowspan.length ? ({ itemIndex }) => {
|
|
4478
|
+
let maxSpan = 1;
|
|
4479
|
+
const dataArray = getDataSourceState().dataArray;
|
|
4480
|
+
const rowInfo = dataArray[itemIndex];
|
|
4481
|
+
const data = rowInfo.data;
|
|
4482
|
+
colsWithRowspan.forEach((column) => {
|
|
4483
|
+
if (!column.rowspan) {
|
|
4484
|
+
return;
|
|
4485
|
+
}
|
|
4486
|
+
const span = column.rowspan({
|
|
4487
|
+
column,
|
|
4488
|
+
data,
|
|
4489
|
+
dataArray,
|
|
4490
|
+
groupRowInfo: null,
|
|
4491
|
+
rowInfo,
|
|
4492
|
+
rowIndex: itemIndex
|
|
4493
|
+
});
|
|
4494
|
+
if (span > maxSpan) {
|
|
4495
|
+
maxSpan = span;
|
|
4496
|
+
}
|
|
4497
|
+
});
|
|
4498
|
+
return maxSpan;
|
|
4499
|
+
} : void 0;
|
|
4500
|
+
}, [computedVisibleColumns]);
|
|
4437
4501
|
const unpinnedColumnWidths = computedUnpinnedColumns.map((c) => c.computedWidth);
|
|
4438
4502
|
let sortedUnpinnedColumnWidths = [...unpinnedColumnWidths].sort(sortAscending);
|
|
4439
4503
|
let unpinnedColumnRenderCount = 0;
|
|
@@ -4460,6 +4524,7 @@ function useComputed() {
|
|
|
4460
4524
|
const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
|
|
4461
4525
|
const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
|
|
4462
4526
|
return {
|
|
4527
|
+
rowSpan,
|
|
4463
4528
|
toggleGroupRow,
|
|
4464
4529
|
computedPinnedStartOverflow,
|
|
4465
4530
|
computedPinnedEndOverflow,
|
|
@@ -6112,7 +6177,8 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
6112
6177
|
showHoverRows = false,
|
|
6113
6178
|
rowIndex,
|
|
6114
6179
|
domRef: domRefFromProps,
|
|
6115
|
-
rowInfo
|
|
6180
|
+
rowInfo,
|
|
6181
|
+
rowSpan
|
|
6116
6182
|
} = props;
|
|
6117
6183
|
const domRef = (0, import_react31.useRef)(null);
|
|
6118
6184
|
const rowDOMRef = (0, import_react31.useCallback)((node) => {
|
|
@@ -6132,7 +6198,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
6132
6198
|
if (rowStyle) {
|
|
6133
6199
|
style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
|
|
6134
6200
|
}
|
|
6135
|
-
if (inlineGroupRoot) {
|
|
6201
|
+
if (inlineGroupRoot || rowSpan) {
|
|
6136
6202
|
style = style || {};
|
|
6137
6203
|
style.zIndex = 2e6 - rowInfo.indexInAll;
|
|
6138
6204
|
}
|
|
@@ -6316,6 +6382,7 @@ function useUnpinnedRendering(params) {
|
|
|
6316
6382
|
computedPinnedStartWidth,
|
|
6317
6383
|
computedPinnedEndWidth,
|
|
6318
6384
|
computedUnpinnedColumns,
|
|
6385
|
+
rowSpan,
|
|
6319
6386
|
getState
|
|
6320
6387
|
} = params;
|
|
6321
6388
|
const { virtualizeColumns } = getState();
|
|
@@ -6329,6 +6396,7 @@ function useUnpinnedRendering(params) {
|
|
|
6329
6396
|
showZebraRows,
|
|
6330
6397
|
showHoverRows,
|
|
6331
6398
|
getData,
|
|
6399
|
+
rowSpan,
|
|
6332
6400
|
toggleGroupRow,
|
|
6333
6401
|
virtualizeColumns: shouldVirtualizeColumns,
|
|
6334
6402
|
brain: null,
|
|
@@ -6345,6 +6413,7 @@ function useUnpinnedRendering(params) {
|
|
|
6345
6413
|
}, [
|
|
6346
6414
|
repaintId,
|
|
6347
6415
|
rowHeight,
|
|
6416
|
+
rowSpan,
|
|
6348
6417
|
computedUnpinnedColumns,
|
|
6349
6418
|
computedUnpinnedColumnsWidth,
|
|
6350
6419
|
shouldVirtualizeColumns,
|
|
@@ -6667,7 +6736,7 @@ function PinnedRowsContainer(props) {
|
|
|
6667
6736
|
return /* @__PURE__ */ React30.createElement(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
|
|
6668
6737
|
}
|
|
6669
6738
|
function useRenderPinnedRow(params) {
|
|
6670
|
-
const { getData, getState, columnsWidth, columns, verticalBrain } = params;
|
|
6739
|
+
const { getData, getState, columnsWidth, columns, rowSpan, verticalBrain } = params;
|
|
6671
6740
|
const renderPinnedRow = (0, import_react37.useCallback)((rowParams) => {
|
|
6672
6741
|
const dataArray = getData();
|
|
6673
6742
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
@@ -6681,6 +6750,7 @@ function useRenderPinnedRow(params) {
|
|
|
6681
6750
|
virtualizeColumns: false,
|
|
6682
6751
|
verticalBrain,
|
|
6683
6752
|
brain: null,
|
|
6753
|
+
rowSpan,
|
|
6684
6754
|
rowWidth: columnsWidth,
|
|
6685
6755
|
columns
|
|
6686
6756
|
}, rowParams);
|
|
@@ -6705,6 +6775,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
6705
6775
|
computedPinnedStartOverflow,
|
|
6706
6776
|
pinnedStartScrollListener,
|
|
6707
6777
|
pinnedEndScrollListener,
|
|
6778
|
+
rowSpan,
|
|
6708
6779
|
repaintId,
|
|
6709
6780
|
toggleGroupRow,
|
|
6710
6781
|
scrollbars: {
|
|
@@ -6723,6 +6794,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
6723
6794
|
getData,
|
|
6724
6795
|
getState,
|
|
6725
6796
|
toggleGroupRow,
|
|
6797
|
+
rowSpan,
|
|
6726
6798
|
verticalBrain: verticalVirtualBrain,
|
|
6727
6799
|
columns,
|
|
6728
6800
|
columnsWidth
|
|
@@ -7086,7 +7158,7 @@ var VirtualBrain = class extends Logger {
|
|
|
7086
7158
|
this.computeCacheFor(lastSizeIndex);
|
|
7087
7159
|
_prev = lastOffset;
|
|
7088
7160
|
lastOffset = this.itemOffsetCache[lastSizeIndex];
|
|
7089
|
-
if (_prev === lastOffset) {
|
|
7161
|
+
if (_prev === lastOffset && _prev != 0) {
|
|
7090
7162
|
return count - 1;
|
|
7091
7163
|
}
|
|
7092
7164
|
}
|
|
@@ -7278,6 +7350,10 @@ function useYourBrain(param) {
|
|
|
7278
7350
|
}, []);
|
|
7279
7351
|
horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
|
|
7280
7352
|
verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
|
|
7353
|
+
if (true) {
|
|
7354
|
+
globalThis.verticalVirtualBrain = verticalVirtualBrain;
|
|
7355
|
+
globalThis.horizontalVirtualBrain = horizontalVirtualBrain;
|
|
7356
|
+
}
|
|
7281
7357
|
(0, import_react40.useEffect)(() => {
|
|
7282
7358
|
verticalVirtualBrain.setAvailableSize({
|
|
7283
7359
|
height: bodySize.height,
|
|
@@ -7309,7 +7385,7 @@ function useListRendering(param) {
|
|
|
7309
7385
|
computedUnpinnedColumnsWidth,
|
|
7310
7386
|
computedPinnedStartOverflow,
|
|
7311
7387
|
computedPinnedEndOverflow,
|
|
7312
|
-
|
|
7388
|
+
rowSpan,
|
|
7313
7389
|
toggleGroupRow
|
|
7314
7390
|
} = computed;
|
|
7315
7391
|
const { componentState: dataSourceState, getState: getDataSourceState } = useDataSourceContextValue();
|
|
@@ -7328,32 +7404,6 @@ function useListRendering(param) {
|
|
|
7328
7404
|
repaintIdRef.current++;
|
|
7329
7405
|
}
|
|
7330
7406
|
const repaintId = repaintIdRef.current;
|
|
7331
|
-
const rowSpan = (0, import_react41.useMemo)(() => {
|
|
7332
|
-
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
7333
|
-
return colsWithRowspan.length ? ({ itemIndex }) => {
|
|
7334
|
-
let maxSpan = 1;
|
|
7335
|
-
const dataArray2 = getData();
|
|
7336
|
-
const rowInfo = dataArray2[itemIndex];
|
|
7337
|
-
const data = rowInfo.data;
|
|
7338
|
-
colsWithRowspan.forEach((column) => {
|
|
7339
|
-
if (!column.rowspan) {
|
|
7340
|
-
return;
|
|
7341
|
-
}
|
|
7342
|
-
const span = column.rowspan({
|
|
7343
|
-
column,
|
|
7344
|
-
data,
|
|
7345
|
-
dataArray: dataArray2,
|
|
7346
|
-
groupRowInfo: null,
|
|
7347
|
-
rowInfo,
|
|
7348
|
-
rowIndex: itemIndex
|
|
7349
|
-
});
|
|
7350
|
-
if (span > maxSpan) {
|
|
7351
|
-
maxSpan = span;
|
|
7352
|
-
}
|
|
7353
|
-
});
|
|
7354
|
-
return maxSpan;
|
|
7355
|
-
} : void 0;
|
|
7356
|
-
}, [computedVisibleColumns]);
|
|
7357
7407
|
const { horizontalVirtualBrain, verticalVirtualBrain } = useYourBrain({
|
|
7358
7408
|
computedPinnedStartWidth: computed.computedPinnedStartWidth,
|
|
7359
7409
|
computedPinnedEndWidth: computed.computedPinnedEndWidth,
|
|
@@ -7414,7 +7464,8 @@ function useListRendering(param) {
|
|
|
7414
7464
|
rowHeight,
|
|
7415
7465
|
verticalVirtualBrain,
|
|
7416
7466
|
pinnedStartScrollListener,
|
|
7417
|
-
pinnedEndScrollListener
|
|
7467
|
+
pinnedEndScrollListener,
|
|
7468
|
+
rowSpan
|
|
7418
7469
|
};
|
|
7419
7470
|
const centerRenderingParams = __spreadProps(__spreadValues({}, pinnedRenderingParams), {
|
|
7420
7471
|
columnShifts,
|
|
@@ -7678,7 +7729,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
7678
7729
|
const valid = (0, import_react43.useMemo)(() => {
|
|
7679
7730
|
let valid2 = isValidLicense(licenseKey, {
|
|
7680
7731
|
publishedAt: 1624970570587,
|
|
7681
|
-
version: "0.2.
|
|
7732
|
+
version: "0.2.7"
|
|
7682
7733
|
});
|
|
7683
7734
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
7684
7735
|
return true;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infinite-table/infinite-react",
|
|
3
3
|
"description": "Infinite Table for React",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.7",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.esm.js",
|
|
7
7
|
"typings": "index.d.ts",
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
},
|
|
15
15
|
"license": "Commercial & Open Source",
|
|
16
16
|
"//": "will be updated at build time",
|
|
17
|
-
"publishedAt":
|
|
17
|
+
"publishedAt": 1645183793183
|
|
18
18
|
}
|