@infinite-table/infinite-react 1.3.17 → 1.3.19

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
  }
@@ -8632,7 +8666,19 @@ function InfiniteTableHeaderCell(props) {
8632
8666
  renderParam2.renderBag.menuIcon = /* @__PURE__ */ React42.createElement(
8633
8667
  RenderHeaderCellHookComponent,
8634
8668
  {
8635
- render: column.renderMenuIcon,
8669
+ render: (param) => {
8670
+ if (typeof column.renderMenuIcon !== "function") {
8671
+ return null;
8672
+ }
8673
+ const result = column.renderMenuIcon(param);
8674
+ if (result) {
8675
+ if (result.type === MenuIconCmp || result.type === MenuIcon) {
8676
+ return result;
8677
+ }
8678
+ return /* @__PURE__ */ React42.createElement(MenuIconCmp, __spreadValues({}, menuIconProps), result);
8679
+ }
8680
+ return null;
8681
+ },
8636
8682
  renderParam: __spreadProps(__spreadValues({}, renderParam2), {
8637
8683
  renderBag: __spreadValues({}, renderParam2.renderBag)
8638
8684
  })
@@ -8756,15 +8802,18 @@ function InfiniteTableHeaderCell(props) {
8756
8802
  const resizeHandle = useColumnResizeHandle(column);
8757
8803
  const zIndex2 = `var(${columnZIndexAtIndex5}-${column.computedVisibleIndex})`;
8758
8804
  style2.zIndex = zIndex2;
8805
+ const dataAttrs = {
8806
+ "data-column-id": column.id,
8807
+ "data-header-align": align2,
8808
+ "data-name": "HeaderCell"
8809
+ };
8759
8810
  return /* @__PURE__ */ React42.createElement(ContextProvider, { value: renderParam }, /* @__PURE__ */ React42.createElement(
8760
8811
  InfiniteTableCell,
8761
- {
8812
+ __spreadProps(__spreadValues({
8762
8813
  domRef: ref,
8763
8814
  cellType: "header",
8764
- column,
8765
- "data-name": `HeaderCell`,
8766
- "data-header-align": align2,
8767
- "data-column-id": column.id,
8815
+ column
8816
+ }, dataAttrs), {
8768
8817
  "data-z-index": zIndex2,
8769
8818
  style: style2,
8770
8819
  width,
@@ -8813,7 +8862,7 @@ function InfiniteTableHeaderCell(props) {
8813
8862
  }
8814
8863
  ) : /* @__PURE__ */ React42.createElement(InfiniteTableColumnHeaderFilterEmpty, null) : null, resizeHandle),
8815
8864
  renderChildren
8816
- }
8865
+ })
8817
8866
  ), draggingProxy);
8818
8867
  }
8819
8868
  function useInfiniteHeaderCell() {
@@ -13380,6 +13429,48 @@ function useRowInfoReducers() {
13380
13429
  return rowInfoReducerResults;
13381
13430
  }
13382
13431
 
13432
+ // src/components/InfiniteTable/api/realignColumnContextMenu.ts
13433
+ function realignColumnContextMenu(param) {
13434
+ const { getComputed, getState, actions } = param;
13435
+ const columnMenuVisibleForColumnId = getState().columnMenuVisibleForColumnId;
13436
+ if (!columnMenuVisibleForColumnId) {
13437
+ return;
13438
+ }
13439
+ const computed = getComputed();
13440
+ const visibleCols = computed.computedVisibleColumnsMap;
13441
+ const order2 = computed.computedColumnOrder;
13442
+ if (visibleCols.has(columnMenuVisibleForColumnId)) {
13443
+ actions.columnMenuVisibleKey = Date.now();
13444
+ return;
13445
+ }
13446
+ function tryCol(diff2, sign2) {
13447
+ const colId2 = order2[index + diff2 * sign2];
13448
+ if (visibleCols.has(colId2)) {
13449
+ return colId2;
13450
+ }
13451
+ return;
13452
+ }
13453
+ const index = order2.indexOf(columnMenuVisibleForColumnId);
13454
+ let diff = 0;
13455
+ let sign = -1;
13456
+ let colId;
13457
+ while (!colId && diff < order2.length) {
13458
+ diff++;
13459
+ colId = tryCol(diff, sign);
13460
+ if (!colId) {
13461
+ sign *= -1;
13462
+ colId = tryCol(diff, sign);
13463
+ }
13464
+ if (colId) {
13465
+ break;
13466
+ }
13467
+ }
13468
+ if (colId) {
13469
+ actions.columnMenuVisibleForColumnId = colId;
13470
+ }
13471
+ return colId;
13472
+ }
13473
+
13383
13474
  // src/components/InfiniteTable/api/getImperativeApi.ts
13384
13475
  var InfiniteTableApiImpl = class {
13385
13476
  constructor(context) {
@@ -13687,6 +13778,21 @@ var InfiniteTableApiImpl = class {
13687
13778
  this.actions.contextMenuVisibleFor = null;
13688
13779
  this.actions.cellContextMenuVisibleFor = null;
13689
13780
  }
13781
+ realignColumnContextMenu() {
13782
+ realignColumnContextMenu({
13783
+ actions: this.actions,
13784
+ getState: this.getState,
13785
+ getComputed: this.getComputed
13786
+ });
13787
+ }
13788
+ getColumnOrder() {
13789
+ return this.getComputed().computedColumnOrder;
13790
+ }
13791
+ getVisibleColumnOrder() {
13792
+ const order2 = this.getColumnOrder();
13793
+ const visibleColumns = this.getComputed().computedVisibleColumnsMap;
13794
+ return order2.filter((id) => visibleColumns.has(id));
13795
+ }
13690
13796
  startEdit(params) {
13691
13797
  return __async(this, null, function* () {
13692
13798
  const { columnId, rowIndex: index, primaryKey } = params;
@@ -14760,6 +14866,7 @@ function initSetupState2() {
14760
14866
  cellContextMenuVisibleFor: null,
14761
14867
  contextMenuVisibleFor: null,
14762
14868
  columnMenuVisibleForColumnId: null,
14869
+ columnMenuVisibleKey: 0,
14763
14870
  filterOperatorMenuVisibleForColumnId: null,
14764
14871
  getDOMNodeForCell: (cellPosition) => {
14765
14872
  if (!domRef.current) {
@@ -14771,6 +14878,7 @@ function initSetupState2() {
14771
14878
  brain,
14772
14879
  headerBrain,
14773
14880
  domRef,
14881
+ columnMenuTargetRef: createRef(),
14774
14882
  editingValueRef: createRef(),
14775
14883
  scrollerDOMRef: createRef(),
14776
14884
  portalDOMRef: createRef(),
@@ -14920,6 +15028,7 @@ var cleanupState = (state) => {
14920
15028
  state.onColumnMenuClick.destroy();
14921
15029
  state.onFilterOperatorMenuClick.destroy();
14922
15030
  state.domRef.current = null;
15031
+ state.columnMenuTargetRef.current = null;
14923
15032
  state.scrollerDOMRef.current = null;
14924
15033
  state.portalDOMRef.current = null;
14925
15034
  state.onRowHeightCSSVarChange.destroy();
@@ -16550,7 +16659,7 @@ var useLicense = (licenseKey = "") => {
16550
16659
  const valid = useMemo11(() => {
16551
16660
  let valid2 = isValidLicense(licenseKey, {
16552
16661
  publishedAt: 1624970570587,
16553
- version: "1.3.17"
16662
+ version: "1.3.19"
16554
16663
  });
16555
16664
  if (!licenseKey && !valid2 && isInsidePlayground) {
16556
16665
  return true;
@@ -19043,7 +19152,11 @@ function defaultGetColumnMenuItems(_items, params) {
19043
19152
  disabled: col.computedVisible && api.getVisibleColumnsCount() === 1,
19044
19153
  checked: col.computedVisible,
19045
19154
  onChange: (checked) => {
19046
- api.setVisibilityForColumn(col.id, !!checked);
19155
+ const visible = !!checked;
19156
+ api.setVisibilityForColumn(col.id, visible);
19157
+ requestAnimationFrame(() => {
19158
+ api.realignColumnContextMenu();
19159
+ });
19047
19160
  }
19048
19161
  }
19049
19162
  )
@@ -19117,6 +19230,42 @@ function getMenuForColumn(columnId, context, onHideIntent) {
19117
19230
  }
19118
19231
 
19119
19232
  // src/components/InfiniteTable/hooks/useColumnMenu.ts
19233
+ var menuIconSelector = `[${MenuIconDataAttributes["data-name"]}="${MenuIconDataAttributesValues["data-name"]}"]`;
19234
+ function showMenuForColumn(options) {
19235
+ var _a;
19236
+ const { columnId, context, clearAll, showOverlay } = options;
19237
+ const { getState, actions } = context;
19238
+ function onHideIntent() {
19239
+ clearAll();
19240
+ actions.columnMenuVisibleForColumnId = null;
19241
+ }
19242
+ let target = options.target;
19243
+ if (!target) {
19244
+ const iconSelector = `[${InfiniteHeaderCellDataAttributes["data-column-id"]}="${columnId}"] ${menuIconSelector}`;
19245
+ target = getState().domRef.current.querySelector(
19246
+ iconSelector
19247
+ );
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
+ }
19255
+ if (!target) {
19256
+ console.warn(`Cannot show column menu for column "${columnId}"`);
19257
+ return;
19258
+ }
19259
+ showOverlay(() => getMenuForColumn(columnId, context, onHideIntent), {
19260
+ constrainTo: getState().domRef.current,
19261
+ id: "column-menu",
19262
+ alignTo: target,
19263
+ alignPosition: [
19264
+ ["TopLeft", "BottomLeft"],
19265
+ ["TopRight", "BottomRight"]
19266
+ ]
19267
+ });
19268
+ }
19120
19269
  function useColumnMenu() {
19121
19270
  const context = useInfiniteTable();
19122
19271
  const { getState, actions } = context;
@@ -19134,31 +19283,17 @@ function useColumnMenu() {
19134
19283
  if (!info) {
19135
19284
  return;
19136
19285
  }
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
- });
19286
+ state.columnMenuTargetRef.current = info.target;
19151
19287
  actions2.contextMenuVisibleFor = null;
19152
19288
  actions2.cellContextMenuVisibleFor = null;
19153
19289
  actions2.filterOperatorMenuVisibleForColumnId = null;
19154
- actions2.columnMenuVisibleForColumnId = column.id;
19290
+ actions2.columnMenuVisibleForColumnId = info.column.id;
19155
19291
  });
19156
19292
  }, []);
19293
+ const { columnMenuVisibleForColumnId, columnMenuVisibleKey } = getState();
19157
19294
  useEffect35(() => {
19158
- const {
19159
- columnMenuVisibleForColumnId: columnContextMenuVisibleForColumnId
19160
- } = getState();
19161
- if (columnContextMenuVisibleForColumnId) {
19295
+ const { columnMenuVisibleForColumnId: columnMenuVisibleForColumnId2, columnMenuTargetRef } = getState();
19296
+ if (columnMenuVisibleForColumnId2) {
19162
19297
  let handleMouseDown2 = function(event) {
19163
19298
  if (event.__insideMenu !== true) {
19164
19299
  clearAll();
@@ -19167,6 +19302,12 @@ function useColumnMenu() {
19167
19302
  };
19168
19303
  var handleMouseDown = handleMouseDown2;
19169
19304
  document.documentElement.addEventListener("mousedown", handleMouseDown2);
19305
+ showMenuForColumn({
19306
+ columnId: columnMenuVisibleForColumnId2,
19307
+ context,
19308
+ clearAll,
19309
+ showOverlay
19310
+ });
19170
19311
  return () => {
19171
19312
  document.documentElement.removeEventListener(
19172
19313
  "mousedown",
@@ -19174,11 +19315,12 @@ function useColumnMenu() {
19174
19315
  );
19175
19316
  };
19176
19317
  } else {
19318
+ columnMenuTargetRef.current = null;
19177
19319
  clearAll();
19178
19320
  }
19179
19321
  return () => {
19180
19322
  };
19181
- }, [getState().columnMenuVisibleForColumnId]);
19323
+ }, [columnMenuVisibleForColumnId, columnMenuVisibleKey]);
19182
19324
  return { menuPortal };
19183
19325
  }
19184
19326
 
@@ -20116,6 +20258,7 @@ InfiniteTable.defaultProps = {
20116
20258
  var components = {
20117
20259
  CheckBox: InfiniteCheckBox,
20118
20260
  LoadMask,
20261
+ MenuIcon,
20119
20262
  StringFilterEditor,
20120
20263
  NumberFilterEditor
20121
20264
  };
@@ -20128,7 +20271,6 @@ export {
20128
20271
  InfiniteTableClassName,
20129
20272
  InfiniteTableComponent,
20130
20273
  Menu,
20131
- MenuIcon,
20132
20274
  RowSelectionState,
20133
20275
  components,
20134
20276
  debounce,