@infinite-table/infinite-react 9.0.3 → 9.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -895,14 +895,38 @@ interface PerfMarker {
895
895
  }): PerfMarker;
896
896
  }
897
897
 
898
+ type RowInfoStoreNotifyParams<T> = {
899
+ marker?: PerfMarker;
900
+ /**
901
+ * The DataSource state that produced `newDataArray` and the state it replaces.
902
+ * Exposed to cells via `getDataSourceStates()` so `repaintCellsKey` functions
903
+ * can compare the two.
904
+ */
905
+ dataSourceState?: DataSourceState<T>;
906
+ previousDataSourceState?: DataSourceState<T>;
907
+ };
908
+ type RowInfoStoreDataSourceStates<T> = {
909
+ dataSourceState: DataSourceState<T> | undefined;
910
+ previousDataSourceState: DataSourceState<T> | undefined;
911
+ };
898
912
  interface RowInfoStore<T> {
899
913
  /**
900
914
  * Update the entire dataArray (called from reducer)
901
915
  * Compares old vs new rowInfo at each index and notifies subscribers for changed indices
902
916
  */
903
- notifyDataArray(newDataArray: InfiniteTableRowInfo<T>[], params?: {
904
- marker?: PerfMarker;
905
- }): void;
917
+ notifyDataArray(newDataArray: InfiniteTableRowInfo<T>[], params?: RowInfoStoreNotifyParams<T>): void;
918
+ /**
919
+ * Subscribe to *any* change of the dataArray reference (regardless of which
920
+ * rows changed). Used by cells whose `repaintCellsKey` is a function, so they
921
+ * can re-evaluate their key after every data change.
922
+ * Returns unsubscribe function
923
+ */
924
+ subscribeToDataArrayChange(callback: () => void): () => void;
925
+ /**
926
+ * The DataSource state that produced the current dataArray, and the one
927
+ * before it - as passed by the reducer via `notifyDataArray`.
928
+ */
929
+ getDataSourceStates(): RowInfoStoreDataSourceStates<T>;
906
930
  /**
907
931
  * Get current rowInfo at index (snapshot for useSyncExternalStore)
908
932
  */
@@ -1216,6 +1240,12 @@ type InfiniteTableColumn<DATA_TYPE> = {
1216
1240
  headerStyle?: InfiniteTableColumnHeaderStyle<DATA_TYPE>;
1217
1241
  headerClassName?: InfiniteTableColumnHeaderClassName<DATA_TYPE>;
1218
1242
  className?: InfiniteTableColumnClassName<DATA_TYPE>;
1243
+ /**
1244
+ * Forces the cells of this column to re-render when their row didn't change
1245
+ * but something they render depends on did (eg: cross-row computations).
1246
+ * Takes precedence over the `repaintCellsKey` prop of the table.
1247
+ */
1248
+ repaintCellsKey?: InfiniteTablePropRepaintCellsKey<DATA_TYPE>;
1219
1249
  rowspan?: InfiniteTableColumnRowspanFn<DATA_TYPE>;
1220
1250
  render?: InfiniteTableColumnRenderFunction<DATA_TYPE>;
1221
1251
  renderValue?: InfiniteTableColumnRenderFunction<DATA_TYPE>;
@@ -2250,6 +2280,7 @@ interface InfiniteTableMappedState<T> {
2250
2280
  columnDefaultSortable: InfiniteTableProps<T>['columnDefaultSortable'];
2251
2281
  rowStyle: InfiniteTableProps<T>['rowStyle'];
2252
2282
  cellStyle: InfiniteTableProps<T>['cellStyle'];
2283
+ repaintCellsKey: InfiniteTableProps<T>['repaintCellsKey'];
2253
2284
  rowProps: InfiniteTableProps<T>['rowProps'];
2254
2285
  rowClassName: InfiniteTableProps<T>['rowClassName'];
2255
2286
  rowHoverClassName: InfiniteTableProps<T>['rowHoverClassName'];
@@ -7278,6 +7309,31 @@ type InfiniteTableRowClassNameFn<T> = (params: InfiniteTableRowStylingFnParams<T
7278
7309
  type InfiniteTableCellClassNameFn<T> = InfiniteTableColumn<T>['className'];
7279
7310
  type InfiniteTablePropRowStyle<T> = React$1.CSSProperties | InfiniteTableRowStyleFn<T>;
7280
7311
  type InfiniteTablePropCellStyle<T> = InfiniteTableColumn<T>['style'];
7312
+ type InfiniteTablePropRepaintCellsKeyFnParams<T> = {
7313
+ rowInfo: InfiniteTableRowInfo<T>;
7314
+ column: InfiniteTableComputedColumn<T>;
7315
+ /**
7316
+ * The DataSource state that produced the current data array.
7317
+ */
7318
+ dataSourceState: DataSourceState<T>;
7319
+ /**
7320
+ * The DataSource state before the last data change - `undefined` until the
7321
+ * first data change happens.
7322
+ */
7323
+ previousDataSourceState: DataSourceState<T> | undefined;
7324
+ };
7325
+ /**
7326
+ * Called for each cell (whenever the DataSource data array changes) - the cell
7327
+ * is re-rendered when the returned key is different (via `Object.is`) from the
7328
+ * key returned on the previous call. Return primitives or stable references.
7329
+ */
7330
+ type InfiniteTablePropRepaintCellsKeyFn<T> = (params: InfiniteTablePropRepaintCellsKeyFnParams<T>) => unknown;
7331
+ /**
7332
+ * When a string/number/object - cells re-render whenever the key changes.
7333
+ * When a function - it is called per cell after each data change and the cell
7334
+ * re-renders when the returned key changes.
7335
+ */
7336
+ type InfiniteTablePropRepaintCellsKey<T> = string | number | object | InfiniteTablePropRepaintCellsKeyFn<T>;
7281
7337
  type InfiniteTablePropRowClassName<T> = string | InfiniteTableRowClassNameFn<T>;
7282
7338
  type InfiniteTablePropCellClassName<T> = string | InfiniteTableCellClassNameFn<T>;
7283
7339
  type InfiniteTableColumnAggregator<T, AggregationResultType> = Omit<AggregationReducer<T, AggregationResultType>, 'getter' | 'id'> & {
@@ -7682,6 +7738,12 @@ interface InfiniteTableProps<T> {
7682
7738
  cellClassName?: InfiniteTablePropCellClassName<T>;
7683
7739
  rowClassName?: InfiniteTablePropRowClassName<T>;
7684
7740
  rowHoverClassName?: string;
7741
+ /**
7742
+ * Forces cells to re-render when their row didn't change but something they
7743
+ * render depends on did (eg: cross-row computations). Applies to all columns,
7744
+ * unless a column specifies its own `repaintCellsKey`, which takes precedence.
7745
+ */
7746
+ repaintCellsKey?: InfiniteTablePropRepaintCellsKey<T>;
7685
7747
  columnHeaderHeight?: number | string;
7686
7748
  onKeyDown?: (context: InfiniteTablePublicContext<T> & {
7687
7749
  actions: InfiniteTableEventHandlerContext<T>['actions'];
@@ -8293,4 +8355,4 @@ declare const components: {
8293
8355
  NumberFilterEditor: typeof NumberFilterEditor;
8294
8356
  };
8295
8357
 
8296
- export { type AdvancedAlignable, AutoScroller, type AutoScrollerConfig, CellSelectionState, type CellSelectionStateObject, type ColumnTypeWithInherit, DRAG_ITEM_ATTRIBUTE, DataClient, DataSource, type DataSourceAction, DataSourceActionType, type DataSourceAggregationReducer, type DataSourceApi, type DataSourceCRUDParam, type DataSourceCallback_BaseParam, type DataSourceComponentActions, type DataSourceContextValue, type DataSourceData, type DataSourceDataFn, type DataSourceDataParams, type DataSourceDataParamsChanges, type DataSourceDebugWarningKey, type DataSourceDerivedState, type DataSourceFilterFunctionParam, type DataSourceFilterOperator, type DataSourceFilterOperatorFunction, type DataSourceFilterOperatorFunctionParam, type DataSourceFilterType, type DataSourceFilterValueItem, type DataSourceFilterValueItemValueGetter, type DataSourceGroupBy, type DataSourceGroupRowsList, type DataSourceInsertParam, type DataSourceLivePaginationCursorFn, type DataSourceLivePaginationCursorParams, type DataSourceLivePaginationCursorValue, type DataSourceMappedState, type DataSourceMappings, type DataSourceMasterDetailContextValue, type DataSourcePivotBy, type DataSourcePropAggregationReducers, type DataSourcePropCellSelection, type DataSourcePropCellSelection_MultiCell, type DataSourcePropCellSelection_SingleCell, type DataSourcePropFilterFunction, type DataSourcePropFilterTypes, type DataSourcePropFilterValue, type DataSourcePropGroupBy, type DataSourcePropGroupRowsState, type DataSourcePropGroupRowsStateObject, type DataSourcePropIsNodeExpanded, type DataSourcePropIsNodeReadOnly, type DataSourcePropIsNodeSelectable, type DataSourcePropIsNodeSelected, type DataSourcePropIsRowSelected, type DataSourcePropLivePaginationCursor, type DataSourcePropMultiRowSelectionChangeParamType, type DataSourcePropOnCellSelectionChange, type DataSourcePropOnCellSelectionChange_MultiCell, type DataSourcePropOnCellSelectionChange_SingleCell, type DataSourcePropOnRowSelectionChange, type DataSourcePropOnRowSelectionChange_MultiRow, type DataSourcePropOnRowSelectionChange_SingleRow, type DataSourcePropOnTreeSelectionChange, type DataSourcePropOnTreeSelectionChange_MultiNode, type DataSourcePropOnTreeSelectionChange_SingleNode, type DataSourcePropPivotBy, type DataSourcePropRowInfoReducers, type DataSourcePropRowSelection, type DataSourcePropRowSelection_MultiRow, type DataSourcePropRowSelection_SingleRow, type DataSourcePropSelectionMode, type DataSourcePropShouldReloadData, type DataSourcePropShouldReloadDataObject, type DataSourcePropSortFn, type DataSourcePropSortInfo, type DataSourcePropSortTypes, type DataSourcePropTreeFilterFunction, type DataSourcePropTreeSelection, type DataSourcePropTreeSelection_MultiNode, type DataSourcePropTreeSelection_SingleNode, type DataSourceProps, type DataSourcePropsNotAvailableInTreeDataSource, type DataSourcePropsWithChildren, type DataSourceRawReducer, type DataSourceRemoteData, type DataSourceRowInfoReducer, type DataSourceSetupState, type DataSourceSingleSortInfo, type DataSourceSortInfo, type DataSourceStableContextValue, type DataSourceState, type DataSourceUpdateParam, type DebugLogger, type DebugTimingKey, type DebugWarningPayload, DeepMap, type DevToolsDataSourceOverrides, type DevToolsGenericMessage, type DevToolsHookFn, type DevToolsHookFnOptions, type DevToolsHostPageLogMessage, type DevToolsHostPageLogMessagePayload, type DevToolsHostPageMessage, type DevToolsHostPageMessagePayload, type DevToolsHostPageMessageType, type DevToolsInfiniteOverrides, type DevToolsMessageAddress, type DevToolsOverrides, DragDropProvider, type DragDropSourceAndTarget, DragInteractionTarget, DragList, type DragListProps, type DragProxyMoveParams, type DragProxyRenderParams, type DragProxySetupParams, type DragProxySetupResult, type ElementContainerGetter, type ErrorCodeKey, FixedSizeSet, FlashingColumnCell, GroupRowsState, INTERNAL_MatrixDebugger, type InfiniteColumnEditorContextType, InfiniteTable, type InfiniteTableAction, InfiniteTableActionType, type InfiniteTableApi, type InfiniteTableCellSelectionApi, InfiniteTableClassName, type InfiniteTableColumn, type InfiniteTableColumnAggregator, type InfiniteTableColumnApi, type InfiniteTableColumnCellContextType, type InfiniteTableColumnComparer, type InfiniteTableColumnGroup, type InfiniteTableColumnRenderFunctionForGroupRows, type InfiniteTableColumnRenderFunctionForNormalRows, type InfiniteTableColumnRenderValueParam, type InfiniteTableColumnRowspanParam, type InfiniteTableColumnSizingOptions, type InfiniteTableColumnValueFormatterParams, type InfiniteTableColumnValueGetterParams, InfiniteTableComponent, type InfiniteTableComputedColumn, type InfiniteTableComputedValues, type InfiniteTableContextValue, type InfiniteTableDebugWarningKey, type InfiniteTableGroupColumnBase, type InfiniteTableGroupColumnFunction, type InfiniteTableGroupColumnGetterOptions, type InfiniteTableKeyboardNavigationApi, type InfiniteTablePivotColumn, type InfiniteTablePropAutoSizeColumnsKey, type InfiniteTablePropColumnGroupVisibility, type InfiniteTablePropColumnGroups, type InfiniteTablePropColumnOrder, type InfiniteTablePropColumnPinning, type InfiniteTablePropColumnSizing, type InfiniteTablePropColumnTypes, type InfiniteTablePropColumnVisibility, type InfiniteTablePropColumns, type InfiniteTablePropComponents, type InfiniteTablePropGetCellContextMenuItems, type InfiniteTablePropGetColumnMenuItems, type InfiniteTablePropGetContextMenuItems, type InfiniteTablePropGroupColumn, type InfiniteTablePropGroupRenderStrategy, type InfiniteTablePropHeaderOptions, type InfiniteTablePropKeyboardNavigation, type InfiniteTablePropKeyboardShorcut, type InfiniteTablePropMultiSortBehavior, type InfiniteTablePropRowClassName, type InfiniteTablePropRowStyle, type InfiniteTableProps, type InfiniteTablePropsNotAvailableInTreeGrid, type InfiniteTableRowClassNameFn, type InfiniteTableRowDetailApi, type InfiniteTableRowInfo, type InfiniteTableRowSelectionApi, type InfiniteTableRowStyleFn, type InfiniteTableState, type InfiniteTable_HasGrouping_RowInfoGroup, type InfiniteTable_HasGrouping_RowInfoNormal, type InfiniteTable_Tree_RowInfoLeafNode, type InfiniteTable_Tree_RowInfoNode, type InfiniteTable_Tree_RowInfoParentNode, type LazyGroupDataDeepMap, type LazyGroupDataItem, type LazyRowInfoGroup, Menu, type MenuChildrenFnParam, type MenuColumn, type MenuColumnRenderParam, type MenuDecoration, type MenuIconProps, type MenuItemActionContext, type MenuItemDefinition, type MenuItemObject, type MenuProps, type MenuRenderable, type MenuRuntimeItem, type MenuRuntimeItemSelectable, type MenuSeparator, type OverlayShowParams, RowDetailCache, RowDetailState, type RowDetailStateObject, RowDisabledState, type RowDisabledStateObject, RowSelectionState, type ScrollStopInfo, type Scrollbars, type ShowOverlayFn, type TableRenderRange, TreeDataSource, type TreeDataSourceProps, TreeExpandState, type TreeExpandStateValue, TreeGrid, type TreeGridOnlyProps, type TreeGridProps, TreeSelectionState, type TreeSelectionStateObject, type TreeSelectionValue, type UpdateChildrenFn, type UpdateOverlayContentFn, type WaitForNodeOptions, WeakFixedSizeSet, alignNode, components, createDefaultProxy, createFlashingColumnCellComponent, debounce, debug, defaultDragProxyMove, defaultFilterTypes, eventMatchesKeyboardShortcut, filterDataArray, defaultFilterTypes as filterTypes, flatten, buildManagedComponent as getComponentStateRoot, group, interceptMap, keyboardShortcuts, multisort, multisortNested, queryKeyToCacheKey, toTreeDataArray, useManagedComponentState as useComponentState, useDataSourceApi, useDataSourceInternal, useDataSourceSelector, useDataSourceState, useDragDropProvider, useDragListContext, useEffectWhen, useEffectWhenSameDeps, useEffectWithChanges, useEffectWithObject, useGridScroll, useInfiniteColumnApi, useInfiniteColumnCell, useInfiniteColumnEditor, useInfiniteColumnFilterEditor, useInfiniteHeaderCell, useInfinitePortalContainer, useInfiniteTableApi, useLayoutEffectWithChanges, useManagedDataSource, useMasterRowInfo, useOverlay, useOverlayPortal, usePrevious, useRowInfoReducers, useVisibleColumnSizes, withSelectedLeafNodesOnly };
8358
+ export { type AdvancedAlignable, AutoScroller, type AutoScrollerConfig, CellSelectionState, type CellSelectionStateObject, type ColumnTypeWithInherit, DRAG_ITEM_ATTRIBUTE, DataClient, DataSource, type DataSourceAction, DataSourceActionType, type DataSourceAggregationReducer, type DataSourceApi, type DataSourceCRUDParam, type DataSourceCallback_BaseParam, type DataSourceComponentActions, type DataSourceContextValue, type DataSourceData, type DataSourceDataFn, type DataSourceDataParams, type DataSourceDataParamsChanges, type DataSourceDebugWarningKey, type DataSourceDerivedState, type DataSourceFilterFunctionParam, type DataSourceFilterOperator, type DataSourceFilterOperatorFunction, type DataSourceFilterOperatorFunctionParam, type DataSourceFilterType, type DataSourceFilterValueItem, type DataSourceFilterValueItemValueGetter, type DataSourceGroupBy, type DataSourceGroupRowsList, type DataSourceInsertParam, type DataSourceLivePaginationCursorFn, type DataSourceLivePaginationCursorParams, type DataSourceLivePaginationCursorValue, type DataSourceMappedState, type DataSourceMappings, type DataSourceMasterDetailContextValue, type DataSourcePivotBy, type DataSourcePropAggregationReducers, type DataSourcePropCellSelection, type DataSourcePropCellSelection_MultiCell, type DataSourcePropCellSelection_SingleCell, type DataSourcePropFilterFunction, type DataSourcePropFilterTypes, type DataSourcePropFilterValue, type DataSourcePropGroupBy, type DataSourcePropGroupRowsState, type DataSourcePropGroupRowsStateObject, type DataSourcePropIsNodeExpanded, type DataSourcePropIsNodeReadOnly, type DataSourcePropIsNodeSelectable, type DataSourcePropIsNodeSelected, type DataSourcePropIsRowSelected, type DataSourcePropLivePaginationCursor, type DataSourcePropMultiRowSelectionChangeParamType, type DataSourcePropOnCellSelectionChange, type DataSourcePropOnCellSelectionChange_MultiCell, type DataSourcePropOnCellSelectionChange_SingleCell, type DataSourcePropOnRowSelectionChange, type DataSourcePropOnRowSelectionChange_MultiRow, type DataSourcePropOnRowSelectionChange_SingleRow, type DataSourcePropOnTreeSelectionChange, type DataSourcePropOnTreeSelectionChange_MultiNode, type DataSourcePropOnTreeSelectionChange_SingleNode, type DataSourcePropPivotBy, type DataSourcePropRowInfoReducers, type DataSourcePropRowSelection, type DataSourcePropRowSelection_MultiRow, type DataSourcePropRowSelection_SingleRow, type DataSourcePropSelectionMode, type DataSourcePropShouldReloadData, type DataSourcePropShouldReloadDataObject, type DataSourcePropSortFn, type DataSourcePropSortInfo, type DataSourcePropSortTypes, type DataSourcePropTreeFilterFunction, type DataSourcePropTreeSelection, type DataSourcePropTreeSelection_MultiNode, type DataSourcePropTreeSelection_SingleNode, type DataSourceProps, type DataSourcePropsNotAvailableInTreeDataSource, type DataSourcePropsWithChildren, type DataSourceRawReducer, type DataSourceRemoteData, type DataSourceRowInfoReducer, type DataSourceSetupState, type DataSourceSingleSortInfo, type DataSourceSortInfo, type DataSourceStableContextValue, type DataSourceState, type DataSourceUpdateParam, type DebugLogger, type DebugTimingKey, type DebugWarningPayload, DeepMap, type DevToolsDataSourceOverrides, type DevToolsGenericMessage, type DevToolsHookFn, type DevToolsHookFnOptions, type DevToolsHostPageLogMessage, type DevToolsHostPageLogMessagePayload, type DevToolsHostPageMessage, type DevToolsHostPageMessagePayload, type DevToolsHostPageMessageType, type DevToolsInfiniteOverrides, type DevToolsMessageAddress, type DevToolsOverrides, DragDropProvider, type DragDropSourceAndTarget, DragInteractionTarget, DragList, type DragListProps, type DragProxyMoveParams, type DragProxyRenderParams, type DragProxySetupParams, type DragProxySetupResult, type ElementContainerGetter, type ErrorCodeKey, FixedSizeSet, FlashingColumnCell, GroupRowsState, INTERNAL_MatrixDebugger, type InfiniteColumnEditorContextType, InfiniteTable, type InfiniteTableAction, InfiniteTableActionType, type InfiniteTableApi, type InfiniteTableCellSelectionApi, InfiniteTableClassName, type InfiniteTableColumn, type InfiniteTableColumnAggregator, type InfiniteTableColumnApi, type InfiniteTableColumnCellContextType, type InfiniteTableColumnComparer, type InfiniteTableColumnGroup, type InfiniteTableColumnRenderFunctionForGroupRows, type InfiniteTableColumnRenderFunctionForNormalRows, type InfiniteTableColumnRenderValueParam, type InfiniteTableColumnRowspanParam, type InfiniteTableColumnSizingOptions, type InfiniteTableColumnValueFormatterParams, type InfiniteTableColumnValueGetterParams, InfiniteTableComponent, type InfiniteTableComputedColumn, type InfiniteTableComputedValues, type InfiniteTableContextValue, type InfiniteTableDebugWarningKey, type InfiniteTableGroupColumnBase, type InfiniteTableGroupColumnFunction, type InfiniteTableGroupColumnGetterOptions, type InfiniteTableKeyboardNavigationApi, type InfiniteTablePivotColumn, type InfiniteTablePropAutoSizeColumnsKey, type InfiniteTablePropColumnGroupVisibility, type InfiniteTablePropColumnGroups, type InfiniteTablePropColumnOrder, type InfiniteTablePropColumnPinning, type InfiniteTablePropColumnSizing, type InfiniteTablePropColumnTypes, type InfiniteTablePropColumnVisibility, type InfiniteTablePropColumns, type InfiniteTablePropComponents, type InfiniteTablePropGetCellContextMenuItems, type InfiniteTablePropGetColumnMenuItems, type InfiniteTablePropGetContextMenuItems, type InfiniteTablePropGroupColumn, type InfiniteTablePropGroupRenderStrategy, type InfiniteTablePropHeaderOptions, type InfiniteTablePropKeyboardNavigation, type InfiniteTablePropKeyboardShorcut, type InfiniteTablePropMultiSortBehavior, type InfiniteTablePropRepaintCellsKey, type InfiniteTablePropRepaintCellsKeyFn, type InfiniteTablePropRepaintCellsKeyFnParams, type InfiniteTablePropRowClassName, type InfiniteTablePropRowStyle, type InfiniteTableProps, type InfiniteTablePropsNotAvailableInTreeGrid, type InfiniteTableRowClassNameFn, type InfiniteTableRowDetailApi, type InfiniteTableRowInfo, type InfiniteTableRowSelectionApi, type InfiniteTableRowStyleFn, type InfiniteTableState, type InfiniteTable_HasGrouping_RowInfoGroup, type InfiniteTable_HasGrouping_RowInfoNormal, type InfiniteTable_Tree_RowInfoLeafNode, type InfiniteTable_Tree_RowInfoNode, type InfiniteTable_Tree_RowInfoParentNode, type LazyGroupDataDeepMap, type LazyGroupDataItem, type LazyRowInfoGroup, Menu, type MenuChildrenFnParam, type MenuColumn, type MenuColumnRenderParam, type MenuDecoration, type MenuIconProps, type MenuItemActionContext, type MenuItemDefinition, type MenuItemObject, type MenuProps, type MenuRenderable, type MenuRuntimeItem, type MenuRuntimeItemSelectable, type MenuSeparator, type OverlayShowParams, RowDetailCache, RowDetailState, type RowDetailStateObject, RowDisabledState, type RowDisabledStateObject, RowSelectionState, type ScrollStopInfo, type Scrollbars, type ShowOverlayFn, type TableRenderRange, TreeDataSource, type TreeDataSourceProps, TreeExpandState, type TreeExpandStateValue, TreeGrid, type TreeGridOnlyProps, type TreeGridProps, TreeSelectionState, type TreeSelectionStateObject, type TreeSelectionValue, type UpdateChildrenFn, type UpdateOverlayContentFn, type WaitForNodeOptions, WeakFixedSizeSet, alignNode, components, createDefaultProxy, createFlashingColumnCellComponent, debounce, debug, defaultDragProxyMove, defaultFilterTypes, eventMatchesKeyboardShortcut, filterDataArray, defaultFilterTypes as filterTypes, flatten, buildManagedComponent as getComponentStateRoot, group, interceptMap, keyboardShortcuts, multisort, multisortNested, queryKeyToCacheKey, toTreeDataArray, useManagedComponentState as useComponentState, useDataSourceApi, useDataSourceInternal, useDataSourceSelector, useDataSourceState, useDragDropProvider, useDragListContext, useEffectWhen, useEffectWhenSameDeps, useEffectWithChanges, useEffectWithObject, useGridScroll, useInfiniteColumnApi, useInfiniteColumnCell, useInfiniteColumnEditor, useInfiniteColumnFilterEditor, useInfiniteHeaderCell, useInfinitePortalContainer, useInfiniteTableApi, useLayoutEffectWithChanges, useManagedDataSource, useMasterRowInfo, useOverlay, useOverlayPortal, usePrevious, useRowInfoReducers, useVisibleColumnSizes, withSelectedLeafNodesOnly };
package/index.dev.js CHANGED
@@ -6365,6 +6365,39 @@ var React26 = __toESM(require("react"));
6365
6365
  var React25 = __toESM(require("react"));
6366
6366
  var import_react20 = require("react");
6367
6367
 
6368
+ // src/components/InfiniteTable/components/InfiniteTableRow/repaintCellsKey.ts
6369
+ var REPAINT_CELLS_KEY_NO_ROW = Symbol("REPAINT_CELLS_KEY_NO_ROW");
6370
+ function isRepaintCellsKeyFn(repaintCellsKey) {
6371
+ return typeof repaintCellsKey === "function";
6372
+ }
6373
+ function computeRepaintCellsKey(fn, params) {
6374
+ const { column, rowIndex, rowInfoStore, getDataSourceState } = params;
6375
+ const rowInfo = rowInfoStore.getRowInfoAtIndex(rowIndex);
6376
+ if (!rowInfo) {
6377
+ return REPAINT_CELLS_KEY_NO_ROW;
6378
+ }
6379
+ const states = rowInfoStore.getDataSourceStates();
6380
+ return fn({
6381
+ rowInfo,
6382
+ column,
6383
+ dataSourceState: states.dataSourceState ?? getDataSourceState(),
6384
+ previousDataSourceState: states.previousDataSourceState
6385
+ });
6386
+ }
6387
+ function subscribeToRepaintCellsKey(fn, params, onKeyChange) {
6388
+ let lastKey = computeRepaintCellsKey(fn, params);
6389
+ return params.rowInfoStore.subscribeToDataArrayChange(() => {
6390
+ const nextKey = computeRepaintCellsKey(fn, params);
6391
+ if (nextKey === REPAINT_CELLS_KEY_NO_ROW) {
6392
+ return;
6393
+ }
6394
+ if (!Object.is(nextKey, lastKey)) {
6395
+ lastKey = nextKey;
6396
+ onKeyChange();
6397
+ }
6398
+ });
6399
+ }
6400
+
6368
6401
  // src/components/InfiniteTable/components/cell.css.ts
6369
6402
  var ColumnCellCls = "_1eexc2a7 _1eexc2a6";
6370
6403
  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"]] });
@@ -7376,6 +7409,21 @@ var defaultRenderSelectionCheckBox = (params) => {
7376
7409
  }
7377
7410
  );
7378
7411
  };
7412
+ function useRepaintCellsKey(params) {
7413
+ const { repaintCellsKey, column, rowIndex, rowInfoStore, getDataSourceState } = params;
7414
+ const [, forceRepaint] = (0, import_react20.useReducer)((x) => x + 1, 0);
7415
+ const repaintCellsKeyFn = isRepaintCellsKeyFn(repaintCellsKey) ? repaintCellsKey : void 0;
7416
+ (0, import_react20.useEffect)(() => {
7417
+ if (!repaintCellsKeyFn) {
7418
+ return;
7419
+ }
7420
+ return subscribeToRepaintCellsKey(
7421
+ repaintCellsKeyFn,
7422
+ { column, rowIndex, rowInfoStore, getDataSourceState },
7423
+ forceRepaint
7424
+ );
7425
+ }, [repaintCellsKeyFn, column, rowIndex, rowInfoStore, getDataSourceState]);
7426
+ }
7379
7427
  function InfiniteTableColumnCellFn(props) {
7380
7428
  const {
7381
7429
  dataSourceStatePartialForCell,
@@ -7389,6 +7437,7 @@ function InfiniteTableColumnCellFn(props) {
7389
7437
  computedColumnOrder,
7390
7438
  cellStyle,
7391
7439
  cellClassName,
7440
+ repaintCellsKey,
7392
7441
  rowDetailState,
7393
7442
  width,
7394
7443
  column,
@@ -7425,6 +7474,13 @@ function InfiniteTableColumnCellFn(props) {
7425
7474
  [rowInfoStore, rowIndex]
7426
7475
  )
7427
7476
  );
7477
+ useRepaintCellsKey({
7478
+ repaintCellsKey,
7479
+ column,
7480
+ rowIndex,
7481
+ rowInfoStore,
7482
+ getDataSourceState
7483
+ });
7428
7484
  const isEmptyRowInfo = !rowInfoFromStore;
7429
7485
  const isEmptyColumn = !column;
7430
7486
  const htmlElementRef = React25.useRef(null);
@@ -20231,9 +20287,22 @@ function deepEqualRowInfo(oldRowInfo, newRowInfo) {
20231
20287
  function createRowInfoStore() {
20232
20288
  let dataArray = [];
20233
20289
  const subscribers = /* @__PURE__ */ new Map();
20290
+ const dataArrayChangeSubscribers = /* @__PURE__ */ new Set();
20291
+ let dataSourceStates = {
20292
+ dataSourceState: void 0,
20293
+ previousDataSourceState: void 0
20294
+ };
20234
20295
  const notifyDataArray = (newDataArray, params) => {
20235
20296
  const oldDataArray = dataArray;
20236
20297
  const marker = params?.marker;
20298
+ const dataArrayChanged = newDataArray !== oldDataArray;
20299
+ const notifyDataArrayChange = dataArrayChanged && dataArrayChangeSubscribers.size > 0;
20300
+ if (notifyDataArrayChange) {
20301
+ dataSourceStates = {
20302
+ dataSourceState: params?.dataSourceState,
20303
+ previousDataSourceState: params?.previousDataSourceState
20304
+ };
20305
+ }
20237
20306
  if (marker) {
20238
20307
  marker.start({
20239
20308
  details: [
@@ -20259,7 +20328,7 @@ function createRowInfoStore() {
20259
20328
  }
20260
20329
  }
20261
20330
  dataArray = newDataArray;
20262
- if (changedIndices.length > 0) {
20331
+ if (changedIndices.length > 0 || notifyDataArrayChange) {
20263
20332
  queueMicrotask(() => {
20264
20333
  for (let i = 0, len = changedIndices.length; i < len; i++) {
20265
20334
  const index = changedIndices[i];
@@ -20270,6 +20339,11 @@ function createRowInfoStore() {
20270
20339
  }
20271
20340
  }
20272
20341
  }
20342
+ if (notifyDataArrayChange) {
20343
+ for (const callback of Array.from(dataArrayChangeSubscribers)) {
20344
+ callback();
20345
+ }
20346
+ }
20273
20347
  });
20274
20348
  }
20275
20349
  if (marker) {
@@ -20304,14 +20378,36 @@ function createRowInfoStore() {
20304
20378
  const getDataArray = () => {
20305
20379
  return dataArray;
20306
20380
  };
20381
+ const subscribeToDataArrayChange = (callback) => {
20382
+ dataArrayChangeSubscribers.add(callback);
20383
+ return () => {
20384
+ dataArrayChangeSubscribers.delete(callback);
20385
+ if (dataArrayChangeSubscribers.size === 0) {
20386
+ dataSourceStates = {
20387
+ dataSourceState: void 0,
20388
+ previousDataSourceState: void 0
20389
+ };
20390
+ }
20391
+ };
20392
+ };
20393
+ const getDataSourceStates = () => {
20394
+ return dataSourceStates;
20395
+ };
20307
20396
  const clear = () => {
20308
20397
  dataArray = [];
20309
20398
  subscribers.clear();
20399
+ dataArrayChangeSubscribers.clear();
20400
+ dataSourceStates = {
20401
+ dataSourceState: void 0,
20402
+ previousDataSourceState: void 0
20403
+ };
20310
20404
  };
20311
20405
  return {
20312
20406
  notifyDataArray,
20313
20407
  getRowInfoAtIndex,
20314
20408
  subscribeToRowIndex,
20409
+ subscribeToDataArrayChange,
20410
+ getDataSourceStates,
20315
20411
  getDataArray,
20316
20412
  clear
20317
20413
  };
@@ -21995,7 +22091,9 @@ function concludeReducer(params) {
21995
22091
  };
21996
22092
  }
21997
22093
  state.rowInfoStore.notifyDataArray(rowInfoDataArray, {
21998
- marker: debugId ? getMarker(debugId).track.DataSource.label.DiffRowInfoInStore : void 0
22094
+ marker: debugId ? getMarker(debugId).track.DataSource.label.DiffRowInfoInStore : void 0,
22095
+ dataSourceState: state,
22096
+ previousDataSourceState: previousState
21999
22097
  });
22000
22098
  if (rootMarker) {
22001
22099
  rootMarker?.track.DataSource.label.PrepareData.end({
@@ -22393,6 +22491,40 @@ function lazyLoadRange(options, cache) {
22393
22491
  }, initialPromise);
22394
22492
  }
22395
22493
 
22494
+ // src/components/InfiniteTable/utils/getEditingCellContext.ts
22495
+ function resolveEditingCellRowIndex(context, editingCell) {
22496
+ const { rowIndex, primaryKey } = editingCell;
22497
+ const { dataArray } = context.getDataSourceState();
22498
+ if (primaryKey !== void 0) {
22499
+ const indexByKey = context.dataSourceApi.getIndexByPrimaryKey(primaryKey);
22500
+ if (indexByKey !== -1) {
22501
+ return indexByKey;
22502
+ }
22503
+ if (dataArray[rowIndex]?.id !== primaryKey) {
22504
+ return -1;
22505
+ }
22506
+ }
22507
+ return dataArray[rowIndex] ? rowIndex : -1;
22508
+ }
22509
+ function getEditingCellContext(context, editingCell) {
22510
+ const rowIndex = resolveEditingCellRowIndex(context, editingCell);
22511
+ if (rowIndex === -1) {
22512
+ return null;
22513
+ }
22514
+ return getCellContext({
22515
+ ...context,
22516
+ rowIndex,
22517
+ columnId: editingCell.columnId
22518
+ });
22519
+ }
22520
+ function warnEditedRowGone(callbackName, editingCell) {
22521
+ console.warn(
22522
+ `Skipping "${callbackName}": the edited row (primaryKey: ${String(
22523
+ editingCell.primaryKey
22524
+ )}, rowIndex: ${editingCell.rowIndex}) is no longer in the data array.`
22525
+ );
22526
+ }
22527
+
22396
22528
  // src/components/InfiniteTable/api/realignColumnContextMenu.ts
22397
22529
  function realignColumnContextMenu(param) {
22398
22530
  const { getComputed, getState, actions } = param;
@@ -23269,9 +23401,28 @@ var InfiniteTableApiImpl = class {
23269
23401
  waiting: "persist"
23270
23402
  };
23271
23403
  }
23404
+ const rowIndex = resolveEditingCellRowIndex(
23405
+ { ...this.context, api: this },
23406
+ editingCell
23407
+ );
23408
+ if (rowIndex === -1) {
23409
+ const error4 = new Error(
23410
+ `Cannot persist edit: the edited row (primaryKey: ${String(
23411
+ editingCell.primaryKey
23412
+ )}, rowIndex: ${editingCell.rowIndex}) is no longer in the data array.`
23413
+ );
23414
+ this.actions.editingCell = {
23415
+ ...editingCell,
23416
+ active: false,
23417
+ accepted: false,
23418
+ waiting: false,
23419
+ persisted: error4
23420
+ };
23421
+ return Promise.resolve(error4);
23422
+ }
23272
23423
  const params = {
23273
23424
  ...getCellContext({
23274
- rowIndex: editingCell.rowIndex,
23425
+ rowIndex,
23275
23426
  columnId: editingCell.columnId,
23276
23427
  ...this.context,
23277
23428
  api: this
@@ -25914,6 +26065,7 @@ var forwardProps4 = (_setupState) => {
25914
26065
  keyboardShortcuts: 1,
25915
26066
  rowStyle: 1,
25916
26067
  cellStyle: 1,
26068
+ repaintCellsKey: 1,
25917
26069
  rowProps: 1,
25918
26070
  rowClassName: 1,
25919
26071
  rowHoverClassName: 1,
@@ -27659,7 +27811,7 @@ var useLicense = (licenseKey = "") => {
27659
27811
  }
27660
27812
  let valid2 = isValidLicense(licenseKey, {
27661
27813
  publishedAt: 1624970570587,
27662
- version: "9.0.3"
27814
+ version: "9.1.1"
27663
27815
  });
27664
27816
  if (!licenseKey && !valid2 && isInsidePlayground) {
27665
27817
  return true;
@@ -30304,15 +30456,19 @@ function useOnEditCancelled() {
30304
30456
  const cancelled = editingCell && !editingCell.active ? editingCell.cancelled : void 0;
30305
30457
  (0, import_react61.useEffect)(() => {
30306
30458
  if (cancelled) {
30307
- const { rowIndex, columnId, initialValue } = getState().editingCell;
30308
30459
  const { onEditCancelled } = getState();
30309
- onEditCancelled?.({
30310
- ...getCellContext({
30311
- rowIndex,
30312
- columnId,
30313
- ...context
30314
- }),
30315
- initialValue
30460
+ const editingCell2 = getState().editingCell;
30461
+ if (!onEditCancelled) {
30462
+ return;
30463
+ }
30464
+ const cellContext = getEditingCellContext(context, editingCell2);
30465
+ if (!cellContext) {
30466
+ warnEditedRowGone("onEditCancelled", editingCell2);
30467
+ return;
30468
+ }
30469
+ onEditCancelled({
30470
+ ...cellContext,
30471
+ initialValue: editingCell2.initialValue
30316
30472
  });
30317
30473
  }
30318
30474
  }, [cancelled]);
@@ -30328,17 +30484,21 @@ function useOnEditRejected() {
30328
30484
  const rejected = editingCell && !editingCell.active && editingCell.accepted instanceof Error ? editingCell.accepted : void 0;
30329
30485
  (0, import_react61.useEffect)(() => {
30330
30486
  if (rejected) {
30331
- const { rowIndex, columnId, value, initialValue } = getState().editingCell;
30332
30487
  const { onEditRejected } = getState();
30333
- onEditRejected?.({
30334
- ...getCellContext({
30335
- rowIndex,
30336
- columnId,
30337
- ...context
30338
- }),
30339
- value,
30488
+ const editingCell2 = getState().editingCell;
30489
+ if (!onEditRejected) {
30490
+ return;
30491
+ }
30492
+ const cellContext = getEditingCellContext(context, editingCell2);
30493
+ if (!cellContext) {
30494
+ warnEditedRowGone("onEditRejected", editingCell2);
30495
+ return;
30496
+ }
30497
+ onEditRejected({
30498
+ ...cellContext,
30499
+ value: editingCell2.value,
30340
30500
  error: rejected,
30341
- initialValue
30501
+ initialValue: editingCell2.initialValue
30342
30502
  });
30343
30503
  }
30344
30504
  }, [rejected]);
@@ -30369,18 +30529,17 @@ function useOnEditAccepted() {
30369
30529
  const accepted = editingCell && !editingCell.active && !editingCell.cancelled && editingCell.accepted === true;
30370
30530
  (0, import_react61.useEffect)(() => {
30371
30531
  if (accepted) {
30372
- const { editingCell: editingCell2 } = getState();
30373
- const { value, rowIndex, columnId, initialValue } = editingCell2;
30374
- const editParams = {
30375
- ...getCellContext({
30376
- rowIndex,
30377
- columnId,
30378
- ...context
30379
- }),
30380
- value,
30381
- initialValue
30382
- };
30383
- getState().onEditAccepted?.(editParams);
30532
+ const { onEditAccepted } = getState();
30533
+ const editingCell2 = getState().editingCell;
30534
+ const { value, initialValue } = editingCell2;
30535
+ if (onEditAccepted) {
30536
+ const cellContext = getEditingCellContext(context, editingCell2);
30537
+ if (cellContext) {
30538
+ onEditAccepted({ ...cellContext, value, initialValue });
30539
+ } else {
30540
+ warnEditedRowGone("onEditAccepted", editingCell2);
30541
+ }
30542
+ }
30384
30543
  context.api.persistEdit({ value });
30385
30544
  }
30386
30545
  }, [accepted]);
@@ -30400,15 +30559,19 @@ function useOnEditPersisted() {
30400
30559
  if (!editingCell2) {
30401
30560
  return;
30402
30561
  }
30403
- const { rowIndex, columnId, value, initialValue } = editingCell2;
30562
+ const callbackName = persisted instanceof Error ? "onEditPersistError" : "onEditPersistSuccess";
30563
+ if (!getState()[callbackName]) {
30564
+ return;
30565
+ }
30566
+ const cellContext = getEditingCellContext(context, editingCell2);
30567
+ if (!cellContext) {
30568
+ warnEditedRowGone(callbackName, editingCell2);
30569
+ return;
30570
+ }
30404
30571
  const params = {
30405
- ...getCellContext({
30406
- rowIndex,
30407
- columnId,
30408
- ...context
30409
- }),
30410
- value,
30411
- initialValue
30572
+ ...cellContext,
30573
+ value: editingCell2.value,
30574
+ initialValue: editingCell2.initialValue
30412
30575
  };
30413
30576
  if (persisted instanceof Error) {
30414
30577
  onEditPersistError?.({ ...params, error: persisted });
@@ -32169,6 +32332,7 @@ function useCellRendering(param) {
32169
32332
  isRowDetailsEnabled,
32170
32333
  cellClassName,
32171
32334
  cellStyle,
32335
+ repaintCellsKey,
32172
32336
  rowStyle,
32173
32337
  rowDetailCache,
32174
32338
  rowClassName,
@@ -32198,6 +32362,7 @@ function useCellRendering(param) {
32198
32362
  isRowDetailsEnabled: ctx.state.isRowDetailEnabled,
32199
32363
  cellClassName: ctx.state.cellClassName,
32200
32364
  cellStyle: ctx.state.cellStyle,
32365
+ repaintCellsKey: ctx.state.repaintCellsKey,
32201
32366
  rowStyle: ctx.state.rowStyle,
32202
32367
  rowDetailCache: ctx.state.rowDetailCache,
32203
32368
  rowClassName: ctx.state.rowClassName,
@@ -32393,6 +32558,8 @@ function useCellRendering(param) {
32393
32558
  rowClassName,
32394
32559
  cellStyle,
32395
32560
  cellClassName,
32561
+ // the column-level key wins over the table-level one
32562
+ repaintCellsKey: column.repaintCellsKey !== void 0 ? column.repaintCellsKey : repaintCellsKey,
32396
32563
  visibleColumnIds,
32397
32564
  computedColumnOrder,
32398
32565
  // Whether this specific cell is in edit mode
@@ -32434,6 +32601,7 @@ function useCellRendering(param) {
32434
32601
  rowClassName,
32435
32602
  cellClassName,
32436
32603
  cellStyle,
32604
+ repaintCellsKey,
32437
32605
  getDataSourceState,
32438
32606
  dataSourceApi,
32439
32607
  dataSourceActions,