@infinite-table/infinite-react 1.3.19 → 1.3.21

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
@@ -1222,6 +1222,7 @@ interface InfiniteTableMappedState<T> {
1222
1222
  showSeparatePivotColumnForSingleAggregation: NonUndefined<InfiniteTableProps<T>['showSeparatePivotColumnForSingleAggregation']>;
1223
1223
  domProps: InfiniteTableProps<T>['domProps'];
1224
1224
  editable: InfiniteTableProps<T>['editable'];
1225
+ columnMenuRealignDelay: NonUndefined<InfiniteTableProps<T>['columnMenuRealignDelay']>;
1225
1226
  columnDefaultEditable: InfiniteTableProps<T>['columnDefaultEditable'];
1226
1227
  columnDefaultFilterable: InfiniteTableProps<T>['columnDefaultFilterable'];
1227
1228
  rowStyle: InfiniteTableProps<T>['rowStyle'];
@@ -2655,6 +2656,14 @@ interface InfiniteTableProps<T> {
2655
2656
  onSelfBlur?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
2656
2657
  onFocusWithin?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
2657
2658
  onBlurWithin?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
2659
+ /**
2660
+ * When a column is hidden by using the column menu, the column menu will stay open,
2661
+ * so it needs (generally) to be realigned to the correct location. This prop
2662
+ * configures the delay in milliseconds before the column menu is realigned.
2663
+ *
2664
+ * @default 50
2665
+ */
2666
+ columnMenuRealignDelay?: number;
2658
2667
  onScrollToTop?: () => void;
2659
2668
  onScrollToBottom?: () => void;
2660
2669
  scrollStopDelay?: number;
package/index.dev.js CHANGED
@@ -13459,7 +13459,8 @@ function realignColumnContextMenu(param) {
13459
13459
  }
13460
13460
  function tryCol(diff2, sign2) {
13461
13461
  const colId2 = order2[index + diff2 * sign2];
13462
- if (visibleCols.has(colId2)) {
13462
+ const col = visibleCols.get(colId2);
13463
+ if (col && col.renderMenuIcon !== false) {
13463
13464
  return colId2;
13464
13465
  }
13465
13466
  return;
@@ -13792,12 +13793,21 @@ var InfiniteTableApiImpl = class {
13792
13793
  this.actions.contextMenuVisibleFor = null;
13793
13794
  this.actions.cellContextMenuVisibleFor = null;
13794
13795
  }
13795
- realignColumnContextMenu() {
13796
- realignColumnContextMenu({
13796
+ realignColumnContextMenu(callback) {
13797
+ const param = {
13797
13798
  actions: this.actions,
13798
13799
  getState: this.getState,
13799
13800
  getComputed: this.getComputed
13800
- });
13801
+ };
13802
+ const delay = this.getState().columnMenuRealignDelay;
13803
+ if (!delay || delay < 0) {
13804
+ realignColumnContextMenu(param);
13805
+ callback == null ? void 0 : callback();
13806
+ }
13807
+ setTimeout(() => {
13808
+ realignColumnContextMenu(param);
13809
+ callback == null ? void 0 : callback();
13810
+ }, delay);
13801
13811
  }
13802
13812
  getColumnOrder() {
13803
13813
  return this.getComputed().computedColumnOrder;
@@ -14967,6 +14977,7 @@ var forwardProps4 = (setupState) => {
14967
14977
  onScrollbarsChange: 1,
14968
14978
  autoSizeColumnsKey: 1,
14969
14979
  columnDefaultFlex: 1,
14980
+ columnMenuRealignDelay: (columnMenuRealignDelay) => columnMenuRealignDelay != null ? columnMenuRealignDelay : 50,
14970
14981
  scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
14971
14982
  viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
14972
14983
  resizableColumns: (resizableColumns) => resizableColumns != null ? resizableColumns : true,
@@ -16669,7 +16680,7 @@ var useLicense = (licenseKey = "") => {
16669
16680
  const valid = (0, import_react49.useMemo)(() => {
16670
16681
  let valid2 = isValidLicense(licenseKey, {
16671
16682
  publishedAt: 1624970570587,
16672
- version: "1.3.19"
16683
+ version: "1.3.21"
16673
16684
  });
16674
16685
  if (!licenseKey && !valid2 && isInsidePlayground) {
16675
16686
  return true;
@@ -19235,29 +19246,31 @@ function showMenuForColumn(options) {
19235
19246
  var _a;
19236
19247
  const { columnId, context, clearAll, showOverlay } = options;
19237
19248
  const { getState, actions } = context;
19249
+ const { columnMenuTargetRef, domRef } = getState();
19238
19250
  function onHideIntent() {
19239
19251
  clearAll();
19240
19252
  actions.columnMenuVisibleForColumnId = null;
19241
19253
  }
19242
19254
  let target = options.target;
19255
+ if (!target) {
19256
+ target = (_a = columnMenuTargetRef.current) != null ? _a : void 0;
19257
+ if (target && !domRef.current.contains(target)) {
19258
+ target = void 0;
19259
+ }
19260
+ }
19243
19261
  if (!target) {
19244
19262
  const iconSelector = `[${InfiniteHeaderCellDataAttributes["data-column-id"]}="${columnId}"] ${menuIconSelector}`;
19245
19263
  target = getState().domRef.current.querySelector(
19246
19264
  iconSelector
19247
19265
  );
19248
- if (!target) {
19249
- target = (_a = getState().columnMenuTargetRef.current) != null ? _a : void 0;
19250
- if (!(target == null ? void 0 : target.parentElement)) {
19251
- target = void 0;
19252
- }
19253
- }
19254
19266
  }
19255
19267
  if (!target) {
19256
19268
  console.warn(`Cannot show column menu for column "${columnId}"`);
19257
19269
  return;
19258
19270
  }
19271
+ columnMenuTargetRef.current = null;
19259
19272
  showOverlay(() => getMenuForColumn(columnId, context, onHideIntent), {
19260
- constrainTo: getState().domRef.current,
19273
+ constrainTo: domRef.current,
19261
19274
  id: "column-menu",
19262
19275
  alignTo: target,
19263
19276
  alignPosition: [
package/index.dev.mjs CHANGED
@@ -13445,7 +13445,8 @@ function realignColumnContextMenu(param) {
13445
13445
  }
13446
13446
  function tryCol(diff2, sign2) {
13447
13447
  const colId2 = order2[index + diff2 * sign2];
13448
- if (visibleCols.has(colId2)) {
13448
+ const col = visibleCols.get(colId2);
13449
+ if (col && col.renderMenuIcon !== false) {
13449
13450
  return colId2;
13450
13451
  }
13451
13452
  return;
@@ -13778,12 +13779,21 @@ var InfiniteTableApiImpl = class {
13778
13779
  this.actions.contextMenuVisibleFor = null;
13779
13780
  this.actions.cellContextMenuVisibleFor = null;
13780
13781
  }
13781
- realignColumnContextMenu() {
13782
- realignColumnContextMenu({
13782
+ realignColumnContextMenu(callback) {
13783
+ const param = {
13783
13784
  actions: this.actions,
13784
13785
  getState: this.getState,
13785
13786
  getComputed: this.getComputed
13786
- });
13787
+ };
13788
+ const delay = this.getState().columnMenuRealignDelay;
13789
+ if (!delay || delay < 0) {
13790
+ realignColumnContextMenu(param);
13791
+ callback == null ? void 0 : callback();
13792
+ }
13793
+ setTimeout(() => {
13794
+ realignColumnContextMenu(param);
13795
+ callback == null ? void 0 : callback();
13796
+ }, delay);
13787
13797
  }
13788
13798
  getColumnOrder() {
13789
13799
  return this.getComputed().computedColumnOrder;
@@ -14957,6 +14967,7 @@ var forwardProps4 = (setupState) => {
14957
14967
  onScrollbarsChange: 1,
14958
14968
  autoSizeColumnsKey: 1,
14959
14969
  columnDefaultFlex: 1,
14970
+ columnMenuRealignDelay: (columnMenuRealignDelay) => columnMenuRealignDelay != null ? columnMenuRealignDelay : 50,
14960
14971
  scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
14961
14972
  viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
14962
14973
  resizableColumns: (resizableColumns) => resizableColumns != null ? resizableColumns : true,
@@ -16659,7 +16670,7 @@ var useLicense = (licenseKey = "") => {
16659
16670
  const valid = useMemo11(() => {
16660
16671
  let valid2 = isValidLicense(licenseKey, {
16661
16672
  publishedAt: 1624970570587,
16662
- version: "1.3.19"
16673
+ version: "1.3.21"
16663
16674
  });
16664
16675
  if (!licenseKey && !valid2 && isInsidePlayground) {
16665
16676
  return true;
@@ -19235,29 +19246,31 @@ function showMenuForColumn(options) {
19235
19246
  var _a;
19236
19247
  const { columnId, context, clearAll, showOverlay } = options;
19237
19248
  const { getState, actions } = context;
19249
+ const { columnMenuTargetRef, domRef } = getState();
19238
19250
  function onHideIntent() {
19239
19251
  clearAll();
19240
19252
  actions.columnMenuVisibleForColumnId = null;
19241
19253
  }
19242
19254
  let target = options.target;
19255
+ if (!target) {
19256
+ target = (_a = columnMenuTargetRef.current) != null ? _a : void 0;
19257
+ if (target && !domRef.current.contains(target)) {
19258
+ target = void 0;
19259
+ }
19260
+ }
19243
19261
  if (!target) {
19244
19262
  const iconSelector = `[${InfiniteHeaderCellDataAttributes["data-column-id"]}="${columnId}"] ${menuIconSelector}`;
19245
19263
  target = getState().domRef.current.querySelector(
19246
19264
  iconSelector
19247
19265
  );
19248
- if (!target) {
19249
- target = (_a = getState().columnMenuTargetRef.current) != null ? _a : void 0;
19250
- if (!(target == null ? void 0 : target.parentElement)) {
19251
- target = void 0;
19252
- }
19253
- }
19254
19266
  }
19255
19267
  if (!target) {
19256
19268
  console.warn(`Cannot show column menu for column "${columnId}"`);
19257
19269
  return;
19258
19270
  }
19271
+ columnMenuTargetRef.current = null;
19259
19272
  showOverlay(() => getMenuForColumn(columnId, context, onHideIntent), {
19260
- constrainTo: getState().domRef.current,
19273
+ constrainTo: domRef.current,
19261
19274
  id: "column-menu",
19262
19275
  alignTo: target,
19263
19276
  alignPosition: [