@infinite-table/infinite-react 0.2.6 → 0.2.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/index.d.ts +951 -3213
- package/index.esm.js +146 -84
- package/index.js +130 -68
- package/package.json +2 -2
package/index.esm.js
CHANGED
|
@@ -193,11 +193,11 @@ var require_common = __commonJS({
|
|
|
193
193
|
let enableOverride = null;
|
|
194
194
|
let namespacesCache;
|
|
195
195
|
let enabledCache;
|
|
196
|
-
function
|
|
197
|
-
if (!
|
|
196
|
+
function debug7(...args) {
|
|
197
|
+
if (!debug7.enabled) {
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
|
-
const self =
|
|
200
|
+
const self = debug7;
|
|
201
201
|
const curr = Number(new Date());
|
|
202
202
|
const ms = curr - (prevTime || curr);
|
|
203
203
|
self.diff = ms;
|
|
@@ -227,12 +227,12 @@ var require_common = __commonJS({
|
|
|
227
227
|
const logFn = self.log || createDebug.log;
|
|
228
228
|
logFn.apply(self, args);
|
|
229
229
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
Object.defineProperty(
|
|
230
|
+
debug7.namespace = namespace;
|
|
231
|
+
debug7.useColors = createDebug.useColors();
|
|
232
|
+
debug7.color = createDebug.selectColor(namespace);
|
|
233
|
+
debug7.extend = extend;
|
|
234
|
+
debug7.destroy = createDebug.destroy;
|
|
235
|
+
Object.defineProperty(debug7, "enabled", {
|
|
236
236
|
enumerable: true,
|
|
237
237
|
configurable: false,
|
|
238
238
|
get: () => {
|
|
@@ -250,9 +250,9 @@ var require_common = __commonJS({
|
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
252
|
if (typeof createDebug.init === "function") {
|
|
253
|
-
createDebug.init(
|
|
253
|
+
createDebug.init(debug7);
|
|
254
254
|
}
|
|
255
|
-
return
|
|
255
|
+
return debug7;
|
|
256
256
|
}
|
|
257
257
|
function extend(namespace, delimiter) {
|
|
258
258
|
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
@@ -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);
|
|
@@ -2930,7 +2936,7 @@ function enhancedFlatten(param) {
|
|
|
2930
2936
|
if (!pivot) {
|
|
2931
2937
|
const startIndex = result.length;
|
|
2932
2938
|
result.push(...items.map((item, index) => {
|
|
2933
|
-
|
|
2939
|
+
const rowInfo = {
|
|
2934
2940
|
id: item ? toPrimaryKey(item) : `${groupKeys}-${index}`,
|
|
2935
2941
|
data: item,
|
|
2936
2942
|
isGroupRow: false,
|
|
@@ -2944,6 +2950,10 @@ function enhancedFlatten(param) {
|
|
|
2944
2950
|
groupNesting,
|
|
2945
2951
|
groupCount: enhancedGroupData.groupCount
|
|
2946
2952
|
};
|
|
2953
|
+
parents.forEach((parent) => {
|
|
2954
|
+
parent.flatRowInfoList.push(rowInfo);
|
|
2955
|
+
});
|
|
2956
|
+
return rowInfo;
|
|
2947
2957
|
}));
|
|
2948
2958
|
}
|
|
2949
2959
|
} else {
|
|
@@ -4222,13 +4232,43 @@ function useHideColumns(groupByMap) {
|
|
|
4222
4232
|
componentState: {
|
|
4223
4233
|
columnTypes,
|
|
4224
4234
|
computedColumns,
|
|
4225
|
-
columnsWhenGrouping: generatedColumns,
|
|
4226
4235
|
hideEmptyGroupColumns,
|
|
4227
4236
|
groupRenderStrategy
|
|
4228
4237
|
}
|
|
4229
4238
|
} = useComponentState();
|
|
4239
|
+
const prevHideEmptyGroupColumns = usePrevious(hideEmptyGroupColumns);
|
|
4230
4240
|
useEffect9(() => {
|
|
4231
|
-
if (groupRenderStrategy !== "multi-column"
|
|
4241
|
+
if (groupRenderStrategy !== "multi-column") {
|
|
4242
|
+
return;
|
|
4243
|
+
}
|
|
4244
|
+
const currentState = getComponentState();
|
|
4245
|
+
const computedGroupColumns = new Map();
|
|
4246
|
+
computedColumns.forEach((column, colId) => {
|
|
4247
|
+
if (typeof column.groupByField !== "string") {
|
|
4248
|
+
return;
|
|
4249
|
+
}
|
|
4250
|
+
const { groupByField } = column;
|
|
4251
|
+
const field = groupByField;
|
|
4252
|
+
const groupInfoForColumn = groupByMap.get(field);
|
|
4253
|
+
if (!groupInfoForColumn) {
|
|
4254
|
+
return;
|
|
4255
|
+
}
|
|
4256
|
+
computedGroupColumns.set(colId, column);
|
|
4257
|
+
});
|
|
4258
|
+
if (!hideEmptyGroupColumns) {
|
|
4259
|
+
if (prevHideEmptyGroupColumns) {
|
|
4260
|
+
let updated2 = false;
|
|
4261
|
+
const columnVisibility2 = __spreadValues({}, currentState.columnVisibility);
|
|
4262
|
+
computedGroupColumns.forEach((_column, colId) => {
|
|
4263
|
+
if (columnVisibility2[colId] === false) {
|
|
4264
|
+
updated2 = true;
|
|
4265
|
+
delete columnVisibility2[colId];
|
|
4266
|
+
}
|
|
4267
|
+
});
|
|
4268
|
+
if (updated2) {
|
|
4269
|
+
componentActions.columnVisibility = columnVisibility2;
|
|
4270
|
+
}
|
|
4271
|
+
}
|
|
4232
4272
|
return;
|
|
4233
4273
|
}
|
|
4234
4274
|
const groupsLength = groupBy.length;
|
|
@@ -4241,23 +4281,24 @@ function useHideColumns(groupByMap) {
|
|
|
4241
4281
|
break;
|
|
4242
4282
|
}
|
|
4243
4283
|
}
|
|
4244
|
-
const currentState = getComponentState();
|
|
4245
|
-
const { computedColumns: computedColumns2 } = currentState;
|
|
4246
4284
|
let updated = false;
|
|
4247
4285
|
const columnVisibility = __spreadValues({}, currentState.columnVisibility);
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
const
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
return;
|
|
4254
|
-
}
|
|
4286
|
+
computedGroupColumns.forEach((column, colId) => {
|
|
4287
|
+
const { groupByField } = column;
|
|
4288
|
+
const field = groupByField;
|
|
4289
|
+
const groupInfoForColumn = groupByMap.get(field);
|
|
4290
|
+
const index = groupInfoForColumn.groupIndex;
|
|
4255
4291
|
const shouldBeHidden = index > expandedGroupsLevel && hideEmptyGroupColumns;
|
|
4256
|
-
updated = true;
|
|
4257
4292
|
if (shouldBeHidden) {
|
|
4258
|
-
columnVisibility[colId]
|
|
4293
|
+
if (columnVisibility[colId] !== false) {
|
|
4294
|
+
updated = true;
|
|
4295
|
+
columnVisibility[colId] = false;
|
|
4296
|
+
}
|
|
4259
4297
|
} else {
|
|
4260
|
-
|
|
4298
|
+
if (columnVisibility.hasOwnProperty(colId)) {
|
|
4299
|
+
updated = true;
|
|
4300
|
+
delete columnVisibility[colId];
|
|
4301
|
+
}
|
|
4261
4302
|
}
|
|
4262
4303
|
});
|
|
4263
4304
|
if (updated) {
|
|
@@ -4266,9 +4307,10 @@ function useHideColumns(groupByMap) {
|
|
|
4266
4307
|
}, [
|
|
4267
4308
|
getDataSourceState,
|
|
4268
4309
|
groupRenderStrategy,
|
|
4269
|
-
generatedColumns,
|
|
4270
4310
|
originalLazyGroupDataChangeDetect,
|
|
4271
4311
|
groupBy,
|
|
4312
|
+
groupByMap,
|
|
4313
|
+
computedColumns,
|
|
4272
4314
|
hideEmptyGroupColumns ? dataArray : null,
|
|
4273
4315
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
4274
4316
|
hideEmptyGroupColumns
|
|
@@ -4448,6 +4490,31 @@ function useComputed() {
|
|
|
4448
4490
|
columnSizing,
|
|
4449
4491
|
columnTypes
|
|
4450
4492
|
});
|
|
4493
|
+
const rowSpan = useMemo6(() => {
|
|
4494
|
+
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
4495
|
+
return colsWithRowspan.length ? ({ itemIndex }) => {
|
|
4496
|
+
let maxSpan = 1;
|
|
4497
|
+
const dataArray = getDataSourceState().dataArray;
|
|
4498
|
+
const rowInfo = dataArray[itemIndex];
|
|
4499
|
+
const data = rowInfo.data;
|
|
4500
|
+
colsWithRowspan.forEach((column) => {
|
|
4501
|
+
if (!column.rowspan) {
|
|
4502
|
+
return;
|
|
4503
|
+
}
|
|
4504
|
+
const span = column.rowspan({
|
|
4505
|
+
column,
|
|
4506
|
+
data,
|
|
4507
|
+
dataArray,
|
|
4508
|
+
rowInfo,
|
|
4509
|
+
rowIndex: itemIndex
|
|
4510
|
+
});
|
|
4511
|
+
if (span > maxSpan) {
|
|
4512
|
+
maxSpan = span;
|
|
4513
|
+
}
|
|
4514
|
+
});
|
|
4515
|
+
return maxSpan;
|
|
4516
|
+
} : void 0;
|
|
4517
|
+
}, [computedVisibleColumns]);
|
|
4451
4518
|
const unpinnedColumnWidths = computedUnpinnedColumns.map((c) => c.computedWidth);
|
|
4452
4519
|
let sortedUnpinnedColumnWidths = [...unpinnedColumnWidths].sort(sortAscending);
|
|
4453
4520
|
let unpinnedColumnRenderCount = 0;
|
|
@@ -4474,6 +4541,7 @@ function useComputed() {
|
|
|
4474
4541
|
const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
|
|
4475
4542
|
const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
|
|
4476
4543
|
return {
|
|
4544
|
+
rowSpan,
|
|
4477
4545
|
toggleGroupRow,
|
|
4478
4546
|
computedPinnedStartOverflow,
|
|
4479
4547
|
computedPinnedEndOverflow,
|
|
@@ -4665,7 +4733,7 @@ var InfiniteTableCell = memo3(InfiniteTableCellFn);
|
|
|
4665
4733
|
var import_binary_search = __toModule(require_binary_search());
|
|
4666
4734
|
import {
|
|
4667
4735
|
useCallback as useCallback6,
|
|
4668
|
-
useMemo as
|
|
4736
|
+
useMemo as useMemo7,
|
|
4669
4737
|
useRef as useRef7,
|
|
4670
4738
|
useState as useState6
|
|
4671
4739
|
} from "react";
|
|
@@ -4712,8 +4780,8 @@ var useColumnPointerEvents = ({
|
|
|
4712
4780
|
const dragging = draggingDiff != null;
|
|
4713
4781
|
const { componentActions, computed } = useInfiniteTable();
|
|
4714
4782
|
const { computedColumnOrder } = computed;
|
|
4715
|
-
const column =
|
|
4716
|
-
const { columnIndex, columnWidth, columnsArray } =
|
|
4783
|
+
const column = useMemo7(() => columns.get(columnId), [columnId, columns]);
|
|
4784
|
+
const { columnIndex, columnWidth, columnsArray } = useMemo7(() => {
|
|
4717
4785
|
const columnsArray2 = Array.from(columns.values());
|
|
4718
4786
|
return {
|
|
4719
4787
|
columnsArray: columnsArray2,
|
|
@@ -5050,7 +5118,7 @@ function AvoidReactDiffFn(props) {
|
|
|
5050
5118
|
var AvoidReactDiff = memo4(AvoidReactDiffFn);
|
|
5051
5119
|
|
|
5052
5120
|
// src/components/RawList/useVirtualRenderer.ts
|
|
5053
|
-
import { useMemo as
|
|
5121
|
+
import { useMemo as useMemo8 } from "react";
|
|
5054
5122
|
|
|
5055
5123
|
// src/components/RawList/ReactVirtualRenderer.tsx
|
|
5056
5124
|
import {
|
|
@@ -5366,7 +5434,7 @@ function createRenderer(brain) {
|
|
|
5366
5434
|
function useVirtualRenderer({
|
|
5367
5435
|
brain
|
|
5368
5436
|
}) {
|
|
5369
|
-
return
|
|
5437
|
+
return useMemo8(() => {
|
|
5370
5438
|
return createRenderer(brain);
|
|
5371
5439
|
}, [brain]);
|
|
5372
5440
|
}
|
|
@@ -5458,7 +5526,7 @@ var InfiniteTableHeader = memo6(InfiniteTableHeaderFn);
|
|
|
5458
5526
|
import {
|
|
5459
5527
|
createElement as createElement17,
|
|
5460
5528
|
memo as memo7,
|
|
5461
|
-
useMemo as
|
|
5529
|
+
useMemo as useMemo9,
|
|
5462
5530
|
useRef as useRef10
|
|
5463
5531
|
} from "react";
|
|
5464
5532
|
|
|
@@ -5672,7 +5740,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5672
5740
|
} = useInfiniteTable();
|
|
5673
5741
|
const domRef = useRef10(null);
|
|
5674
5742
|
const hasColumnGroups = computedColumnGroups.size > 0;
|
|
5675
|
-
const columnHeaderGroups =
|
|
5743
|
+
const columnHeaderGroups = useMemo9(() => {
|
|
5676
5744
|
return hasColumnGroups ? renderColumnHeaderGroups({
|
|
5677
5745
|
columnGroups: computedColumnGroups,
|
|
5678
5746
|
columnGroupsDepthsMap,
|
|
@@ -5909,7 +5977,7 @@ function SpacePlaceholderFn(props) {
|
|
|
5909
5977
|
var SpacePlaceholder = memo8(SpacePlaceholderFn);
|
|
5910
5978
|
|
|
5911
5979
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
5912
|
-
import { useEffect as useEffect22, useMemo as
|
|
5980
|
+
import { useEffect as useEffect22, useMemo as useMemo12, useRef as useRef17 } from "react";
|
|
5913
5981
|
|
|
5914
5982
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
5915
5983
|
import {
|
|
@@ -6141,7 +6209,6 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
6141
6209
|
dataArray: getData(),
|
|
6142
6210
|
column,
|
|
6143
6211
|
rowInfo,
|
|
6144
|
-
groupRowInfo,
|
|
6145
6212
|
rowIndex,
|
|
6146
6213
|
data: rowInfo.data
|
|
6147
6214
|
});
|
|
@@ -6192,7 +6259,8 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
6192
6259
|
showHoverRows = false,
|
|
6193
6260
|
rowIndex,
|
|
6194
6261
|
domRef: domRefFromProps,
|
|
6195
|
-
rowInfo
|
|
6262
|
+
rowInfo,
|
|
6263
|
+
rowSpan
|
|
6196
6264
|
} = props;
|
|
6197
6265
|
const domRef = useRef13(null);
|
|
6198
6266
|
const rowDOMRef = useCallback10((node) => {
|
|
@@ -6212,7 +6280,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
6212
6280
|
if (rowStyle) {
|
|
6213
6281
|
style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
|
|
6214
6282
|
}
|
|
6215
|
-
if (inlineGroupRoot) {
|
|
6283
|
+
if (inlineGroupRoot || rowSpan) {
|
|
6216
6284
|
style = style || {};
|
|
6217
6285
|
style.zIndex = 2e6 - rowInfo.indexInAll;
|
|
6218
6286
|
}
|
|
@@ -6399,6 +6467,7 @@ function useUnpinnedRendering(params) {
|
|
|
6399
6467
|
computedPinnedStartWidth,
|
|
6400
6468
|
computedPinnedEndWidth,
|
|
6401
6469
|
computedUnpinnedColumns,
|
|
6470
|
+
rowSpan,
|
|
6402
6471
|
getState
|
|
6403
6472
|
} = params;
|
|
6404
6473
|
const { virtualizeColumns } = getState();
|
|
@@ -6412,6 +6481,7 @@ function useUnpinnedRendering(params) {
|
|
|
6412
6481
|
showZebraRows,
|
|
6413
6482
|
showHoverRows,
|
|
6414
6483
|
getData,
|
|
6484
|
+
rowSpan,
|
|
6415
6485
|
toggleGroupRow,
|
|
6416
6486
|
virtualizeColumns: shouldVirtualizeColumns,
|
|
6417
6487
|
brain: null,
|
|
@@ -6428,6 +6498,7 @@ function useUnpinnedRendering(params) {
|
|
|
6428
6498
|
}, [
|
|
6429
6499
|
repaintId,
|
|
6430
6500
|
rowHeight,
|
|
6501
|
+
rowSpan,
|
|
6431
6502
|
computedUnpinnedColumns,
|
|
6432
6503
|
computedUnpinnedColumnsWidth,
|
|
6433
6504
|
shouldVirtualizeColumns,
|
|
@@ -6593,7 +6664,7 @@ var useOnContainerScroll = ({
|
|
|
6593
6664
|
// src/components/InfiniteTable/hooks/usePinnedRendering.tsx
|
|
6594
6665
|
import {
|
|
6595
6666
|
createElement as createElement28,
|
|
6596
|
-
useMemo as
|
|
6667
|
+
useMemo as useMemo10
|
|
6597
6668
|
} from "react";
|
|
6598
6669
|
import { useCallback as useCallback15 } from "react";
|
|
6599
6670
|
|
|
@@ -6699,7 +6770,7 @@ function PinnedRowsContainer(props) {
|
|
|
6699
6770
|
brain,
|
|
6700
6771
|
renderRow
|
|
6701
6772
|
} = props;
|
|
6702
|
-
const style =
|
|
6773
|
+
const style = useMemo10(() => {
|
|
6703
6774
|
const result = pinning === "end" ? {
|
|
6704
6775
|
width: rowWidth,
|
|
6705
6776
|
height,
|
|
@@ -6755,7 +6826,7 @@ function PinnedRowsContainer(props) {
|
|
|
6755
6826
|
return /* @__PURE__ */ createElement28(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
|
|
6756
6827
|
}
|
|
6757
6828
|
function useRenderPinnedRow(params) {
|
|
6758
|
-
const { getData, getState, columnsWidth, columns, verticalBrain } = params;
|
|
6829
|
+
const { getData, getState, columnsWidth, columns, rowSpan, verticalBrain } = params;
|
|
6759
6830
|
const renderPinnedRow = useCallback15((rowParams) => {
|
|
6760
6831
|
const dataArray = getData();
|
|
6761
6832
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
@@ -6769,6 +6840,7 @@ function useRenderPinnedRow(params) {
|
|
|
6769
6840
|
virtualizeColumns: false,
|
|
6770
6841
|
verticalBrain,
|
|
6771
6842
|
brain: null,
|
|
6843
|
+
rowSpan,
|
|
6772
6844
|
rowWidth: columnsWidth,
|
|
6773
6845
|
columns
|
|
6774
6846
|
}, rowParams);
|
|
@@ -6793,6 +6865,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
6793
6865
|
computedPinnedStartOverflow,
|
|
6794
6866
|
pinnedStartScrollListener,
|
|
6795
6867
|
pinnedEndScrollListener,
|
|
6868
|
+
rowSpan,
|
|
6796
6869
|
repaintId,
|
|
6797
6870
|
toggleGroupRow,
|
|
6798
6871
|
scrollbars: {
|
|
@@ -6811,6 +6884,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
6811
6884
|
getData,
|
|
6812
6885
|
getState,
|
|
6813
6886
|
toggleGroupRow,
|
|
6887
|
+
rowSpan,
|
|
6814
6888
|
verticalBrain: verticalVirtualBrain,
|
|
6815
6889
|
columns,
|
|
6816
6890
|
columnsWidth
|
|
@@ -6873,9 +6947,9 @@ function usePinnedStartRendering(params) {
|
|
|
6873
6947
|
import { useEffect as useEffect21 } from "react";
|
|
6874
6948
|
|
|
6875
6949
|
// src/components/hooks/useOnce.ts
|
|
6876
|
-
import { useMemo as
|
|
6950
|
+
import { useMemo as useMemo11 } from "react";
|
|
6877
6951
|
function useOnce(fn) {
|
|
6878
|
-
const onceFn =
|
|
6952
|
+
const onceFn = useMemo11(() => {
|
|
6879
6953
|
return once(fn);
|
|
6880
6954
|
}, []);
|
|
6881
6955
|
return onceFn();
|
|
@@ -7174,7 +7248,7 @@ var VirtualBrain = class extends Logger {
|
|
|
7174
7248
|
this.computeCacheFor(lastSizeIndex);
|
|
7175
7249
|
_prev = lastOffset;
|
|
7176
7250
|
lastOffset = this.itemOffsetCache[lastSizeIndex];
|
|
7177
|
-
if (_prev === lastOffset) {
|
|
7251
|
+
if (_prev === lastOffset && _prev != 0) {
|
|
7178
7252
|
return count - 1;
|
|
7179
7253
|
}
|
|
7180
7254
|
}
|
|
@@ -7318,11 +7392,12 @@ var VirtualBrain = class extends Logger {
|
|
|
7318
7392
|
|
|
7319
7393
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
7320
7394
|
import { useCallback as useCallback16 } from "react";
|
|
7395
|
+
var debug5 = dbg("useColumnSizeFn");
|
|
7321
7396
|
function useColumnSizeFn(computedUnpinnedColumns) {
|
|
7322
7397
|
const columnSize = useCallback16((index) => {
|
|
7323
7398
|
const column = computedUnpinnedColumns[index];
|
|
7324
7399
|
if (!column) {
|
|
7325
|
-
|
|
7400
|
+
debug5("cannot find column at index", index, computedUnpinnedColumns);
|
|
7326
7401
|
}
|
|
7327
7402
|
return column ? column.computedWidth : 0;
|
|
7328
7403
|
}, [computedUnpinnedColumns]);
|
|
@@ -7366,6 +7441,10 @@ function useYourBrain(param) {
|
|
|
7366
7441
|
}, []);
|
|
7367
7442
|
horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
|
|
7368
7443
|
verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
|
|
7444
|
+
if (true) {
|
|
7445
|
+
globalThis.verticalVirtualBrain = verticalVirtualBrain;
|
|
7446
|
+
globalThis.horizontalVirtualBrain = horizontalVirtualBrain;
|
|
7447
|
+
}
|
|
7369
7448
|
useEffect21(() => {
|
|
7370
7449
|
verticalVirtualBrain.setAvailableSize({
|
|
7371
7450
|
height: bodySize.height,
|
|
@@ -7397,7 +7476,7 @@ function useListRendering(param) {
|
|
|
7397
7476
|
computedUnpinnedColumnsWidth,
|
|
7398
7477
|
computedPinnedStartOverflow,
|
|
7399
7478
|
computedPinnedEndOverflow,
|
|
7400
|
-
|
|
7479
|
+
rowSpan,
|
|
7401
7480
|
toggleGroupRow
|
|
7402
7481
|
} = computed;
|
|
7403
7482
|
const { componentState: dataSourceState, getState: getDataSourceState } = useDataSourceContextValue();
|
|
@@ -7416,32 +7495,6 @@ function useListRendering(param) {
|
|
|
7416
7495
|
repaintIdRef.current++;
|
|
7417
7496
|
}
|
|
7418
7497
|
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
7498
|
const { horizontalVirtualBrain, verticalVirtualBrain } = useYourBrain({
|
|
7446
7499
|
computedPinnedStartWidth: computed.computedPinnedStartWidth,
|
|
7447
7500
|
computedPinnedEndWidth: computed.computedPinnedEndWidth,
|
|
@@ -7454,7 +7507,7 @@ function useListRendering(param) {
|
|
|
7454
7507
|
const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
|
|
7455
7508
|
const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
7456
7509
|
const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
|
|
7457
|
-
const scrollbars =
|
|
7510
|
+
const scrollbars = useMemo12(() => ({
|
|
7458
7511
|
vertical: hasVerticalScrollbar,
|
|
7459
7512
|
horizontal: hasHorizontalScrollbar
|
|
7460
7513
|
}), [hasVerticalScrollbar, hasHorizontalScrollbar]);
|
|
@@ -7502,7 +7555,8 @@ function useListRendering(param) {
|
|
|
7502
7555
|
rowHeight,
|
|
7503
7556
|
verticalVirtualBrain,
|
|
7504
7557
|
pinnedStartScrollListener,
|
|
7505
|
-
pinnedEndScrollListener
|
|
7558
|
+
pinnedEndScrollListener,
|
|
7559
|
+
rowSpan
|
|
7506
7560
|
};
|
|
7507
7561
|
const centerRenderingParams = __spreadProps(__spreadValues({}, pinnedRenderingParams), {
|
|
7508
7562
|
columnShifts,
|
|
@@ -7618,7 +7672,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
7618
7672
|
});
|
|
7619
7673
|
|
|
7620
7674
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
7621
|
-
import { useMemo as
|
|
7675
|
+
import { useMemo as useMemo13 } from "react";
|
|
7622
7676
|
|
|
7623
7677
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
7624
7678
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -7763,17 +7817,25 @@ var decode = (licenseKey) => {
|
|
|
7763
7817
|
};
|
|
7764
7818
|
|
|
7765
7819
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
7766
|
-
var
|
|
7820
|
+
var SANDPACK_REGEX = /(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g;
|
|
7821
|
+
var SANDBOX_REGEX = /(https):\/\/\S+(\.csb\.app)/g;
|
|
7767
7822
|
var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
7768
|
-
var
|
|
7769
|
-
|
|
7823
|
+
var isInsideSandpack = () => {
|
|
7824
|
+
const [_fullUrl, protocol, sandpackUrl] = Array.from(SANDPACK_REGEX.exec(origin) || []);
|
|
7825
|
+
return protocol === "https" && sandpackUrl === "sandpack.codesandbox.io";
|
|
7826
|
+
};
|
|
7827
|
+
var isInsideSandbox = () => {
|
|
7828
|
+
const [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
|
|
7829
|
+
return protocol === "https" && sandboxUrl === ".csb.app";
|
|
7830
|
+
};
|
|
7831
|
+
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
7770
7832
|
var useLicense = (licenseKey = "") => {
|
|
7771
|
-
const valid =
|
|
7833
|
+
const valid = useMemo13(() => {
|
|
7772
7834
|
let valid2 = isValidLicense(licenseKey, {
|
|
7773
7835
|
publishedAt: 1624970570587,
|
|
7774
|
-
version: "0.2.
|
|
7836
|
+
version: "0.2.9"
|
|
7775
7837
|
});
|
|
7776
|
-
if (!licenseKey && !valid2 &&
|
|
7838
|
+
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
7777
7839
|
return true;
|
|
7778
7840
|
}
|
|
7779
7841
|
return valid2;
|
|
@@ -7789,7 +7851,7 @@ import {
|
|
|
7789
7851
|
} from "react";
|
|
7790
7852
|
import { useRef as useRef19 } from "react";
|
|
7791
7853
|
var error = err("CSSVariableWatch");
|
|
7792
|
-
var
|
|
7854
|
+
var debug6 = dbg("CSSVariableWatch");
|
|
7793
7855
|
var WRAPPER_STYLE = {
|
|
7794
7856
|
position: "absolute",
|
|
7795
7857
|
pointerEvents: "none",
|
|
@@ -7812,7 +7874,7 @@ var useCSSVariableWatch = (params) => {
|
|
|
7812
7874
|
const value = params.ref.current.getBoundingClientRect().height;
|
|
7813
7875
|
if (value) {
|
|
7814
7876
|
lastValueRef.current = value;
|
|
7815
|
-
|
|
7877
|
+
debug6(`Variable ${params.varName} found and equals ${value}.`);
|
|
7816
7878
|
params.onChange(value);
|
|
7817
7879
|
} else {
|
|
7818
7880
|
error(`Specified variable ${params.varName} not found or does not have a numeric value.`);
|