@infinite-table/infinite-react 8.0.2 → 8.0.4

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
@@ -3411,6 +3411,10 @@ declare namespace InfiniteTableBody {
3411
3411
  var rowHoverClassName: string[];
3412
3412
  }
3413
3413
 
3414
+ declare function useInfiniteTableApi<T>(): InfiniteTableApi<T>;
3415
+
3416
+ declare function useInfiniteColumnApi<T = unknown>(columnId: string): InfiniteTableColumnApi<T> | null;
3417
+
3414
3418
  declare const InfiniteTableClassName: string;
3415
3419
  declare const InfiniteTableComponent: React$1.MemoExoticComponent<(<T>() => React$1.JSX.Element)>;
3416
3420
  type InfiniteTableComponent = {
@@ -3479,6 +3483,8 @@ declare function useDataSourceSelector<R extends unknown>(selector: (ctx: DataSo
3479
3483
 
3480
3484
  declare function useMasterRowInfo<T = any>(): InfiniteTableRowInfo<T> | undefined;
3481
3485
 
3486
+ declare function useDataSourceApi<T>(): DataSourceApi<T>;
3487
+
3482
3488
  declare const useManagedDataSource: (props: object) => {
3483
3489
  contextValue: {
3484
3490
  componentState: {
@@ -7220,6 +7226,8 @@ type ColumnCellValues = {
7220
7226
  formattedValue: any;
7221
7227
  };
7222
7228
  type InfiniteTableColumnApi<_T> = {
7229
+ getColumnId(): string | null;
7230
+ getComputedColumn(): InfiniteTableComputedColumn<_T> | null;
7223
7231
  showContextMenu: (target: EventTarget | HTMLElement) => void;
7224
7232
  toggleContextMenu: (target: EventTarget | HTMLElement) => void;
7225
7233
  hideContextMenu: () => void;
@@ -8043,6 +8051,7 @@ type DragItemContextValue = {
8043
8051
  };
8044
8052
  type DraggableItemProps = {
8045
8053
  id: string | number;
8054
+ dragListId?: string;
8046
8055
  children: React$1.ReactNode | ((domProps: React$1.HTMLAttributes<HTMLDivElement>, context: DragItemContextValue) => React$1.ReactNode);
8047
8056
  };
8048
8057
  declare const DRAG_ITEM_ATTRIBUTE = "data-drag-item-id";
@@ -8168,4 +8177,4 @@ declare const components: {
8168
8177
  NumberFilterEditor: typeof NumberFilterEditor;
8169
8178
  };
8170
8179
 
8171
- 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, useDataSourceInternal, useDataSourceSelector, useDataSourceState, useDragDropProvider, useDragListContext, useEffectWhen, useEffectWhenSameDeps, useEffectWithChanges, useEffectWithObject, useGridScroll, useInfiniteColumnCell, useInfiniteColumnEditor, useInfiniteColumnFilterEditor, useInfiniteHeaderCell, useInfinitePortalContainer, useLayoutEffectWithChanges, useManagedDataSource, useMasterRowInfo, useOverlay, useOverlayPortal, usePrevious, useRowInfoReducers, useVisibleColumnSizes, withSelectedLeafNodesOnly };
8180
+ 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 };
package/index.dev.js CHANGED
@@ -116,6 +116,7 @@ __export(index_exports, {
116
116
  queryKeyToCacheKey: () => queryKeyToCacheKey,
117
117
  toTreeDataArray: () => toTreeDataArray,
118
118
  useComponentState: () => useManagedComponentState,
119
+ useDataSourceApi: () => useDataSourceApi,
119
120
  useDataSourceInternal: () => useDataSourceInternal,
120
121
  useDataSourceSelector: () => useDataSourceSelector,
121
122
  useDataSourceState: () => useDataSourceState,
@@ -126,11 +127,13 @@ __export(index_exports, {
126
127
  useEffectWithChanges: () => useEffectWithChanges,
127
128
  useEffectWithObject: () => useEffectWithObject,
128
129
  useGridScroll: () => useGridScroll,
130
+ useInfiniteColumnApi: () => useInfiniteColumnApi,
129
131
  useInfiniteColumnCell: () => useInfiniteColumnCell,
130
132
  useInfiniteColumnEditor: () => useInfiniteColumnEditor,
131
133
  useInfiniteColumnFilterEditor: () => useInfiniteColumnFilterEditor,
132
134
  useInfiniteHeaderCell: () => useInfiniteHeaderCell,
133
135
  useInfinitePortalContainer: () => useInfinitePortalContainer,
136
+ useInfiniteTableApi: () => useInfiniteTableApi,
134
137
  useLayoutEffectWithChanges: () => useLayoutEffectWithChanges,
135
138
  useManagedDataSource: () => useManagedDataSource,
136
139
  useMasterRowInfo: () => useMasterRowInfo,
@@ -3437,6 +3440,12 @@ function getColumnApiForColumn(colOrColId, param) {
3437
3440
  },
3438
3441
  clearSort() {
3439
3442
  this.setSort(null);
3443
+ },
3444
+ getColumnId() {
3445
+ return column.id;
3446
+ },
3447
+ getComputedColumn() {
3448
+ return column;
3440
3449
  }
3441
3450
  };
3442
3451
  return columnApi;
@@ -8568,8 +8577,15 @@ var defaultUpdatePosition = (options) => {
8568
8577
  var getDraggableItemId = (node) => {
8569
8578
  return `${node.getAttribute(DRAG_ITEM_ATTRIBUTE)}`;
8570
8579
  };
8571
- function getDraggableItems(domRef) {
8580
+ function getDraggableItemNodes(domRef, dragListId) {
8572
8581
  const dragItems = domRef.current?.querySelectorAll(DRAG_ITEM_SELECTOR) ?? [];
8582
+ const result = Array.from(dragItems).filter(
8583
+ (item) => item.getAttribute(DRAG_ITEM_LIST_ATTRIBUTE) === `${dragListId}`
8584
+ );
8585
+ return result;
8586
+ }
8587
+ function getDraggableItems(domRef, dragListId) {
8588
+ const dragItems = getDraggableItemNodes(domRef, dragListId);
8573
8589
  if (!dragItems || dragItems.length === 0) {
8574
8590
  }
8575
8591
  const draggableItems = Array.from(dragItems).map((item) => {
@@ -8584,7 +8600,7 @@ function getDraggableItems(domRef) {
8584
8600
  }
8585
8601
  function getInteractionTargetData(params) {
8586
8602
  const { domRef, orientation, dragListId } = params;
8587
- const draggableItems = getDraggableItems(domRef);
8603
+ const draggableItems = getDraggableItems(domRef, dragListId);
8588
8604
  const domRect = domRef.current.getBoundingClientRect();
8589
8605
  let top2 = domRect.top;
8590
8606
  let left2 = domRect.left;
@@ -8907,13 +8923,11 @@ var DragList = (props) => {
8907
8923
  const getDragItems = (0, import_react23.useCallback)(() => {
8908
8924
  let dragItems = dragItemsRef.current;
8909
8925
  if (!dragItems || dragItems.length === 0) {
8910
- dragItems = Array.from(
8911
- domRef.current?.querySelectorAll(DRAG_ITEM_SELECTOR) ?? []
8912
- );
8926
+ dragItems = getDraggableItemNodes(domRef, props.dragListId);
8913
8927
  dragItemsRef.current = dragItems;
8914
8928
  }
8915
8929
  return dragItems;
8916
- }, []);
8930
+ }, [props.dragListId]);
8917
8931
  const onDragItemPointerDown = (0, import_react23.useCallback)(
8918
8932
  (e) => {
8919
8933
  const target = e.currentTarget;
@@ -8934,9 +8948,7 @@ var DragList = (props) => {
8934
8948
  }
8935
8949
  dragItemId2 = `${dragItemId2}`;
8936
8950
  let dragOperation = null;
8937
- const dragItems = Array.from(
8938
- domRef.current?.querySelectorAll(DRAG_ITEM_SELECTOR) ?? []
8939
- );
8951
+ const dragItems = getDraggableItemNodes(domRef, props.dragListId);
8940
8952
  dragItemsRef.current = dragItems;
8941
8953
  const interactionTarget2 = createInteractionTarget({
8942
8954
  domRef,
@@ -9146,6 +9158,7 @@ var DragList = (props) => {
9146
9158
  };
9147
9159
  var DRAG_LIST_ATTRIBUTE = "data-drag-list-id";
9148
9160
  var DRAG_ITEM_ATTRIBUTE = "data-drag-item-id";
9161
+ var DRAG_ITEM_LIST_ATTRIBUTE = "data-drag-item-list-id";
9149
9162
  var DRAG_ITEM_SELECTOR = `[${DRAG_ITEM_ATTRIBUTE}]`;
9150
9163
  var DragItemContext = React33.createContext({
9151
9164
  dragItemId: "",
@@ -9164,21 +9177,30 @@ var DraggableItem = (props) => {
9164
9177
  dragSourceListId,
9165
9178
  dropTargetListId
9166
9179
  } = useDragListContext();
9167
- const active = dragSourceListId === dragListId && dragItemId === `${props.id}`;
9180
+ const dragItemListId = props.dragListId ?? dragListId;
9181
+ const active = dragSourceListId === dragItemListId && dragItemId === `${props.id}`;
9168
9182
  const contextValue = React33.useMemo(
9169
9183
  () => ({
9170
9184
  dragItemId: props.id,
9171
9185
  active,
9172
- dragListId,
9186
+ dragListId: dragItemListId,
9173
9187
  draggingInProgress,
9174
9188
  dragSourceListId,
9175
9189
  dropTargetListId
9176
9190
  }),
9177
- [props.id, active, draggingInProgress, dragSourceListId, dropTargetListId]
9191
+ [
9192
+ props.id,
9193
+ active,
9194
+ dragItemListId,
9195
+ draggingInProgress,
9196
+ dragSourceListId,
9197
+ dropTargetListId
9198
+ ]
9178
9199
  );
9179
9200
  const domProps = {
9180
9201
  // @ts-ignore
9181
- "data-drag-item-id": `${props.id}`,
9202
+ [DRAG_ITEM_ATTRIBUTE]: `${props.id}`,
9203
+ [DRAG_ITEM_LIST_ATTRIBUTE]: dragItemListId,
9182
9204
  onPointerDown: onDragItemPointerDown,
9183
9205
  className: join(
9184
9206
  "DraggableItem",
@@ -14098,7 +14120,8 @@ var InfiniteHeaderCellDataAttributes = keyMirror({
14098
14120
  "data-column-id": "",
14099
14121
  "data-sort": "",
14100
14122
  "data-sort-index": "",
14101
- [DRAG_ITEM_ATTRIBUTE]: ""
14123
+ [DRAG_ITEM_ATTRIBUTE]: "",
14124
+ [DRAG_ITEM_LIST_ATTRIBUTE]: ""
14102
14125
  });
14103
14126
  function InfiniteTableHeaderCellFn(props) {
14104
14127
  const column = props.column;
@@ -14413,6 +14436,7 @@ function InfiniteTableHeaderCellFn(props) {
14413
14436
  "data-field": `${column.field || ""}`,
14414
14437
  "data-column-id": column.id,
14415
14438
  [DRAG_ITEM_ATTRIBUTE]: column.id,
14439
+ [DRAG_ITEM_LIST_ATTRIBUTE]: "header",
14416
14440
  "data-header-align": align2,
14417
14441
  "data-name": "HeaderCell",
14418
14442
  "data-sort": column.computedSortedAsc ? "asc" : column.computedSortedDesc ? "desc" : "none",
@@ -22581,6 +22605,11 @@ function useDataSourceInternal(props) {
22581
22605
  };
22582
22606
  }
22583
22607
 
22608
+ // src/components/DataSource/publicHooks/useDataSourceApi.ts
22609
+ function useDataSourceApi() {
22610
+ return useDataSourceSelector((ctx) => ctx.dataSourceApi);
22611
+ }
22612
+
22584
22613
  // src/components/DataSource/RowDetailState.ts
22585
22614
  var RowDetailState = class extends BooleanCollectionState {
22586
22615
  constructor(state) {
@@ -23590,6 +23619,7 @@ function isSortInfoForColumn(sortInfo, col) {
23590
23619
  }
23591
23620
  var InfiniteTableApiImpl = class {
23592
23621
  constructor(context) {
23622
+ this.columnApiById = /* @__PURE__ */ new Map();
23593
23623
  this.getVisibleRenderRange = () => {
23594
23624
  return this.getState().brain.getRenderRange();
23595
23625
  };
@@ -23820,10 +23850,19 @@ var InfiniteTableApiImpl = class {
23820
23850
  return result;
23821
23851
  };
23822
23852
  this.getColumnApi = (columnIdOrIndex) => {
23823
- return getColumnApiForColumn(columnIdOrIndex, {
23853
+ const colId = typeof columnIdOrIndex === "string" ? columnIdOrIndex : this.getComputed().computedVisibleColumns[columnIdOrIndex]?.id;
23854
+ const existingApi = this.columnApiById.get(colId);
23855
+ if (existingApi) {
23856
+ return existingApi;
23857
+ }
23858
+ const columnApi = getColumnApiForColumn(columnIdOrIndex, {
23824
23859
  ...this.context,
23825
23860
  api: this
23826
23861
  });
23862
+ if (columnApi) {
23863
+ this.columnApiById.set(columnApi.getColumnId(), columnApi);
23864
+ }
23865
+ return columnApi;
23827
23866
  };
23828
23867
  this.isColumnSortable = (columnId) => {
23829
23868
  return this.getColumnApi(columnId)?.isSortable() ?? false;
@@ -26919,7 +26958,7 @@ var useLicense = (licenseKey = "") => {
26919
26958
  }
26920
26959
  let valid2 = isValidLicense(licenseKey, {
26921
26960
  publishedAt: 1624970570587,
26922
- version: "8.0.2"
26961
+ version: "8.0.4"
26923
26962
  });
26924
26963
  if (!licenseKey && !valid2 && isInsidePlayground) {
26925
26964
  return true;
@@ -31830,6 +31869,16 @@ function InfiniteTableBody(props) {
31830
31869
  }
31831
31870
  InfiniteTableBody.rowHoverClassName = _HOVERED_CLASS_NAMES;
31832
31871
 
31872
+ // src/components/InfiniteTable/hooks/useInfiniteTableApi.ts
31873
+ function useInfiniteTableApi() {
31874
+ return useInfiniteTableSelector((ctx) => ctx.api);
31875
+ }
31876
+
31877
+ // src/components/InfiniteTable/hooks/useInfiniteColumnApi.ts
31878
+ function useInfiniteColumnApi(columnId) {
31879
+ return useInfiniteTableSelector((ctx) => ctx.api.getColumnApi(columnId));
31880
+ }
31881
+
31833
31882
  // src/components/InfiniteTable/index.tsx
31834
31883
  var InfiniteTableClassName = internalProps.rootClassName;
31835
31884
  var { ManagedComponentContextProvider: InfiniteTableRoot } = buildManagedComponent({
@@ -32932,6 +32981,7 @@ var components = {
32932
32981
  queryKeyToCacheKey,
32933
32982
  toTreeDataArray,
32934
32983
  useComponentState,
32984
+ useDataSourceApi,
32935
32985
  useDataSourceInternal,
32936
32986
  useDataSourceSelector,
32937
32987
  useDataSourceState,
@@ -32942,11 +32992,13 @@ var components = {
32942
32992
  useEffectWithChanges,
32943
32993
  useEffectWithObject,
32944
32994
  useGridScroll,
32995
+ useInfiniteColumnApi,
32945
32996
  useInfiniteColumnCell,
32946
32997
  useInfiniteColumnEditor,
32947
32998
  useInfiniteColumnFilterEditor,
32948
32999
  useInfiniteHeaderCell,
32949
33000
  useInfinitePortalContainer,
33001
+ useInfiniteTableApi,
32950
33002
  useLayoutEffectWithChanges,
32951
33003
  useManagedDataSource,
32952
33004
  useMasterRowInfo,
package/index.dev.mjs CHANGED
@@ -3367,6 +3367,12 @@ function getColumnApiForColumn(colOrColId, param) {
3367
3367
  },
3368
3368
  clearSort() {
3369
3369
  this.setSort(null);
3370
+ },
3371
+ getColumnId() {
3372
+ return column.id;
3373
+ },
3374
+ getComputedColumn() {
3375
+ return column;
3370
3376
  }
3371
3377
  };
3372
3378
  return columnApi;
@@ -8498,8 +8504,15 @@ var defaultUpdatePosition = (options) => {
8498
8504
  var getDraggableItemId = (node) => {
8499
8505
  return `${node.getAttribute(DRAG_ITEM_ATTRIBUTE)}`;
8500
8506
  };
8501
- function getDraggableItems(domRef) {
8507
+ function getDraggableItemNodes(domRef, dragListId) {
8502
8508
  const dragItems = domRef.current?.querySelectorAll(DRAG_ITEM_SELECTOR) ?? [];
8509
+ const result = Array.from(dragItems).filter(
8510
+ (item) => item.getAttribute(DRAG_ITEM_LIST_ATTRIBUTE) === `${dragListId}`
8511
+ );
8512
+ return result;
8513
+ }
8514
+ function getDraggableItems(domRef, dragListId) {
8515
+ const dragItems = getDraggableItemNodes(domRef, dragListId);
8503
8516
  if (!dragItems || dragItems.length === 0) {
8504
8517
  }
8505
8518
  const draggableItems = Array.from(dragItems).map((item) => {
@@ -8514,7 +8527,7 @@ function getDraggableItems(domRef) {
8514
8527
  }
8515
8528
  function getInteractionTargetData(params) {
8516
8529
  const { domRef, orientation, dragListId } = params;
8517
- const draggableItems = getDraggableItems(domRef);
8530
+ const draggableItems = getDraggableItems(domRef, dragListId);
8518
8531
  const domRect = domRef.current.getBoundingClientRect();
8519
8532
  let top2 = domRect.top;
8520
8533
  let left2 = domRect.left;
@@ -8837,13 +8850,11 @@ var DragList = (props) => {
8837
8850
  const getDragItems = useCallback17(() => {
8838
8851
  let dragItems = dragItemsRef.current;
8839
8852
  if (!dragItems || dragItems.length === 0) {
8840
- dragItems = Array.from(
8841
- domRef.current?.querySelectorAll(DRAG_ITEM_SELECTOR) ?? []
8842
- );
8853
+ dragItems = getDraggableItemNodes(domRef, props.dragListId);
8843
8854
  dragItemsRef.current = dragItems;
8844
8855
  }
8845
8856
  return dragItems;
8846
- }, []);
8857
+ }, [props.dragListId]);
8847
8858
  const onDragItemPointerDown = useCallback17(
8848
8859
  (e) => {
8849
8860
  const target = e.currentTarget;
@@ -8864,9 +8875,7 @@ var DragList = (props) => {
8864
8875
  }
8865
8876
  dragItemId2 = `${dragItemId2}`;
8866
8877
  let dragOperation = null;
8867
- const dragItems = Array.from(
8868
- domRef.current?.querySelectorAll(DRAG_ITEM_SELECTOR) ?? []
8869
- );
8878
+ const dragItems = getDraggableItemNodes(domRef, props.dragListId);
8870
8879
  dragItemsRef.current = dragItems;
8871
8880
  const interactionTarget2 = createInteractionTarget({
8872
8881
  domRef,
@@ -9076,6 +9085,7 @@ var DragList = (props) => {
9076
9085
  };
9077
9086
  var DRAG_LIST_ATTRIBUTE = "data-drag-list-id";
9078
9087
  var DRAG_ITEM_ATTRIBUTE = "data-drag-item-id";
9088
+ var DRAG_ITEM_LIST_ATTRIBUTE = "data-drag-item-list-id";
9079
9089
  var DRAG_ITEM_SELECTOR = `[${DRAG_ITEM_ATTRIBUTE}]`;
9080
9090
  var DragItemContext = React33.createContext({
9081
9091
  dragItemId: "",
@@ -9094,21 +9104,30 @@ var DraggableItem = (props) => {
9094
9104
  dragSourceListId,
9095
9105
  dropTargetListId
9096
9106
  } = useDragListContext();
9097
- const active = dragSourceListId === dragListId && dragItemId === `${props.id}`;
9107
+ const dragItemListId = props.dragListId ?? dragListId;
9108
+ const active = dragSourceListId === dragItemListId && dragItemId === `${props.id}`;
9098
9109
  const contextValue = React33.useMemo(
9099
9110
  () => ({
9100
9111
  dragItemId: props.id,
9101
9112
  active,
9102
- dragListId,
9113
+ dragListId: dragItemListId,
9103
9114
  draggingInProgress,
9104
9115
  dragSourceListId,
9105
9116
  dropTargetListId
9106
9117
  }),
9107
- [props.id, active, draggingInProgress, dragSourceListId, dropTargetListId]
9118
+ [
9119
+ props.id,
9120
+ active,
9121
+ dragItemListId,
9122
+ draggingInProgress,
9123
+ dragSourceListId,
9124
+ dropTargetListId
9125
+ ]
9108
9126
  );
9109
9127
  const domProps = {
9110
9128
  // @ts-ignore
9111
- "data-drag-item-id": `${props.id}`,
9129
+ [DRAG_ITEM_ATTRIBUTE]: `${props.id}`,
9130
+ [DRAG_ITEM_LIST_ATTRIBUTE]: dragItemListId,
9112
9131
  onPointerDown: onDragItemPointerDown,
9113
9132
  className: join(
9114
9133
  "DraggableItem",
@@ -14028,7 +14047,8 @@ var InfiniteHeaderCellDataAttributes = keyMirror({
14028
14047
  "data-column-id": "",
14029
14048
  "data-sort": "",
14030
14049
  "data-sort-index": "",
14031
- [DRAG_ITEM_ATTRIBUTE]: ""
14050
+ [DRAG_ITEM_ATTRIBUTE]: "",
14051
+ [DRAG_ITEM_LIST_ATTRIBUTE]: ""
14032
14052
  });
14033
14053
  function InfiniteTableHeaderCellFn(props) {
14034
14054
  const column = props.column;
@@ -14343,6 +14363,7 @@ function InfiniteTableHeaderCellFn(props) {
14343
14363
  "data-field": `${column.field || ""}`,
14344
14364
  "data-column-id": column.id,
14345
14365
  [DRAG_ITEM_ATTRIBUTE]: column.id,
14366
+ [DRAG_ITEM_LIST_ATTRIBUTE]: "header",
14346
14367
  "data-header-align": align2,
14347
14368
  "data-name": "HeaderCell",
14348
14369
  "data-sort": column.computedSortedAsc ? "asc" : column.computedSortedDesc ? "desc" : "none",
@@ -22516,6 +22537,11 @@ function useDataSourceInternal(props) {
22516
22537
  };
22517
22538
  }
22518
22539
 
22540
+ // src/components/DataSource/publicHooks/useDataSourceApi.ts
22541
+ function useDataSourceApi() {
22542
+ return useDataSourceSelector((ctx) => ctx.dataSourceApi);
22543
+ }
22544
+
22519
22545
  // src/components/DataSource/RowDetailState.ts
22520
22546
  var RowDetailState = class extends BooleanCollectionState {
22521
22547
  constructor(state) {
@@ -23525,6 +23551,7 @@ function isSortInfoForColumn(sortInfo, col) {
23525
23551
  }
23526
23552
  var InfiniteTableApiImpl = class {
23527
23553
  constructor(context) {
23554
+ this.columnApiById = /* @__PURE__ */ new Map();
23528
23555
  this.getVisibleRenderRange = () => {
23529
23556
  return this.getState().brain.getRenderRange();
23530
23557
  };
@@ -23755,10 +23782,19 @@ var InfiniteTableApiImpl = class {
23755
23782
  return result;
23756
23783
  };
23757
23784
  this.getColumnApi = (columnIdOrIndex) => {
23758
- return getColumnApiForColumn(columnIdOrIndex, {
23785
+ const colId = typeof columnIdOrIndex === "string" ? columnIdOrIndex : this.getComputed().computedVisibleColumns[columnIdOrIndex]?.id;
23786
+ const existingApi = this.columnApiById.get(colId);
23787
+ if (existingApi) {
23788
+ return existingApi;
23789
+ }
23790
+ const columnApi = getColumnApiForColumn(columnIdOrIndex, {
23759
23791
  ...this.context,
23760
23792
  api: this
23761
23793
  });
23794
+ if (columnApi) {
23795
+ this.columnApiById.set(columnApi.getColumnId(), columnApi);
23796
+ }
23797
+ return columnApi;
23762
23798
  };
23763
23799
  this.isColumnSortable = (columnId) => {
23764
23800
  return this.getColumnApi(columnId)?.isSortable() ?? false;
@@ -26858,7 +26894,7 @@ var useLicense = (licenseKey = "") => {
26858
26894
  }
26859
26895
  let valid2 = isValidLicense(licenseKey, {
26860
26896
  publishedAt: 1624970570587,
26861
- version: "8.0.2"
26897
+ version: "8.0.4"
26862
26898
  });
26863
26899
  if (!licenseKey && !valid2 && isInsidePlayground) {
26864
26900
  return true;
@@ -31779,6 +31815,16 @@ function InfiniteTableBody(props) {
31779
31815
  }
31780
31816
  InfiniteTableBody.rowHoverClassName = _HOVERED_CLASS_NAMES;
31781
31817
 
31818
+ // src/components/InfiniteTable/hooks/useInfiniteTableApi.ts
31819
+ function useInfiniteTableApi() {
31820
+ return useInfiniteTableSelector((ctx) => ctx.api);
31821
+ }
31822
+
31823
+ // src/components/InfiniteTable/hooks/useInfiniteColumnApi.ts
31824
+ function useInfiniteColumnApi(columnId) {
31825
+ return useInfiniteTableSelector((ctx) => ctx.api.getColumnApi(columnId));
31826
+ }
31827
+
31782
31828
  // src/components/InfiniteTable/index.tsx
31783
31829
  var InfiniteTableClassName = internalProps.rootClassName;
31784
31830
  var { ManagedComponentContextProvider: InfiniteTableRoot } = buildManagedComponent({
@@ -32880,6 +32926,7 @@ export {
32880
32926
  queryKeyToCacheKey,
32881
32927
  toTreeDataArray,
32882
32928
  useManagedComponentState as useComponentState,
32929
+ useDataSourceApi,
32883
32930
  useDataSourceInternal,
32884
32931
  useDataSourceSelector,
32885
32932
  useDataSourceState,
@@ -32890,11 +32937,13 @@ export {
32890
32937
  useEffectWithChanges,
32891
32938
  useEffectWithObject,
32892
32939
  useGridScroll,
32940
+ useInfiniteColumnApi,
32893
32941
  useInfiniteColumnCell,
32894
32942
  useInfiniteColumnEditor,
32895
32943
  useInfiniteColumnFilterEditor,
32896
32944
  useInfiniteHeaderCell,
32897
32945
  useInfinitePortalContainer,
32946
+ useInfiniteTableApi,
32898
32947
  useLayoutEffectWithChanges,
32899
32948
  useManagedDataSource,
32900
32949
  useMasterRowInfo,