@infinite-table/infinite-react 4.3.6 → 4.3.8

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.js CHANGED
@@ -2980,11 +2980,16 @@ var ReactHeadlessTableRenderer = class extends Logger {
2980
2980
  }, zIndex2) => {
2981
2981
  const columnOffsetX = `${columnOffsetAtIndex2}-${colIndex}`;
2982
2982
  const columnOffsetXWhileReordering = `${columnOffsetAtIndexWhileReordering2}-${colIndex}`;
2983
- element.style.setProperty(
2984
- currentTransformY,
2985
- scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}) )` : `${y}px`
2986
- );
2987
- element.style.transform = `translate3d(var(${columnOffsetXWhileReordering}, var(${columnOffsetX})), var(${currentTransformY}), 0)`;
2983
+ const currentTransformYValue = scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}) )` : `${y}px`;
2984
+ if (element.__currentTransformY !== currentTransformYValue) {
2985
+ element.__currentTransformY = currentTransformYValue;
2986
+ element.style.setProperty(currentTransformY, currentTransformYValue);
2987
+ }
2988
+ const transformValue = `translate3d(var(${columnOffsetXWhileReordering}, var(${columnOffsetX})), var(${currentTransformY}), 0)`;
2989
+ if (element.__transformValue !== transformValue) {
2990
+ element.__transformValue = transformValue;
2991
+ element.style.transform = transformValue;
2992
+ }
2988
2993
  if (zIndex2 != null) {
2989
2994
  }
2990
2995
  };
@@ -3638,11 +3643,15 @@ var ReactHeadlessTableRenderer = class extends Logger {
3638
3643
  itemElement.style.willChange = "transform";
3639
3644
  itemElement.style.backfaceVisibility = "hidden";
3640
3645
  const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
3641
- itemElement.style.zIndex = hidden ? "-1" : (
3646
+ const zIndex2 = hidden ? "-1" : (
3642
3647
  // #updatezindex - we need to allow elements use their own zIndex, so we
3643
3648
  // resort to allowing them to have it as a data-z-index attribute
3644
3649
  itemElement.dataset.zIndex || "auto"
3645
3650
  );
3651
+ if (itemElement.__zIndex !== zIndex2) {
3652
+ itemElement.__zIndex = zIndex2;
3653
+ itemElement.style.zIndex = zIndex2;
3654
+ }
3646
3655
  } else {
3647
3656
  itemElement.style.display = "";
3648
3657
  itemElement.style.left = `${x}px`;
@@ -4160,7 +4169,7 @@ var ActiveCellIndicatorCls = { visible: "ActiveCellIndicator_ActiveCellIndicator
4160
4169
  var ActiveIndicatorWrapperCls = "ActiveCellIndicator_ActiveIndicatorWrapperCls__nxbq1c0 utilities_pointerEvents_none__16lm1iwl utilities_position_sticky__16lm1iw4 utilities_left_0__16lm1iw1e utilities_top_0__16lm1iw1c utilities_height_0__16lm1iw18 utilities_zIndex_1000000__16lm1iwu";
4161
4170
 
4162
4171
  // src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
4163
- var ActiveRowIndicatorCls = { visible: "ActiveRowIndicator_ActiveRowIndicatorCls_visible__j26lrx1 ActiveRowIndicator_ActiveRowIndicator__j26lrx0 utilities_pointerEvents_none__16lm1iwl utilities_position_sticky__16lm1iw4 utilities_width_100%__16lm1iw1b utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e", hidden: "ActiveRowIndicator_ActiveRowIndicatorCls_hidden__j26lrx2 ActiveRowIndicator_ActiveRowIndicator__j26lrx0 utilities_pointerEvents_none__16lm1iwl utilities_position_sticky__16lm1iw4 utilities_width_100%__16lm1iw1b utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e" };
4172
+ var ActiveRowIndicatorCls = { visible: "ActiveRowIndicator_ActiveRowIndicatorCls_visible__j26lrx1 ActiveRowIndicator_ActiveRowIndicator__j26lrx0 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2 utilities_width_100%__16lm1iw1b utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e", hidden: "ActiveRowIndicator_ActiveRowIndicatorCls_hidden__j26lrx2 ActiveRowIndicator_ActiveRowIndicator__j26lrx0 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2 utilities_width_100%__16lm1iw1b utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e" };
4164
4173
 
4165
4174
  // src/components/InfiniteTable/components/ActiveRowIndicator.tsx
4166
4175
  var { rootClassName: rootClassName3 } = internalProps;
@@ -4592,8 +4601,8 @@ function forwardProps(propsToForward, props, setupState) {
4592
4601
  return mappedState;
4593
4602
  }
4594
4603
  function buildManagedComponent(config) {
4604
+ const useParentStateFn = config.getParentState || (() => null);
4595
4605
  function useManagedComponent(props) {
4596
- var _a, _b;
4597
4606
  const [initialSetupState] = (0, import_react14.useState)(() => {
4598
4607
  return config.initSetupState ? config.initSetupState(props) : {};
4599
4608
  });
@@ -4602,7 +4611,7 @@ function buildManagedComponent(config) {
4602
4611
  () => config.forwardProps ? config.forwardProps(initialSetupState) : {},
4603
4612
  [initialSetupState]
4604
4613
  );
4605
- const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
4614
+ const parentState = useParentStateFn();
4606
4615
  const getParentState = useLatest(parentState);
4607
4616
  function initStateOnce() {
4608
4617
  let mappedState = {};
@@ -4638,11 +4647,11 @@ function buildManagedComponent(config) {
4638
4647
  const [wholeState] = (0, import_react14.useState)(initStateOnce);
4639
4648
  const getProps = useLatest(props);
4640
4649
  const theReducer = (previousState, action) => {
4641
- var _a2;
4650
+ var _a;
4642
4651
  if (action.type === "REPLACE_STATE") {
4643
4652
  return action.payload;
4644
4653
  }
4645
- const parentState2 = (_a2 = getParentState == null ? void 0 : getParentState()) != null ? _a2 : null;
4654
+ const parentState2 = (_a = getParentState == null ? void 0 : getParentState()) != null ? _a : null;
4646
4655
  const mappedState = action.payload.mappedState;
4647
4656
  const updatedProps = action.payload.updatedPropsToState;
4648
4657
  const newState = Object.assign({}, previousState);
@@ -4727,6 +4736,8 @@ function buildManagedComponent(config) {
4727
4736
  [state, actions, getComponentState]
4728
4737
  );
4729
4738
  const prevProps = usePrevious(props);
4739
+ const skipTriggerParentStateChangeRef = (0, import_react14.useRef)(false);
4740
+ skipTriggerParentStateChangeRef.current = false;
4730
4741
  const effectFn = config.layoutEffect ? import_react14.useLayoutEffect : import_react14.useEffect;
4731
4742
  effectFn(() => {
4732
4743
  const currentProps = props;
@@ -4784,6 +4795,7 @@ function buildManagedComponent(config) {
4784
4795
  updatedPropsToState: updatedPropsToStateCount ? updatedPropsToState : null
4785
4796
  }
4786
4797
  };
4798
+ skipTriggerParentStateChangeRef.current = true;
4787
4799
  dispatch(action);
4788
4800
  if (config.onPropChange) {
4789
4801
  for (var prop in rawUpdatedProps)
@@ -4802,10 +4814,18 @@ function buildManagedComponent(config) {
4802
4814
  }
4803
4815
  }
4804
4816
  });
4817
+ effectFn(() => {
4818
+ if (parentState != null && !skipTriggerParentStateChangeRef.current) {
4819
+ dispatch({
4820
+ type: "PARENT_STATE_CHANGE",
4821
+ payload: {}
4822
+ });
4823
+ }
4824
+ }, [parentState]);
4805
4825
  useEffectOnce(() => {
4806
4826
  return () => {
4807
- var _a2;
4808
- (_a2 = config.cleanup) == null ? void 0 : _a2.call(config, getComponentState());
4827
+ var _a;
4828
+ (_a = config.cleanup) == null ? void 0 : _a.call(config, getComponentState());
4809
4829
  };
4810
4830
  });
4811
4831
  return { contextValue, ContextComponent: Context };
@@ -5686,6 +5706,7 @@ var getComputedColumns = ({
5686
5706
  viewportReservedWidth,
5687
5707
  resizableColumns,
5688
5708
  draggableColumns,
5709
+ columnDefaultDraggable,
5689
5710
  columnOrder,
5690
5711
  columnPinning,
5691
5712
  editable,
@@ -5969,7 +5990,7 @@ var getComputedColumns = ({
5969
5990
  computedSortedDesc,
5970
5991
  computedVisibleIndex,
5971
5992
  computedPinned,
5972
- computedDraggable: (_z = (_y = c.draggable) != null ? _y : draggableColumns) != null ? _z : DEFAULT_DRAGGABLE,
5993
+ computedDraggable: (_z = (_y = draggableColumns != null ? draggableColumns : c.defaultDraggable) != null ? _y : columnDefaultDraggable) != null ? _z : DEFAULT_DRAGGABLE,
5973
5994
  computedFirstInCategory,
5974
5995
  computedLastInCategory,
5975
5996
  computedFirst: theComputedVisibleIndex === 0,
@@ -8248,7 +8269,7 @@ function InfiniteTableCellFn(props) {
8248
8269
  }
8249
8270
  const RenderComponent = cellType === "body" ? (_b = column.components) == null ? void 0 : _b.ColumnCell : (_c = column.components) == null ? void 0 : _c.HeaderCell;
8250
8271
  if (RenderComponent) {
8251
- return /* @__PURE__ */ React34.createElement(RenderComponent, __spreadValues({}, finalDOMProps));
8272
+ return /* @__PURE__ */ React34.createElement(RenderComponent, __spreadProps(__spreadValues({}, finalDOMProps), { ref: domRef }));
8252
8273
  }
8253
8274
  return /* @__PURE__ */ React34.createElement("div", __spreadProps(__spreadValues({}, finalDOMProps), { ref: domRef }));
8254
8275
  }
@@ -12902,6 +12923,10 @@ function getDataSourceApi(param) {
12902
12923
  var DataSourceApiImpl = class {
12903
12924
  constructor(param) {
12904
12925
  this.pendingOperations = [];
12926
+ //@ts-ignore
12927
+ this.batchOperationRafId = 0;
12928
+ //@ts-ignore
12929
+ this.batchOperationTimeoutId = 0;
12905
12930
  this.pendingPromise = null;
12906
12931
  this.resolvePendingPromise = null;
12907
12932
  this.toPrimaryKey = (data) => {
@@ -13048,13 +13073,23 @@ var DataSourceApiImpl = class {
13048
13073
  this.actions = param.actions;
13049
13074
  }
13050
13075
  batchOperation(operation) {
13076
+ var _a;
13051
13077
  if (!this.pendingPromise) {
13052
13078
  this.pendingPromise = new Promise((resolve) => {
13053
13079
  this.resolvePendingPromise = resolve;
13054
13080
  });
13055
- raf(() => {
13056
- this.commit();
13057
- });
13081
+ const delay = Math.max(0, (_a = this.getState().batchOperationDelay) != null ? _a : 0);
13082
+ if (delay === 0) {
13083
+ this.batchOperationRafId = raf(() => {
13084
+ this.commit();
13085
+ });
13086
+ } else {
13087
+ this.batchOperationTimeoutId = setTimeout(() => {
13088
+ this.batchOperationRafId = raf(() => {
13089
+ this.commit();
13090
+ });
13091
+ }, delay);
13092
+ }
13058
13093
  }
13059
13094
  this.pendingOperations.push(operation);
13060
13095
  return this.pendingPromise;
@@ -14463,6 +14498,7 @@ var forwardProps3 = (setupState) => {
14463
14498
  __idToIndex: idToIndexReducer
14464
14499
  };
14465
14500
  },
14501
+ batchOperationDelay: 1,
14466
14502
  isRowSelected: 1,
14467
14503
  onDataArrayChange: 1,
14468
14504
  onDataMutations: 1,
@@ -15918,6 +15954,15 @@ var InfiniteTableApiImpl = class {
15918
15954
  this.setColumnOrder = (columnOrder) => {
15919
15955
  this.actions.columnOrder = columnOrder;
15920
15956
  };
15957
+ this.setVisibilityForColumnGroup = (columnGroupId, visible) => {
15958
+ const columnGroupVisibility = __spreadValues({}, this.getState().columnGroupVisibility);
15959
+ if (visible) {
15960
+ delete columnGroupVisibility[columnGroupId];
15961
+ } else {
15962
+ columnGroupVisibility[columnGroupId] = false;
15963
+ }
15964
+ this.actions.columnGroupVisibility = columnGroupVisibility;
15965
+ };
15921
15966
  this.collapseAllGroupRows = () => {
15922
15967
  const state = this.getDataSourceState();
15923
15968
  const newState = new GroupRowsState(state.groupRowsState);
@@ -17563,7 +17608,8 @@ var forwardProps4 = (_setupState) => {
17563
17608
  columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 5e3,
17564
17609
  columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
17565
17610
  columnCssEllipsis: (columnCssEllipsis) => columnCssEllipsis != null ? columnCssEllipsis : true,
17566
- draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
17611
+ draggableColumns: 1,
17612
+ columnDefaultDraggable: 1,
17567
17613
  headerOptions: (headerOptions) => __spreadValues({
17568
17614
  alwaysReserveSpaceForSortIcon: true
17569
17615
  }, headerOptions),
@@ -18284,6 +18330,7 @@ var useComputedColumns = ({
18284
18330
  columnCssEllipsis,
18285
18331
  columnHeaderCssEllipsis,
18286
18332
  draggableColumns,
18333
+ columnDefaultDraggable,
18287
18334
  sortInfo,
18288
18335
  multiSort,
18289
18336
  filterValue,
@@ -18345,6 +18392,7 @@ var useComputedColumns = ({
18345
18392
  pinnedEndMaxWidth,
18346
18393
  pinnedStartMaxWidth,
18347
18394
  draggableColumns,
18395
+ columnDefaultDraggable,
18348
18396
  columnOrder,
18349
18397
  columnPinning,
18350
18398
  columnDefaultEditable,
@@ -18372,6 +18420,8 @@ var useComputedColumns = ({
18372
18420
  columnOrder,
18373
18421
  columnVisibility,
18374
18422
  columnVisibilityAssumeVisible,
18423
+ columnDefaultDraggable,
18424
+ draggableColumns,
18375
18425
  resizableColumns,
18376
18426
  pinnedEndMaxWidth,
18377
18427
  pinnedStartMaxWidth,
@@ -18629,6 +18679,7 @@ function useComputed() {
18629
18679
  columnDefaultWidth: componentState.columnDefaultWidth,
18630
18680
  columnDefaultFlex: componentState.columnDefaultFlex,
18631
18681
  columnDefaultSortable: componentState.columnDefaultSortable,
18682
+ columnDefaultDraggable: componentState.columnDefaultDraggable,
18632
18683
  pinnedStartMaxWidth: componentState.pinnedStartMaxWidth,
18633
18684
  pinnedEndMaxWidth: componentState.pinnedEndMaxWidth,
18634
18685
  bodySize,
@@ -18893,7 +18944,7 @@ var useLicense = (licenseKey = "") => {
18893
18944
  }
18894
18945
  let valid2 = isValidLicense(licenseKey, {
18895
18946
  publishedAt: 1624970570587,
18896
- version: "4.3.6"
18947
+ version: "4.3.8"
18897
18948
  });
18898
18949
  if (!licenseKey && !valid2 && isInsidePlayground) {
18899
18950
  return true;
package/index.mjs CHANGED
@@ -2935,11 +2935,16 @@ var ReactHeadlessTableRenderer = class extends Logger {
2935
2935
  }, zIndex2) => {
2936
2936
  const columnOffsetX = `${columnOffsetAtIndex2}-${colIndex}`;
2937
2937
  const columnOffsetXWhileReordering = `${columnOffsetAtIndexWhileReordering2}-${colIndex}`;
2938
- element.style.setProperty(
2939
- currentTransformY,
2940
- scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}) )` : `${y}px`
2941
- );
2942
- element.style.transform = `translate3d(var(${columnOffsetXWhileReordering}, var(${columnOffsetX})), var(${currentTransformY}), 0)`;
2938
+ const currentTransformYValue = scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}) )` : `${y}px`;
2939
+ if (element.__currentTransformY !== currentTransformYValue) {
2940
+ element.__currentTransformY = currentTransformYValue;
2941
+ element.style.setProperty(currentTransformY, currentTransformYValue);
2942
+ }
2943
+ const transformValue = `translate3d(var(${columnOffsetXWhileReordering}, var(${columnOffsetX})), var(${currentTransformY}), 0)`;
2944
+ if (element.__transformValue !== transformValue) {
2945
+ element.__transformValue = transformValue;
2946
+ element.style.transform = transformValue;
2947
+ }
2943
2948
  if (zIndex2 != null) {
2944
2949
  }
2945
2950
  };
@@ -3593,11 +3598,15 @@ var ReactHeadlessTableRenderer = class extends Logger {
3593
3598
  itemElement.style.willChange = "transform";
3594
3599
  itemElement.style.backfaceVisibility = "hidden";
3595
3600
  const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
3596
- itemElement.style.zIndex = hidden ? "-1" : (
3601
+ const zIndex2 = hidden ? "-1" : (
3597
3602
  // #updatezindex - we need to allow elements use their own zIndex, so we
3598
3603
  // resort to allowing them to have it as a data-z-index attribute
3599
3604
  itemElement.dataset.zIndex || "auto"
3600
3605
  );
3606
+ if (itemElement.__zIndex !== zIndex2) {
3607
+ itemElement.__zIndex = zIndex2;
3608
+ itemElement.style.zIndex = zIndex2;
3609
+ }
3601
3610
  } else {
3602
3611
  itemElement.style.display = "";
3603
3612
  itemElement.style.left = `${x}px`;
@@ -4115,7 +4124,7 @@ var ActiveCellIndicatorCls = { visible: "ActiveCellIndicator_ActiveCellIndicator
4115
4124
  var ActiveIndicatorWrapperCls = "ActiveCellIndicator_ActiveIndicatorWrapperCls__nxbq1c0 utilities_pointerEvents_none__16lm1iwl utilities_position_sticky__16lm1iw4 utilities_left_0__16lm1iw1e utilities_top_0__16lm1iw1c utilities_height_0__16lm1iw18 utilities_zIndex_1000000__16lm1iwu";
4116
4125
 
4117
4126
  // src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
4118
- var ActiveRowIndicatorCls = { visible: "ActiveRowIndicator_ActiveRowIndicatorCls_visible__j26lrx1 ActiveRowIndicator_ActiveRowIndicator__j26lrx0 utilities_pointerEvents_none__16lm1iwl utilities_position_sticky__16lm1iw4 utilities_width_100%__16lm1iw1b utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e", hidden: "ActiveRowIndicator_ActiveRowIndicatorCls_hidden__j26lrx2 ActiveRowIndicator_ActiveRowIndicator__j26lrx0 utilities_pointerEvents_none__16lm1iwl utilities_position_sticky__16lm1iw4 utilities_width_100%__16lm1iw1b utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e" };
4127
+ var ActiveRowIndicatorCls = { visible: "ActiveRowIndicator_ActiveRowIndicatorCls_visible__j26lrx1 ActiveRowIndicator_ActiveRowIndicator__j26lrx0 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2 utilities_width_100%__16lm1iw1b utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e", hidden: "ActiveRowIndicator_ActiveRowIndicatorCls_hidden__j26lrx2 ActiveRowIndicator_ActiveRowIndicator__j26lrx0 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2 utilities_width_100%__16lm1iw1b utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e" };
4119
4128
 
4120
4129
  // src/components/InfiniteTable/components/ActiveRowIndicator.tsx
4121
4130
  var { rootClassName: rootClassName3 } = internalProps;
@@ -4555,8 +4564,8 @@ function forwardProps(propsToForward, props, setupState) {
4555
4564
  return mappedState;
4556
4565
  }
4557
4566
  function buildManagedComponent(config) {
4567
+ const useParentStateFn = config.getParentState || (() => null);
4558
4568
  function useManagedComponent(props) {
4559
- var _a, _b;
4560
4569
  const [initialSetupState] = useState4(() => {
4561
4570
  return config.initSetupState ? config.initSetupState(props) : {};
4562
4571
  });
@@ -4565,7 +4574,7 @@ function buildManagedComponent(config) {
4565
4574
  () => config.forwardProps ? config.forwardProps(initialSetupState) : {},
4566
4575
  [initialSetupState]
4567
4576
  );
4568
- const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
4577
+ const parentState = useParentStateFn();
4569
4578
  const getParentState = useLatest(parentState);
4570
4579
  function initStateOnce() {
4571
4580
  let mappedState = {};
@@ -4601,11 +4610,11 @@ function buildManagedComponent(config) {
4601
4610
  const [wholeState] = useState4(initStateOnce);
4602
4611
  const getProps = useLatest(props);
4603
4612
  const theReducer = (previousState, action) => {
4604
- var _a2;
4613
+ var _a;
4605
4614
  if (action.type === "REPLACE_STATE") {
4606
4615
  return action.payload;
4607
4616
  }
4608
- const parentState2 = (_a2 = getParentState == null ? void 0 : getParentState()) != null ? _a2 : null;
4617
+ const parentState2 = (_a = getParentState == null ? void 0 : getParentState()) != null ? _a : null;
4609
4618
  const mappedState = action.payload.mappedState;
4610
4619
  const updatedProps = action.payload.updatedPropsToState;
4611
4620
  const newState = Object.assign({}, previousState);
@@ -4690,6 +4699,8 @@ function buildManagedComponent(config) {
4690
4699
  [state, actions, getComponentState]
4691
4700
  );
4692
4701
  const prevProps = usePrevious(props);
4702
+ const skipTriggerParentStateChangeRef = useRef11(false);
4703
+ skipTriggerParentStateChangeRef.current = false;
4693
4704
  const effectFn = config.layoutEffect ? useLayoutEffect7 : useEffect9;
4694
4705
  effectFn(() => {
4695
4706
  const currentProps = props;
@@ -4747,6 +4758,7 @@ function buildManagedComponent(config) {
4747
4758
  updatedPropsToState: updatedPropsToStateCount ? updatedPropsToState : null
4748
4759
  }
4749
4760
  };
4761
+ skipTriggerParentStateChangeRef.current = true;
4750
4762
  dispatch(action);
4751
4763
  if (config.onPropChange) {
4752
4764
  for (var prop in rawUpdatedProps)
@@ -4765,10 +4777,18 @@ function buildManagedComponent(config) {
4765
4777
  }
4766
4778
  }
4767
4779
  });
4780
+ effectFn(() => {
4781
+ if (parentState != null && !skipTriggerParentStateChangeRef.current) {
4782
+ dispatch({
4783
+ type: "PARENT_STATE_CHANGE",
4784
+ payload: {}
4785
+ });
4786
+ }
4787
+ }, [parentState]);
4768
4788
  useEffectOnce(() => {
4769
4789
  return () => {
4770
- var _a2;
4771
- (_a2 = config.cleanup) == null ? void 0 : _a2.call(config, getComponentState());
4790
+ var _a;
4791
+ (_a = config.cleanup) == null ? void 0 : _a.call(config, getComponentState());
4772
4792
  };
4773
4793
  });
4774
4794
  return { contextValue, ContextComponent: Context };
@@ -5649,6 +5669,7 @@ var getComputedColumns = ({
5649
5669
  viewportReservedWidth,
5650
5670
  resizableColumns,
5651
5671
  draggableColumns,
5672
+ columnDefaultDraggable,
5652
5673
  columnOrder,
5653
5674
  columnPinning,
5654
5675
  editable,
@@ -5932,7 +5953,7 @@ var getComputedColumns = ({
5932
5953
  computedSortedDesc,
5933
5954
  computedVisibleIndex,
5934
5955
  computedPinned,
5935
- computedDraggable: (_z = (_y = c.draggable) != null ? _y : draggableColumns) != null ? _z : DEFAULT_DRAGGABLE,
5956
+ computedDraggable: (_z = (_y = draggableColumns != null ? draggableColumns : c.defaultDraggable) != null ? _y : columnDefaultDraggable) != null ? _z : DEFAULT_DRAGGABLE,
5936
5957
  computedFirstInCategory,
5937
5958
  computedLastInCategory,
5938
5959
  computedFirst: theComputedVisibleIndex === 0,
@@ -8211,7 +8232,7 @@ function InfiniteTableCellFn(props) {
8211
8232
  }
8212
8233
  const RenderComponent = cellType === "body" ? (_b = column.components) == null ? void 0 : _b.ColumnCell : (_c = column.components) == null ? void 0 : _c.HeaderCell;
8213
8234
  if (RenderComponent) {
8214
- return /* @__PURE__ */ React34.createElement(RenderComponent, __spreadValues({}, finalDOMProps));
8235
+ return /* @__PURE__ */ React34.createElement(RenderComponent, __spreadProps(__spreadValues({}, finalDOMProps), { ref: domRef }));
8215
8236
  }
8216
8237
  return /* @__PURE__ */ React34.createElement("div", __spreadProps(__spreadValues({}, finalDOMProps), { ref: domRef }));
8217
8238
  }
@@ -12865,6 +12886,10 @@ function getDataSourceApi(param) {
12865
12886
  var DataSourceApiImpl = class {
12866
12887
  constructor(param) {
12867
12888
  this.pendingOperations = [];
12889
+ //@ts-ignore
12890
+ this.batchOperationRafId = 0;
12891
+ //@ts-ignore
12892
+ this.batchOperationTimeoutId = 0;
12868
12893
  this.pendingPromise = null;
12869
12894
  this.resolvePendingPromise = null;
12870
12895
  this.toPrimaryKey = (data) => {
@@ -13011,13 +13036,23 @@ var DataSourceApiImpl = class {
13011
13036
  this.actions = param.actions;
13012
13037
  }
13013
13038
  batchOperation(operation) {
13039
+ var _a;
13014
13040
  if (!this.pendingPromise) {
13015
13041
  this.pendingPromise = new Promise((resolve) => {
13016
13042
  this.resolvePendingPromise = resolve;
13017
13043
  });
13018
- raf(() => {
13019
- this.commit();
13020
- });
13044
+ const delay = Math.max(0, (_a = this.getState().batchOperationDelay) != null ? _a : 0);
13045
+ if (delay === 0) {
13046
+ this.batchOperationRafId = raf(() => {
13047
+ this.commit();
13048
+ });
13049
+ } else {
13050
+ this.batchOperationTimeoutId = setTimeout(() => {
13051
+ this.batchOperationRafId = raf(() => {
13052
+ this.commit();
13053
+ });
13054
+ }, delay);
13055
+ }
13021
13056
  }
13022
13057
  this.pendingOperations.push(operation);
13023
13058
  return this.pendingPromise;
@@ -14426,6 +14461,7 @@ var forwardProps3 = (setupState) => {
14426
14461
  __idToIndex: idToIndexReducer
14427
14462
  };
14428
14463
  },
14464
+ batchOperationDelay: 1,
14429
14465
  isRowSelected: 1,
14430
14466
  onDataArrayChange: 1,
14431
14467
  onDataMutations: 1,
@@ -15886,6 +15922,15 @@ var InfiniteTableApiImpl = class {
15886
15922
  this.setColumnOrder = (columnOrder) => {
15887
15923
  this.actions.columnOrder = columnOrder;
15888
15924
  };
15925
+ this.setVisibilityForColumnGroup = (columnGroupId, visible) => {
15926
+ const columnGroupVisibility = __spreadValues({}, this.getState().columnGroupVisibility);
15927
+ if (visible) {
15928
+ delete columnGroupVisibility[columnGroupId];
15929
+ } else {
15930
+ columnGroupVisibility[columnGroupId] = false;
15931
+ }
15932
+ this.actions.columnGroupVisibility = columnGroupVisibility;
15933
+ };
15889
15934
  this.collapseAllGroupRows = () => {
15890
15935
  const state = this.getDataSourceState();
15891
15936
  const newState = new GroupRowsState(state.groupRowsState);
@@ -17535,7 +17580,8 @@ var forwardProps4 = (_setupState) => {
17535
17580
  columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 5e3,
17536
17581
  columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
17537
17582
  columnCssEllipsis: (columnCssEllipsis) => columnCssEllipsis != null ? columnCssEllipsis : true,
17538
- draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
17583
+ draggableColumns: 1,
17584
+ columnDefaultDraggable: 1,
17539
17585
  headerOptions: (headerOptions) => __spreadValues({
17540
17586
  alwaysReserveSpaceForSortIcon: true
17541
17587
  }, headerOptions),
@@ -18256,6 +18302,7 @@ var useComputedColumns = ({
18256
18302
  columnCssEllipsis,
18257
18303
  columnHeaderCssEllipsis,
18258
18304
  draggableColumns,
18305
+ columnDefaultDraggable,
18259
18306
  sortInfo,
18260
18307
  multiSort,
18261
18308
  filterValue,
@@ -18317,6 +18364,7 @@ var useComputedColumns = ({
18317
18364
  pinnedEndMaxWidth,
18318
18365
  pinnedStartMaxWidth,
18319
18366
  draggableColumns,
18367
+ columnDefaultDraggable,
18320
18368
  columnOrder,
18321
18369
  columnPinning,
18322
18370
  columnDefaultEditable,
@@ -18344,6 +18392,8 @@ var useComputedColumns = ({
18344
18392
  columnOrder,
18345
18393
  columnVisibility,
18346
18394
  columnVisibilityAssumeVisible,
18395
+ columnDefaultDraggable,
18396
+ draggableColumns,
18347
18397
  resizableColumns,
18348
18398
  pinnedEndMaxWidth,
18349
18399
  pinnedStartMaxWidth,
@@ -18601,6 +18651,7 @@ function useComputed() {
18601
18651
  columnDefaultWidth: componentState.columnDefaultWidth,
18602
18652
  columnDefaultFlex: componentState.columnDefaultFlex,
18603
18653
  columnDefaultSortable: componentState.columnDefaultSortable,
18654
+ columnDefaultDraggable: componentState.columnDefaultDraggable,
18604
18655
  pinnedStartMaxWidth: componentState.pinnedStartMaxWidth,
18605
18656
  pinnedEndMaxWidth: componentState.pinnedEndMaxWidth,
18606
18657
  bodySize,
@@ -18865,7 +18916,7 @@ var useLicense = (licenseKey = "") => {
18865
18916
  }
18866
18917
  let valid2 = isValidLicense(licenseKey, {
18867
18918
  publishedAt: 1624970570587,
18868
- version: "4.3.6"
18919
+ version: "4.3.8"
18869
18920
  });
18870
18921
  if (!licenseKey && !valid2 && isInsidePlayground) {
18871
18922
  return true;
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "bugs": {
26
26
  "url": "https://github.com/infinite-table/infinite-react/issues"
27
27
  },
28
- "version": "4.3.6",
28
+ "version": "4.3.8",
29
29
  "main": "index.js",
30
30
  "module": "index.mjs",
31
31
  "typings": "index.d.ts",
@@ -34,5 +34,5 @@
34
34
  },
35
35
  "license": "Commercial & Open Source",
36
36
  "//": "will be updated at build time",
37
- "publishedAt": 1723632776523
37
+ "publishedAt": 1724077305504
38
38
  }