@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.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: () => confirmEdit(),
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
- rowInfo,
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
- if (!column) {
6942
- return /* @__PURE__ */ React29.createElement("div", { ref: domRef }, "no column");
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 } = dataSourceState;
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
@@ -11381,6 +11417,14 @@ var GridRenderer = class extends Logger {
11381
11417
  const covered = coveredByAnotherRow || coveredByAnotherCol;
11382
11418
  return covered ? [rowspanParent, colspanParent] : false;
11383
11419
  };
11420
+ this.onMouseEnterNotBound = (event) => {
11421
+ const rowIndex = Number(event.target.dataset.rowIndex);
11422
+ this.onMouseEnter(rowIndex);
11423
+ };
11424
+ this.onMouseLeaveNotBound = (event) => {
11425
+ const rowIndex = Number(event.target.dataset.rowIndex);
11426
+ this.onMouseLeave(rowIndex);
11427
+ };
11384
11428
  this.onMouseEnter = (rowIndex) => {
11385
11429
  this.lastEnteredRow = rowIndex;
11386
11430
  this.lastExitedRow = -1;
@@ -12070,8 +12114,12 @@ var GridRenderer = class extends Logger {
12070
12114
  hidden,
12071
12115
  heightWithRowspan,
12072
12116
  widthWithColspan,
12073
- onMouseEnter: this.onMouseEnter.bind(null, rowIndex),
12074
- onMouseLeave: this.onMouseLeave.bind(null, rowIndex),
12117
+ // onMouseEnter: this.onMouseEnter.bind(null, rowIndex),
12118
+ onMouseEnter: this.onMouseEnterNotBound,
12119
+ //.bind(null, rowIndex),
12120
+ // onMouseLeave: this.onMouseLeave.bind(null, rowIndex),
12121
+ onMouseLeave: this.onMouseLeaveNotBound,
12122
+ //.bind(null, rowIndex),
12075
12123
  domRef: cell.ref
12076
12124
  });
12077
12125
  if (!cell.isMounted()) {
@@ -19763,6 +19811,9 @@ function concludeReducer(params) {
19763
19811
  treeMutations: treeMutations?.size ? treeMutations : void 0
19764
19812
  };
19765
19813
  }
19814
+ state.rowInfoStore.notifyDataArray(rowInfoDataArray, {
19815
+ marker: debugId ? getMarker(debugId).track.DataSource.label.DiffRowInfoInStore : void 0
19816
+ });
19766
19817
  if (rootMarker) {
19767
19818
  rootMarker?.track.DataSource.label.PrepareData.end({
19768
19819
  details: [
@@ -20617,6 +20668,279 @@ var normalizeSortInfo = (initialSortInfo, weakMap3) => {
20617
20668
  return result;
20618
20669
  };
20619
20670
 
20671
+ // src/components/DataSource/RowInfoStore.ts
20672
+ function deepEqual(a, b) {
20673
+ if (a === b) return true;
20674
+ if (a == null || b == null) return a === b;
20675
+ if (typeof a !== typeof b) return false;
20676
+ if (Array.isArray(a) && Array.isArray(b)) {
20677
+ if (a.length !== b.length) return false;
20678
+ for (let i = 0, len = a.length; i < len; i++) {
20679
+ if (!deepEqual(a[i], b[i])) return false;
20680
+ }
20681
+ return true;
20682
+ }
20683
+ if (typeof a === "object") {
20684
+ const keysA = Object.keys(a);
20685
+ const keysB = Object.keys(b);
20686
+ if (keysA.length !== keysB.length) return false;
20687
+ for (const key of keysA) {
20688
+ if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
20689
+ if (!deepEqual(a[key], b[key])) return false;
20690
+ }
20691
+ return true;
20692
+ }
20693
+ return false;
20694
+ }
20695
+ function isSameRowInfoType(one, two) {
20696
+ if (one === void 0 || two === void 0) return false;
20697
+ if (one.isGroupRow !== two.isGroupRow) return false;
20698
+ if (one.dataSourceHasGrouping !== two.dataSourceHasGrouping) return false;
20699
+ if (one.isTreeNode !== two.isTreeNode) return false;
20700
+ if (one.isTreeNode) {
20701
+ if (one.isParentNode !== two.isParentNode)
20702
+ return false;
20703
+ }
20704
+ return true;
20705
+ }
20706
+ var rowInfoBase_KeysRecord = {
20707
+ id: true,
20708
+ value: true,
20709
+ indexInAll: true,
20710
+ rowSelected: true,
20711
+ rowDisabled: true,
20712
+ isCellSelected: false,
20713
+ hasSelectedCells: false
20714
+ };
20715
+ var rowInfo_NoGrouping_RowInfoNormal_KeysRecord = {
20716
+ ...rowInfoBase_KeysRecord,
20717
+ dataSourceHasGrouping: true,
20718
+ isTreeNode: true,
20719
+ data: false,
20720
+ isGroupRow: true,
20721
+ selfLoaded: true
20722
+ };
20723
+ var rowInfo_HasGrouping_RowInfoBase_KeysRecord = {
20724
+ indexInGroup: true,
20725
+ groupKeys: true,
20726
+ groupBy: true,
20727
+ rootGroupBy: true,
20728
+ parents: false,
20729
+ indexInParentGroups: true,
20730
+ groupCount: true,
20731
+ groupNesting: true,
20732
+ collapsed: true,
20733
+ selfLoaded: true
20734
+ };
20735
+ var rowInfo_HasGrouping_RowInfoGroup_KeysRecord = {
20736
+ ...rowInfoBase_KeysRecord,
20737
+ ...rowInfo_HasGrouping_RowInfoBase_KeysRecord,
20738
+ dataSourceHasGrouping: true,
20739
+ isTreeNode: true,
20740
+ data: false,
20741
+ reducerData: true,
20742
+ isGroupRow: true,
20743
+ duplicateOf: false,
20744
+ deepRowInfoArray: false,
20745
+ error: true,
20746
+ reducerResults: true,
20747
+ groupCount: true,
20748
+ groupData: true,
20749
+ selectedChildredCount: true,
20750
+ deselectedChildredCount: true,
20751
+ totalChildrenCount: true,
20752
+ collapsedChildrenCount: true,
20753
+ collapsedGroupsCount: true,
20754
+ directChildrenCount: true,
20755
+ directChildrenLoadedCount: true,
20756
+ pivotValuesMap: true,
20757
+ childrenAvailable: true,
20758
+ childrenLoading: true
20759
+ };
20760
+ var rowInfo_Tree_RowInfoBase_KeysRecord = {
20761
+ isTreeNode: true,
20762
+ isParentNode: true,
20763
+ indexInParent: true,
20764
+ nodePath: true,
20765
+ parentNodes: false,
20766
+ indexInParentNodes: true,
20767
+ totalLeafNodesCount: true,
20768
+ collapsedLeafNodesCount: true,
20769
+ treeNesting: true,
20770
+ selfLoaded: true
20771
+ };
20772
+ var rowInfo_Tree_RowInfoLeafNode_KeysRecord = {
20773
+ ...rowInfoBase_KeysRecord,
20774
+ ...rowInfo_Tree_RowInfoBase_KeysRecord,
20775
+ dataSourceHasGrouping: true,
20776
+ isTreeNode: true,
20777
+ isGroupRow: true,
20778
+ isParentNode: true,
20779
+ data: false
20780
+ };
20781
+ var rowInfo_Tree_RowInfoParentNode_KeysRecord = {
20782
+ ...rowInfoBase_KeysRecord,
20783
+ ...rowInfo_Tree_RowInfoBase_KeysRecord,
20784
+ dataSourceHasGrouping: true,
20785
+ isParentNode: true,
20786
+ isGroupRow: true,
20787
+ nodeExpanded: true,
20788
+ selfExpanded: true,
20789
+ data: false,
20790
+ selectedLeafNodesCount: true,
20791
+ deepRowInfoArray: false,
20792
+ deselectedLeafNodesCount: true,
20793
+ duplicateOf: false
20794
+ };
20795
+ var rowInfoKeys_noGrouping = Object.entries(
20796
+ rowInfo_NoGrouping_RowInfoNormal_KeysRecord
20797
+ ).map(([key, value]) => value ? key : void 0).filter(Boolean);
20798
+ var rowInfoKeys_hasGrouping_normalRow = Object.entries(
20799
+ rowInfo_NoGrouping_RowInfoNormal_KeysRecord
20800
+ ).map(
20801
+ ([key, value]) => value ? key : void 0
20802
+ );
20803
+ var rowInfoKeys_hasGrouping_groupRow = Object.entries(
20804
+ rowInfo_HasGrouping_RowInfoGroup_KeysRecord
20805
+ ).map(
20806
+ ([key, value]) => value ? key : void 0
20807
+ );
20808
+ var rowInfoKeys_tree_leafNode = Object.entries(
20809
+ rowInfo_Tree_RowInfoLeafNode_KeysRecord
20810
+ ).map(
20811
+ ([key, value]) => value ? key : void 0
20812
+ );
20813
+ var rowInfoKeys_tree_parentNode = Object.entries(
20814
+ rowInfo_Tree_RowInfoParentNode_KeysRecord
20815
+ ).map(
20816
+ ([key, value]) => value ? key : void 0
20817
+ );
20818
+ function deepEqualRowInfo(oldRowInfo, newRowInfo) {
20819
+ if (oldRowInfo === newRowInfo) return true;
20820
+ if (!oldRowInfo || !newRowInfo) {
20821
+ return false;
20822
+ }
20823
+ if (!isSameRowInfoType(oldRowInfo, newRowInfo)) {
20824
+ return false;
20825
+ }
20826
+ if (oldRowInfo.id !== newRowInfo.id) return false;
20827
+ if (oldRowInfo.data !== newRowInfo.data) {
20828
+ if (!deepEqual(oldRowInfo.data, newRowInfo.data)) {
20829
+ return false;
20830
+ }
20831
+ }
20832
+ let allKeys = [];
20833
+ if (!oldRowInfo.dataSourceHasGrouping) {
20834
+ if (oldRowInfo.isTreeNode) {
20835
+ allKeys = oldRowInfo.isTreeNode && oldRowInfo.isParentNode ? rowInfoKeys_tree_parentNode : rowInfoKeys_tree_leafNode;
20836
+ } else {
20837
+ allKeys = rowInfoKeys_noGrouping;
20838
+ }
20839
+ } else {
20840
+ allKeys = oldRowInfo.isGroupRow ? rowInfoKeys_hasGrouping_groupRow : rowInfoKeys_hasGrouping_normalRow;
20841
+ }
20842
+ for (const key of allKeys) {
20843
+ const oldValue = oldRowInfo[key];
20844
+ const newValue = newRowInfo[key];
20845
+ if (typeof oldValue === "function" || typeof newValue === "function") {
20846
+ continue;
20847
+ }
20848
+ if (!deepEqual(oldValue, newValue)) {
20849
+ return false;
20850
+ }
20851
+ }
20852
+ return true;
20853
+ }
20854
+ function createRowInfoStore() {
20855
+ let dataArray = [];
20856
+ const subscribers = /* @__PURE__ */ new Map();
20857
+ const notifyDataArray = (newDataArray, params) => {
20858
+ const oldDataArray = dataArray;
20859
+ const marker = params?.marker;
20860
+ if (marker) {
20861
+ marker.start({
20862
+ details: [
20863
+ { name: "new dataArray length", value: newDataArray.length },
20864
+ {
20865
+ name: "old dataArray length",
20866
+ value: oldDataArray.length
20867
+ }
20868
+ ]
20869
+ });
20870
+ }
20871
+ const changedIndices = [];
20872
+ const subscribedRowIndexes = getSubscribedRowIndexes();
20873
+ for (const index of subscribedRowIndexes) {
20874
+ const oldRowInfo = oldDataArray[index];
20875
+ const newRowInfo = newDataArray[index];
20876
+ if (newRowInfo === void 0) {
20877
+ changedIndices.push(index);
20878
+ continue;
20879
+ }
20880
+ if (!deepEqualRowInfo(oldRowInfo, newRowInfo)) {
20881
+ changedIndices.push(index);
20882
+ }
20883
+ }
20884
+ dataArray = newDataArray;
20885
+ if (changedIndices.length > 0) {
20886
+ queueMicrotask(() => {
20887
+ console.log("notify", changedIndices);
20888
+ for (let i = 0, len = changedIndices.length; i < len; i++) {
20889
+ const index = changedIndices[i];
20890
+ const indexSubscribers = subscribers.get(index);
20891
+ if (indexSubscribers) {
20892
+ for (const callback of indexSubscribers) {
20893
+ callback();
20894
+ }
20895
+ }
20896
+ }
20897
+ });
20898
+ }
20899
+ if (marker) {
20900
+ marker.end({
20901
+ details: [{ name: "updated row infos", value: changedIndices.length }]
20902
+ });
20903
+ }
20904
+ };
20905
+ const getRowInfoAtIndex = (index) => {
20906
+ return dataArray[index];
20907
+ };
20908
+ const subscribeToRowIndex = (rowIndex, callback) => {
20909
+ let indexSubscribers = subscribers.get(rowIndex);
20910
+ if (!indexSubscribers) {
20911
+ indexSubscribers = /* @__PURE__ */ new Set();
20912
+ subscribers.set(rowIndex, indexSubscribers);
20913
+ }
20914
+ indexSubscribers.add(callback);
20915
+ return () => {
20916
+ const subs = subscribers.get(rowIndex);
20917
+ if (subs) {
20918
+ subs.delete(callback);
20919
+ if (subs.size === 0) {
20920
+ subscribers.delete(rowIndex);
20921
+ }
20922
+ }
20923
+ };
20924
+ };
20925
+ const getSubscribedRowIndexes = () => {
20926
+ return Array.from(subscribers.keys());
20927
+ };
20928
+ const getDataArray = () => {
20929
+ return dataArray;
20930
+ };
20931
+ const clear = () => {
20932
+ dataArray = [];
20933
+ subscribers.clear();
20934
+ };
20935
+ return {
20936
+ notifyDataArray,
20937
+ getRowInfoAtIndex,
20938
+ subscribeToRowIndex,
20939
+ getDataArray,
20940
+ clear
20941
+ };
20942
+ }
20943
+
20620
20944
  // src/components/DataSource/state/getInitialState.ts
20621
20945
  var defaultCursorId = Symbol("cursorId");
20622
20946
  var isNodeReadOnly = (rowInfo) => {
@@ -20636,6 +20960,7 @@ function initSetupState(props) {
20636
20960
  debugTimings: /* @__PURE__ */ new Map(),
20637
20961
  debugWarnings: /* @__PURE__ */ new Map(),
20638
20962
  devToolsDetected: !!globalThis.__INFINITE_TABLE_DEVTOOLS_HOOK__,
20963
+ rowInfoStore: createRowInfoStore(),
20639
20964
  // TODO cleanup indexer on unmount
20640
20965
  indexer: new Indexer(),
20641
20966
  totalLeafNodesCount: 0,
@@ -20736,6 +21061,7 @@ var cleanupDataSource = (state) => {
20736
21061
  state.treeSelectionState?.destroy();
20737
21062
  state.idToPathMap.clear();
20738
21063
  state.idToIndexMap.clear();
21064
+ state.rowInfoStore.clear();
20739
21065
  };
20740
21066
  var forwardProps3 = (setupState, props) => {
20741
21067
  return {
@@ -23296,7 +23622,9 @@ var InfiniteTableApiImpl = class {
23296
23622
  }
23297
23623
  set scrollLeft(scrollLeft2) {
23298
23624
  const state = this.getState();
23299
- state.scrollerDOMRef.current.scrollLeft = Math.max(scrollLeft2, 0);
23625
+ if (state.scrollerDOMRef.current) {
23626
+ state.scrollerDOMRef.current.scrollLeft = Math.max(scrollLeft2, 0);
23627
+ }
23300
23628
  }
23301
23629
  get scrollTop() {
23302
23630
  const state = this.getState();
@@ -23304,7 +23632,9 @@ var InfiniteTableApiImpl = class {
23304
23632
  }
23305
23633
  set scrollTop(scrollTop2) {
23306
23634
  const state = this.getState();
23307
- state.scrollerDOMRef.current.scrollTop = Math.max(scrollTop2, 0);
23635
+ if (state.scrollerDOMRef.current) {
23636
+ state.scrollerDOMRef.current.scrollTop = Math.max(scrollTop2, 0);
23637
+ }
23308
23638
  }
23309
23639
  scrollRowIntoView(rowIndex, config = { offset: 0 }) {
23310
23640
  const state = this.getState();
@@ -24183,12 +24513,14 @@ function initSetupState2({
24183
24513
  headerOnRenderUpdater
24184
24514
  } = createBrains(debugId, !!wrapRowsHorizontally);
24185
24515
  const domRef = createRef();
24516
+ const now = Date.now();
24186
24517
  return {
24187
24518
  debugWarnings: /* @__PURE__ */ new Map(),
24188
24519
  renderer,
24189
24520
  onRenderUpdater,
24190
24521
  headerRenderer,
24191
24522
  headerOnRenderUpdater,
24523
+ updatedAt: now,
24192
24524
  devToolsDetected: !!globalThis.__INFINITE_TABLE_DEVTOOLS_HOOK__,
24193
24525
  propsCache: /* @__PURE__ */ new Map([]),
24194
24526
  lastRowToCollapseRef: { current: null },
@@ -24475,6 +24807,7 @@ var mapPropsToState = (params) => {
24475
24807
  }
24476
24808
  const isRowDetailEnabled = !rowDetailRenderer ? false : props.isRowDetailEnabled || true;
24477
24809
  let result = {
24810
+ updatedAt: Date.now(),
24478
24811
  isTree: parentState.isTree,
24479
24812
  rowDetailRenderer,
24480
24813
  rowDetailState,
@@ -25695,7 +26028,7 @@ var useLicense = (licenseKey = "") => {
25695
26028
  }
25696
26029
  let valid2 = isValidLicense(licenseKey, {
25697
26030
  publishedAt: 1624970570587,
25698
- version: "7.4.2"
26031
+ version: "7.5.0-canary.0"
25699
26032
  });
25700
26033
  if (!licenseKey && !valid2 && isInsidePlayground) {
25701
26034
  return true;
@@ -29944,7 +30277,7 @@ var InfiniteTableDetailRow = React73.memo(
29944
30277
  var SCROLL_BOTTOM_OFFSET = 1;
29945
30278
  function useCellRendering(param) {
29946
30279
  const { computed, bodySize, imperativeApi } = param;
29947
- const { actions, state, getState } = useInfiniteTable();
30280
+ const { actions, state, getState, getComputed, getDataSourceMasterContext } = useInfiniteTable();
29948
30281
  const {
29949
30282
  computedPinnedStartColumns,
29950
30283
  computedPinnedEndColumns,
@@ -29963,7 +30296,13 @@ function useCellRendering(param) {
29963
30296
  componentActions: dataSourceActions,
29964
30297
  api: dataSourceApi
29965
30298
  } = useDataSourceContextValue();
29966
- const { dataArray, isNodeReadOnly: isNodeReadOnly2 } = dataSourceState;
30299
+ const {
30300
+ dataArray,
30301
+ rowInfoStore,
30302
+ selectionMode,
30303
+ cellSelection,
30304
+ isNodeReadOnly: isNodeReadOnly2
30305
+ } = dataSourceState;
29967
30306
  const getData = useLatest(dataArray);
29968
30307
  const {
29969
30308
  rowHeight,
@@ -29986,7 +30325,9 @@ function useCellRendering(param) {
29986
30325
  onScrollStop,
29987
30326
  scrollToBottomOffset,
29988
30327
  wrapRowsHorizontally,
29989
- ready
30328
+ updatedAt: componentStateUpdatedAt,
30329
+ ready,
30330
+ editingCell
29990
30331
  } = state;
29991
30332
  const repaintId = dataSourceState.updatedAt;
29992
30333
  useYourBrain({
@@ -30069,6 +30410,13 @@ function useCellRendering(param) {
30069
30410
  useEffect38(() => {
30070
30411
  rerender();
30071
30412
  }, [dataSourceState]);
30413
+ const dataSourceStatePartialForCell = useMemo17(() => {
30414
+ return {
30415
+ isNodeReadOnly: isNodeReadOnly2,
30416
+ selectionMode,
30417
+ cellSelection
30418
+ };
30419
+ }, [isNodeReadOnly2, selectionMode, cellSelection]);
30072
30420
  const renderCell = useCallback31(
30073
30421
  (params) => {
30074
30422
  const {
@@ -30099,6 +30447,10 @@ function useCellRendering(param) {
30099
30447
  }
30100
30448
  const rowIndexInHorizontalLayoutPage = wrapRowsHorizontally ? brain.getRowIndexInPage(rowIndex) : null;
30101
30449
  const horizontalLayoutPageIndex = wrapRowsHorizontally ? brain.getPageIndexForRow(rowIndex) : null;
30450
+ const inEditMode = imperativeApi.isEditorVisibleForCell({
30451
+ rowIndex,
30452
+ columnId: column.id
30453
+ });
30102
30454
  const cellProps = {
30103
30455
  getData,
30104
30456
  virtualized: true,
@@ -30107,7 +30459,7 @@ function useCellRendering(param) {
30107
30459
  rowIndexInHorizontalLayoutPage,
30108
30460
  horizontalLayoutPageIndex,
30109
30461
  rowIndex,
30110
- rowInfo,
30462
+ rowInfoStore,
30111
30463
  hidden,
30112
30464
  toggleGroupRow,
30113
30465
  rowHeight: rowHeight2,
@@ -30124,7 +30476,21 @@ function useCellRendering(param) {
30124
30476
  rowStyle,
30125
30477
  rowClassName,
30126
30478
  cellStyle,
30127
- cellClassName
30479
+ cellClassName,
30480
+ // Whether this specific cell is in edit mode
30481
+ // Passed as prop to trigger re-render when editing state changes
30482
+ inEditMode,
30483
+ // DataSource context values passed as props to avoid context re-renders
30484
+ getDataSourceState,
30485
+ dataSourceApi,
30486
+ dataSourceActions,
30487
+ // InfiniteTable context values passed as props to avoid context re-renders
30488
+ getState,
30489
+ imperativeApi,
30490
+ componentActions: actions,
30491
+ getComputed,
30492
+ getDataSourceMasterContext,
30493
+ dataSourceStatePartialForCell
30128
30494
  };
30129
30495
  return /* @__PURE__ */ React74.createElement(InfiniteTableColumnCell, { ...cellProps });
30130
30496
  },
@@ -30146,11 +30512,22 @@ function useCellRendering(param) {
30146
30512
  showZebraRows,
30147
30513
  brain,
30148
30514
  repaintId,
30149
- isNodeReadOnly2,
30515
+ rowInfoStore,
30150
30516
  rowStyle,
30151
30517
  rowClassName,
30152
30518
  cellClassName,
30153
- cellStyle
30519
+ cellStyle,
30520
+ getDataSourceState,
30521
+ dataSourceApi,
30522
+ dataSourceActions,
30523
+ getState,
30524
+ imperativeApi,
30525
+ actions,
30526
+ getComputed,
30527
+ getDataSourceMasterContext,
30528
+ componentStateUpdatedAt,
30529
+ editingCell,
30530
+ dataSourceStatePartialForCell
30154
30531
  ]
30155
30532
  );
30156
30533
  const renderDetailRow = useMemo17(() => {
@@ -30497,7 +30874,7 @@ var InfiniteTableComponent = React78.memo(
30497
30874
  if (false) {
30498
30875
  globalThis.infiniteApi = context.api;
30499
30876
  }
30500
- }, [componentState.ready]);
30877
+ }, [componentState.ready, context.api]);
30501
30878
  const debugId = useDebugMode();
30502
30879
  React78.useEffect(() => {
30503
30880
  if (masterContext) {