@infinite-table/infinite-react 9.0.2 → 9.1.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.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"]] });
@@ -6841,6 +6874,22 @@ function getColumnRenderParam(options) {
6841
6874
  });
6842
6875
  return renderParam;
6843
6876
  }
6877
+ function getUniqueFieldValueFromGroupItems(rowInfo, field) {
6878
+ if (!rowInfo.isGroupRow) {
6879
+ return void 0;
6880
+ }
6881
+ const items = rowInfo.groupData;
6882
+ if (!items.length) {
6883
+ return void 0;
6884
+ }
6885
+ const first = items[0][field];
6886
+ for (let i = 1, len = items.length; i < len; i++) {
6887
+ if (items[i][field] !== first) {
6888
+ return void 0;
6889
+ }
6890
+ }
6891
+ return first;
6892
+ }
6844
6893
  function getRawValueForCell(column, rowInfo) {
6845
6894
  const { data, isGroupRow, dataSourceHasGrouping } = rowInfo;
6846
6895
  const groupBy = dataSourceHasGrouping ? rowInfo.groupBy : void 0;
@@ -6853,6 +6902,9 @@ function getRawValueForCell(column, rowInfo) {
6853
6902
  if (column.field && rowInfo.isGroupRow && rowInfo.reducerData && rowInfo.reducerData[column.field] != null) {
6854
6903
  value = rowInfo.reducerData[column.field];
6855
6904
  }
6905
+ if (value === void 0 && rowInfo.isGroupRow && column.groupByForColumn && isColumnWithField(column)) {
6906
+ value = getUniqueFieldValueFromGroupItems(rowInfo, column.field);
6907
+ }
6856
6908
  if (column.valueGetter) {
6857
6909
  if (!rowInfo.isGroupRow && rowInfo.data) {
6858
6910
  value = column.valueGetter({ data: rowInfo.data, field: column.field });
@@ -6954,10 +7006,24 @@ var InfiniteTableColumnCellClassName = `${rootClassName3}ColumnCell`;
6954
7006
  var columnZIndexAtIndex3 = stripVar(InternalVars.columnZIndexAtIndex);
6955
7007
  var columnVisibilityAtIndex2 = stripVar(InternalVars.columnVisibilityAtIndex);
6956
7008
  function styleForGroupColumn({
6957
- rowInfo
7009
+ rowInfo,
7010
+ column
6958
7011
  }) {
7012
+ let nesting = 0;
7013
+ if (rowInfo.dataSourceHasGrouping) {
7014
+ if (rowInfo.isGroupRow) {
7015
+ const colGroupBy = column?.groupByForColumn;
7016
+ const rowGroupBy = rowInfo.groupBy[rowInfo.groupBy.length - 1];
7017
+ const isPivot = !!rowInfo.pivotValuesMap;
7018
+ const isNestedBoundFieldInPivot = isPivot && !!column?.field && !!colGroupBy && !Array.isArray(colGroupBy) && (colGroupBy.field ?? colGroupBy.groupField) !== (rowGroupBy?.field ?? rowGroupBy?.groupField);
7019
+ const isPivotLeafGroupInSingleColumn = isPivot && Array.isArray(colGroupBy) && rowInfo.groupNesting === rowInfo.rootGroupBy.length;
7020
+ nesting = isNestedBoundFieldInPivot || isPivotLeafGroupInSingleColumn ? rowInfo.groupNesting : rowInfo.groupNesting - 1;
7021
+ } else {
7022
+ nesting = rowInfo.groupNesting;
7023
+ }
7024
+ }
6959
7025
  return {
6960
- [stripVar(ThemeVars.components.Row.groupNesting)]: rowInfo.dataSourceHasGrouping ? rowInfo.isGroupRow ? rowInfo.groupNesting - 1 : rowInfo.groupNesting : 0
7026
+ [stripVar(ThemeVars.components.Row.groupNesting)]: nesting
6961
7027
  };
6962
7028
  }
6963
7029
  function styleForTreeColumn({
@@ -7049,7 +7115,7 @@ function getColumnCellStyling(options) {
7049
7115
  }
7050
7116
  let style2;
7051
7117
  if (rowInfo.dataSourceHasGrouping && column.groupByForColumn) {
7052
- style2 = styleForGroupColumn({ rowInfo });
7118
+ style2 = styleForGroupColumn({ rowInfo, column });
7053
7119
  }
7054
7120
  if (columnIsTree) {
7055
7121
  style2 = styleForTreeColumn({
@@ -7343,6 +7409,21 @@ var defaultRenderSelectionCheckBox = (params) => {
7343
7409
  }
7344
7410
  );
7345
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
+ }
7346
7427
  function InfiniteTableColumnCellFn(props) {
7347
7428
  const {
7348
7429
  dataSourceStatePartialForCell,
@@ -7356,6 +7437,7 @@ function InfiniteTableColumnCellFn(props) {
7356
7437
  computedColumnOrder,
7357
7438
  cellStyle,
7358
7439
  cellClassName,
7440
+ repaintCellsKey,
7359
7441
  rowDetailState,
7360
7442
  width,
7361
7443
  column,
@@ -7392,6 +7474,13 @@ function InfiniteTableColumnCellFn(props) {
7392
7474
  [rowInfoStore, rowIndex]
7393
7475
  )
7394
7476
  );
7477
+ useRepaintCellsKey({
7478
+ repaintCellsKey,
7479
+ column,
7480
+ rowIndex,
7481
+ rowInfoStore,
7482
+ getDataSourceState
7483
+ });
7395
7484
  const isEmptyRowInfo = !rowInfoFromStore;
7396
7485
  const isEmptyColumn = !column;
7397
7486
  const htmlElementRef = React25.useRef(null);
@@ -20198,9 +20287,22 @@ function deepEqualRowInfo(oldRowInfo, newRowInfo) {
20198
20287
  function createRowInfoStore() {
20199
20288
  let dataArray = [];
20200
20289
  const subscribers = /* @__PURE__ */ new Map();
20290
+ const dataArrayChangeSubscribers = /* @__PURE__ */ new Set();
20291
+ let dataSourceStates = {
20292
+ dataSourceState: void 0,
20293
+ previousDataSourceState: void 0
20294
+ };
20201
20295
  const notifyDataArray = (newDataArray, params) => {
20202
20296
  const oldDataArray = dataArray;
20203
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
+ }
20204
20306
  if (marker) {
20205
20307
  marker.start({
20206
20308
  details: [
@@ -20226,7 +20328,7 @@ function createRowInfoStore() {
20226
20328
  }
20227
20329
  }
20228
20330
  dataArray = newDataArray;
20229
- if (changedIndices.length > 0) {
20331
+ if (changedIndices.length > 0 || notifyDataArrayChange) {
20230
20332
  queueMicrotask(() => {
20231
20333
  for (let i = 0, len = changedIndices.length; i < len; i++) {
20232
20334
  const index = changedIndices[i];
@@ -20237,6 +20339,11 @@ function createRowInfoStore() {
20237
20339
  }
20238
20340
  }
20239
20341
  }
20342
+ if (notifyDataArrayChange) {
20343
+ for (const callback of Array.from(dataArrayChangeSubscribers)) {
20344
+ callback();
20345
+ }
20346
+ }
20240
20347
  });
20241
20348
  }
20242
20349
  if (marker) {
@@ -20271,14 +20378,36 @@ function createRowInfoStore() {
20271
20378
  const getDataArray = () => {
20272
20379
  return dataArray;
20273
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
+ };
20274
20396
  const clear = () => {
20275
20397
  dataArray = [];
20276
20398
  subscribers.clear();
20399
+ dataArrayChangeSubscribers.clear();
20400
+ dataSourceStates = {
20401
+ dataSourceState: void 0,
20402
+ previousDataSourceState: void 0
20403
+ };
20277
20404
  };
20278
20405
  return {
20279
20406
  notifyDataArray,
20280
20407
  getRowInfoAtIndex,
20281
20408
  subscribeToRowIndex,
20409
+ subscribeToDataArrayChange,
20410
+ getDataSourceStates,
20282
20411
  getDataArray,
20283
20412
  clear
20284
20413
  };
@@ -21962,7 +22091,9 @@ function concludeReducer(params) {
21962
22091
  };
21963
22092
  }
21964
22093
  state.rowInfoStore.notifyDataArray(rowInfoDataArray, {
21965
- 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
21966
22097
  });
21967
22098
  if (rootMarker) {
21968
22099
  rootMarker?.track.DataSource.label.PrepareData.end({
@@ -25881,6 +26012,7 @@ var forwardProps4 = (_setupState) => {
25881
26012
  keyboardShortcuts: 1,
25882
26013
  rowStyle: 1,
25883
26014
  cellStyle: 1,
26015
+ repaintCellsKey: 1,
25884
26016
  rowProps: 1,
25885
26017
  rowClassName: 1,
25886
26018
  rowHoverClassName: 1,
@@ -27626,7 +27758,7 @@ var useLicense = (licenseKey = "") => {
27626
27758
  }
27627
27759
  let valid2 = isValidLicense(licenseKey, {
27628
27760
  publishedAt: 1624970570587,
27629
- version: "9.0.2"
27761
+ version: "9.1.0"
27630
27762
  });
27631
27763
  if (!licenseKey && !valid2 && isInsidePlayground) {
27632
27764
  return true;
@@ -32136,6 +32268,7 @@ function useCellRendering(param) {
32136
32268
  isRowDetailsEnabled,
32137
32269
  cellClassName,
32138
32270
  cellStyle,
32271
+ repaintCellsKey,
32139
32272
  rowStyle,
32140
32273
  rowDetailCache,
32141
32274
  rowClassName,
@@ -32165,6 +32298,7 @@ function useCellRendering(param) {
32165
32298
  isRowDetailsEnabled: ctx.state.isRowDetailEnabled,
32166
32299
  cellClassName: ctx.state.cellClassName,
32167
32300
  cellStyle: ctx.state.cellStyle,
32301
+ repaintCellsKey: ctx.state.repaintCellsKey,
32168
32302
  rowStyle: ctx.state.rowStyle,
32169
32303
  rowDetailCache: ctx.state.rowDetailCache,
32170
32304
  rowClassName: ctx.state.rowClassName,
@@ -32360,6 +32494,8 @@ function useCellRendering(param) {
32360
32494
  rowClassName,
32361
32495
  cellStyle,
32362
32496
  cellClassName,
32497
+ // the column-level key wins over the table-level one
32498
+ repaintCellsKey: column.repaintCellsKey !== void 0 ? column.repaintCellsKey : repaintCellsKey,
32363
32499
  visibleColumnIds,
32364
32500
  computedColumnOrder,
32365
32501
  // Whether this specific cell is in edit mode
@@ -32401,6 +32537,7 @@ function useCellRendering(param) {
32401
32537
  rowClassName,
32402
32538
  cellClassName,
32403
32539
  cellStyle,
32540
+ repaintCellsKey,
32404
32541
  getDataSourceState,
32405
32542
  dataSourceApi,
32406
32543
  dataSourceActions,