@infinite-table/infinite-react 1.3.18 → 1.3.20
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 +1 -0
- package/index.dev.js +35 -10
- package/index.dev.mjs +35 -10
- package/index.js +5 -5
- package/index.mjs +5 -5
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1125,6 +1125,7 @@ interface InfiniteTableSetupState<T> {
|
|
|
1125
1125
|
point: PointCoords;
|
|
1126
1126
|
}) | null;
|
|
1127
1127
|
columnMenuVisibleForColumnId: string | null;
|
|
1128
|
+
columnMenuTargetRef: MutableRefObject<HTMLElement | null>;
|
|
1128
1129
|
columnMenuVisibleKey: string | number;
|
|
1129
1130
|
filterOperatorMenuVisibleForColumnId: string | null;
|
|
1130
1131
|
onColumnHeaderHeightCSSVarChange: SubscriptionCallback<number>;
|
package/index.dev.js
CHANGED
|
@@ -8680,7 +8680,19 @@ function InfiniteTableHeaderCell(props) {
|
|
|
8680
8680
|
renderParam2.renderBag.menuIcon = /* @__PURE__ */ React42.createElement(
|
|
8681
8681
|
RenderHeaderCellHookComponent,
|
|
8682
8682
|
{
|
|
8683
|
-
render:
|
|
8683
|
+
render: (param) => {
|
|
8684
|
+
if (typeof column.renderMenuIcon !== "function") {
|
|
8685
|
+
return null;
|
|
8686
|
+
}
|
|
8687
|
+
const result = column.renderMenuIcon(param);
|
|
8688
|
+
if (result) {
|
|
8689
|
+
if (result.type === MenuIconCmp || result.type === MenuIcon) {
|
|
8690
|
+
return result;
|
|
8691
|
+
}
|
|
8692
|
+
return /* @__PURE__ */ React42.createElement(MenuIconCmp, __spreadValues({}, menuIconProps), result);
|
|
8693
|
+
}
|
|
8694
|
+
return null;
|
|
8695
|
+
},
|
|
8684
8696
|
renderParam: __spreadProps(__spreadValues({}, renderParam2), {
|
|
8685
8697
|
renderBag: __spreadValues({}, renderParam2.renderBag)
|
|
8686
8698
|
})
|
|
@@ -13447,7 +13459,8 @@ function realignColumnContextMenu(param) {
|
|
|
13447
13459
|
}
|
|
13448
13460
|
function tryCol(diff2, sign2) {
|
|
13449
13461
|
const colId2 = order2[index + diff2 * sign2];
|
|
13450
|
-
|
|
13462
|
+
const col = visibleCols.get(colId2);
|
|
13463
|
+
if (col && col.renderMenuIcon !== false) {
|
|
13451
13464
|
return colId2;
|
|
13452
13465
|
}
|
|
13453
13466
|
return;
|
|
@@ -14876,6 +14889,7 @@ function initSetupState2() {
|
|
|
14876
14889
|
brain,
|
|
14877
14890
|
headerBrain,
|
|
14878
14891
|
domRef,
|
|
14892
|
+
columnMenuTargetRef: (0, import_react42.createRef)(),
|
|
14879
14893
|
editingValueRef: (0, import_react42.createRef)(),
|
|
14880
14894
|
scrollerDOMRef: (0, import_react42.createRef)(),
|
|
14881
14895
|
portalDOMRef: (0, import_react42.createRef)(),
|
|
@@ -15025,6 +15039,7 @@ var cleanupState = (state) => {
|
|
|
15025
15039
|
state.onColumnMenuClick.destroy();
|
|
15026
15040
|
state.onFilterOperatorMenuClick.destroy();
|
|
15027
15041
|
state.domRef.current = null;
|
|
15042
|
+
state.columnMenuTargetRef.current = null;
|
|
15028
15043
|
state.scrollerDOMRef.current = null;
|
|
15029
15044
|
state.portalDOMRef.current = null;
|
|
15030
15045
|
state.onRowHeightCSSVarChange.destroy();
|
|
@@ -16655,7 +16670,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
16655
16670
|
const valid = (0, import_react49.useMemo)(() => {
|
|
16656
16671
|
let valid2 = isValidLicense(licenseKey, {
|
|
16657
16672
|
publishedAt: 1624970570587,
|
|
16658
|
-
version: "1.3.
|
|
16673
|
+
version: "1.3.20"
|
|
16659
16674
|
});
|
|
16660
16675
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
16661
16676
|
return true;
|
|
@@ -19138,7 +19153,8 @@ function defaultGetColumnMenuItems(_items, params) {
|
|
|
19138
19153
|
disabled: col.computedVisible && api.getVisibleColumnsCount() === 1,
|
|
19139
19154
|
checked: col.computedVisible,
|
|
19140
19155
|
onChange: (checked) => {
|
|
19141
|
-
|
|
19156
|
+
const visible = !!checked;
|
|
19157
|
+
api.setVisibilityForColumn(col.id, visible);
|
|
19142
19158
|
requestAnimationFrame(() => {
|
|
19143
19159
|
api.realignColumnContextMenu();
|
|
19144
19160
|
});
|
|
@@ -19217,13 +19233,21 @@ function getMenuForColumn(columnId, context, onHideIntent) {
|
|
|
19217
19233
|
// src/components/InfiniteTable/hooks/useColumnMenu.ts
|
|
19218
19234
|
var menuIconSelector = `[${MenuIconDataAttributes["data-name"]}="${MenuIconDataAttributesValues["data-name"]}"]`;
|
|
19219
19235
|
function showMenuForColumn(options) {
|
|
19236
|
+
var _a;
|
|
19220
19237
|
const { columnId, context, clearAll, showOverlay } = options;
|
|
19221
19238
|
const { getState, actions } = context;
|
|
19239
|
+
const { columnMenuTargetRef, domRef } = getState();
|
|
19222
19240
|
function onHideIntent() {
|
|
19223
19241
|
clearAll();
|
|
19224
19242
|
actions.columnMenuVisibleForColumnId = null;
|
|
19225
19243
|
}
|
|
19226
19244
|
let target = options.target;
|
|
19245
|
+
if (!target) {
|
|
19246
|
+
target = (_a = columnMenuTargetRef.current) != null ? _a : void 0;
|
|
19247
|
+
if (target && !domRef.current.contains(target)) {
|
|
19248
|
+
target = void 0;
|
|
19249
|
+
}
|
|
19250
|
+
}
|
|
19227
19251
|
if (!target) {
|
|
19228
19252
|
const iconSelector = `[${InfiniteHeaderCellDataAttributes["data-column-id"]}="${columnId}"] ${menuIconSelector}`;
|
|
19229
19253
|
target = getState().domRef.current.querySelector(
|
|
@@ -19234,8 +19258,9 @@ function showMenuForColumn(options) {
|
|
|
19234
19258
|
console.warn(`Cannot show column menu for column "${columnId}"`);
|
|
19235
19259
|
return;
|
|
19236
19260
|
}
|
|
19261
|
+
columnMenuTargetRef.current = null;
|
|
19237
19262
|
showOverlay(() => getMenuForColumn(columnId, context, onHideIntent), {
|
|
19238
|
-
constrainTo:
|
|
19263
|
+
constrainTo: domRef.current,
|
|
19239
19264
|
id: "column-menu",
|
|
19240
19265
|
alignTo: target,
|
|
19241
19266
|
alignPosition: [
|
|
@@ -19261,6 +19286,7 @@ function useColumnMenu() {
|
|
|
19261
19286
|
if (!info) {
|
|
19262
19287
|
return;
|
|
19263
19288
|
}
|
|
19289
|
+
state.columnMenuTargetRef.current = info.target;
|
|
19264
19290
|
actions2.contextMenuVisibleFor = null;
|
|
19265
19291
|
actions2.cellContextMenuVisibleFor = null;
|
|
19266
19292
|
actions2.filterOperatorMenuVisibleForColumnId = null;
|
|
@@ -19269,10 +19295,8 @@ function useColumnMenu() {
|
|
|
19269
19295
|
}, []);
|
|
19270
19296
|
const { columnMenuVisibleForColumnId, columnMenuVisibleKey } = getState();
|
|
19271
19297
|
(0, import_react57.useEffect)(() => {
|
|
19272
|
-
const {
|
|
19273
|
-
|
|
19274
|
-
} = getState();
|
|
19275
|
-
if (columnContextMenuVisibleForColumnId) {
|
|
19298
|
+
const { columnMenuVisibleForColumnId: columnMenuVisibleForColumnId2, columnMenuTargetRef } = getState();
|
|
19299
|
+
if (columnMenuVisibleForColumnId2) {
|
|
19276
19300
|
let handleMouseDown2 = function(event) {
|
|
19277
19301
|
if (event.__insideMenu !== true) {
|
|
19278
19302
|
clearAll();
|
|
@@ -19282,7 +19306,7 @@ function useColumnMenu() {
|
|
|
19282
19306
|
var handleMouseDown = handleMouseDown2;
|
|
19283
19307
|
document.documentElement.addEventListener("mousedown", handleMouseDown2);
|
|
19284
19308
|
showMenuForColumn({
|
|
19285
|
-
columnId:
|
|
19309
|
+
columnId: columnMenuVisibleForColumnId2,
|
|
19286
19310
|
context,
|
|
19287
19311
|
clearAll,
|
|
19288
19312
|
showOverlay
|
|
@@ -19294,6 +19318,7 @@ function useColumnMenu() {
|
|
|
19294
19318
|
);
|
|
19295
19319
|
};
|
|
19296
19320
|
} else {
|
|
19321
|
+
columnMenuTargetRef.current = null;
|
|
19297
19322
|
clearAll();
|
|
19298
19323
|
}
|
|
19299
19324
|
return () => {
|
package/index.dev.mjs
CHANGED
|
@@ -8666,7 +8666,19 @@ function InfiniteTableHeaderCell(props) {
|
|
|
8666
8666
|
renderParam2.renderBag.menuIcon = /* @__PURE__ */ React42.createElement(
|
|
8667
8667
|
RenderHeaderCellHookComponent,
|
|
8668
8668
|
{
|
|
8669
|
-
render:
|
|
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
|
+
},
|
|
8670
8682
|
renderParam: __spreadProps(__spreadValues({}, renderParam2), {
|
|
8671
8683
|
renderBag: __spreadValues({}, renderParam2.renderBag)
|
|
8672
8684
|
})
|
|
@@ -13433,7 +13445,8 @@ function realignColumnContextMenu(param) {
|
|
|
13433
13445
|
}
|
|
13434
13446
|
function tryCol(diff2, sign2) {
|
|
13435
13447
|
const colId2 = order2[index + diff2 * sign2];
|
|
13436
|
-
|
|
13448
|
+
const col = visibleCols.get(colId2);
|
|
13449
|
+
if (col && col.renderMenuIcon !== false) {
|
|
13437
13450
|
return colId2;
|
|
13438
13451
|
}
|
|
13439
13452
|
return;
|
|
@@ -14866,6 +14879,7 @@ function initSetupState2() {
|
|
|
14866
14879
|
brain,
|
|
14867
14880
|
headerBrain,
|
|
14868
14881
|
domRef,
|
|
14882
|
+
columnMenuTargetRef: createRef(),
|
|
14869
14883
|
editingValueRef: createRef(),
|
|
14870
14884
|
scrollerDOMRef: createRef(),
|
|
14871
14885
|
portalDOMRef: createRef(),
|
|
@@ -15015,6 +15029,7 @@ var cleanupState = (state) => {
|
|
|
15015
15029
|
state.onColumnMenuClick.destroy();
|
|
15016
15030
|
state.onFilterOperatorMenuClick.destroy();
|
|
15017
15031
|
state.domRef.current = null;
|
|
15032
|
+
state.columnMenuTargetRef.current = null;
|
|
15018
15033
|
state.scrollerDOMRef.current = null;
|
|
15019
15034
|
state.portalDOMRef.current = null;
|
|
15020
15035
|
state.onRowHeightCSSVarChange.destroy();
|
|
@@ -16645,7 +16660,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
16645
16660
|
const valid = useMemo11(() => {
|
|
16646
16661
|
let valid2 = isValidLicense(licenseKey, {
|
|
16647
16662
|
publishedAt: 1624970570587,
|
|
16648
|
-
version: "1.3.
|
|
16663
|
+
version: "1.3.20"
|
|
16649
16664
|
});
|
|
16650
16665
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
16651
16666
|
return true;
|
|
@@ -19138,7 +19153,8 @@ function defaultGetColumnMenuItems(_items, params) {
|
|
|
19138
19153
|
disabled: col.computedVisible && api.getVisibleColumnsCount() === 1,
|
|
19139
19154
|
checked: col.computedVisible,
|
|
19140
19155
|
onChange: (checked) => {
|
|
19141
|
-
|
|
19156
|
+
const visible = !!checked;
|
|
19157
|
+
api.setVisibilityForColumn(col.id, visible);
|
|
19142
19158
|
requestAnimationFrame(() => {
|
|
19143
19159
|
api.realignColumnContextMenu();
|
|
19144
19160
|
});
|
|
@@ -19217,13 +19233,21 @@ function getMenuForColumn(columnId, context, onHideIntent) {
|
|
|
19217
19233
|
// src/components/InfiniteTable/hooks/useColumnMenu.ts
|
|
19218
19234
|
var menuIconSelector = `[${MenuIconDataAttributes["data-name"]}="${MenuIconDataAttributesValues["data-name"]}"]`;
|
|
19219
19235
|
function showMenuForColumn(options) {
|
|
19236
|
+
var _a;
|
|
19220
19237
|
const { columnId, context, clearAll, showOverlay } = options;
|
|
19221
19238
|
const { getState, actions } = context;
|
|
19239
|
+
const { columnMenuTargetRef, domRef } = getState();
|
|
19222
19240
|
function onHideIntent() {
|
|
19223
19241
|
clearAll();
|
|
19224
19242
|
actions.columnMenuVisibleForColumnId = null;
|
|
19225
19243
|
}
|
|
19226
19244
|
let target = options.target;
|
|
19245
|
+
if (!target) {
|
|
19246
|
+
target = (_a = columnMenuTargetRef.current) != null ? _a : void 0;
|
|
19247
|
+
if (target && !domRef.current.contains(target)) {
|
|
19248
|
+
target = void 0;
|
|
19249
|
+
}
|
|
19250
|
+
}
|
|
19227
19251
|
if (!target) {
|
|
19228
19252
|
const iconSelector = `[${InfiniteHeaderCellDataAttributes["data-column-id"]}="${columnId}"] ${menuIconSelector}`;
|
|
19229
19253
|
target = getState().domRef.current.querySelector(
|
|
@@ -19234,8 +19258,9 @@ function showMenuForColumn(options) {
|
|
|
19234
19258
|
console.warn(`Cannot show column menu for column "${columnId}"`);
|
|
19235
19259
|
return;
|
|
19236
19260
|
}
|
|
19261
|
+
columnMenuTargetRef.current = null;
|
|
19237
19262
|
showOverlay(() => getMenuForColumn(columnId, context, onHideIntent), {
|
|
19238
|
-
constrainTo:
|
|
19263
|
+
constrainTo: domRef.current,
|
|
19239
19264
|
id: "column-menu",
|
|
19240
19265
|
alignTo: target,
|
|
19241
19266
|
alignPosition: [
|
|
@@ -19261,6 +19286,7 @@ function useColumnMenu() {
|
|
|
19261
19286
|
if (!info) {
|
|
19262
19287
|
return;
|
|
19263
19288
|
}
|
|
19289
|
+
state.columnMenuTargetRef.current = info.target;
|
|
19264
19290
|
actions2.contextMenuVisibleFor = null;
|
|
19265
19291
|
actions2.cellContextMenuVisibleFor = null;
|
|
19266
19292
|
actions2.filterOperatorMenuVisibleForColumnId = null;
|
|
@@ -19269,10 +19295,8 @@ function useColumnMenu() {
|
|
|
19269
19295
|
}, []);
|
|
19270
19296
|
const { columnMenuVisibleForColumnId, columnMenuVisibleKey } = getState();
|
|
19271
19297
|
useEffect35(() => {
|
|
19272
|
-
const {
|
|
19273
|
-
|
|
19274
|
-
} = getState();
|
|
19275
|
-
if (columnContextMenuVisibleForColumnId) {
|
|
19298
|
+
const { columnMenuVisibleForColumnId: columnMenuVisibleForColumnId2, columnMenuTargetRef } = getState();
|
|
19299
|
+
if (columnMenuVisibleForColumnId2) {
|
|
19276
19300
|
let handleMouseDown2 = function(event) {
|
|
19277
19301
|
if (event.__insideMenu !== true) {
|
|
19278
19302
|
clearAll();
|
|
@@ -19282,7 +19306,7 @@ function useColumnMenu() {
|
|
|
19282
19306
|
var handleMouseDown = handleMouseDown2;
|
|
19283
19307
|
document.documentElement.addEventListener("mousedown", handleMouseDown2);
|
|
19284
19308
|
showMenuForColumn({
|
|
19285
|
-
columnId:
|
|
19309
|
+
columnId: columnMenuVisibleForColumnId2,
|
|
19286
19310
|
context,
|
|
19287
19311
|
clearAll,
|
|
19288
19312
|
showOverlay
|
|
@@ -19294,6 +19318,7 @@ function useColumnMenu() {
|
|
|
19294
19318
|
);
|
|
19295
19319
|
};
|
|
19296
19320
|
} else {
|
|
19321
|
+
columnMenuTargetRef.current = null;
|
|
19297
19322
|
clearAll();
|
|
19298
19323
|
}
|
|
19299
19324
|
return () => {
|