@infinite-table/infinite-react 1.3.16 → 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.css +1 -1
- package/index.d.ts +23 -13
- package/index.dev.js +158 -48
- package/index.dev.mjs +158 -47
- package/index.js +5 -5
- package/index.mjs +5 -5
- package/package.json +2 -2
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: "
|
|
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 = "
|
|
5125
|
-
var HeaderFilterEditorCls = "
|
|
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 = "
|
|
5128
|
-
var HeaderFilterOperatorIconRecipe = createRuntimeFn({ defaultClassName: "
|
|
5129
|
-
var HeaderGroupCls = "
|
|
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: "
|
|
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 = "
|
|
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 {
|
|
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
|
-
|
|
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,16 +8666,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
8632
8666
|
renderParam2.renderBag.menuIcon = /* @__PURE__ */ React42.createElement(
|
|
8633
8667
|
RenderHeaderCellHookComponent,
|
|
8634
8668
|
{
|
|
8635
|
-
render:
|
|
8636
|
-
if (typeof column.renderMenuIcon !== "function") {
|
|
8637
|
-
return null;
|
|
8638
|
-
}
|
|
8639
|
-
const result = column.renderMenuIcon(param);
|
|
8640
|
-
if (result) {
|
|
8641
|
-
return /* @__PURE__ */ React42.createElement(MenuIconCmp, __spreadValues({}, menuIconProps), result);
|
|
8642
|
-
}
|
|
8643
|
-
return null;
|
|
8644
|
-
},
|
|
8669
|
+
render: column.renderMenuIcon,
|
|
8645
8670
|
renderParam: __spreadProps(__spreadValues({}, renderParam2), {
|
|
8646
8671
|
renderBag: __spreadValues({}, renderParam2.renderBag)
|
|
8647
8672
|
})
|
|
@@ -8765,15 +8790,18 @@ function InfiniteTableHeaderCell(props) {
|
|
|
8765
8790
|
const resizeHandle = useColumnResizeHandle(column);
|
|
8766
8791
|
const zIndex2 = `var(${columnZIndexAtIndex5}-${column.computedVisibleIndex})`;
|
|
8767
8792
|
style2.zIndex = zIndex2;
|
|
8793
|
+
const dataAttrs = {
|
|
8794
|
+
"data-column-id": column.id,
|
|
8795
|
+
"data-header-align": align2,
|
|
8796
|
+
"data-name": "HeaderCell"
|
|
8797
|
+
};
|
|
8768
8798
|
return /* @__PURE__ */ React42.createElement(ContextProvider, { value: renderParam }, /* @__PURE__ */ React42.createElement(
|
|
8769
8799
|
InfiniteTableCell,
|
|
8770
|
-
{
|
|
8800
|
+
__spreadProps(__spreadValues({
|
|
8771
8801
|
domRef: ref,
|
|
8772
8802
|
cellType: "header",
|
|
8773
|
-
column
|
|
8774
|
-
|
|
8775
|
-
"data-header-align": align2,
|
|
8776
|
-
"data-column-id": column.id,
|
|
8803
|
+
column
|
|
8804
|
+
}, dataAttrs), {
|
|
8777
8805
|
"data-z-index": zIndex2,
|
|
8778
8806
|
style: style2,
|
|
8779
8807
|
width,
|
|
@@ -8822,7 +8850,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
8822
8850
|
}
|
|
8823
8851
|
) : /* @__PURE__ */ React42.createElement(InfiniteTableColumnHeaderFilterEmpty, null) : null, resizeHandle),
|
|
8824
8852
|
renderChildren
|
|
8825
|
-
}
|
|
8853
|
+
})
|
|
8826
8854
|
), draggingProxy);
|
|
8827
8855
|
}
|
|
8828
8856
|
function useInfiniteHeaderCell() {
|
|
@@ -13389,6 +13417,48 @@ function useRowInfoReducers() {
|
|
|
13389
13417
|
return rowInfoReducerResults;
|
|
13390
13418
|
}
|
|
13391
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
|
+
|
|
13392
13462
|
// src/components/InfiniteTable/api/getImperativeApi.ts
|
|
13393
13463
|
var InfiniteTableApiImpl = class {
|
|
13394
13464
|
constructor(context) {
|
|
@@ -13696,6 +13766,21 @@ var InfiniteTableApiImpl = class {
|
|
|
13696
13766
|
this.actions.contextMenuVisibleFor = null;
|
|
13697
13767
|
this.actions.cellContextMenuVisibleFor = null;
|
|
13698
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
|
+
}
|
|
13699
13784
|
startEdit(params) {
|
|
13700
13785
|
return __async(this, null, function* () {
|
|
13701
13786
|
const { columnId, rowIndex: index, primaryKey } = params;
|
|
@@ -14769,6 +14854,7 @@ function initSetupState2() {
|
|
|
14769
14854
|
cellContextMenuVisibleFor: null,
|
|
14770
14855
|
contextMenuVisibleFor: null,
|
|
14771
14856
|
columnMenuVisibleForColumnId: null,
|
|
14857
|
+
columnMenuVisibleKey: 0,
|
|
14772
14858
|
filterOperatorMenuVisibleForColumnId: null,
|
|
14773
14859
|
getDOMNodeForCell: (cellPosition) => {
|
|
14774
14860
|
if (!domRef.current) {
|
|
@@ -16559,7 +16645,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
16559
16645
|
const valid = useMemo11(() => {
|
|
16560
16646
|
let valid2 = isValidLicense(licenseKey, {
|
|
16561
16647
|
publishedAt: 1624970570587,
|
|
16562
|
-
version: "1.3.
|
|
16648
|
+
version: "1.3.18"
|
|
16563
16649
|
});
|
|
16564
16650
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
16565
16651
|
return true;
|
|
@@ -19053,6 +19139,9 @@ function defaultGetColumnMenuItems(_items, params) {
|
|
|
19053
19139
|
checked: col.computedVisible,
|
|
19054
19140
|
onChange: (checked) => {
|
|
19055
19141
|
api.setVisibilityForColumn(col.id, !!checked);
|
|
19142
|
+
requestAnimationFrame(() => {
|
|
19143
|
+
api.realignColumnContextMenu();
|
|
19144
|
+
});
|
|
19056
19145
|
}
|
|
19057
19146
|
}
|
|
19058
19147
|
)
|
|
@@ -19126,6 +19215,35 @@ function getMenuForColumn(columnId, context, onHideIntent) {
|
|
|
19126
19215
|
}
|
|
19127
19216
|
|
|
19128
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
|
+
}
|
|
19129
19247
|
function useColumnMenu() {
|
|
19130
19248
|
const context = useInfiniteTable();
|
|
19131
19249
|
const { getState, actions } = context;
|
|
@@ -19143,26 +19261,13 @@ function useColumnMenu() {
|
|
|
19143
19261
|
if (!info) {
|
|
19144
19262
|
return;
|
|
19145
19263
|
}
|
|
19146
|
-
const { target, column } = info;
|
|
19147
|
-
function onHideIntent() {
|
|
19148
|
-
clearAll();
|
|
19149
|
-
actions2.columnMenuVisibleForColumnId = null;
|
|
19150
|
-
}
|
|
19151
|
-
showOverlay(() => getMenuForColumn(column.id, context, onHideIntent), {
|
|
19152
|
-
constrainTo: getState2().domRef.current,
|
|
19153
|
-
id: "column-menu",
|
|
19154
|
-
alignTo: target,
|
|
19155
|
-
alignPosition: [
|
|
19156
|
-
["TopLeft", "BottomLeft"],
|
|
19157
|
-
["TopRight", "BottomRight"]
|
|
19158
|
-
]
|
|
19159
|
-
});
|
|
19160
19264
|
actions2.contextMenuVisibleFor = null;
|
|
19161
19265
|
actions2.cellContextMenuVisibleFor = null;
|
|
19162
19266
|
actions2.filterOperatorMenuVisibleForColumnId = null;
|
|
19163
|
-
actions2.columnMenuVisibleForColumnId = column.id;
|
|
19267
|
+
actions2.columnMenuVisibleForColumnId = info.column.id;
|
|
19164
19268
|
});
|
|
19165
19269
|
}, []);
|
|
19270
|
+
const { columnMenuVisibleForColumnId, columnMenuVisibleKey } = getState();
|
|
19166
19271
|
useEffect35(() => {
|
|
19167
19272
|
const {
|
|
19168
19273
|
columnMenuVisibleForColumnId: columnContextMenuVisibleForColumnId
|
|
@@ -19176,6 +19281,12 @@ function useColumnMenu() {
|
|
|
19176
19281
|
};
|
|
19177
19282
|
var handleMouseDown = handleMouseDown2;
|
|
19178
19283
|
document.documentElement.addEventListener("mousedown", handleMouseDown2);
|
|
19284
|
+
showMenuForColumn({
|
|
19285
|
+
columnId: columnContextMenuVisibleForColumnId,
|
|
19286
|
+
context,
|
|
19287
|
+
clearAll,
|
|
19288
|
+
showOverlay
|
|
19289
|
+
});
|
|
19179
19290
|
return () => {
|
|
19180
19291
|
document.documentElement.removeEventListener(
|
|
19181
19292
|
"mousedown",
|
|
@@ -19187,7 +19298,7 @@ function useColumnMenu() {
|
|
|
19187
19298
|
}
|
|
19188
19299
|
return () => {
|
|
19189
19300
|
};
|
|
19190
|
-
}, [
|
|
19301
|
+
}, [columnMenuVisibleForColumnId, columnMenuVisibleKey]);
|
|
19191
19302
|
return { menuPortal };
|
|
19192
19303
|
}
|
|
19193
19304
|
|
|
@@ -20125,6 +20236,7 @@ InfiniteTable.defaultProps = {
|
|
|
20125
20236
|
var components = {
|
|
20126
20237
|
CheckBox: InfiniteCheckBox,
|
|
20127
20238
|
LoadMask,
|
|
20239
|
+
MenuIcon,
|
|
20128
20240
|
StringFilterEditor,
|
|
20129
20241
|
NumberFilterEditor
|
|
20130
20242
|
};
|
|
@@ -20137,7 +20249,6 @@ export {
|
|
|
20137
20249
|
InfiniteTableClassName,
|
|
20138
20250
|
InfiniteTableComponent,
|
|
20139
20251
|
Menu,
|
|
20140
|
-
MenuIcon,
|
|
20141
20252
|
RowSelectionState,
|
|
20142
20253
|
components,
|
|
20143
20254
|
debounce,
|