@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.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
|
|
@@ -10066,10 +10102,10 @@ var GridCellForReact = class {
|
|
|
10066
10102
|
constructor(debugId, cellInfo) {
|
|
10067
10103
|
this.element = null;
|
|
10068
10104
|
this.mounted = false;
|
|
10069
|
-
this.
|
|
10105
|
+
this.IS_UPDATED_WHILE_SCROLLING_IN_HORIZONTAL_LAYOUT = false;
|
|
10070
10106
|
this.mountSubscription = buildSubscriptionCallback();
|
|
10071
10107
|
this.isUpdatedWhileScrolling = () => {
|
|
10072
|
-
return this.
|
|
10108
|
+
return this.IS_UPDATED_WHILE_SCROLLING_IN_HORIZONTAL_LAYOUT;
|
|
10073
10109
|
};
|
|
10074
10110
|
const count = CELL_COUNT_BY_DEBUG_ID.get(debugId) ?? 0;
|
|
10075
10111
|
const key = `${debugId}:GridCellReact:${count}`;
|
|
@@ -10118,7 +10154,7 @@ var GridCellForReact = class {
|
|
|
10118
10154
|
return this.node;
|
|
10119
10155
|
}
|
|
10120
10156
|
update(content, additionalInfo, scrollingObjectParam) {
|
|
10121
|
-
this.
|
|
10157
|
+
this.IS_UPDATED_WHILE_SCROLLING_IN_HORIZONTAL_LAYOUT = scrollingObjectParam ? scrollingObjectParam.scrolling && scrollingObjectParam.isHorizontalLayout : false;
|
|
10122
10158
|
this.updater(content);
|
|
10123
10159
|
this.cellInfo = additionalInfo;
|
|
10124
10160
|
}
|
|
@@ -11001,7 +11037,8 @@ var columnOffsetAtIndexWhileReordering2 = stripVar(
|
|
|
11001
11037
|
InternalVars.columnOffsetAtIndexWhileReordering
|
|
11002
11038
|
);
|
|
11003
11039
|
var SCROLLING_OBJECT_PARAM_FLYWEIGHT = {
|
|
11004
|
-
scrolling: false
|
|
11040
|
+
scrolling: false,
|
|
11041
|
+
isHorizontalLayout: false
|
|
11005
11042
|
};
|
|
11006
11043
|
var GridRenderer = class extends Logger {
|
|
11007
11044
|
constructor(brain, debugId) {
|
|
@@ -11441,6 +11478,14 @@ var GridRenderer = class extends Logger {
|
|
|
11441
11478
|
const covered = coveredByAnotherRow || coveredByAnotherCol;
|
|
11442
11479
|
return covered ? [rowspanParent, colspanParent] : false;
|
|
11443
11480
|
};
|
|
11481
|
+
this.onMouseEnterNotBound = (event) => {
|
|
11482
|
+
const rowIndex = Number(event.target.dataset.rowIndex);
|
|
11483
|
+
this.onMouseEnter(rowIndex);
|
|
11484
|
+
};
|
|
11485
|
+
this.onMouseLeaveNotBound = (event) => {
|
|
11486
|
+
const rowIndex = Number(event.target.dataset.rowIndex);
|
|
11487
|
+
this.onMouseLeave(rowIndex);
|
|
11488
|
+
};
|
|
11444
11489
|
this.onMouseEnter = (rowIndex) => {
|
|
11445
11490
|
this.lastEnteredRow = rowIndex;
|
|
11446
11491
|
this.lastExitedRow = -1;
|
|
@@ -12130,8 +12175,12 @@ var GridRenderer = class extends Logger {
|
|
|
12130
12175
|
hidden,
|
|
12131
12176
|
heightWithRowspan,
|
|
12132
12177
|
widthWithColspan,
|
|
12133
|
-
onMouseEnter: this.onMouseEnter.bind(null, rowIndex),
|
|
12134
|
-
|
|
12178
|
+
// onMouseEnter: this.onMouseEnter.bind(null, rowIndex),
|
|
12179
|
+
onMouseEnter: this.onMouseEnterNotBound,
|
|
12180
|
+
//.bind(null, rowIndex),
|
|
12181
|
+
// onMouseLeave: this.onMouseLeave.bind(null, rowIndex),
|
|
12182
|
+
onMouseLeave: this.onMouseLeaveNotBound,
|
|
12183
|
+
//.bind(null, rowIndex),
|
|
12135
12184
|
domRef: cell.ref
|
|
12136
12185
|
});
|
|
12137
12186
|
if (!cell.isMounted()) {
|
|
@@ -12149,8 +12198,9 @@ var GridRenderer = class extends Logger {
|
|
|
12149
12198
|
renderRowIndex,
|
|
12150
12199
|
renderColIndex
|
|
12151
12200
|
} : void 0;
|
|
12201
|
+
const isHorizontalLayout = this.brain.isHorizontalLayoutBrain;
|
|
12152
12202
|
if (!renderedNode) {
|
|
12153
|
-
if (
|
|
12203
|
+
if (isHorizontalLayout) {
|
|
12154
12204
|
this.cellManager.detachCell(cell);
|
|
12155
12205
|
} else {
|
|
12156
12206
|
this.cellManager.detachCell(cell);
|
|
@@ -12158,6 +12208,7 @@ var GridRenderer = class extends Logger {
|
|
|
12158
12208
|
return;
|
|
12159
12209
|
}
|
|
12160
12210
|
SCROLLING_OBJECT_PARAM_FLYWEIGHT.scrolling = this.scrolling;
|
|
12211
|
+
SCROLLING_OBJECT_PARAM_FLYWEIGHT.isHorizontalLayout = isHorizontalLayout;
|
|
12161
12212
|
this.cellManager.renderNodeAtCell(
|
|
12162
12213
|
renderedNode,
|
|
12163
12214
|
cell,
|
|
@@ -19823,6 +19874,9 @@ function concludeReducer(params) {
|
|
|
19823
19874
|
treeMutations: treeMutations?.size ? treeMutations : void 0
|
|
19824
19875
|
};
|
|
19825
19876
|
}
|
|
19877
|
+
state.rowInfoStore.notifyDataArray(rowInfoDataArray, {
|
|
19878
|
+
marker: debugId ? getMarker(debugId).track.DataSource.label.DiffRowInfoInStore : void 0
|
|
19879
|
+
});
|
|
19826
19880
|
if (rootMarker) {
|
|
19827
19881
|
rootMarker?.track.DataSource.label.PrepareData.end({
|
|
19828
19882
|
details: [
|
|
@@ -20677,6 +20731,279 @@ var normalizeSortInfo = (initialSortInfo, weakMap3) => {
|
|
|
20677
20731
|
return result;
|
|
20678
20732
|
};
|
|
20679
20733
|
|
|
20734
|
+
// src/components/DataSource/RowInfoStore.ts
|
|
20735
|
+
function deepEqual(a, b) {
|
|
20736
|
+
if (a === b) return true;
|
|
20737
|
+
if (a == null || b == null) return a === b;
|
|
20738
|
+
if (typeof a !== typeof b) return false;
|
|
20739
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
20740
|
+
if (a.length !== b.length) return false;
|
|
20741
|
+
for (let i = 0, len = a.length; i < len; i++) {
|
|
20742
|
+
if (!deepEqual(a[i], b[i])) return false;
|
|
20743
|
+
}
|
|
20744
|
+
return true;
|
|
20745
|
+
}
|
|
20746
|
+
if (typeof a === "object") {
|
|
20747
|
+
const keysA = Object.keys(a);
|
|
20748
|
+
const keysB = Object.keys(b);
|
|
20749
|
+
if (keysA.length !== keysB.length) return false;
|
|
20750
|
+
for (const key of keysA) {
|
|
20751
|
+
if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
|
|
20752
|
+
if (!deepEqual(a[key], b[key])) return false;
|
|
20753
|
+
}
|
|
20754
|
+
return true;
|
|
20755
|
+
}
|
|
20756
|
+
return false;
|
|
20757
|
+
}
|
|
20758
|
+
function isSameRowInfoType(one, two) {
|
|
20759
|
+
if (one === void 0 || two === void 0) return false;
|
|
20760
|
+
if (one.isGroupRow !== two.isGroupRow) return false;
|
|
20761
|
+
if (one.dataSourceHasGrouping !== two.dataSourceHasGrouping) return false;
|
|
20762
|
+
if (one.isTreeNode !== two.isTreeNode) return false;
|
|
20763
|
+
if (one.isTreeNode) {
|
|
20764
|
+
if (one.isParentNode !== two.isParentNode)
|
|
20765
|
+
return false;
|
|
20766
|
+
}
|
|
20767
|
+
return true;
|
|
20768
|
+
}
|
|
20769
|
+
var rowInfoBase_KeysRecord = {
|
|
20770
|
+
id: true,
|
|
20771
|
+
value: true,
|
|
20772
|
+
indexInAll: true,
|
|
20773
|
+
rowSelected: true,
|
|
20774
|
+
rowDisabled: true,
|
|
20775
|
+
isCellSelected: false,
|
|
20776
|
+
hasSelectedCells: false
|
|
20777
|
+
};
|
|
20778
|
+
var rowInfo_NoGrouping_RowInfoNormal_KeysRecord = {
|
|
20779
|
+
...rowInfoBase_KeysRecord,
|
|
20780
|
+
dataSourceHasGrouping: true,
|
|
20781
|
+
isTreeNode: true,
|
|
20782
|
+
data: false,
|
|
20783
|
+
isGroupRow: true,
|
|
20784
|
+
selfLoaded: true
|
|
20785
|
+
};
|
|
20786
|
+
var rowInfo_HasGrouping_RowInfoBase_KeysRecord = {
|
|
20787
|
+
indexInGroup: true,
|
|
20788
|
+
groupKeys: true,
|
|
20789
|
+
groupBy: true,
|
|
20790
|
+
rootGroupBy: true,
|
|
20791
|
+
parents: false,
|
|
20792
|
+
indexInParentGroups: true,
|
|
20793
|
+
groupCount: true,
|
|
20794
|
+
groupNesting: true,
|
|
20795
|
+
collapsed: true,
|
|
20796
|
+
selfLoaded: true
|
|
20797
|
+
};
|
|
20798
|
+
var rowInfo_HasGrouping_RowInfoGroup_KeysRecord = {
|
|
20799
|
+
...rowInfoBase_KeysRecord,
|
|
20800
|
+
...rowInfo_HasGrouping_RowInfoBase_KeysRecord,
|
|
20801
|
+
dataSourceHasGrouping: true,
|
|
20802
|
+
isTreeNode: true,
|
|
20803
|
+
data: false,
|
|
20804
|
+
reducerData: true,
|
|
20805
|
+
isGroupRow: true,
|
|
20806
|
+
duplicateOf: false,
|
|
20807
|
+
deepRowInfoArray: false,
|
|
20808
|
+
error: true,
|
|
20809
|
+
reducerResults: true,
|
|
20810
|
+
groupCount: true,
|
|
20811
|
+
groupData: true,
|
|
20812
|
+
selectedChildredCount: true,
|
|
20813
|
+
deselectedChildredCount: true,
|
|
20814
|
+
totalChildrenCount: true,
|
|
20815
|
+
collapsedChildrenCount: true,
|
|
20816
|
+
collapsedGroupsCount: true,
|
|
20817
|
+
directChildrenCount: true,
|
|
20818
|
+
directChildrenLoadedCount: true,
|
|
20819
|
+
pivotValuesMap: true,
|
|
20820
|
+
childrenAvailable: true,
|
|
20821
|
+
childrenLoading: true
|
|
20822
|
+
};
|
|
20823
|
+
var rowInfo_Tree_RowInfoBase_KeysRecord = {
|
|
20824
|
+
isTreeNode: true,
|
|
20825
|
+
isParentNode: true,
|
|
20826
|
+
indexInParent: true,
|
|
20827
|
+
nodePath: true,
|
|
20828
|
+
parentNodes: false,
|
|
20829
|
+
indexInParentNodes: true,
|
|
20830
|
+
totalLeafNodesCount: true,
|
|
20831
|
+
collapsedLeafNodesCount: true,
|
|
20832
|
+
treeNesting: true,
|
|
20833
|
+
selfLoaded: true
|
|
20834
|
+
};
|
|
20835
|
+
var rowInfo_Tree_RowInfoLeafNode_KeysRecord = {
|
|
20836
|
+
...rowInfoBase_KeysRecord,
|
|
20837
|
+
...rowInfo_Tree_RowInfoBase_KeysRecord,
|
|
20838
|
+
dataSourceHasGrouping: true,
|
|
20839
|
+
isTreeNode: true,
|
|
20840
|
+
isGroupRow: true,
|
|
20841
|
+
isParentNode: true,
|
|
20842
|
+
data: false
|
|
20843
|
+
};
|
|
20844
|
+
var rowInfo_Tree_RowInfoParentNode_KeysRecord = {
|
|
20845
|
+
...rowInfoBase_KeysRecord,
|
|
20846
|
+
...rowInfo_Tree_RowInfoBase_KeysRecord,
|
|
20847
|
+
dataSourceHasGrouping: true,
|
|
20848
|
+
isParentNode: true,
|
|
20849
|
+
isGroupRow: true,
|
|
20850
|
+
nodeExpanded: true,
|
|
20851
|
+
selfExpanded: true,
|
|
20852
|
+
data: false,
|
|
20853
|
+
selectedLeafNodesCount: true,
|
|
20854
|
+
deepRowInfoArray: false,
|
|
20855
|
+
deselectedLeafNodesCount: true,
|
|
20856
|
+
duplicateOf: false
|
|
20857
|
+
};
|
|
20858
|
+
var rowInfoKeys_noGrouping = Object.entries(
|
|
20859
|
+
rowInfo_NoGrouping_RowInfoNormal_KeysRecord
|
|
20860
|
+
).map(([key, value]) => value ? key : void 0).filter(Boolean);
|
|
20861
|
+
var rowInfoKeys_hasGrouping_normalRow = Object.entries(
|
|
20862
|
+
rowInfo_NoGrouping_RowInfoNormal_KeysRecord
|
|
20863
|
+
).map(
|
|
20864
|
+
([key, value]) => value ? key : void 0
|
|
20865
|
+
);
|
|
20866
|
+
var rowInfoKeys_hasGrouping_groupRow = Object.entries(
|
|
20867
|
+
rowInfo_HasGrouping_RowInfoGroup_KeysRecord
|
|
20868
|
+
).map(
|
|
20869
|
+
([key, value]) => value ? key : void 0
|
|
20870
|
+
);
|
|
20871
|
+
var rowInfoKeys_tree_leafNode = Object.entries(
|
|
20872
|
+
rowInfo_Tree_RowInfoLeafNode_KeysRecord
|
|
20873
|
+
).map(
|
|
20874
|
+
([key, value]) => value ? key : void 0
|
|
20875
|
+
);
|
|
20876
|
+
var rowInfoKeys_tree_parentNode = Object.entries(
|
|
20877
|
+
rowInfo_Tree_RowInfoParentNode_KeysRecord
|
|
20878
|
+
).map(
|
|
20879
|
+
([key, value]) => value ? key : void 0
|
|
20880
|
+
);
|
|
20881
|
+
function deepEqualRowInfo(oldRowInfo, newRowInfo) {
|
|
20882
|
+
if (oldRowInfo === newRowInfo) return true;
|
|
20883
|
+
if (!oldRowInfo || !newRowInfo) {
|
|
20884
|
+
return false;
|
|
20885
|
+
}
|
|
20886
|
+
if (!isSameRowInfoType(oldRowInfo, newRowInfo)) {
|
|
20887
|
+
return false;
|
|
20888
|
+
}
|
|
20889
|
+
if (oldRowInfo.id !== newRowInfo.id) return false;
|
|
20890
|
+
if (oldRowInfo.data !== newRowInfo.data) {
|
|
20891
|
+
if (!deepEqual(oldRowInfo.data, newRowInfo.data)) {
|
|
20892
|
+
return false;
|
|
20893
|
+
}
|
|
20894
|
+
}
|
|
20895
|
+
let allKeys = [];
|
|
20896
|
+
if (!oldRowInfo.dataSourceHasGrouping) {
|
|
20897
|
+
if (oldRowInfo.isTreeNode) {
|
|
20898
|
+
allKeys = oldRowInfo.isTreeNode && oldRowInfo.isParentNode ? rowInfoKeys_tree_parentNode : rowInfoKeys_tree_leafNode;
|
|
20899
|
+
} else {
|
|
20900
|
+
allKeys = rowInfoKeys_noGrouping;
|
|
20901
|
+
}
|
|
20902
|
+
} else {
|
|
20903
|
+
allKeys = oldRowInfo.isGroupRow ? rowInfoKeys_hasGrouping_groupRow : rowInfoKeys_hasGrouping_normalRow;
|
|
20904
|
+
}
|
|
20905
|
+
for (const key of allKeys) {
|
|
20906
|
+
const oldValue = oldRowInfo[key];
|
|
20907
|
+
const newValue = newRowInfo[key];
|
|
20908
|
+
if (typeof oldValue === "function" || typeof newValue === "function") {
|
|
20909
|
+
continue;
|
|
20910
|
+
}
|
|
20911
|
+
if (!deepEqual(oldValue, newValue)) {
|
|
20912
|
+
return false;
|
|
20913
|
+
}
|
|
20914
|
+
}
|
|
20915
|
+
return true;
|
|
20916
|
+
}
|
|
20917
|
+
function createRowInfoStore() {
|
|
20918
|
+
let dataArray = [];
|
|
20919
|
+
const subscribers = /* @__PURE__ */ new Map();
|
|
20920
|
+
const notifyDataArray = (newDataArray, params) => {
|
|
20921
|
+
const oldDataArray = dataArray;
|
|
20922
|
+
const marker = params?.marker;
|
|
20923
|
+
if (marker) {
|
|
20924
|
+
marker.start({
|
|
20925
|
+
details: [
|
|
20926
|
+
{ name: "new dataArray length", value: newDataArray.length },
|
|
20927
|
+
{
|
|
20928
|
+
name: "old dataArray length",
|
|
20929
|
+
value: oldDataArray.length
|
|
20930
|
+
}
|
|
20931
|
+
]
|
|
20932
|
+
});
|
|
20933
|
+
}
|
|
20934
|
+
const changedIndices = [];
|
|
20935
|
+
const subscribedRowIndexes = getSubscribedRowIndexes();
|
|
20936
|
+
for (const index of subscribedRowIndexes) {
|
|
20937
|
+
const oldRowInfo = oldDataArray[index];
|
|
20938
|
+
const newRowInfo = newDataArray[index];
|
|
20939
|
+
if (newRowInfo === void 0) {
|
|
20940
|
+
changedIndices.push(index);
|
|
20941
|
+
continue;
|
|
20942
|
+
}
|
|
20943
|
+
if (!deepEqualRowInfo(oldRowInfo, newRowInfo)) {
|
|
20944
|
+
changedIndices.push(index);
|
|
20945
|
+
}
|
|
20946
|
+
}
|
|
20947
|
+
dataArray = newDataArray;
|
|
20948
|
+
if (changedIndices.length > 0) {
|
|
20949
|
+
queueMicrotask(() => {
|
|
20950
|
+
console.log("notify", changedIndices);
|
|
20951
|
+
for (let i = 0, len = changedIndices.length; i < len; i++) {
|
|
20952
|
+
const index = changedIndices[i];
|
|
20953
|
+
const indexSubscribers = subscribers.get(index);
|
|
20954
|
+
if (indexSubscribers) {
|
|
20955
|
+
for (const callback of indexSubscribers) {
|
|
20956
|
+
callback();
|
|
20957
|
+
}
|
|
20958
|
+
}
|
|
20959
|
+
}
|
|
20960
|
+
});
|
|
20961
|
+
}
|
|
20962
|
+
if (marker) {
|
|
20963
|
+
marker.end({
|
|
20964
|
+
details: [{ name: "updated row infos", value: changedIndices.length }]
|
|
20965
|
+
});
|
|
20966
|
+
}
|
|
20967
|
+
};
|
|
20968
|
+
const getRowInfoAtIndex = (index) => {
|
|
20969
|
+
return dataArray[index];
|
|
20970
|
+
};
|
|
20971
|
+
const subscribeToRowIndex = (rowIndex, callback) => {
|
|
20972
|
+
let indexSubscribers = subscribers.get(rowIndex);
|
|
20973
|
+
if (!indexSubscribers) {
|
|
20974
|
+
indexSubscribers = /* @__PURE__ */ new Set();
|
|
20975
|
+
subscribers.set(rowIndex, indexSubscribers);
|
|
20976
|
+
}
|
|
20977
|
+
indexSubscribers.add(callback);
|
|
20978
|
+
return () => {
|
|
20979
|
+
const subs = subscribers.get(rowIndex);
|
|
20980
|
+
if (subs) {
|
|
20981
|
+
subs.delete(callback);
|
|
20982
|
+
if (subs.size === 0) {
|
|
20983
|
+
subscribers.delete(rowIndex);
|
|
20984
|
+
}
|
|
20985
|
+
}
|
|
20986
|
+
};
|
|
20987
|
+
};
|
|
20988
|
+
const getSubscribedRowIndexes = () => {
|
|
20989
|
+
return Array.from(subscribers.keys());
|
|
20990
|
+
};
|
|
20991
|
+
const getDataArray = () => {
|
|
20992
|
+
return dataArray;
|
|
20993
|
+
};
|
|
20994
|
+
const clear = () => {
|
|
20995
|
+
dataArray = [];
|
|
20996
|
+
subscribers.clear();
|
|
20997
|
+
};
|
|
20998
|
+
return {
|
|
20999
|
+
notifyDataArray,
|
|
21000
|
+
getRowInfoAtIndex,
|
|
21001
|
+
subscribeToRowIndex,
|
|
21002
|
+
getDataArray,
|
|
21003
|
+
clear
|
|
21004
|
+
};
|
|
21005
|
+
}
|
|
21006
|
+
|
|
20680
21007
|
// src/components/DataSource/state/getInitialState.ts
|
|
20681
21008
|
var defaultCursorId = Symbol("cursorId");
|
|
20682
21009
|
var isNodeReadOnly = (rowInfo) => {
|
|
@@ -20696,6 +21023,7 @@ function initSetupState(props) {
|
|
|
20696
21023
|
debugTimings: /* @__PURE__ */ new Map(),
|
|
20697
21024
|
debugWarnings: /* @__PURE__ */ new Map(),
|
|
20698
21025
|
devToolsDetected: !!globalThis.__INFINITE_TABLE_DEVTOOLS_HOOK__,
|
|
21026
|
+
rowInfoStore: createRowInfoStore(),
|
|
20699
21027
|
// TODO cleanup indexer on unmount
|
|
20700
21028
|
indexer: new Indexer(),
|
|
20701
21029
|
totalLeafNodesCount: 0,
|
|
@@ -20796,6 +21124,7 @@ var cleanupDataSource = (state) => {
|
|
|
20796
21124
|
state.treeSelectionState?.destroy();
|
|
20797
21125
|
state.idToPathMap.clear();
|
|
20798
21126
|
state.idToIndexMap.clear();
|
|
21127
|
+
state.rowInfoStore.clear();
|
|
20799
21128
|
};
|
|
20800
21129
|
var forwardProps3 = (setupState, props) => {
|
|
20801
21130
|
return {
|
|
@@ -23351,7 +23680,9 @@ var InfiniteTableApiImpl = class {
|
|
|
23351
23680
|
}
|
|
23352
23681
|
set scrollLeft(scrollLeft2) {
|
|
23353
23682
|
const state = this.getState();
|
|
23354
|
-
state.scrollerDOMRef.current
|
|
23683
|
+
if (state.scrollerDOMRef.current) {
|
|
23684
|
+
state.scrollerDOMRef.current.scrollLeft = Math.max(scrollLeft2, 0);
|
|
23685
|
+
}
|
|
23355
23686
|
}
|
|
23356
23687
|
get scrollTop() {
|
|
23357
23688
|
const state = this.getState();
|
|
@@ -23359,7 +23690,9 @@ var InfiniteTableApiImpl = class {
|
|
|
23359
23690
|
}
|
|
23360
23691
|
set scrollTop(scrollTop2) {
|
|
23361
23692
|
const state = this.getState();
|
|
23362
|
-
state.scrollerDOMRef.current
|
|
23693
|
+
if (state.scrollerDOMRef.current) {
|
|
23694
|
+
state.scrollerDOMRef.current.scrollTop = Math.max(scrollTop2, 0);
|
|
23695
|
+
}
|
|
23363
23696
|
}
|
|
23364
23697
|
scrollRowIntoView(rowIndex, config = { offset: 0 }) {
|
|
23365
23698
|
const state = this.getState();
|
|
@@ -24234,12 +24567,14 @@ function initSetupState2({
|
|
|
24234
24567
|
headerOnRenderUpdater
|
|
24235
24568
|
} = createBrains(debugId, !!wrapRowsHorizontally);
|
|
24236
24569
|
const domRef = (0, import_react42.createRef)();
|
|
24570
|
+
const now = Date.now();
|
|
24237
24571
|
return {
|
|
24238
24572
|
debugWarnings: /* @__PURE__ */ new Map(),
|
|
24239
24573
|
renderer,
|
|
24240
24574
|
onRenderUpdater,
|
|
24241
24575
|
headerRenderer,
|
|
24242
24576
|
headerOnRenderUpdater,
|
|
24577
|
+
updatedAt: now,
|
|
24243
24578
|
devToolsDetected: !!globalThis.__INFINITE_TABLE_DEVTOOLS_HOOK__,
|
|
24244
24579
|
propsCache: /* @__PURE__ */ new Map([]),
|
|
24245
24580
|
lastRowToCollapseRef: { current: null },
|
|
@@ -24526,6 +24861,7 @@ var mapPropsToState = (params) => {
|
|
|
24526
24861
|
}
|
|
24527
24862
|
const isRowDetailEnabled = !rowDetailRenderer ? false : props.isRowDetailEnabled || true;
|
|
24528
24863
|
let result = {
|
|
24864
|
+
updatedAt: Date.now(),
|
|
24529
24865
|
isTree: parentState.isTree,
|
|
24530
24866
|
rowDetailRenderer,
|
|
24531
24867
|
rowDetailState,
|
|
@@ -25746,7 +26082,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
25746
26082
|
}
|
|
25747
26083
|
let valid2 = isValidLicense(licenseKey, {
|
|
25748
26084
|
publishedAt: 1624970570587,
|
|
25749
|
-
version: "7.
|
|
26085
|
+
version: "7.5.0"
|
|
25750
26086
|
});
|
|
25751
26087
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
25752
26088
|
return true;
|
|
@@ -29985,7 +30321,7 @@ var InfiniteTableDetailRow = React73.memo(
|
|
|
29985
30321
|
var SCROLL_BOTTOM_OFFSET = 1;
|
|
29986
30322
|
function useCellRendering(param) {
|
|
29987
30323
|
const { computed, bodySize, imperativeApi } = param;
|
|
29988
|
-
const { actions, state, getState } = useInfiniteTable();
|
|
30324
|
+
const { actions, state, getState, getComputed, getDataSourceMasterContext } = useInfiniteTable();
|
|
29989
30325
|
const {
|
|
29990
30326
|
computedPinnedStartColumns,
|
|
29991
30327
|
computedPinnedEndColumns,
|
|
@@ -30004,7 +30340,13 @@ function useCellRendering(param) {
|
|
|
30004
30340
|
componentActions: dataSourceActions,
|
|
30005
30341
|
api: dataSourceApi
|
|
30006
30342
|
} = useDataSourceContextValue();
|
|
30007
|
-
const {
|
|
30343
|
+
const {
|
|
30344
|
+
dataArray,
|
|
30345
|
+
rowInfoStore,
|
|
30346
|
+
selectionMode,
|
|
30347
|
+
cellSelection,
|
|
30348
|
+
isNodeReadOnly: isNodeReadOnly2
|
|
30349
|
+
} = dataSourceState;
|
|
30008
30350
|
const getData = useLatest(dataArray);
|
|
30009
30351
|
const {
|
|
30010
30352
|
rowHeight,
|
|
@@ -30027,7 +30369,9 @@ function useCellRendering(param) {
|
|
|
30027
30369
|
onScrollStop,
|
|
30028
30370
|
scrollToBottomOffset,
|
|
30029
30371
|
wrapRowsHorizontally,
|
|
30030
|
-
|
|
30372
|
+
updatedAt: componentStateUpdatedAt,
|
|
30373
|
+
ready,
|
|
30374
|
+
editingCell
|
|
30031
30375
|
} = state;
|
|
30032
30376
|
const repaintId = dataSourceState.updatedAt;
|
|
30033
30377
|
useYourBrain({
|
|
@@ -30110,6 +30454,13 @@ function useCellRendering(param) {
|
|
|
30110
30454
|
(0, import_react69.useEffect)(() => {
|
|
30111
30455
|
rerender();
|
|
30112
30456
|
}, [dataSourceState]);
|
|
30457
|
+
const dataSourceStatePartialForCell = (0, import_react68.useMemo)(() => {
|
|
30458
|
+
return {
|
|
30459
|
+
isNodeReadOnly: isNodeReadOnly2,
|
|
30460
|
+
selectionMode,
|
|
30461
|
+
cellSelection
|
|
30462
|
+
};
|
|
30463
|
+
}, [isNodeReadOnly2, selectionMode, cellSelection]);
|
|
30113
30464
|
const renderCell = (0, import_react69.useCallback)(
|
|
30114
30465
|
(params) => {
|
|
30115
30466
|
const {
|
|
@@ -30140,6 +30491,10 @@ function useCellRendering(param) {
|
|
|
30140
30491
|
}
|
|
30141
30492
|
const rowIndexInHorizontalLayoutPage = wrapRowsHorizontally ? brain.getRowIndexInPage(rowIndex) : null;
|
|
30142
30493
|
const horizontalLayoutPageIndex = wrapRowsHorizontally ? brain.getPageIndexForRow(rowIndex) : null;
|
|
30494
|
+
const inEditMode = imperativeApi.isEditorVisibleForCell({
|
|
30495
|
+
rowIndex,
|
|
30496
|
+
columnId: column.id
|
|
30497
|
+
});
|
|
30143
30498
|
const cellProps = {
|
|
30144
30499
|
getData,
|
|
30145
30500
|
virtualized: true,
|
|
@@ -30148,7 +30503,7 @@ function useCellRendering(param) {
|
|
|
30148
30503
|
rowIndexInHorizontalLayoutPage,
|
|
30149
30504
|
horizontalLayoutPageIndex,
|
|
30150
30505
|
rowIndex,
|
|
30151
|
-
|
|
30506
|
+
rowInfoStore,
|
|
30152
30507
|
hidden,
|
|
30153
30508
|
toggleGroupRow,
|
|
30154
30509
|
rowHeight: rowHeight2,
|
|
@@ -30165,7 +30520,21 @@ function useCellRendering(param) {
|
|
|
30165
30520
|
rowStyle,
|
|
30166
30521
|
rowClassName,
|
|
30167
30522
|
cellStyle,
|
|
30168
|
-
cellClassName
|
|
30523
|
+
cellClassName,
|
|
30524
|
+
// Whether this specific cell is in edit mode
|
|
30525
|
+
// Passed as prop to trigger re-render when editing state changes
|
|
30526
|
+
inEditMode,
|
|
30527
|
+
// DataSource context values passed as props to avoid context re-renders
|
|
30528
|
+
getDataSourceState,
|
|
30529
|
+
dataSourceApi,
|
|
30530
|
+
dataSourceActions,
|
|
30531
|
+
// InfiniteTable context values passed as props to avoid context re-renders
|
|
30532
|
+
getState,
|
|
30533
|
+
imperativeApi,
|
|
30534
|
+
componentActions: actions,
|
|
30535
|
+
getComputed,
|
|
30536
|
+
getDataSourceMasterContext,
|
|
30537
|
+
dataSourceStatePartialForCell
|
|
30169
30538
|
};
|
|
30170
30539
|
return /* @__PURE__ */ React74.createElement(InfiniteTableColumnCell, { ...cellProps });
|
|
30171
30540
|
},
|
|
@@ -30187,11 +30556,22 @@ function useCellRendering(param) {
|
|
|
30187
30556
|
showZebraRows,
|
|
30188
30557
|
brain,
|
|
30189
30558
|
repaintId,
|
|
30190
|
-
|
|
30559
|
+
rowInfoStore,
|
|
30191
30560
|
rowStyle,
|
|
30192
30561
|
rowClassName,
|
|
30193
30562
|
cellClassName,
|
|
30194
|
-
cellStyle
|
|
30563
|
+
cellStyle,
|
|
30564
|
+
getDataSourceState,
|
|
30565
|
+
dataSourceApi,
|
|
30566
|
+
dataSourceActions,
|
|
30567
|
+
getState,
|
|
30568
|
+
imperativeApi,
|
|
30569
|
+
actions,
|
|
30570
|
+
getComputed,
|
|
30571
|
+
getDataSourceMasterContext,
|
|
30572
|
+
componentStateUpdatedAt,
|
|
30573
|
+
editingCell,
|
|
30574
|
+
dataSourceStatePartialForCell
|
|
30195
30575
|
]
|
|
30196
30576
|
);
|
|
30197
30577
|
const renderDetailRow = (0, import_react68.useMemo)(() => {
|
|
@@ -30538,7 +30918,7 @@ var InfiniteTableComponent = React78.memo(
|
|
|
30538
30918
|
if (false) {
|
|
30539
30919
|
globalThis.infiniteApi = context.api;
|
|
30540
30920
|
}
|
|
30541
|
-
}, [componentState.ready]);
|
|
30921
|
+
}, [componentState.ready, context.api]);
|
|
30542
30922
|
const debugId = useDebugMode();
|
|
30543
30923
|
React78.useEffect(() => {
|
|
30544
30924
|
if (masterContext) {
|