@infinite-table/infinite-react 7.4.2 → 7.5.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.css +1 -1
- package/index.d.ts +2146 -2093
- package/index.dev.js +421 -44
- package/index.dev.mjs +422 -45
- package/index.js +8 -8
- package/index.mjs +8 -8
- package/package.json +2 -2
package/index.dev.js
CHANGED
|
@@ -1485,7 +1485,8 @@ var DevToolsTracks = {
|
|
|
1485
1485
|
PrepareData: "Preparing data",
|
|
1486
1486
|
ComputeSelectionCount: "Computing selection count",
|
|
1487
1487
|
ComputeSelectionCountLazy: "Computing selection count (lazy)",
|
|
1488
|
-
PrepareRowInfo: "Preparing row info array"
|
|
1488
|
+
PrepareRowInfo: "Preparing row info array",
|
|
1489
|
+
DiffRowInfoInStore: "setDataArray diffing in RowInfoStore"
|
|
1489
1490
|
}
|
|
1490
1491
|
},
|
|
1491
1492
|
InfiniteTable: {
|
|
@@ -6254,16 +6255,6 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
6254
6255
|
return generatedGroupColumn;
|
|
6255
6256
|
}
|
|
6256
6257
|
|
|
6257
|
-
// src/components/InfiniteTable/utils/objectValuesExcept.ts
|
|
6258
|
-
function objectValuesExcept(obj, exceptList) {
|
|
6259
|
-
const result = [];
|
|
6260
|
-
for (const k in obj)
|
|
6261
|
-
if (obj.hasOwnProperty(k) && !exceptList.hasOwnProperty(k)) {
|
|
6262
|
-
result.push(obj[k]);
|
|
6263
|
-
}
|
|
6264
|
-
return result;
|
|
6265
|
-
}
|
|
6266
|
-
|
|
6267
6258
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
6268
6259
|
var ColumnCellCls = "_1eexc2a7 _1eexc2a6";
|
|
6269
6260
|
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"]] });
|
|
@@ -6837,6 +6828,7 @@ var import_react17 = require("react");
|
|
|
6837
6828
|
function InfiniteTableColumnEditor() {
|
|
6838
6829
|
const { initialValue, setValue, confirmEdit, cancelEdit, readOnly } = useInfiniteColumnEditor();
|
|
6839
6830
|
const domRef = (0, import_react17.useRef)(null);
|
|
6831
|
+
const cancelledRef = (0, import_react17.useRef)(false);
|
|
6840
6832
|
const refCallback = React28.useCallback((node) => {
|
|
6841
6833
|
domRef.current = node;
|
|
6842
6834
|
if (node) {
|
|
@@ -6848,18 +6840,24 @@ function InfiniteTableColumnEditor() {
|
|
|
6848
6840
|
if (key === "Enter" || key === "Tab") {
|
|
6849
6841
|
confirmEdit();
|
|
6850
6842
|
} else if (key === "Escape") {
|
|
6843
|
+
cancelledRef.current = true;
|
|
6851
6844
|
cancelEdit();
|
|
6852
6845
|
} else {
|
|
6853
6846
|
event.stopPropagation();
|
|
6854
6847
|
}
|
|
6855
6848
|
}, []);
|
|
6849
|
+
const onBlur = (0, import_react17.useCallback)(() => {
|
|
6850
|
+
if (!cancelledRef.current) {
|
|
6851
|
+
confirmEdit();
|
|
6852
|
+
}
|
|
6853
|
+
}, []);
|
|
6856
6854
|
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(
|
|
6857
6855
|
"input",
|
|
6858
6856
|
{
|
|
6859
6857
|
readOnly,
|
|
6860
6858
|
ref: refCallback,
|
|
6861
6859
|
onKeyDown: onKeyDown2,
|
|
6862
|
-
onBlur
|
|
6860
|
+
onBlur,
|
|
6863
6861
|
className: join(absoluteCover, outline.none),
|
|
6864
6862
|
type: "text",
|
|
6865
6863
|
defaultValue: initialValue,
|
|
@@ -6870,6 +6868,16 @@ function InfiniteTableColumnEditor() {
|
|
|
6870
6868
|
));
|
|
6871
6869
|
}
|
|
6872
6870
|
|
|
6871
|
+
// src/components/InfiniteTable/utils/objectValuesExcept.ts
|
|
6872
|
+
function objectValuesExcept(obj, exceptList) {
|
|
6873
|
+
const result = [];
|
|
6874
|
+
for (const k in obj)
|
|
6875
|
+
if (obj.hasOwnProperty(k) && !exceptList.hasOwnProperty(k)) {
|
|
6876
|
+
result.push(obj[k]);
|
|
6877
|
+
}
|
|
6878
|
+
return result;
|
|
6879
|
+
}
|
|
6880
|
+
|
|
6873
6881
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
6874
6882
|
var columnZIndexAtIndex3 = stripVar(InternalVars.columnZIndexAtIndex);
|
|
6875
6883
|
var columnVisibilityAtIndex2 = stripVar(InternalVars.columnVisibilityAtIndex);
|
|
@@ -6964,7 +6972,8 @@ function applyColumnStyle(existingStyle, columnStyle, param) {
|
|
|
6964
6972
|
}
|
|
6965
6973
|
function InfiniteTableColumnCellFn(props) {
|
|
6966
6974
|
const {
|
|
6967
|
-
|
|
6975
|
+
dataSourceStatePartialForCell,
|
|
6976
|
+
rowInfoStore,
|
|
6968
6977
|
rowStyle,
|
|
6969
6978
|
rowClassName,
|
|
6970
6979
|
rowIndexInHorizontalLayoutPage,
|
|
@@ -6986,8 +6995,30 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
6986
6995
|
fieldsToColumn,
|
|
6987
6996
|
domRef: initialDomRef,
|
|
6988
6997
|
hidden,
|
|
6989
|
-
showZebraRows
|
|
6998
|
+
showZebraRows,
|
|
6999
|
+
// DataSource context values passed as props
|
|
7000
|
+
getDataSourceState,
|
|
7001
|
+
dataSourceApi,
|
|
7002
|
+
dataSourceActions,
|
|
7003
|
+
// InfiniteTable context values passed as props
|
|
7004
|
+
getState,
|
|
7005
|
+
imperativeApi,
|
|
7006
|
+
componentActions,
|
|
7007
|
+
getComputed,
|
|
7008
|
+
getDataSourceMasterContext
|
|
6990
7009
|
} = props;
|
|
7010
|
+
const rowInfoFromStore = (0, import_react18.useSyncExternalStore)(
|
|
7011
|
+
(0, import_react18.useCallback)(
|
|
7012
|
+
(callback) => rowInfoStore.subscribeToRowIndex(rowIndex, callback),
|
|
7013
|
+
[rowInfoStore, rowIndex]
|
|
7014
|
+
),
|
|
7015
|
+
(0, import_react18.useCallback)(
|
|
7016
|
+
() => rowInfoStore.getRowInfoAtIndex(rowIndex),
|
|
7017
|
+
[rowInfoStore, rowIndex]
|
|
7018
|
+
)
|
|
7019
|
+
);
|
|
7020
|
+
const isEmptyRowInfo = !rowInfoFromStore;
|
|
7021
|
+
const isEmptyColumn = !column;
|
|
6991
7022
|
const htmlElementRef = React29.useRef(null);
|
|
6992
7023
|
const domRef = (0, import_react18.useCallback)(
|
|
6993
7024
|
(node) => {
|
|
@@ -6998,23 +7029,25 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
6998
7029
|
},
|
|
6999
7030
|
[initialDomRef]
|
|
7000
7031
|
);
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7032
|
+
const rowInfo = rowInfoFromStore ?? {
|
|
7033
|
+
id: "",
|
|
7034
|
+
indexInAll: rowIndex,
|
|
7035
|
+
rowSelected: false,
|
|
7036
|
+
rowDisabled: false,
|
|
7037
|
+
isCellSelected: () => false,
|
|
7038
|
+
hasSelectedCells: () => false,
|
|
7039
|
+
isGroupRow: false,
|
|
7040
|
+
isTreeNode: false,
|
|
7041
|
+
isParentNode: false,
|
|
7042
|
+
treeNesting: 0,
|
|
7043
|
+
nodePath: [],
|
|
7044
|
+
collapsed: false,
|
|
7045
|
+
dataSourceHasGrouping: false,
|
|
7046
|
+
selfLoaded: true,
|
|
7047
|
+
data: {}
|
|
7048
|
+
};
|
|
7004
7049
|
const { rowSelected } = rowInfo;
|
|
7005
|
-
const
|
|
7006
|
-
getState,
|
|
7007
|
-
actions: componentActions,
|
|
7008
|
-
computed,
|
|
7009
|
-
api: imperativeApi,
|
|
7010
|
-
getDataSourceMasterContext
|
|
7011
|
-
} = useInfiniteTable();
|
|
7012
|
-
const {
|
|
7013
|
-
componentState: dataSourceState,
|
|
7014
|
-
getState: getDataSourceState,
|
|
7015
|
-
api: dataSourceApi,
|
|
7016
|
-
componentActions: dataSourceActions
|
|
7017
|
-
} = useDataSourceContextValue();
|
|
7050
|
+
const computed = getComputed();
|
|
7018
7051
|
const { activeRowIndex, keyboardNavigation, columnReorderInPageIndex } = getState();
|
|
7019
7052
|
const rowActive = rowIndex === activeRowIndex && keyboardNavigation === "row";
|
|
7020
7053
|
const renderingContext = {
|
|
@@ -7099,7 +7132,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
7099
7132
|
},
|
|
7100
7133
|
[rowIndex, rowDisabled, column.computedVisibleIndex, keyboardNavigation]
|
|
7101
7134
|
);
|
|
7102
|
-
const { selectionMode, cellSelection, isNodeReadOnly: isNodeReadOnly2 } =
|
|
7135
|
+
const { selectionMode, cellSelection, isNodeReadOnly: isNodeReadOnly2 } = dataSourceStatePartialForCell;
|
|
7103
7136
|
const cellSelected = renderParam.cellSelected;
|
|
7104
7137
|
renderParam.domRef = domRef;
|
|
7105
7138
|
renderParam.htmlElementRef = htmlElementRef;
|
|
@@ -7458,6 +7491,9 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
7458
7491
|
renderChildren: (0, import_react18.useCallback)(() => theChildren, [renderChildren])
|
|
7459
7492
|
};
|
|
7460
7493
|
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
7494
|
+
if (isEmptyColumn || isEmptyRowInfo) {
|
|
7495
|
+
return /* @__PURE__ */ React29.createElement("div", { ref: domRef, style: { display: "none" } });
|
|
7496
|
+
}
|
|
7461
7497
|
return (
|
|
7462
7498
|
// this context is here for supporting useInfiniteColumnCell to be used
|
|
7463
7499
|
// with a custom column component, specified via column.components.ColumnCell
|
|
@@ -11441,6 +11477,14 @@ var GridRenderer = class extends Logger {
|
|
|
11441
11477
|
const covered = coveredByAnotherRow || coveredByAnotherCol;
|
|
11442
11478
|
return covered ? [rowspanParent, colspanParent] : false;
|
|
11443
11479
|
};
|
|
11480
|
+
this.onMouseEnterNotBound = (event) => {
|
|
11481
|
+
const rowIndex = Number(event.target.dataset.rowIndex);
|
|
11482
|
+
this.onMouseEnter(rowIndex);
|
|
11483
|
+
};
|
|
11484
|
+
this.onMouseLeaveNotBound = (event) => {
|
|
11485
|
+
const rowIndex = Number(event.target.dataset.rowIndex);
|
|
11486
|
+
this.onMouseLeave(rowIndex);
|
|
11487
|
+
};
|
|
11444
11488
|
this.onMouseEnter = (rowIndex) => {
|
|
11445
11489
|
this.lastEnteredRow = rowIndex;
|
|
11446
11490
|
this.lastExitedRow = -1;
|
|
@@ -12130,8 +12174,12 @@ var GridRenderer = class extends Logger {
|
|
|
12130
12174
|
hidden,
|
|
12131
12175
|
heightWithRowspan,
|
|
12132
12176
|
widthWithColspan,
|
|
12133
|
-
onMouseEnter: this.onMouseEnter.bind(null, rowIndex),
|
|
12134
|
-
|
|
12177
|
+
// onMouseEnter: this.onMouseEnter.bind(null, rowIndex),
|
|
12178
|
+
onMouseEnter: this.onMouseEnterNotBound,
|
|
12179
|
+
//.bind(null, rowIndex),
|
|
12180
|
+
// onMouseLeave: this.onMouseLeave.bind(null, rowIndex),
|
|
12181
|
+
onMouseLeave: this.onMouseLeaveNotBound,
|
|
12182
|
+
//.bind(null, rowIndex),
|
|
12135
12183
|
domRef: cell.ref
|
|
12136
12184
|
});
|
|
12137
12185
|
if (!cell.isMounted()) {
|
|
@@ -19823,6 +19871,9 @@ function concludeReducer(params) {
|
|
|
19823
19871
|
treeMutations: treeMutations?.size ? treeMutations : void 0
|
|
19824
19872
|
};
|
|
19825
19873
|
}
|
|
19874
|
+
state.rowInfoStore.notifyDataArray(rowInfoDataArray, {
|
|
19875
|
+
marker: debugId ? getMarker(debugId).track.DataSource.label.DiffRowInfoInStore : void 0
|
|
19876
|
+
});
|
|
19826
19877
|
if (rootMarker) {
|
|
19827
19878
|
rootMarker?.track.DataSource.label.PrepareData.end({
|
|
19828
19879
|
details: [
|
|
@@ -20677,6 +20728,279 @@ var normalizeSortInfo = (initialSortInfo, weakMap3) => {
|
|
|
20677
20728
|
return result;
|
|
20678
20729
|
};
|
|
20679
20730
|
|
|
20731
|
+
// src/components/DataSource/RowInfoStore.ts
|
|
20732
|
+
function deepEqual(a, b) {
|
|
20733
|
+
if (a === b) return true;
|
|
20734
|
+
if (a == null || b == null) return a === b;
|
|
20735
|
+
if (typeof a !== typeof b) return false;
|
|
20736
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
20737
|
+
if (a.length !== b.length) return false;
|
|
20738
|
+
for (let i = 0, len = a.length; i < len; i++) {
|
|
20739
|
+
if (!deepEqual(a[i], b[i])) return false;
|
|
20740
|
+
}
|
|
20741
|
+
return true;
|
|
20742
|
+
}
|
|
20743
|
+
if (typeof a === "object") {
|
|
20744
|
+
const keysA = Object.keys(a);
|
|
20745
|
+
const keysB = Object.keys(b);
|
|
20746
|
+
if (keysA.length !== keysB.length) return false;
|
|
20747
|
+
for (const key of keysA) {
|
|
20748
|
+
if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
|
|
20749
|
+
if (!deepEqual(a[key], b[key])) return false;
|
|
20750
|
+
}
|
|
20751
|
+
return true;
|
|
20752
|
+
}
|
|
20753
|
+
return false;
|
|
20754
|
+
}
|
|
20755
|
+
function isSameRowInfoType(one, two) {
|
|
20756
|
+
if (one === void 0 || two === void 0) return false;
|
|
20757
|
+
if (one.isGroupRow !== two.isGroupRow) return false;
|
|
20758
|
+
if (one.dataSourceHasGrouping !== two.dataSourceHasGrouping) return false;
|
|
20759
|
+
if (one.isTreeNode !== two.isTreeNode) return false;
|
|
20760
|
+
if (one.isTreeNode) {
|
|
20761
|
+
if (one.isParentNode !== two.isParentNode)
|
|
20762
|
+
return false;
|
|
20763
|
+
}
|
|
20764
|
+
return true;
|
|
20765
|
+
}
|
|
20766
|
+
var rowInfoBase_KeysRecord = {
|
|
20767
|
+
id: true,
|
|
20768
|
+
value: true,
|
|
20769
|
+
indexInAll: true,
|
|
20770
|
+
rowSelected: true,
|
|
20771
|
+
rowDisabled: true,
|
|
20772
|
+
isCellSelected: false,
|
|
20773
|
+
hasSelectedCells: false
|
|
20774
|
+
};
|
|
20775
|
+
var rowInfo_NoGrouping_RowInfoNormal_KeysRecord = {
|
|
20776
|
+
...rowInfoBase_KeysRecord,
|
|
20777
|
+
dataSourceHasGrouping: true,
|
|
20778
|
+
isTreeNode: true,
|
|
20779
|
+
data: false,
|
|
20780
|
+
isGroupRow: true,
|
|
20781
|
+
selfLoaded: true
|
|
20782
|
+
};
|
|
20783
|
+
var rowInfo_HasGrouping_RowInfoBase_KeysRecord = {
|
|
20784
|
+
indexInGroup: true,
|
|
20785
|
+
groupKeys: true,
|
|
20786
|
+
groupBy: true,
|
|
20787
|
+
rootGroupBy: true,
|
|
20788
|
+
parents: false,
|
|
20789
|
+
indexInParentGroups: true,
|
|
20790
|
+
groupCount: true,
|
|
20791
|
+
groupNesting: true,
|
|
20792
|
+
collapsed: true,
|
|
20793
|
+
selfLoaded: true
|
|
20794
|
+
};
|
|
20795
|
+
var rowInfo_HasGrouping_RowInfoGroup_KeysRecord = {
|
|
20796
|
+
...rowInfoBase_KeysRecord,
|
|
20797
|
+
...rowInfo_HasGrouping_RowInfoBase_KeysRecord,
|
|
20798
|
+
dataSourceHasGrouping: true,
|
|
20799
|
+
isTreeNode: true,
|
|
20800
|
+
data: false,
|
|
20801
|
+
reducerData: true,
|
|
20802
|
+
isGroupRow: true,
|
|
20803
|
+
duplicateOf: false,
|
|
20804
|
+
deepRowInfoArray: false,
|
|
20805
|
+
error: true,
|
|
20806
|
+
reducerResults: true,
|
|
20807
|
+
groupCount: true,
|
|
20808
|
+
groupData: true,
|
|
20809
|
+
selectedChildredCount: true,
|
|
20810
|
+
deselectedChildredCount: true,
|
|
20811
|
+
totalChildrenCount: true,
|
|
20812
|
+
collapsedChildrenCount: true,
|
|
20813
|
+
collapsedGroupsCount: true,
|
|
20814
|
+
directChildrenCount: true,
|
|
20815
|
+
directChildrenLoadedCount: true,
|
|
20816
|
+
pivotValuesMap: true,
|
|
20817
|
+
childrenAvailable: true,
|
|
20818
|
+
childrenLoading: true
|
|
20819
|
+
};
|
|
20820
|
+
var rowInfo_Tree_RowInfoBase_KeysRecord = {
|
|
20821
|
+
isTreeNode: true,
|
|
20822
|
+
isParentNode: true,
|
|
20823
|
+
indexInParent: true,
|
|
20824
|
+
nodePath: true,
|
|
20825
|
+
parentNodes: false,
|
|
20826
|
+
indexInParentNodes: true,
|
|
20827
|
+
totalLeafNodesCount: true,
|
|
20828
|
+
collapsedLeafNodesCount: true,
|
|
20829
|
+
treeNesting: true,
|
|
20830
|
+
selfLoaded: true
|
|
20831
|
+
};
|
|
20832
|
+
var rowInfo_Tree_RowInfoLeafNode_KeysRecord = {
|
|
20833
|
+
...rowInfoBase_KeysRecord,
|
|
20834
|
+
...rowInfo_Tree_RowInfoBase_KeysRecord,
|
|
20835
|
+
dataSourceHasGrouping: true,
|
|
20836
|
+
isTreeNode: true,
|
|
20837
|
+
isGroupRow: true,
|
|
20838
|
+
isParentNode: true,
|
|
20839
|
+
data: false
|
|
20840
|
+
};
|
|
20841
|
+
var rowInfo_Tree_RowInfoParentNode_KeysRecord = {
|
|
20842
|
+
...rowInfoBase_KeysRecord,
|
|
20843
|
+
...rowInfo_Tree_RowInfoBase_KeysRecord,
|
|
20844
|
+
dataSourceHasGrouping: true,
|
|
20845
|
+
isParentNode: true,
|
|
20846
|
+
isGroupRow: true,
|
|
20847
|
+
nodeExpanded: true,
|
|
20848
|
+
selfExpanded: true,
|
|
20849
|
+
data: false,
|
|
20850
|
+
selectedLeafNodesCount: true,
|
|
20851
|
+
deepRowInfoArray: false,
|
|
20852
|
+
deselectedLeafNodesCount: true,
|
|
20853
|
+
duplicateOf: false
|
|
20854
|
+
};
|
|
20855
|
+
var rowInfoKeys_noGrouping = Object.entries(
|
|
20856
|
+
rowInfo_NoGrouping_RowInfoNormal_KeysRecord
|
|
20857
|
+
).map(([key, value]) => value ? key : void 0).filter(Boolean);
|
|
20858
|
+
var rowInfoKeys_hasGrouping_normalRow = Object.entries(
|
|
20859
|
+
rowInfo_NoGrouping_RowInfoNormal_KeysRecord
|
|
20860
|
+
).map(
|
|
20861
|
+
([key, value]) => value ? key : void 0
|
|
20862
|
+
);
|
|
20863
|
+
var rowInfoKeys_hasGrouping_groupRow = Object.entries(
|
|
20864
|
+
rowInfo_HasGrouping_RowInfoGroup_KeysRecord
|
|
20865
|
+
).map(
|
|
20866
|
+
([key, value]) => value ? key : void 0
|
|
20867
|
+
);
|
|
20868
|
+
var rowInfoKeys_tree_leafNode = Object.entries(
|
|
20869
|
+
rowInfo_Tree_RowInfoLeafNode_KeysRecord
|
|
20870
|
+
).map(
|
|
20871
|
+
([key, value]) => value ? key : void 0
|
|
20872
|
+
);
|
|
20873
|
+
var rowInfoKeys_tree_parentNode = Object.entries(
|
|
20874
|
+
rowInfo_Tree_RowInfoParentNode_KeysRecord
|
|
20875
|
+
).map(
|
|
20876
|
+
([key, value]) => value ? key : void 0
|
|
20877
|
+
);
|
|
20878
|
+
function deepEqualRowInfo(oldRowInfo, newRowInfo) {
|
|
20879
|
+
if (oldRowInfo === newRowInfo) return true;
|
|
20880
|
+
if (!oldRowInfo || !newRowInfo) {
|
|
20881
|
+
return false;
|
|
20882
|
+
}
|
|
20883
|
+
if (!isSameRowInfoType(oldRowInfo, newRowInfo)) {
|
|
20884
|
+
return false;
|
|
20885
|
+
}
|
|
20886
|
+
if (oldRowInfo.id !== newRowInfo.id) return false;
|
|
20887
|
+
if (oldRowInfo.data !== newRowInfo.data) {
|
|
20888
|
+
if (!deepEqual(oldRowInfo.data, newRowInfo.data)) {
|
|
20889
|
+
return false;
|
|
20890
|
+
}
|
|
20891
|
+
}
|
|
20892
|
+
let allKeys = [];
|
|
20893
|
+
if (!oldRowInfo.dataSourceHasGrouping) {
|
|
20894
|
+
if (oldRowInfo.isTreeNode) {
|
|
20895
|
+
allKeys = oldRowInfo.isTreeNode && oldRowInfo.isParentNode ? rowInfoKeys_tree_parentNode : rowInfoKeys_tree_leafNode;
|
|
20896
|
+
} else {
|
|
20897
|
+
allKeys = rowInfoKeys_noGrouping;
|
|
20898
|
+
}
|
|
20899
|
+
} else {
|
|
20900
|
+
allKeys = oldRowInfo.isGroupRow ? rowInfoKeys_hasGrouping_groupRow : rowInfoKeys_hasGrouping_normalRow;
|
|
20901
|
+
}
|
|
20902
|
+
for (const key of allKeys) {
|
|
20903
|
+
const oldValue = oldRowInfo[key];
|
|
20904
|
+
const newValue = newRowInfo[key];
|
|
20905
|
+
if (typeof oldValue === "function" || typeof newValue === "function") {
|
|
20906
|
+
continue;
|
|
20907
|
+
}
|
|
20908
|
+
if (!deepEqual(oldValue, newValue)) {
|
|
20909
|
+
return false;
|
|
20910
|
+
}
|
|
20911
|
+
}
|
|
20912
|
+
return true;
|
|
20913
|
+
}
|
|
20914
|
+
function createRowInfoStore() {
|
|
20915
|
+
let dataArray = [];
|
|
20916
|
+
const subscribers = /* @__PURE__ */ new Map();
|
|
20917
|
+
const notifyDataArray = (newDataArray, params) => {
|
|
20918
|
+
const oldDataArray = dataArray;
|
|
20919
|
+
const marker = params?.marker;
|
|
20920
|
+
if (marker) {
|
|
20921
|
+
marker.start({
|
|
20922
|
+
details: [
|
|
20923
|
+
{ name: "new dataArray length", value: newDataArray.length },
|
|
20924
|
+
{
|
|
20925
|
+
name: "old dataArray length",
|
|
20926
|
+
value: oldDataArray.length
|
|
20927
|
+
}
|
|
20928
|
+
]
|
|
20929
|
+
});
|
|
20930
|
+
}
|
|
20931
|
+
const changedIndices = [];
|
|
20932
|
+
const subscribedRowIndexes = getSubscribedRowIndexes();
|
|
20933
|
+
for (const index of subscribedRowIndexes) {
|
|
20934
|
+
const oldRowInfo = oldDataArray[index];
|
|
20935
|
+
const newRowInfo = newDataArray[index];
|
|
20936
|
+
if (newRowInfo === void 0) {
|
|
20937
|
+
changedIndices.push(index);
|
|
20938
|
+
continue;
|
|
20939
|
+
}
|
|
20940
|
+
if (!deepEqualRowInfo(oldRowInfo, newRowInfo)) {
|
|
20941
|
+
changedIndices.push(index);
|
|
20942
|
+
}
|
|
20943
|
+
}
|
|
20944
|
+
dataArray = newDataArray;
|
|
20945
|
+
if (changedIndices.length > 0) {
|
|
20946
|
+
queueMicrotask(() => {
|
|
20947
|
+
console.log("notify", changedIndices);
|
|
20948
|
+
for (let i = 0, len = changedIndices.length; i < len; i++) {
|
|
20949
|
+
const index = changedIndices[i];
|
|
20950
|
+
const indexSubscribers = subscribers.get(index);
|
|
20951
|
+
if (indexSubscribers) {
|
|
20952
|
+
for (const callback of indexSubscribers) {
|
|
20953
|
+
callback();
|
|
20954
|
+
}
|
|
20955
|
+
}
|
|
20956
|
+
}
|
|
20957
|
+
});
|
|
20958
|
+
}
|
|
20959
|
+
if (marker) {
|
|
20960
|
+
marker.end({
|
|
20961
|
+
details: [{ name: "updated row infos", value: changedIndices.length }]
|
|
20962
|
+
});
|
|
20963
|
+
}
|
|
20964
|
+
};
|
|
20965
|
+
const getRowInfoAtIndex = (index) => {
|
|
20966
|
+
return dataArray[index];
|
|
20967
|
+
};
|
|
20968
|
+
const subscribeToRowIndex = (rowIndex, callback) => {
|
|
20969
|
+
let indexSubscribers = subscribers.get(rowIndex);
|
|
20970
|
+
if (!indexSubscribers) {
|
|
20971
|
+
indexSubscribers = /* @__PURE__ */ new Set();
|
|
20972
|
+
subscribers.set(rowIndex, indexSubscribers);
|
|
20973
|
+
}
|
|
20974
|
+
indexSubscribers.add(callback);
|
|
20975
|
+
return () => {
|
|
20976
|
+
const subs = subscribers.get(rowIndex);
|
|
20977
|
+
if (subs) {
|
|
20978
|
+
subs.delete(callback);
|
|
20979
|
+
if (subs.size === 0) {
|
|
20980
|
+
subscribers.delete(rowIndex);
|
|
20981
|
+
}
|
|
20982
|
+
}
|
|
20983
|
+
};
|
|
20984
|
+
};
|
|
20985
|
+
const getSubscribedRowIndexes = () => {
|
|
20986
|
+
return Array.from(subscribers.keys());
|
|
20987
|
+
};
|
|
20988
|
+
const getDataArray = () => {
|
|
20989
|
+
return dataArray;
|
|
20990
|
+
};
|
|
20991
|
+
const clear = () => {
|
|
20992
|
+
dataArray = [];
|
|
20993
|
+
subscribers.clear();
|
|
20994
|
+
};
|
|
20995
|
+
return {
|
|
20996
|
+
notifyDataArray,
|
|
20997
|
+
getRowInfoAtIndex,
|
|
20998
|
+
subscribeToRowIndex,
|
|
20999
|
+
getDataArray,
|
|
21000
|
+
clear
|
|
21001
|
+
};
|
|
21002
|
+
}
|
|
21003
|
+
|
|
20680
21004
|
// src/components/DataSource/state/getInitialState.ts
|
|
20681
21005
|
var defaultCursorId = Symbol("cursorId");
|
|
20682
21006
|
var isNodeReadOnly = (rowInfo) => {
|
|
@@ -20696,6 +21020,7 @@ function initSetupState(props) {
|
|
|
20696
21020
|
debugTimings: /* @__PURE__ */ new Map(),
|
|
20697
21021
|
debugWarnings: /* @__PURE__ */ new Map(),
|
|
20698
21022
|
devToolsDetected: !!globalThis.__INFINITE_TABLE_DEVTOOLS_HOOK__,
|
|
21023
|
+
rowInfoStore: createRowInfoStore(),
|
|
20699
21024
|
// TODO cleanup indexer on unmount
|
|
20700
21025
|
indexer: new Indexer(),
|
|
20701
21026
|
totalLeafNodesCount: 0,
|
|
@@ -20796,6 +21121,7 @@ var cleanupDataSource = (state) => {
|
|
|
20796
21121
|
state.treeSelectionState?.destroy();
|
|
20797
21122
|
state.idToPathMap.clear();
|
|
20798
21123
|
state.idToIndexMap.clear();
|
|
21124
|
+
state.rowInfoStore.clear();
|
|
20799
21125
|
};
|
|
20800
21126
|
var forwardProps3 = (setupState, props) => {
|
|
20801
21127
|
return {
|
|
@@ -23351,7 +23677,9 @@ var InfiniteTableApiImpl = class {
|
|
|
23351
23677
|
}
|
|
23352
23678
|
set scrollLeft(scrollLeft2) {
|
|
23353
23679
|
const state = this.getState();
|
|
23354
|
-
state.scrollerDOMRef.current
|
|
23680
|
+
if (state.scrollerDOMRef.current) {
|
|
23681
|
+
state.scrollerDOMRef.current.scrollLeft = Math.max(scrollLeft2, 0);
|
|
23682
|
+
}
|
|
23355
23683
|
}
|
|
23356
23684
|
get scrollTop() {
|
|
23357
23685
|
const state = this.getState();
|
|
@@ -23359,7 +23687,9 @@ var InfiniteTableApiImpl = class {
|
|
|
23359
23687
|
}
|
|
23360
23688
|
set scrollTop(scrollTop2) {
|
|
23361
23689
|
const state = this.getState();
|
|
23362
|
-
state.scrollerDOMRef.current
|
|
23690
|
+
if (state.scrollerDOMRef.current) {
|
|
23691
|
+
state.scrollerDOMRef.current.scrollTop = Math.max(scrollTop2, 0);
|
|
23692
|
+
}
|
|
23363
23693
|
}
|
|
23364
23694
|
scrollRowIntoView(rowIndex, config = { offset: 0 }) {
|
|
23365
23695
|
const state = this.getState();
|
|
@@ -24234,12 +24564,14 @@ function initSetupState2({
|
|
|
24234
24564
|
headerOnRenderUpdater
|
|
24235
24565
|
} = createBrains(debugId, !!wrapRowsHorizontally);
|
|
24236
24566
|
const domRef = (0, import_react42.createRef)();
|
|
24567
|
+
const now = Date.now();
|
|
24237
24568
|
return {
|
|
24238
24569
|
debugWarnings: /* @__PURE__ */ new Map(),
|
|
24239
24570
|
renderer,
|
|
24240
24571
|
onRenderUpdater,
|
|
24241
24572
|
headerRenderer,
|
|
24242
24573
|
headerOnRenderUpdater,
|
|
24574
|
+
updatedAt: now,
|
|
24243
24575
|
devToolsDetected: !!globalThis.__INFINITE_TABLE_DEVTOOLS_HOOK__,
|
|
24244
24576
|
propsCache: /* @__PURE__ */ new Map([]),
|
|
24245
24577
|
lastRowToCollapseRef: { current: null },
|
|
@@ -24526,6 +24858,7 @@ var mapPropsToState = (params) => {
|
|
|
24526
24858
|
}
|
|
24527
24859
|
const isRowDetailEnabled = !rowDetailRenderer ? false : props.isRowDetailEnabled || true;
|
|
24528
24860
|
let result = {
|
|
24861
|
+
updatedAt: Date.now(),
|
|
24529
24862
|
isTree: parentState.isTree,
|
|
24530
24863
|
rowDetailRenderer,
|
|
24531
24864
|
rowDetailState,
|
|
@@ -25746,7 +26079,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
25746
26079
|
}
|
|
25747
26080
|
let valid2 = isValidLicense(licenseKey, {
|
|
25748
26081
|
publishedAt: 1624970570587,
|
|
25749
|
-
version: "7.
|
|
26082
|
+
version: "7.5.0-canary.0"
|
|
25750
26083
|
});
|
|
25751
26084
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
25752
26085
|
return true;
|
|
@@ -29985,7 +30318,7 @@ var InfiniteTableDetailRow = React73.memo(
|
|
|
29985
30318
|
var SCROLL_BOTTOM_OFFSET = 1;
|
|
29986
30319
|
function useCellRendering(param) {
|
|
29987
30320
|
const { computed, bodySize, imperativeApi } = param;
|
|
29988
|
-
const { actions, state, getState } = useInfiniteTable();
|
|
30321
|
+
const { actions, state, getState, getComputed, getDataSourceMasterContext } = useInfiniteTable();
|
|
29989
30322
|
const {
|
|
29990
30323
|
computedPinnedStartColumns,
|
|
29991
30324
|
computedPinnedEndColumns,
|
|
@@ -30004,7 +30337,13 @@ function useCellRendering(param) {
|
|
|
30004
30337
|
componentActions: dataSourceActions,
|
|
30005
30338
|
api: dataSourceApi
|
|
30006
30339
|
} = useDataSourceContextValue();
|
|
30007
|
-
const {
|
|
30340
|
+
const {
|
|
30341
|
+
dataArray,
|
|
30342
|
+
rowInfoStore,
|
|
30343
|
+
selectionMode,
|
|
30344
|
+
cellSelection,
|
|
30345
|
+
isNodeReadOnly: isNodeReadOnly2
|
|
30346
|
+
} = dataSourceState;
|
|
30008
30347
|
const getData = useLatest(dataArray);
|
|
30009
30348
|
const {
|
|
30010
30349
|
rowHeight,
|
|
@@ -30027,7 +30366,9 @@ function useCellRendering(param) {
|
|
|
30027
30366
|
onScrollStop,
|
|
30028
30367
|
scrollToBottomOffset,
|
|
30029
30368
|
wrapRowsHorizontally,
|
|
30030
|
-
|
|
30369
|
+
updatedAt: componentStateUpdatedAt,
|
|
30370
|
+
ready,
|
|
30371
|
+
editingCell
|
|
30031
30372
|
} = state;
|
|
30032
30373
|
const repaintId = dataSourceState.updatedAt;
|
|
30033
30374
|
useYourBrain({
|
|
@@ -30110,6 +30451,13 @@ function useCellRendering(param) {
|
|
|
30110
30451
|
(0, import_react69.useEffect)(() => {
|
|
30111
30452
|
rerender();
|
|
30112
30453
|
}, [dataSourceState]);
|
|
30454
|
+
const dataSourceStatePartialForCell = (0, import_react68.useMemo)(() => {
|
|
30455
|
+
return {
|
|
30456
|
+
isNodeReadOnly: isNodeReadOnly2,
|
|
30457
|
+
selectionMode,
|
|
30458
|
+
cellSelection
|
|
30459
|
+
};
|
|
30460
|
+
}, [isNodeReadOnly2, selectionMode, cellSelection]);
|
|
30113
30461
|
const renderCell = (0, import_react69.useCallback)(
|
|
30114
30462
|
(params) => {
|
|
30115
30463
|
const {
|
|
@@ -30140,6 +30488,10 @@ function useCellRendering(param) {
|
|
|
30140
30488
|
}
|
|
30141
30489
|
const rowIndexInHorizontalLayoutPage = wrapRowsHorizontally ? brain.getRowIndexInPage(rowIndex) : null;
|
|
30142
30490
|
const horizontalLayoutPageIndex = wrapRowsHorizontally ? brain.getPageIndexForRow(rowIndex) : null;
|
|
30491
|
+
const inEditMode = imperativeApi.isEditorVisibleForCell({
|
|
30492
|
+
rowIndex,
|
|
30493
|
+
columnId: column.id
|
|
30494
|
+
});
|
|
30143
30495
|
const cellProps = {
|
|
30144
30496
|
getData,
|
|
30145
30497
|
virtualized: true,
|
|
@@ -30148,7 +30500,7 @@ function useCellRendering(param) {
|
|
|
30148
30500
|
rowIndexInHorizontalLayoutPage,
|
|
30149
30501
|
horizontalLayoutPageIndex,
|
|
30150
30502
|
rowIndex,
|
|
30151
|
-
|
|
30503
|
+
rowInfoStore,
|
|
30152
30504
|
hidden,
|
|
30153
30505
|
toggleGroupRow,
|
|
30154
30506
|
rowHeight: rowHeight2,
|
|
@@ -30165,7 +30517,21 @@ function useCellRendering(param) {
|
|
|
30165
30517
|
rowStyle,
|
|
30166
30518
|
rowClassName,
|
|
30167
30519
|
cellStyle,
|
|
30168
|
-
cellClassName
|
|
30520
|
+
cellClassName,
|
|
30521
|
+
// Whether this specific cell is in edit mode
|
|
30522
|
+
// Passed as prop to trigger re-render when editing state changes
|
|
30523
|
+
inEditMode,
|
|
30524
|
+
// DataSource context values passed as props to avoid context re-renders
|
|
30525
|
+
getDataSourceState,
|
|
30526
|
+
dataSourceApi,
|
|
30527
|
+
dataSourceActions,
|
|
30528
|
+
// InfiniteTable context values passed as props to avoid context re-renders
|
|
30529
|
+
getState,
|
|
30530
|
+
imperativeApi,
|
|
30531
|
+
componentActions: actions,
|
|
30532
|
+
getComputed,
|
|
30533
|
+
getDataSourceMasterContext,
|
|
30534
|
+
dataSourceStatePartialForCell
|
|
30169
30535
|
};
|
|
30170
30536
|
return /* @__PURE__ */ React74.createElement(InfiniteTableColumnCell, { ...cellProps });
|
|
30171
30537
|
},
|
|
@@ -30187,11 +30553,22 @@ function useCellRendering(param) {
|
|
|
30187
30553
|
showZebraRows,
|
|
30188
30554
|
brain,
|
|
30189
30555
|
repaintId,
|
|
30190
|
-
|
|
30556
|
+
rowInfoStore,
|
|
30191
30557
|
rowStyle,
|
|
30192
30558
|
rowClassName,
|
|
30193
30559
|
cellClassName,
|
|
30194
|
-
cellStyle
|
|
30560
|
+
cellStyle,
|
|
30561
|
+
getDataSourceState,
|
|
30562
|
+
dataSourceApi,
|
|
30563
|
+
dataSourceActions,
|
|
30564
|
+
getState,
|
|
30565
|
+
imperativeApi,
|
|
30566
|
+
actions,
|
|
30567
|
+
getComputed,
|
|
30568
|
+
getDataSourceMasterContext,
|
|
30569
|
+
componentStateUpdatedAt,
|
|
30570
|
+
editingCell,
|
|
30571
|
+
dataSourceStatePartialForCell
|
|
30195
30572
|
]
|
|
30196
30573
|
);
|
|
30197
30574
|
const renderDetailRow = (0, import_react68.useMemo)(() => {
|
|
@@ -30538,7 +30915,7 @@ var InfiniteTableComponent = React78.memo(
|
|
|
30538
30915
|
if (false) {
|
|
30539
30916
|
globalThis.infiniteApi = context.api;
|
|
30540
30917
|
}
|
|
30541
|
-
}, [componentState.ready]);
|
|
30918
|
+
}, [componentState.ready, context.api]);
|
|
30542
30919
|
const debugId = useDebugMode();
|
|
30543
30920
|
React78.useEffect(() => {
|
|
30544
30921
|
if (masterContext) {
|