@infinite-table/infinite-react 7.4.2 → 7.5.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 +1 -1
- package/index.d.ts +2147 -2093
- package/index.dev.js +429 -49
- package/index.dev.mjs +430 -50
- package/index.js +8 -8
- package/index.mjs +8 -8
- package/package.json +2 -2
package/index.dev.mjs
CHANGED
|
@@ -1425,7 +1425,8 @@ var DevToolsTracks = {
|
|
|
1425
1425
|
PrepareData: "Preparing data",
|
|
1426
1426
|
ComputeSelectionCount: "Computing selection count",
|
|
1427
1427
|
ComputeSelectionCountLazy: "Computing selection count (lazy)",
|
|
1428
|
-
PrepareRowInfo: "Preparing row info array"
|
|
1428
|
+
PrepareRowInfo: "Preparing row info array",
|
|
1429
|
+
DiffRowInfoInStore: "setDataArray diffing in RowInfoStore"
|
|
1429
1430
|
}
|
|
1430
1431
|
},
|
|
1431
1432
|
InfiniteTable: {
|
|
@@ -5898,7 +5899,7 @@ import * as React30 from "react";
|
|
|
5898
5899
|
|
|
5899
5900
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5900
5901
|
import * as React29 from "react";
|
|
5901
|
-
import { useCallback as useCallback12, useContext as useContext7, useMemo as useMemo4 } from "react";
|
|
5902
|
+
import { useCallback as useCallback12, useContext as useContext7, useMemo as useMemo4, useSyncExternalStore } from "react";
|
|
5902
5903
|
|
|
5903
5904
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
5904
5905
|
import * as React25 from "react";
|
|
@@ -6194,16 +6195,6 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
6194
6195
|
return generatedGroupColumn;
|
|
6195
6196
|
}
|
|
6196
6197
|
|
|
6197
|
-
// src/components/InfiniteTable/utils/objectValuesExcept.ts
|
|
6198
|
-
function objectValuesExcept(obj, exceptList) {
|
|
6199
|
-
const result = [];
|
|
6200
|
-
for (const k in obj)
|
|
6201
|
-
if (obj.hasOwnProperty(k) && !exceptList.hasOwnProperty(k)) {
|
|
6202
|
-
result.push(obj[k]);
|
|
6203
|
-
}
|
|
6204
|
-
return result;
|
|
6205
|
-
}
|
|
6206
|
-
|
|
6207
6198
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
6208
6199
|
var ColumnCellCls = "_1eexc2a7 _1eexc2a6";
|
|
6209
6200
|
var ColumnCellRecipe = createRuntimeFn({ defaultClassName: "_1eexc2an", variantClassNames: { dragging: { false: "_1eexc2ao", true: "_1eexc2ap" }, insideDisabledDraggingPage: { true: "_1eexc2aq", false: "_1eexc2ar" }, cellSelected: { false: "_1eexc2as", true: "_1eexc2at" }, treeNode: { parent: "_1eexc2au", leaf: "_1eexc2av", false: "_1eexc2aw" }, align: { start: "_1eexc2ax", end: "_1eexc2ay", center: "_1eexc2az" }, verticalAlign: { start: "_1eexc2a10", end: "_1eexc2a11", center: "_1eexc2a12" }, rowActive: { false: "_1eexc2a13", true: "_1eexc2a14" }, groupRow: { false: "_1eexc2a15", true: "_1eexc2a16" }, groupCell: { false: "_1eexc2a17", true: "_1eexc2a18" }, rowDisabled: { false: "_1eexc2a19", true: "_1eexc2a1a" }, zebra: { false: "_1eexc2a1b", even: "_1eexc2a1c", odd: "_1eexc2a1d" }, rowSelected: { true: "_1eexc2a1e", false: "_1eexc2a1f", null: "_1eexc2a1g" }, first: { true: "_1eexc2a1h", false: "_1eexc2a1i" }, last: { true: "_1eexc2a1j", false: "_1eexc2a1k" }, groupByField: { true: "_1eexc2a1l", false: "_1eexc2a1m" }, firstInCategory: { true: "_1eexc2a1n", false: "_1eexc2a1o" }, firstRow: { true: "_1eexc2a1p", false: "_1eexc2a1q" }, firstRowInHorizontalLayoutPage: { true: "_1eexc2a1r", false: "_1eexc2a1s" }, lastInCategory: { true: "_1eexc2a1t", false: "_1eexc2a1u" }, pinned: { start: "_1eexc2a1v", end: "_1eexc2a1w", false: "_1eexc2a1x" }, filtered: { true: "_1eexc2a1y", false: "_1eexc2a1z" } }, defaultVariants: {}, compoundVariants: [[{ firstRowInHorizontalLayoutPage: true, firstRow: false }, "_1eexc2a20"], [{ pinned: "start", lastInCategory: true }, "_1eexc2a21"], [{ pinned: "start", firstInCategory: true }, "_1eexc2a22"], [{ pinned: "end", firstInCategory: true }, "_1eexc2a23"], [{ pinned: "end", lastInCategory: true }, "_1eexc2a24"], [{ align: "center", groupCell: false }, "_1eexc2a25"], [{ rowDisabled: true, zebra: "odd" }, "_1eexc2a26"]] });
|
|
@@ -6777,6 +6768,7 @@ import { useCallback as useCallback10, useRef as useRef9 } from "react";
|
|
|
6777
6768
|
function InfiniteTableColumnEditor() {
|
|
6778
6769
|
const { initialValue, setValue, confirmEdit, cancelEdit, readOnly } = useInfiniteColumnEditor();
|
|
6779
6770
|
const domRef = useRef9(null);
|
|
6771
|
+
const cancelledRef = useRef9(false);
|
|
6780
6772
|
const refCallback = React28.useCallback((node) => {
|
|
6781
6773
|
domRef.current = node;
|
|
6782
6774
|
if (node) {
|
|
@@ -6788,18 +6780,24 @@ function InfiniteTableColumnEditor() {
|
|
|
6788
6780
|
if (key === "Enter" || key === "Tab") {
|
|
6789
6781
|
confirmEdit();
|
|
6790
6782
|
} else if (key === "Escape") {
|
|
6783
|
+
cancelledRef.current = true;
|
|
6791
6784
|
cancelEdit();
|
|
6792
6785
|
} else {
|
|
6793
6786
|
event.stopPropagation();
|
|
6794
6787
|
}
|
|
6795
6788
|
}, []);
|
|
6789
|
+
const onBlur = useCallback10(() => {
|
|
6790
|
+
if (!cancelledRef.current) {
|
|
6791
|
+
confirmEdit();
|
|
6792
|
+
}
|
|
6793
|
+
}, []);
|
|
6796
6794
|
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(
|
|
6797
6795
|
"input",
|
|
6798
6796
|
{
|
|
6799
6797
|
readOnly,
|
|
6800
6798
|
ref: refCallback,
|
|
6801
6799
|
onKeyDown: onKeyDown2,
|
|
6802
|
-
onBlur
|
|
6800
|
+
onBlur,
|
|
6803
6801
|
className: join(absoluteCover, outline.none),
|
|
6804
6802
|
type: "text",
|
|
6805
6803
|
defaultValue: initialValue,
|
|
@@ -6810,6 +6808,16 @@ function InfiniteTableColumnEditor() {
|
|
|
6810
6808
|
));
|
|
6811
6809
|
}
|
|
6812
6810
|
|
|
6811
|
+
// src/components/InfiniteTable/utils/objectValuesExcept.ts
|
|
6812
|
+
function objectValuesExcept(obj, exceptList) {
|
|
6813
|
+
const result = [];
|
|
6814
|
+
for (const k in obj)
|
|
6815
|
+
if (obj.hasOwnProperty(k) && !exceptList.hasOwnProperty(k)) {
|
|
6816
|
+
result.push(obj[k]);
|
|
6817
|
+
}
|
|
6818
|
+
return result;
|
|
6819
|
+
}
|
|
6820
|
+
|
|
6813
6821
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
6814
6822
|
var columnZIndexAtIndex3 = stripVar(InternalVars.columnZIndexAtIndex);
|
|
6815
6823
|
var columnVisibilityAtIndex2 = stripVar(InternalVars.columnVisibilityAtIndex);
|
|
@@ -6904,7 +6912,8 @@ function applyColumnStyle(existingStyle, columnStyle, param) {
|
|
|
6904
6912
|
}
|
|
6905
6913
|
function InfiniteTableColumnCellFn(props) {
|
|
6906
6914
|
const {
|
|
6907
|
-
|
|
6915
|
+
dataSourceStatePartialForCell,
|
|
6916
|
+
rowInfoStore,
|
|
6908
6917
|
rowStyle,
|
|
6909
6918
|
rowClassName,
|
|
6910
6919
|
rowIndexInHorizontalLayoutPage,
|
|
@@ -6926,8 +6935,30 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
6926
6935
|
fieldsToColumn,
|
|
6927
6936
|
domRef: initialDomRef,
|
|
6928
6937
|
hidden,
|
|
6929
|
-
showZebraRows
|
|
6938
|
+
showZebraRows,
|
|
6939
|
+
// DataSource context values passed as props
|
|
6940
|
+
getDataSourceState,
|
|
6941
|
+
dataSourceApi,
|
|
6942
|
+
dataSourceActions,
|
|
6943
|
+
// InfiniteTable context values passed as props
|
|
6944
|
+
getState,
|
|
6945
|
+
imperativeApi,
|
|
6946
|
+
componentActions,
|
|
6947
|
+
getComputed,
|
|
6948
|
+
getDataSourceMasterContext
|
|
6930
6949
|
} = props;
|
|
6950
|
+
const rowInfoFromStore = useSyncExternalStore(
|
|
6951
|
+
useCallback12(
|
|
6952
|
+
(callback) => rowInfoStore.subscribeToRowIndex(rowIndex, callback),
|
|
6953
|
+
[rowInfoStore, rowIndex]
|
|
6954
|
+
),
|
|
6955
|
+
useCallback12(
|
|
6956
|
+
() => rowInfoStore.getRowInfoAtIndex(rowIndex),
|
|
6957
|
+
[rowInfoStore, rowIndex]
|
|
6958
|
+
)
|
|
6959
|
+
);
|
|
6960
|
+
const isEmptyRowInfo = !rowInfoFromStore;
|
|
6961
|
+
const isEmptyColumn = !column;
|
|
6931
6962
|
const htmlElementRef = React29.useRef(null);
|
|
6932
6963
|
const domRef = useCallback12(
|
|
6933
6964
|
(node) => {
|
|
@@ -6938,23 +6969,25 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
6938
6969
|
},
|
|
6939
6970
|
[initialDomRef]
|
|
6940
6971
|
);
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6972
|
+
const rowInfo = rowInfoFromStore ?? {
|
|
6973
|
+
id: "",
|
|
6974
|
+
indexInAll: rowIndex,
|
|
6975
|
+
rowSelected: false,
|
|
6976
|
+
rowDisabled: false,
|
|
6977
|
+
isCellSelected: () => false,
|
|
6978
|
+
hasSelectedCells: () => false,
|
|
6979
|
+
isGroupRow: false,
|
|
6980
|
+
isTreeNode: false,
|
|
6981
|
+
isParentNode: false,
|
|
6982
|
+
treeNesting: 0,
|
|
6983
|
+
nodePath: [],
|
|
6984
|
+
collapsed: false,
|
|
6985
|
+
dataSourceHasGrouping: false,
|
|
6986
|
+
selfLoaded: true,
|
|
6987
|
+
data: {}
|
|
6988
|
+
};
|
|
6944
6989
|
const { rowSelected } = rowInfo;
|
|
6945
|
-
const
|
|
6946
|
-
getState,
|
|
6947
|
-
actions: componentActions,
|
|
6948
|
-
computed,
|
|
6949
|
-
api: imperativeApi,
|
|
6950
|
-
getDataSourceMasterContext
|
|
6951
|
-
} = useInfiniteTable();
|
|
6952
|
-
const {
|
|
6953
|
-
componentState: dataSourceState,
|
|
6954
|
-
getState: getDataSourceState,
|
|
6955
|
-
api: dataSourceApi,
|
|
6956
|
-
componentActions: dataSourceActions
|
|
6957
|
-
} = useDataSourceContextValue();
|
|
6990
|
+
const computed = getComputed();
|
|
6958
6991
|
const { activeRowIndex, keyboardNavigation, columnReorderInPageIndex } = getState();
|
|
6959
6992
|
const rowActive = rowIndex === activeRowIndex && keyboardNavigation === "row";
|
|
6960
6993
|
const renderingContext = {
|
|
@@ -7039,7 +7072,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
7039
7072
|
},
|
|
7040
7073
|
[rowIndex, rowDisabled, column.computedVisibleIndex, keyboardNavigation]
|
|
7041
7074
|
);
|
|
7042
|
-
const { selectionMode, cellSelection, isNodeReadOnly: isNodeReadOnly2 } =
|
|
7075
|
+
const { selectionMode, cellSelection, isNodeReadOnly: isNodeReadOnly2 } = dataSourceStatePartialForCell;
|
|
7043
7076
|
const cellSelected = renderParam.cellSelected;
|
|
7044
7077
|
renderParam.domRef = domRef;
|
|
7045
7078
|
renderParam.htmlElementRef = htmlElementRef;
|
|
@@ -7398,6 +7431,9 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
7398
7431
|
renderChildren: useCallback12(() => theChildren, [renderChildren])
|
|
7399
7432
|
};
|
|
7400
7433
|
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
7434
|
+
if (isEmptyColumn || isEmptyRowInfo) {
|
|
7435
|
+
return /* @__PURE__ */ React29.createElement("div", { ref: domRef, style: { display: "none" } });
|
|
7436
|
+
}
|
|
7401
7437
|
return (
|
|
7402
7438
|
// this context is here for supporting useInfiniteColumnCell to be used
|
|
7403
7439
|
// with a custom column component, specified via column.components.ColumnCell
|
|
@@ -10006,10 +10042,10 @@ var GridCellForReact = class {
|
|
|
10006
10042
|
constructor(debugId, cellInfo) {
|
|
10007
10043
|
this.element = null;
|
|
10008
10044
|
this.mounted = false;
|
|
10009
|
-
this.
|
|
10045
|
+
this.IS_UPDATED_WHILE_SCROLLING_IN_HORIZONTAL_LAYOUT = false;
|
|
10010
10046
|
this.mountSubscription = buildSubscriptionCallback();
|
|
10011
10047
|
this.isUpdatedWhileScrolling = () => {
|
|
10012
|
-
return this.
|
|
10048
|
+
return this.IS_UPDATED_WHILE_SCROLLING_IN_HORIZONTAL_LAYOUT;
|
|
10013
10049
|
};
|
|
10014
10050
|
const count = CELL_COUNT_BY_DEBUG_ID.get(debugId) ?? 0;
|
|
10015
10051
|
const key = `${debugId}:GridCellReact:${count}`;
|
|
@@ -10058,7 +10094,7 @@ var GridCellForReact = class {
|
|
|
10058
10094
|
return this.node;
|
|
10059
10095
|
}
|
|
10060
10096
|
update(content, additionalInfo, scrollingObjectParam) {
|
|
10061
|
-
this.
|
|
10097
|
+
this.IS_UPDATED_WHILE_SCROLLING_IN_HORIZONTAL_LAYOUT = scrollingObjectParam ? scrollingObjectParam.scrolling && scrollingObjectParam.isHorizontalLayout : false;
|
|
10062
10098
|
this.updater(content);
|
|
10063
10099
|
this.cellInfo = additionalInfo;
|
|
10064
10100
|
}
|
|
@@ -10941,7 +10977,8 @@ var columnOffsetAtIndexWhileReordering2 = stripVar(
|
|
|
10941
10977
|
InternalVars.columnOffsetAtIndexWhileReordering
|
|
10942
10978
|
);
|
|
10943
10979
|
var SCROLLING_OBJECT_PARAM_FLYWEIGHT = {
|
|
10944
|
-
scrolling: false
|
|
10980
|
+
scrolling: false,
|
|
10981
|
+
isHorizontalLayout: false
|
|
10945
10982
|
};
|
|
10946
10983
|
var GridRenderer = class extends Logger {
|
|
10947
10984
|
constructor(brain, debugId) {
|
|
@@ -11381,6 +11418,14 @@ var GridRenderer = class extends Logger {
|
|
|
11381
11418
|
const covered = coveredByAnotherRow || coveredByAnotherCol;
|
|
11382
11419
|
return covered ? [rowspanParent, colspanParent] : false;
|
|
11383
11420
|
};
|
|
11421
|
+
this.onMouseEnterNotBound = (event) => {
|
|
11422
|
+
const rowIndex = Number(event.target.dataset.rowIndex);
|
|
11423
|
+
this.onMouseEnter(rowIndex);
|
|
11424
|
+
};
|
|
11425
|
+
this.onMouseLeaveNotBound = (event) => {
|
|
11426
|
+
const rowIndex = Number(event.target.dataset.rowIndex);
|
|
11427
|
+
this.onMouseLeave(rowIndex);
|
|
11428
|
+
};
|
|
11384
11429
|
this.onMouseEnter = (rowIndex) => {
|
|
11385
11430
|
this.lastEnteredRow = rowIndex;
|
|
11386
11431
|
this.lastExitedRow = -1;
|
|
@@ -12070,8 +12115,12 @@ var GridRenderer = class extends Logger {
|
|
|
12070
12115
|
hidden,
|
|
12071
12116
|
heightWithRowspan,
|
|
12072
12117
|
widthWithColspan,
|
|
12073
|
-
onMouseEnter: this.onMouseEnter.bind(null, rowIndex),
|
|
12074
|
-
|
|
12118
|
+
// onMouseEnter: this.onMouseEnter.bind(null, rowIndex),
|
|
12119
|
+
onMouseEnter: this.onMouseEnterNotBound,
|
|
12120
|
+
//.bind(null, rowIndex),
|
|
12121
|
+
// onMouseLeave: this.onMouseLeave.bind(null, rowIndex),
|
|
12122
|
+
onMouseLeave: this.onMouseLeaveNotBound,
|
|
12123
|
+
//.bind(null, rowIndex),
|
|
12075
12124
|
domRef: cell.ref
|
|
12076
12125
|
});
|
|
12077
12126
|
if (!cell.isMounted()) {
|
|
@@ -12089,8 +12138,9 @@ var GridRenderer = class extends Logger {
|
|
|
12089
12138
|
renderRowIndex,
|
|
12090
12139
|
renderColIndex
|
|
12091
12140
|
} : void 0;
|
|
12141
|
+
const isHorizontalLayout = this.brain.isHorizontalLayoutBrain;
|
|
12092
12142
|
if (!renderedNode) {
|
|
12093
|
-
if (
|
|
12143
|
+
if (isHorizontalLayout) {
|
|
12094
12144
|
this.cellManager.detachCell(cell);
|
|
12095
12145
|
} else {
|
|
12096
12146
|
this.cellManager.detachCell(cell);
|
|
@@ -12098,6 +12148,7 @@ var GridRenderer = class extends Logger {
|
|
|
12098
12148
|
return;
|
|
12099
12149
|
}
|
|
12100
12150
|
SCROLLING_OBJECT_PARAM_FLYWEIGHT.scrolling = this.scrolling;
|
|
12151
|
+
SCROLLING_OBJECT_PARAM_FLYWEIGHT.isHorizontalLayout = isHorizontalLayout;
|
|
12101
12152
|
this.cellManager.renderNodeAtCell(
|
|
12102
12153
|
renderedNode,
|
|
12103
12154
|
cell,
|
|
@@ -19763,6 +19814,9 @@ function concludeReducer(params) {
|
|
|
19763
19814
|
treeMutations: treeMutations?.size ? treeMutations : void 0
|
|
19764
19815
|
};
|
|
19765
19816
|
}
|
|
19817
|
+
state.rowInfoStore.notifyDataArray(rowInfoDataArray, {
|
|
19818
|
+
marker: debugId ? getMarker(debugId).track.DataSource.label.DiffRowInfoInStore : void 0
|
|
19819
|
+
});
|
|
19766
19820
|
if (rootMarker) {
|
|
19767
19821
|
rootMarker?.track.DataSource.label.PrepareData.end({
|
|
19768
19822
|
details: [
|
|
@@ -20617,6 +20671,279 @@ var normalizeSortInfo = (initialSortInfo, weakMap3) => {
|
|
|
20617
20671
|
return result;
|
|
20618
20672
|
};
|
|
20619
20673
|
|
|
20674
|
+
// src/components/DataSource/RowInfoStore.ts
|
|
20675
|
+
function deepEqual(a, b) {
|
|
20676
|
+
if (a === b) return true;
|
|
20677
|
+
if (a == null || b == null) return a === b;
|
|
20678
|
+
if (typeof a !== typeof b) return false;
|
|
20679
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
20680
|
+
if (a.length !== b.length) return false;
|
|
20681
|
+
for (let i = 0, len = a.length; i < len; i++) {
|
|
20682
|
+
if (!deepEqual(a[i], b[i])) return false;
|
|
20683
|
+
}
|
|
20684
|
+
return true;
|
|
20685
|
+
}
|
|
20686
|
+
if (typeof a === "object") {
|
|
20687
|
+
const keysA = Object.keys(a);
|
|
20688
|
+
const keysB = Object.keys(b);
|
|
20689
|
+
if (keysA.length !== keysB.length) return false;
|
|
20690
|
+
for (const key of keysA) {
|
|
20691
|
+
if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
|
|
20692
|
+
if (!deepEqual(a[key], b[key])) return false;
|
|
20693
|
+
}
|
|
20694
|
+
return true;
|
|
20695
|
+
}
|
|
20696
|
+
return false;
|
|
20697
|
+
}
|
|
20698
|
+
function isSameRowInfoType(one, two) {
|
|
20699
|
+
if (one === void 0 || two === void 0) return false;
|
|
20700
|
+
if (one.isGroupRow !== two.isGroupRow) return false;
|
|
20701
|
+
if (one.dataSourceHasGrouping !== two.dataSourceHasGrouping) return false;
|
|
20702
|
+
if (one.isTreeNode !== two.isTreeNode) return false;
|
|
20703
|
+
if (one.isTreeNode) {
|
|
20704
|
+
if (one.isParentNode !== two.isParentNode)
|
|
20705
|
+
return false;
|
|
20706
|
+
}
|
|
20707
|
+
return true;
|
|
20708
|
+
}
|
|
20709
|
+
var rowInfoBase_KeysRecord = {
|
|
20710
|
+
id: true,
|
|
20711
|
+
value: true,
|
|
20712
|
+
indexInAll: true,
|
|
20713
|
+
rowSelected: true,
|
|
20714
|
+
rowDisabled: true,
|
|
20715
|
+
isCellSelected: false,
|
|
20716
|
+
hasSelectedCells: false
|
|
20717
|
+
};
|
|
20718
|
+
var rowInfo_NoGrouping_RowInfoNormal_KeysRecord = {
|
|
20719
|
+
...rowInfoBase_KeysRecord,
|
|
20720
|
+
dataSourceHasGrouping: true,
|
|
20721
|
+
isTreeNode: true,
|
|
20722
|
+
data: false,
|
|
20723
|
+
isGroupRow: true,
|
|
20724
|
+
selfLoaded: true
|
|
20725
|
+
};
|
|
20726
|
+
var rowInfo_HasGrouping_RowInfoBase_KeysRecord = {
|
|
20727
|
+
indexInGroup: true,
|
|
20728
|
+
groupKeys: true,
|
|
20729
|
+
groupBy: true,
|
|
20730
|
+
rootGroupBy: true,
|
|
20731
|
+
parents: false,
|
|
20732
|
+
indexInParentGroups: true,
|
|
20733
|
+
groupCount: true,
|
|
20734
|
+
groupNesting: true,
|
|
20735
|
+
collapsed: true,
|
|
20736
|
+
selfLoaded: true
|
|
20737
|
+
};
|
|
20738
|
+
var rowInfo_HasGrouping_RowInfoGroup_KeysRecord = {
|
|
20739
|
+
...rowInfoBase_KeysRecord,
|
|
20740
|
+
...rowInfo_HasGrouping_RowInfoBase_KeysRecord,
|
|
20741
|
+
dataSourceHasGrouping: true,
|
|
20742
|
+
isTreeNode: true,
|
|
20743
|
+
data: false,
|
|
20744
|
+
reducerData: true,
|
|
20745
|
+
isGroupRow: true,
|
|
20746
|
+
duplicateOf: false,
|
|
20747
|
+
deepRowInfoArray: false,
|
|
20748
|
+
error: true,
|
|
20749
|
+
reducerResults: true,
|
|
20750
|
+
groupCount: true,
|
|
20751
|
+
groupData: true,
|
|
20752
|
+
selectedChildredCount: true,
|
|
20753
|
+
deselectedChildredCount: true,
|
|
20754
|
+
totalChildrenCount: true,
|
|
20755
|
+
collapsedChildrenCount: true,
|
|
20756
|
+
collapsedGroupsCount: true,
|
|
20757
|
+
directChildrenCount: true,
|
|
20758
|
+
directChildrenLoadedCount: true,
|
|
20759
|
+
pivotValuesMap: true,
|
|
20760
|
+
childrenAvailable: true,
|
|
20761
|
+
childrenLoading: true
|
|
20762
|
+
};
|
|
20763
|
+
var rowInfo_Tree_RowInfoBase_KeysRecord = {
|
|
20764
|
+
isTreeNode: true,
|
|
20765
|
+
isParentNode: true,
|
|
20766
|
+
indexInParent: true,
|
|
20767
|
+
nodePath: true,
|
|
20768
|
+
parentNodes: false,
|
|
20769
|
+
indexInParentNodes: true,
|
|
20770
|
+
totalLeafNodesCount: true,
|
|
20771
|
+
collapsedLeafNodesCount: true,
|
|
20772
|
+
treeNesting: true,
|
|
20773
|
+
selfLoaded: true
|
|
20774
|
+
};
|
|
20775
|
+
var rowInfo_Tree_RowInfoLeafNode_KeysRecord = {
|
|
20776
|
+
...rowInfoBase_KeysRecord,
|
|
20777
|
+
...rowInfo_Tree_RowInfoBase_KeysRecord,
|
|
20778
|
+
dataSourceHasGrouping: true,
|
|
20779
|
+
isTreeNode: true,
|
|
20780
|
+
isGroupRow: true,
|
|
20781
|
+
isParentNode: true,
|
|
20782
|
+
data: false
|
|
20783
|
+
};
|
|
20784
|
+
var rowInfo_Tree_RowInfoParentNode_KeysRecord = {
|
|
20785
|
+
...rowInfoBase_KeysRecord,
|
|
20786
|
+
...rowInfo_Tree_RowInfoBase_KeysRecord,
|
|
20787
|
+
dataSourceHasGrouping: true,
|
|
20788
|
+
isParentNode: true,
|
|
20789
|
+
isGroupRow: true,
|
|
20790
|
+
nodeExpanded: true,
|
|
20791
|
+
selfExpanded: true,
|
|
20792
|
+
data: false,
|
|
20793
|
+
selectedLeafNodesCount: true,
|
|
20794
|
+
deepRowInfoArray: false,
|
|
20795
|
+
deselectedLeafNodesCount: true,
|
|
20796
|
+
duplicateOf: false
|
|
20797
|
+
};
|
|
20798
|
+
var rowInfoKeys_noGrouping = Object.entries(
|
|
20799
|
+
rowInfo_NoGrouping_RowInfoNormal_KeysRecord
|
|
20800
|
+
).map(([key, value]) => value ? key : void 0).filter(Boolean);
|
|
20801
|
+
var rowInfoKeys_hasGrouping_normalRow = Object.entries(
|
|
20802
|
+
rowInfo_NoGrouping_RowInfoNormal_KeysRecord
|
|
20803
|
+
).map(
|
|
20804
|
+
([key, value]) => value ? key : void 0
|
|
20805
|
+
);
|
|
20806
|
+
var rowInfoKeys_hasGrouping_groupRow = Object.entries(
|
|
20807
|
+
rowInfo_HasGrouping_RowInfoGroup_KeysRecord
|
|
20808
|
+
).map(
|
|
20809
|
+
([key, value]) => value ? key : void 0
|
|
20810
|
+
);
|
|
20811
|
+
var rowInfoKeys_tree_leafNode = Object.entries(
|
|
20812
|
+
rowInfo_Tree_RowInfoLeafNode_KeysRecord
|
|
20813
|
+
).map(
|
|
20814
|
+
([key, value]) => value ? key : void 0
|
|
20815
|
+
);
|
|
20816
|
+
var rowInfoKeys_tree_parentNode = Object.entries(
|
|
20817
|
+
rowInfo_Tree_RowInfoParentNode_KeysRecord
|
|
20818
|
+
).map(
|
|
20819
|
+
([key, value]) => value ? key : void 0
|
|
20820
|
+
);
|
|
20821
|
+
function deepEqualRowInfo(oldRowInfo, newRowInfo) {
|
|
20822
|
+
if (oldRowInfo === newRowInfo) return true;
|
|
20823
|
+
if (!oldRowInfo || !newRowInfo) {
|
|
20824
|
+
return false;
|
|
20825
|
+
}
|
|
20826
|
+
if (!isSameRowInfoType(oldRowInfo, newRowInfo)) {
|
|
20827
|
+
return false;
|
|
20828
|
+
}
|
|
20829
|
+
if (oldRowInfo.id !== newRowInfo.id) return false;
|
|
20830
|
+
if (oldRowInfo.data !== newRowInfo.data) {
|
|
20831
|
+
if (!deepEqual(oldRowInfo.data, newRowInfo.data)) {
|
|
20832
|
+
return false;
|
|
20833
|
+
}
|
|
20834
|
+
}
|
|
20835
|
+
let allKeys = [];
|
|
20836
|
+
if (!oldRowInfo.dataSourceHasGrouping) {
|
|
20837
|
+
if (oldRowInfo.isTreeNode) {
|
|
20838
|
+
allKeys = oldRowInfo.isTreeNode && oldRowInfo.isParentNode ? rowInfoKeys_tree_parentNode : rowInfoKeys_tree_leafNode;
|
|
20839
|
+
} else {
|
|
20840
|
+
allKeys = rowInfoKeys_noGrouping;
|
|
20841
|
+
}
|
|
20842
|
+
} else {
|
|
20843
|
+
allKeys = oldRowInfo.isGroupRow ? rowInfoKeys_hasGrouping_groupRow : rowInfoKeys_hasGrouping_normalRow;
|
|
20844
|
+
}
|
|
20845
|
+
for (const key of allKeys) {
|
|
20846
|
+
const oldValue = oldRowInfo[key];
|
|
20847
|
+
const newValue = newRowInfo[key];
|
|
20848
|
+
if (typeof oldValue === "function" || typeof newValue === "function") {
|
|
20849
|
+
continue;
|
|
20850
|
+
}
|
|
20851
|
+
if (!deepEqual(oldValue, newValue)) {
|
|
20852
|
+
return false;
|
|
20853
|
+
}
|
|
20854
|
+
}
|
|
20855
|
+
return true;
|
|
20856
|
+
}
|
|
20857
|
+
function createRowInfoStore() {
|
|
20858
|
+
let dataArray = [];
|
|
20859
|
+
const subscribers = /* @__PURE__ */ new Map();
|
|
20860
|
+
const notifyDataArray = (newDataArray, params) => {
|
|
20861
|
+
const oldDataArray = dataArray;
|
|
20862
|
+
const marker = params?.marker;
|
|
20863
|
+
if (marker) {
|
|
20864
|
+
marker.start({
|
|
20865
|
+
details: [
|
|
20866
|
+
{ name: "new dataArray length", value: newDataArray.length },
|
|
20867
|
+
{
|
|
20868
|
+
name: "old dataArray length",
|
|
20869
|
+
value: oldDataArray.length
|
|
20870
|
+
}
|
|
20871
|
+
]
|
|
20872
|
+
});
|
|
20873
|
+
}
|
|
20874
|
+
const changedIndices = [];
|
|
20875
|
+
const subscribedRowIndexes = getSubscribedRowIndexes();
|
|
20876
|
+
for (const index of subscribedRowIndexes) {
|
|
20877
|
+
const oldRowInfo = oldDataArray[index];
|
|
20878
|
+
const newRowInfo = newDataArray[index];
|
|
20879
|
+
if (newRowInfo === void 0) {
|
|
20880
|
+
changedIndices.push(index);
|
|
20881
|
+
continue;
|
|
20882
|
+
}
|
|
20883
|
+
if (!deepEqualRowInfo(oldRowInfo, newRowInfo)) {
|
|
20884
|
+
changedIndices.push(index);
|
|
20885
|
+
}
|
|
20886
|
+
}
|
|
20887
|
+
dataArray = newDataArray;
|
|
20888
|
+
if (changedIndices.length > 0) {
|
|
20889
|
+
queueMicrotask(() => {
|
|
20890
|
+
console.log("notify", changedIndices);
|
|
20891
|
+
for (let i = 0, len = changedIndices.length; i < len; i++) {
|
|
20892
|
+
const index = changedIndices[i];
|
|
20893
|
+
const indexSubscribers = subscribers.get(index);
|
|
20894
|
+
if (indexSubscribers) {
|
|
20895
|
+
for (const callback of indexSubscribers) {
|
|
20896
|
+
callback();
|
|
20897
|
+
}
|
|
20898
|
+
}
|
|
20899
|
+
}
|
|
20900
|
+
});
|
|
20901
|
+
}
|
|
20902
|
+
if (marker) {
|
|
20903
|
+
marker.end({
|
|
20904
|
+
details: [{ name: "updated row infos", value: changedIndices.length }]
|
|
20905
|
+
});
|
|
20906
|
+
}
|
|
20907
|
+
};
|
|
20908
|
+
const getRowInfoAtIndex = (index) => {
|
|
20909
|
+
return dataArray[index];
|
|
20910
|
+
};
|
|
20911
|
+
const subscribeToRowIndex = (rowIndex, callback) => {
|
|
20912
|
+
let indexSubscribers = subscribers.get(rowIndex);
|
|
20913
|
+
if (!indexSubscribers) {
|
|
20914
|
+
indexSubscribers = /* @__PURE__ */ new Set();
|
|
20915
|
+
subscribers.set(rowIndex, indexSubscribers);
|
|
20916
|
+
}
|
|
20917
|
+
indexSubscribers.add(callback);
|
|
20918
|
+
return () => {
|
|
20919
|
+
const subs = subscribers.get(rowIndex);
|
|
20920
|
+
if (subs) {
|
|
20921
|
+
subs.delete(callback);
|
|
20922
|
+
if (subs.size === 0) {
|
|
20923
|
+
subscribers.delete(rowIndex);
|
|
20924
|
+
}
|
|
20925
|
+
}
|
|
20926
|
+
};
|
|
20927
|
+
};
|
|
20928
|
+
const getSubscribedRowIndexes = () => {
|
|
20929
|
+
return Array.from(subscribers.keys());
|
|
20930
|
+
};
|
|
20931
|
+
const getDataArray = () => {
|
|
20932
|
+
return dataArray;
|
|
20933
|
+
};
|
|
20934
|
+
const clear = () => {
|
|
20935
|
+
dataArray = [];
|
|
20936
|
+
subscribers.clear();
|
|
20937
|
+
};
|
|
20938
|
+
return {
|
|
20939
|
+
notifyDataArray,
|
|
20940
|
+
getRowInfoAtIndex,
|
|
20941
|
+
subscribeToRowIndex,
|
|
20942
|
+
getDataArray,
|
|
20943
|
+
clear
|
|
20944
|
+
};
|
|
20945
|
+
}
|
|
20946
|
+
|
|
20620
20947
|
// src/components/DataSource/state/getInitialState.ts
|
|
20621
20948
|
var defaultCursorId = Symbol("cursorId");
|
|
20622
20949
|
var isNodeReadOnly = (rowInfo) => {
|
|
@@ -20636,6 +20963,7 @@ function initSetupState(props) {
|
|
|
20636
20963
|
debugTimings: /* @__PURE__ */ new Map(),
|
|
20637
20964
|
debugWarnings: /* @__PURE__ */ new Map(),
|
|
20638
20965
|
devToolsDetected: !!globalThis.__INFINITE_TABLE_DEVTOOLS_HOOK__,
|
|
20966
|
+
rowInfoStore: createRowInfoStore(),
|
|
20639
20967
|
// TODO cleanup indexer on unmount
|
|
20640
20968
|
indexer: new Indexer(),
|
|
20641
20969
|
totalLeafNodesCount: 0,
|
|
@@ -20736,6 +21064,7 @@ var cleanupDataSource = (state) => {
|
|
|
20736
21064
|
state.treeSelectionState?.destroy();
|
|
20737
21065
|
state.idToPathMap.clear();
|
|
20738
21066
|
state.idToIndexMap.clear();
|
|
21067
|
+
state.rowInfoStore.clear();
|
|
20739
21068
|
};
|
|
20740
21069
|
var forwardProps3 = (setupState, props) => {
|
|
20741
21070
|
return {
|
|
@@ -23296,7 +23625,9 @@ var InfiniteTableApiImpl = class {
|
|
|
23296
23625
|
}
|
|
23297
23626
|
set scrollLeft(scrollLeft2) {
|
|
23298
23627
|
const state = this.getState();
|
|
23299
|
-
state.scrollerDOMRef.current
|
|
23628
|
+
if (state.scrollerDOMRef.current) {
|
|
23629
|
+
state.scrollerDOMRef.current.scrollLeft = Math.max(scrollLeft2, 0);
|
|
23630
|
+
}
|
|
23300
23631
|
}
|
|
23301
23632
|
get scrollTop() {
|
|
23302
23633
|
const state = this.getState();
|
|
@@ -23304,7 +23635,9 @@ var InfiniteTableApiImpl = class {
|
|
|
23304
23635
|
}
|
|
23305
23636
|
set scrollTop(scrollTop2) {
|
|
23306
23637
|
const state = this.getState();
|
|
23307
|
-
state.scrollerDOMRef.current
|
|
23638
|
+
if (state.scrollerDOMRef.current) {
|
|
23639
|
+
state.scrollerDOMRef.current.scrollTop = Math.max(scrollTop2, 0);
|
|
23640
|
+
}
|
|
23308
23641
|
}
|
|
23309
23642
|
scrollRowIntoView(rowIndex, config = { offset: 0 }) {
|
|
23310
23643
|
const state = this.getState();
|
|
@@ -24183,12 +24516,14 @@ function initSetupState2({
|
|
|
24183
24516
|
headerOnRenderUpdater
|
|
24184
24517
|
} = createBrains(debugId, !!wrapRowsHorizontally);
|
|
24185
24518
|
const domRef = createRef();
|
|
24519
|
+
const now = Date.now();
|
|
24186
24520
|
return {
|
|
24187
24521
|
debugWarnings: /* @__PURE__ */ new Map(),
|
|
24188
24522
|
renderer,
|
|
24189
24523
|
onRenderUpdater,
|
|
24190
24524
|
headerRenderer,
|
|
24191
24525
|
headerOnRenderUpdater,
|
|
24526
|
+
updatedAt: now,
|
|
24192
24527
|
devToolsDetected: !!globalThis.__INFINITE_TABLE_DEVTOOLS_HOOK__,
|
|
24193
24528
|
propsCache: /* @__PURE__ */ new Map([]),
|
|
24194
24529
|
lastRowToCollapseRef: { current: null },
|
|
@@ -24475,6 +24810,7 @@ var mapPropsToState = (params) => {
|
|
|
24475
24810
|
}
|
|
24476
24811
|
const isRowDetailEnabled = !rowDetailRenderer ? false : props.isRowDetailEnabled || true;
|
|
24477
24812
|
let result = {
|
|
24813
|
+
updatedAt: Date.now(),
|
|
24478
24814
|
isTree: parentState.isTree,
|
|
24479
24815
|
rowDetailRenderer,
|
|
24480
24816
|
rowDetailState,
|
|
@@ -25695,7 +26031,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
25695
26031
|
}
|
|
25696
26032
|
let valid2 = isValidLicense(licenseKey, {
|
|
25697
26033
|
publishedAt: 1624970570587,
|
|
25698
|
-
version: "7.
|
|
26034
|
+
version: "7.5.0"
|
|
25699
26035
|
});
|
|
25700
26036
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
25701
26037
|
return true;
|
|
@@ -29944,7 +30280,7 @@ var InfiniteTableDetailRow = React73.memo(
|
|
|
29944
30280
|
var SCROLL_BOTTOM_OFFSET = 1;
|
|
29945
30281
|
function useCellRendering(param) {
|
|
29946
30282
|
const { computed, bodySize, imperativeApi } = param;
|
|
29947
|
-
const { actions, state, getState } = useInfiniteTable();
|
|
30283
|
+
const { actions, state, getState, getComputed, getDataSourceMasterContext } = useInfiniteTable();
|
|
29948
30284
|
const {
|
|
29949
30285
|
computedPinnedStartColumns,
|
|
29950
30286
|
computedPinnedEndColumns,
|
|
@@ -29963,7 +30299,13 @@ function useCellRendering(param) {
|
|
|
29963
30299
|
componentActions: dataSourceActions,
|
|
29964
30300
|
api: dataSourceApi
|
|
29965
30301
|
} = useDataSourceContextValue();
|
|
29966
|
-
const {
|
|
30302
|
+
const {
|
|
30303
|
+
dataArray,
|
|
30304
|
+
rowInfoStore,
|
|
30305
|
+
selectionMode,
|
|
30306
|
+
cellSelection,
|
|
30307
|
+
isNodeReadOnly: isNodeReadOnly2
|
|
30308
|
+
} = dataSourceState;
|
|
29967
30309
|
const getData = useLatest(dataArray);
|
|
29968
30310
|
const {
|
|
29969
30311
|
rowHeight,
|
|
@@ -29986,7 +30328,9 @@ function useCellRendering(param) {
|
|
|
29986
30328
|
onScrollStop,
|
|
29987
30329
|
scrollToBottomOffset,
|
|
29988
30330
|
wrapRowsHorizontally,
|
|
29989
|
-
|
|
30331
|
+
updatedAt: componentStateUpdatedAt,
|
|
30332
|
+
ready,
|
|
30333
|
+
editingCell
|
|
29990
30334
|
} = state;
|
|
29991
30335
|
const repaintId = dataSourceState.updatedAt;
|
|
29992
30336
|
useYourBrain({
|
|
@@ -30069,6 +30413,13 @@ function useCellRendering(param) {
|
|
|
30069
30413
|
useEffect38(() => {
|
|
30070
30414
|
rerender();
|
|
30071
30415
|
}, [dataSourceState]);
|
|
30416
|
+
const dataSourceStatePartialForCell = useMemo17(() => {
|
|
30417
|
+
return {
|
|
30418
|
+
isNodeReadOnly: isNodeReadOnly2,
|
|
30419
|
+
selectionMode,
|
|
30420
|
+
cellSelection
|
|
30421
|
+
};
|
|
30422
|
+
}, [isNodeReadOnly2, selectionMode, cellSelection]);
|
|
30072
30423
|
const renderCell = useCallback31(
|
|
30073
30424
|
(params) => {
|
|
30074
30425
|
const {
|
|
@@ -30099,6 +30450,10 @@ function useCellRendering(param) {
|
|
|
30099
30450
|
}
|
|
30100
30451
|
const rowIndexInHorizontalLayoutPage = wrapRowsHorizontally ? brain.getRowIndexInPage(rowIndex) : null;
|
|
30101
30452
|
const horizontalLayoutPageIndex = wrapRowsHorizontally ? brain.getPageIndexForRow(rowIndex) : null;
|
|
30453
|
+
const inEditMode = imperativeApi.isEditorVisibleForCell({
|
|
30454
|
+
rowIndex,
|
|
30455
|
+
columnId: column.id
|
|
30456
|
+
});
|
|
30102
30457
|
const cellProps = {
|
|
30103
30458
|
getData,
|
|
30104
30459
|
virtualized: true,
|
|
@@ -30107,7 +30462,7 @@ function useCellRendering(param) {
|
|
|
30107
30462
|
rowIndexInHorizontalLayoutPage,
|
|
30108
30463
|
horizontalLayoutPageIndex,
|
|
30109
30464
|
rowIndex,
|
|
30110
|
-
|
|
30465
|
+
rowInfoStore,
|
|
30111
30466
|
hidden,
|
|
30112
30467
|
toggleGroupRow,
|
|
30113
30468
|
rowHeight: rowHeight2,
|
|
@@ -30124,7 +30479,21 @@ function useCellRendering(param) {
|
|
|
30124
30479
|
rowStyle,
|
|
30125
30480
|
rowClassName,
|
|
30126
30481
|
cellStyle,
|
|
30127
|
-
cellClassName
|
|
30482
|
+
cellClassName,
|
|
30483
|
+
// Whether this specific cell is in edit mode
|
|
30484
|
+
// Passed as prop to trigger re-render when editing state changes
|
|
30485
|
+
inEditMode,
|
|
30486
|
+
// DataSource context values passed as props to avoid context re-renders
|
|
30487
|
+
getDataSourceState,
|
|
30488
|
+
dataSourceApi,
|
|
30489
|
+
dataSourceActions,
|
|
30490
|
+
// InfiniteTable context values passed as props to avoid context re-renders
|
|
30491
|
+
getState,
|
|
30492
|
+
imperativeApi,
|
|
30493
|
+
componentActions: actions,
|
|
30494
|
+
getComputed,
|
|
30495
|
+
getDataSourceMasterContext,
|
|
30496
|
+
dataSourceStatePartialForCell
|
|
30128
30497
|
};
|
|
30129
30498
|
return /* @__PURE__ */ React74.createElement(InfiniteTableColumnCell, { ...cellProps });
|
|
30130
30499
|
},
|
|
@@ -30146,11 +30515,22 @@ function useCellRendering(param) {
|
|
|
30146
30515
|
showZebraRows,
|
|
30147
30516
|
brain,
|
|
30148
30517
|
repaintId,
|
|
30149
|
-
|
|
30518
|
+
rowInfoStore,
|
|
30150
30519
|
rowStyle,
|
|
30151
30520
|
rowClassName,
|
|
30152
30521
|
cellClassName,
|
|
30153
|
-
cellStyle
|
|
30522
|
+
cellStyle,
|
|
30523
|
+
getDataSourceState,
|
|
30524
|
+
dataSourceApi,
|
|
30525
|
+
dataSourceActions,
|
|
30526
|
+
getState,
|
|
30527
|
+
imperativeApi,
|
|
30528
|
+
actions,
|
|
30529
|
+
getComputed,
|
|
30530
|
+
getDataSourceMasterContext,
|
|
30531
|
+
componentStateUpdatedAt,
|
|
30532
|
+
editingCell,
|
|
30533
|
+
dataSourceStatePartialForCell
|
|
30154
30534
|
]
|
|
30155
30535
|
);
|
|
30156
30536
|
const renderDetailRow = useMemo17(() => {
|
|
@@ -30497,7 +30877,7 @@ var InfiniteTableComponent = React78.memo(
|
|
|
30497
30877
|
if (false) {
|
|
30498
30878
|
globalThis.infiniteApi = context.api;
|
|
30499
30879
|
}
|
|
30500
|
-
}, [componentState.ready]);
|
|
30880
|
+
}, [componentState.ready, context.api]);
|
|
30501
30881
|
const debugId = useDebugMode();
|
|
30502
30882
|
React78.useEffect(() => {
|
|
30503
30883
|
if (masterContext) {
|