@infinite-table/infinite-react 1.3.17 → 1.3.18

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.dev.mjs CHANGED
@@ -4940,6 +4940,15 @@ import * as React42 from "react";
4940
4940
  import { useCallback as useCallback14, useContext as useContext6, useEffect as useEffect15, useRef as useRef16 } from "react";
4941
4941
  import { createPortal } from "react-dom";
4942
4942
 
4943
+ // src/utils/keyMirror.ts
4944
+ function keyMirror(obj) {
4945
+ const result = {};
4946
+ Object.keys(obj).forEach((key) => {
4947
+ result[key] = key;
4948
+ });
4949
+ return result;
4950
+ }
4951
+
4943
4952
  // src/components/InfiniteTable/components/icons/Icon.tsx
4944
4953
  import * as React16 from "react";
4945
4954
  var Icon = (props) => {
@@ -5117,22 +5126,22 @@ var createRuntimeFn = (config) => (options) => {
5117
5126
 
5118
5127
  // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
5119
5128
  var CellCls = "cell_CellCls__1eexc2a5 utilities_display_flex__16lm1iwy utilities_flexFlow_row__16lm1iw1n utilities_alignItems_center__16lm1iw1p utilities_position_absolute__16lm1iw2 utilities_willChange_transform__16lm1iw21 utilities_whiteSpace_nowrap__16lm1iw22 utilities_userSelect_none__16lm1iw16";
5120
- var HeaderCellContentRecipe = createRuntimeFn({ defaultClassName: "header_HeaderCellContentRecipe__12zfob11t utilities_height_100%__16lm1iw18 utilities_width_100%__16lm1iw1a utilities_display_flex__16lm1iwy utilities_flexFlow_row__16lm1iw1n utilities_alignItems_center__16lm1iw1p utilities_justifyContent_start__16lm1iw1u", variantClassNames: { filtered: { false: "header_HeaderCellContentRecipe_filtered_false__12zfob11u", true: "header_HeaderCellContentRecipe_filtered_true__12zfob11v" }, verticalAlign: { start: "header_HeaderCellContentRecipe_verticalAlign_start__12zfob11w", end: "header_HeaderCellContentRecipe_verticalAlign_end__12zfob11x", center: "header_HeaderCellContentRecipe_verticalAlign_center__12zfob11y" }, align: { start: "header_HeaderCellContentRecipe_align_start__12zfob11z", end: "header_HeaderCellContentRecipe_align_end__12zfob120", center: "header_HeaderCellContentRecipe_align_center__12zfob121" } }, defaultVariants: {}, compoundVariants: [] });
5129
+ var HeaderCellContentRecipe = createRuntimeFn({ defaultClassName: "header_HeaderCellContentRecipe__12zfob11v utilities_height_100%__16lm1iw18 utilities_width_100%__16lm1iw1a utilities_display_flex__16lm1iwy utilities_flexFlow_row__16lm1iw1n utilities_alignItems_center__16lm1iw1p utilities_justifyContent_start__16lm1iw1u", variantClassNames: { filtered: { false: "header_HeaderCellContentRecipe_filtered_false__12zfob11w", true: "header_HeaderCellContentRecipe_filtered_true__12zfob11x" }, verticalAlign: { start: "header_HeaderCellContentRecipe_verticalAlign_start__12zfob11y", end: "header_HeaderCellContentRecipe_verticalAlign_end__12zfob11z", center: "header_HeaderCellContentRecipe_verticalAlign_center__12zfob120" }, align: { start: "header_HeaderCellContentRecipe_align_start__12zfob121", end: "header_HeaderCellContentRecipe_align_end__12zfob122", center: "header_HeaderCellContentRecipe_align_center__12zfob123" } }, defaultVariants: {}, compoundVariants: [] });
5121
5130
  var HeaderCellProxy = "header_HeaderCellProxy__12zfob1m utilities_whiteSpace_nowrap__16lm1iw22 utilities_textOverflow_ellipsis__16lm1iw23 utilities_overflow_hidden__16lm1iw1w";
5122
5131
  var HeaderCellRecipe = createRuntimeFn({ defaultClassName: "header_HeaderCellRecipe__12zfob1n utilities_display_block__16lm1iw11", variantClassNames: { rowActive: { false: "header_HeaderCellRecipe_rowActive_false__12zfob1o", true: "header_HeaderCellRecipe_rowActive_true__12zfob1p" }, rowSelected: { false: "header_HeaderCellRecipe_rowSelected_false__12zfob1q", true: "header_HeaderCellRecipe_rowSelected_true__12zfob1r", null: "header_HeaderCellRecipe_rowSelected_null__12zfob1s" }, groupRow: { false: "header_HeaderCellRecipe_groupRow_false__12zfob1t", true: "header_HeaderCellRecipe_groupRow_true__12zfob1u" }, groupCell: { false: "header_HeaderCellRecipe_groupCell_false__12zfob1v", true: "header_HeaderCellRecipe_groupCell_true__12zfob1w" }, align: { start: "header_HeaderCellRecipe_align_start__12zfob1x", end: "header_HeaderCellRecipe_align_end__12zfob1y", center: "header_HeaderCellRecipe_align_center__12zfob1z" }, verticalAlign: { start: "header_HeaderCellRecipe_verticalAlign_start__12zfob110", end: "header_HeaderCellRecipe_verticalAlign_end__12zfob111", center: "header_HeaderCellRecipe_verticalAlign_center__12zfob112" }, zebra: { false: "header_HeaderCellRecipe_zebra_false__12zfob113", even: "header_HeaderCellRecipe_zebra_even__12zfob114", odd: "header_HeaderCellRecipe_zebra_odd__12zfob115" }, dragging: { true: "header_HeaderCellRecipe_dragging_true__12zfob116", false: "header_HeaderCellRecipe_dragging_false__12zfob117" }, first: { true: "header_HeaderCellRecipe_first_true__12zfob118", false: "header_HeaderCellRecipe_first_false__12zfob119" }, last: { true: "header_HeaderCellRecipe_last_true__12zfob11a", false: "header_HeaderCellRecipe_last_false__12zfob11b" }, groupByField: { true: "header_HeaderCellRecipe_groupByField_true__12zfob11c", false: "header_HeaderCellRecipe_groupByField_false__12zfob11d" }, firstInCategory: { true: "header_HeaderCellRecipe_firstInCategory_true__12zfob11e", false: "header_HeaderCellRecipe_firstInCategory_false__12zfob11f" }, lastInCategory: { true: "header_HeaderCellRecipe_lastInCategory_true__12zfob11g", false: "header_HeaderCellRecipe_lastInCategory_false__12zfob11h" }, pinned: { start: "header_HeaderCellRecipe_pinned_start__12zfob11i", end: "header_HeaderCellRecipe_pinned_end__12zfob11j", false: "header_HeaderCellRecipe_pinned_false__12zfob11k" }, filtered: { true: "header_HeaderCellRecipe_filtered_true__12zfob11l", false: "header_HeaderCellRecipe_filtered_false__12zfob11m" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "header_HeaderCellRecipe_compound_0__12zfob11n"], [{ pinned: "end", firstInCategory: true }, "header_HeaderCellRecipe_compound_1__12zfob11o"], [{ pinned: false, lastInCategory: true }, "header_HeaderCellRecipe_compound_2__12zfob11p"]] });
5123
5132
  var HeaderClsRecipe = createRuntimeFn({ defaultClassName: "header_HeaderClsRecipe__12zfob18 utilities_display_block__16lm1iw11 utilities_position_absolute__16lm1iw2", variantClassNames: { pinned: { start: "header_HeaderClsRecipe_pinned_start__12zfob19", end: "header_HeaderClsRecipe_pinned_end__12zfob1a", false: "header_HeaderClsRecipe_pinned_false__12zfob1b" }, firstInCategory: { true: "header_HeaderClsRecipe_firstInCategory_true__12zfob1c", false: "header_HeaderClsRecipe_firstInCategory_false__12zfob1d" }, lastInCategory: { true: "header_HeaderClsRecipe_lastInCategory_true__12zfob1e", false: "header_HeaderClsRecipe_lastInCategory_false__12zfob1f" }, overflow: { true: "header_HeaderClsRecipe_overflow_true__12zfob1g", false: "header_HeaderClsRecipe_overflow_false__12zfob1h" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "header_HeaderClsRecipe_compound_0__12zfob1i"], [{ pinned: "start", firstInCategory: true }, "header_HeaderClsRecipe_compound_1__12zfob1j"], [{ overflow: true, pinned: "end" }, "header_HeaderClsRecipe_compound_2__12zfob1k"], [{ pinned: "end", lastInCategory: true }, "header_HeaderClsRecipe_compound_3__12zfob1l"]] });
5124
- var HeaderFilterCls = "header_HeaderFilterCls__12zfob124 utilities_display_flex__16lm1iwy utilities_flexFlow_row__16lm1iw1n utilities_alignItems_stretch__16lm1iw1q utilities_position_relative__16lm1iw1";
5125
- var HeaderFilterEditorCls = "header_HeaderFilterEditorCls__12zfob129 utilities_width_100%__16lm1iw1a utilities_height_100%__16lm1iw18";
5133
+ var HeaderFilterCls = "header_HeaderFilterCls__12zfob126 utilities_display_flex__16lm1iwy utilities_flexFlow_row__16lm1iw1n utilities_alignItems_stretch__16lm1iw1q utilities_position_relative__16lm1iw1";
5134
+ var HeaderFilterEditorCls = "header_HeaderFilterEditorCls__12zfob12b utilities_width_100%__16lm1iw1a utilities_height_100%__16lm1iw18";
5126
5135
  var HeaderFilterIconIndexCls = "header_HeaderFilterIconIndexCls__12zfob16";
5127
- var HeaderFilterOperatorCls = "header_HeaderFilterOperatorCls__12zfob125 utilities_display_flex__16lm1iwy utilities_flexFlow_row__16lm1iw1n utilities_alignItems_center__16lm1iw1p utilities_position_relative__16lm1iw1";
5128
- var HeaderFilterOperatorIconRecipe = createRuntimeFn({ defaultClassName: "header_HeaderFilterOperatorIconRecipe__12zfob126 utilities_position_relative__16lm1iw1 utilities_top_0__16lm1iw1b", variantClassNames: { disabled: { true: "header_HeaderFilterOperatorIconRecipe_disabled_true__12zfob127", false: "header_HeaderFilterOperatorIconRecipe_disabled_false__12zfob128" } }, defaultVariants: {}, compoundVariants: [] });
5129
- var HeaderGroupCls = "header_HeaderGroupCls__12zfob123 utilities_display_flex__16lm1iwy utilities_flexFlow_row__16lm1iw1n utilities_alignItems_center__16lm1iw1p";
5130
- var HeaderMenuIconCls = createRuntimeFn({ defaultClassName: "header_HeaderMenuIconCls__12zfob11q utilities_position_relative__16lm1iw1 utilities_display_flex__16lm1iwy utilities_flexFlow_column__16lm1iw1l utilities_justifyContent_spaceAround__16lm1iw1t utilities_visibility_hidden__16lm1iw20", variantClassNames: { reserveSpaceWhenHidden: { true: "header_HeaderMenuIconCls_reserveSpaceWhenHidden_true__12zfob11r", false: "header_HeaderMenuIconCls_reserveSpaceWhenHidden_false__12zfob11s" } }, defaultVariants: {}, compoundVariants: [] });
5136
+ var HeaderFilterOperatorCls = "header_HeaderFilterOperatorCls__12zfob127 utilities_display_flex__16lm1iwy utilities_flexFlow_row__16lm1iw1n utilities_alignItems_center__16lm1iw1p utilities_position_relative__16lm1iw1";
5137
+ var HeaderFilterOperatorIconRecipe = createRuntimeFn({ defaultClassName: "header_HeaderFilterOperatorIconRecipe__12zfob128 utilities_position_relative__16lm1iw1 utilities_top_0__16lm1iw1b", variantClassNames: { disabled: { true: "header_HeaderFilterOperatorIconRecipe_disabled_true__12zfob129", false: "header_HeaderFilterOperatorIconRecipe_disabled_false__12zfob12a" } }, defaultVariants: {}, compoundVariants: [] });
5138
+ var HeaderGroupCls = "header_HeaderGroupCls__12zfob125 utilities_display_flex__16lm1iwy utilities_flexFlow_row__16lm1iw1n utilities_alignItems_center__16lm1iw1p";
5139
+ var HeaderMenuIconCls = createRuntimeFn({ defaultClassName: "header_HeaderMenuIconCls__12zfob11q utilities_position_relative__16lm1iw1 utilities_display_flex__16lm1iwy utilities_flexFlow_column__16lm1iw1l utilities_justifyContent_spaceAround__16lm1iw1t utilities_visibility_hidden__16lm1iw20", variantClassNames: { menuVisible: { true: "header_HeaderMenuIconCls_menuVisible_true__12zfob11r" }, reserveSpaceWhenHidden: { true: "header_HeaderMenuIconCls_reserveSpaceWhenHidden_true__12zfob11s", false: "header_HeaderMenuIconCls_reserveSpaceWhenHidden_false__12zfob11t" } }, defaultVariants: {}, compoundVariants: [[{ menuVisible: true, reserveSpaceWhenHidden: false }, "header_HeaderMenuIconCls_compound_0__12zfob11u"]] });
5131
5140
  var HeaderScrollbarPlaceholderCls = "header_HeaderScrollbarPlaceholderCls__12zfob17 utilities_position_absolute__16lm1iw2";
5132
5141
  var HeaderSortIconCls = "utilities_position_relative__16lm1iw1";
5133
5142
  var HeaderSortIconIndexCls = "header_HeaderSortIconIndexCls__12zfob15";
5134
5143
  var HeaderSortIconRecipe = createRuntimeFn({ defaultClassName: "", variantClassNames: { align: { start: "header_HeaderSortIconRecipe_align_start__12zfob12", center: "header_HeaderSortIconRecipe_align_center__12zfob13", end: "header_HeaderSortIconRecipe_align_end__12zfob14" } }, defaultVariants: {}, compoundVariants: [] });
5135
- var HeaderWrapperCls = "header_HeaderWrapperCls__12zfob122 utilities_overflow_hidden__16lm1iw1w utilities_position_relative__16lm1iw1 utilities_display_flex__16lm1iwy utilities_flexFlow_row__16lm1iw1n";
5144
+ var HeaderWrapperCls = "header_HeaderWrapperCls__12zfob124 utilities_overflow_hidden__16lm1iw1w utilities_position_relative__16lm1iw1 utilities_display_flex__16lm1iwy utilities_flexFlow_row__16lm1iw1n";
5136
5145
 
5137
5146
  // src/components/InfiniteTable/components/icons/InfiniteTableIconClassName.ts
5138
5147
  var InfiniteTableIconClassName = "InfiniteTableIcon";
@@ -5252,6 +5261,9 @@ function getColumnApiForColumn(colOrColId, param) {
5252
5261
  hideContextMenu() {
5253
5262
  actions.columnMenuVisibleForColumnId = null;
5254
5263
  },
5264
+ isVisible() {
5265
+ return getComputed().computedVisibleColumnsMap.has(column.id);
5266
+ },
5255
5267
  toggleSort(params = {
5256
5268
  multiSortBehavior: "replace"
5257
5269
  }) {
@@ -7699,20 +7711,34 @@ var defaultLineStyle2 = {
7699
7711
  pointerEvents: "none"
7700
7712
  };
7701
7713
  var lineClassName = `${InfiniteTableIconClassName}-menu`;
7714
+ var MenuIconDataAttributes = keyMirror({
7715
+ "data-name": ""
7716
+ });
7717
+ var MenuIconDataAttributesValues = {
7718
+ [MenuIconDataAttributes["data-name"]]: "menu-icon"
7719
+ };
7702
7720
  function MenuIcon(props) {
7703
- const { style: style2, className, domProps, reserveSpaceWhenHidden, children } = props;
7721
+ const {
7722
+ style: style2,
7723
+ className,
7724
+ domProps,
7725
+ reserveSpaceWhenHidden,
7726
+ menuVisible,
7727
+ children
7728
+ } = props;
7704
7729
  const lineStyle = __spreadValues(__spreadProps(__spreadValues({}, defaultLineStyle2), {
7705
7730
  borderTop: `${ThemeVars.components.HeaderCell.menuIconLineWidth} solid currentColor`
7706
7731
  }), props.lineStyle);
7707
7732
  return /* @__PURE__ */ React38.createElement(
7708
7733
  "div",
7709
- __spreadProps(__spreadValues({}, domProps), {
7710
- style: style2,
7711
- "data-name": "menu-icon",
7734
+ __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, domProps), {
7735
+ style: style2
7736
+ }), MenuIconDataAttributesValues), {
7712
7737
  onPointerDown: (e) => e.stopPropagation(),
7713
7738
  className: join(
7714
7739
  className,
7715
7740
  HeaderMenuIconCls({
7741
+ menuVisible,
7716
7742
  reserveSpaceWhenHidden
7717
7743
  }),
7718
7744
  InfiniteTableIconClassName,
@@ -8493,6 +8519,11 @@ var { rootClassName: rootClassName8 } = internalProps;
8493
8519
  var InfiniteTableHeaderCellClassName = `${rootClassName8}HeaderCell`;
8494
8520
  var columnZIndexAtIndex5 = stripVar(InternalVars.columnZIndexAtIndex);
8495
8521
  var spacer = /* @__PURE__ */ React42.createElement("div", { className: flex["1"] });
8522
+ var InfiniteHeaderCellDataAttributes = keyMirror({
8523
+ "data-name": ``,
8524
+ "data-header-align": "",
8525
+ "data-column-id": ""
8526
+ });
8496
8527
  function InfiniteTableHeaderCell(props) {
8497
8528
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
8498
8529
  const column = props.column;
@@ -8506,7 +8537,8 @@ function InfiniteTableHeaderCell(props) {
8506
8537
  components: components2,
8507
8538
  portalDOMRef,
8508
8539
  columnHeaderHeight,
8509
- columnReorderDragColumnId
8540
+ columnReorderDragColumnId,
8541
+ columnMenuVisibleForColumnId
8510
8542
  }
8511
8543
  } = useInfiniteTable();
8512
8544
  const {
@@ -8553,6 +8585,7 @@ function InfiniteTableHeaderCell(props) {
8553
8585
  const headerCSSEllipsis = (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true;
8554
8586
  const menuIconProps = {
8555
8587
  reserveSpaceWhenHidden: align2 === "center",
8588
+ menuVisible: columnMenuVisibleForColumnId === column.id,
8556
8589
  style: align2 === "end" ? {
8557
8590
  marginInlineStart: `calc(${ThemeVars.components.HeaderCell.resizeHandleActiveAreaWidth} / 2)`,
8558
8591
  marginInlineEnd: ThemeVars.spacing[2]
@@ -8596,6 +8629,7 @@ function InfiniteTableHeaderCell(props) {
8596
8629
  sortIcon,
8597
8630
  filterIcon,
8598
8631
  menuIcon,
8632
+ menuIconProps,
8599
8633
  selectionCheckBox: null,
8600
8634
  header: column.header && typeof column.header !== "function" ? column.header : column.name
8601
8635
  }
@@ -8756,15 +8790,18 @@ function InfiniteTableHeaderCell(props) {
8756
8790
  const resizeHandle = useColumnResizeHandle(column);
8757
8791
  const zIndex2 = `var(${columnZIndexAtIndex5}-${column.computedVisibleIndex})`;
8758
8792
  style2.zIndex = zIndex2;
8793
+ const dataAttrs = {
8794
+ "data-column-id": column.id,
8795
+ "data-header-align": align2,
8796
+ "data-name": "HeaderCell"
8797
+ };
8759
8798
  return /* @__PURE__ */ React42.createElement(ContextProvider, { value: renderParam }, /* @__PURE__ */ React42.createElement(
8760
8799
  InfiniteTableCell,
8761
- {
8800
+ __spreadProps(__spreadValues({
8762
8801
  domRef: ref,
8763
8802
  cellType: "header",
8764
- column,
8765
- "data-name": `HeaderCell`,
8766
- "data-header-align": align2,
8767
- "data-column-id": column.id,
8803
+ column
8804
+ }, dataAttrs), {
8768
8805
  "data-z-index": zIndex2,
8769
8806
  style: style2,
8770
8807
  width,
@@ -8813,7 +8850,7 @@ function InfiniteTableHeaderCell(props) {
8813
8850
  }
8814
8851
  ) : /* @__PURE__ */ React42.createElement(InfiniteTableColumnHeaderFilterEmpty, null) : null, resizeHandle),
8815
8852
  renderChildren
8816
- }
8853
+ })
8817
8854
  ), draggingProxy);
8818
8855
  }
8819
8856
  function useInfiniteHeaderCell() {
@@ -13380,6 +13417,48 @@ function useRowInfoReducers() {
13380
13417
  return rowInfoReducerResults;
13381
13418
  }
13382
13419
 
13420
+ // src/components/InfiniteTable/api/realignColumnContextMenu.ts
13421
+ function realignColumnContextMenu(param) {
13422
+ const { getComputed, getState, actions } = param;
13423
+ const columnMenuVisibleForColumnId = getState().columnMenuVisibleForColumnId;
13424
+ if (!columnMenuVisibleForColumnId) {
13425
+ return;
13426
+ }
13427
+ const computed = getComputed();
13428
+ const visibleCols = computed.computedVisibleColumnsMap;
13429
+ const order2 = computed.computedColumnOrder;
13430
+ if (visibleCols.has(columnMenuVisibleForColumnId)) {
13431
+ actions.columnMenuVisibleKey = Date.now();
13432
+ return;
13433
+ }
13434
+ function tryCol(diff2, sign2) {
13435
+ const colId2 = order2[index + diff2 * sign2];
13436
+ if (visibleCols.has(colId2)) {
13437
+ return colId2;
13438
+ }
13439
+ return;
13440
+ }
13441
+ const index = order2.indexOf(columnMenuVisibleForColumnId);
13442
+ let diff = 0;
13443
+ let sign = -1;
13444
+ let colId;
13445
+ while (!colId && diff < order2.length) {
13446
+ diff++;
13447
+ colId = tryCol(diff, sign);
13448
+ if (!colId) {
13449
+ sign *= -1;
13450
+ colId = tryCol(diff, sign);
13451
+ }
13452
+ if (colId) {
13453
+ break;
13454
+ }
13455
+ }
13456
+ if (colId) {
13457
+ actions.columnMenuVisibleForColumnId = colId;
13458
+ }
13459
+ return colId;
13460
+ }
13461
+
13383
13462
  // src/components/InfiniteTable/api/getImperativeApi.ts
13384
13463
  var InfiniteTableApiImpl = class {
13385
13464
  constructor(context) {
@@ -13687,6 +13766,21 @@ var InfiniteTableApiImpl = class {
13687
13766
  this.actions.contextMenuVisibleFor = null;
13688
13767
  this.actions.cellContextMenuVisibleFor = null;
13689
13768
  }
13769
+ realignColumnContextMenu() {
13770
+ realignColumnContextMenu({
13771
+ actions: this.actions,
13772
+ getState: this.getState,
13773
+ getComputed: this.getComputed
13774
+ });
13775
+ }
13776
+ getColumnOrder() {
13777
+ return this.getComputed().computedColumnOrder;
13778
+ }
13779
+ getVisibleColumnOrder() {
13780
+ const order2 = this.getColumnOrder();
13781
+ const visibleColumns = this.getComputed().computedVisibleColumnsMap;
13782
+ return order2.filter((id) => visibleColumns.has(id));
13783
+ }
13690
13784
  startEdit(params) {
13691
13785
  return __async(this, null, function* () {
13692
13786
  const { columnId, rowIndex: index, primaryKey } = params;
@@ -14760,6 +14854,7 @@ function initSetupState2() {
14760
14854
  cellContextMenuVisibleFor: null,
14761
14855
  contextMenuVisibleFor: null,
14762
14856
  columnMenuVisibleForColumnId: null,
14857
+ columnMenuVisibleKey: 0,
14763
14858
  filterOperatorMenuVisibleForColumnId: null,
14764
14859
  getDOMNodeForCell: (cellPosition) => {
14765
14860
  if (!domRef.current) {
@@ -16550,7 +16645,7 @@ var useLicense = (licenseKey = "") => {
16550
16645
  const valid = useMemo11(() => {
16551
16646
  let valid2 = isValidLicense(licenseKey, {
16552
16647
  publishedAt: 1624970570587,
16553
- version: "1.3.17"
16648
+ version: "1.3.18"
16554
16649
  });
16555
16650
  if (!licenseKey && !valid2 && isInsidePlayground) {
16556
16651
  return true;
@@ -19044,6 +19139,9 @@ function defaultGetColumnMenuItems(_items, params) {
19044
19139
  checked: col.computedVisible,
19045
19140
  onChange: (checked) => {
19046
19141
  api.setVisibilityForColumn(col.id, !!checked);
19142
+ requestAnimationFrame(() => {
19143
+ api.realignColumnContextMenu();
19144
+ });
19047
19145
  }
19048
19146
  }
19049
19147
  )
@@ -19117,6 +19215,35 @@ function getMenuForColumn(columnId, context, onHideIntent) {
19117
19215
  }
19118
19216
 
19119
19217
  // src/components/InfiniteTable/hooks/useColumnMenu.ts
19218
+ var menuIconSelector = `[${MenuIconDataAttributes["data-name"]}="${MenuIconDataAttributesValues["data-name"]}"]`;
19219
+ function showMenuForColumn(options) {
19220
+ const { columnId, context, clearAll, showOverlay } = options;
19221
+ const { getState, actions } = context;
19222
+ function onHideIntent() {
19223
+ clearAll();
19224
+ actions.columnMenuVisibleForColumnId = null;
19225
+ }
19226
+ let target = options.target;
19227
+ if (!target) {
19228
+ const iconSelector = `[${InfiniteHeaderCellDataAttributes["data-column-id"]}="${columnId}"] ${menuIconSelector}`;
19229
+ target = getState().domRef.current.querySelector(
19230
+ iconSelector
19231
+ );
19232
+ }
19233
+ if (!target) {
19234
+ console.warn(`Cannot show column menu for column "${columnId}"`);
19235
+ return;
19236
+ }
19237
+ showOverlay(() => getMenuForColumn(columnId, context, onHideIntent), {
19238
+ constrainTo: getState().domRef.current,
19239
+ id: "column-menu",
19240
+ alignTo: target,
19241
+ alignPosition: [
19242
+ ["TopLeft", "BottomLeft"],
19243
+ ["TopRight", "BottomRight"]
19244
+ ]
19245
+ });
19246
+ }
19120
19247
  function useColumnMenu() {
19121
19248
  const context = useInfiniteTable();
19122
19249
  const { getState, actions } = context;
@@ -19134,26 +19261,13 @@ function useColumnMenu() {
19134
19261
  if (!info) {
19135
19262
  return;
19136
19263
  }
19137
- const { target, column } = info;
19138
- function onHideIntent() {
19139
- clearAll();
19140
- actions2.columnMenuVisibleForColumnId = null;
19141
- }
19142
- showOverlay(() => getMenuForColumn(column.id, context, onHideIntent), {
19143
- constrainTo: getState2().domRef.current,
19144
- id: "column-menu",
19145
- alignTo: target,
19146
- alignPosition: [
19147
- ["TopLeft", "BottomLeft"],
19148
- ["TopRight", "BottomRight"]
19149
- ]
19150
- });
19151
19264
  actions2.contextMenuVisibleFor = null;
19152
19265
  actions2.cellContextMenuVisibleFor = null;
19153
19266
  actions2.filterOperatorMenuVisibleForColumnId = null;
19154
- actions2.columnMenuVisibleForColumnId = column.id;
19267
+ actions2.columnMenuVisibleForColumnId = info.column.id;
19155
19268
  });
19156
19269
  }, []);
19270
+ const { columnMenuVisibleForColumnId, columnMenuVisibleKey } = getState();
19157
19271
  useEffect35(() => {
19158
19272
  const {
19159
19273
  columnMenuVisibleForColumnId: columnContextMenuVisibleForColumnId
@@ -19167,6 +19281,12 @@ function useColumnMenu() {
19167
19281
  };
19168
19282
  var handleMouseDown = handleMouseDown2;
19169
19283
  document.documentElement.addEventListener("mousedown", handleMouseDown2);
19284
+ showMenuForColumn({
19285
+ columnId: columnContextMenuVisibleForColumnId,
19286
+ context,
19287
+ clearAll,
19288
+ showOverlay
19289
+ });
19170
19290
  return () => {
19171
19291
  document.documentElement.removeEventListener(
19172
19292
  "mousedown",
@@ -19178,7 +19298,7 @@ function useColumnMenu() {
19178
19298
  }
19179
19299
  return () => {
19180
19300
  };
19181
- }, [getState().columnMenuVisibleForColumnId]);
19301
+ }, [columnMenuVisibleForColumnId, columnMenuVisibleKey]);
19182
19302
  return { menuPortal };
19183
19303
  }
19184
19304
 
@@ -20116,6 +20236,7 @@ InfiniteTable.defaultProps = {
20116
20236
  var components = {
20117
20237
  CheckBox: InfiniteCheckBox,
20118
20238
  LoadMask,
20239
+ MenuIcon,
20119
20240
  StringFilterEditor,
20120
20241
  NumberFilterEditor
20121
20242
  };
@@ -20128,7 +20249,6 @@ export {
20128
20249
  InfiniteTableClassName,
20129
20250
  InfiniteTableComponent,
20130
20251
  Menu,
20131
- MenuIcon,
20132
20252
  RowSelectionState,
20133
20253
  components,
20134
20254
  debounce,