@infinite-table/infinite-react 1.3.20 → 1.3.22
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 +22 -5
- package/index.dev.js +172 -169
- package/index.dev.mjs +190 -187
- package/index.js +5 -5
- package/index.mjs +5 -5
- package/package.json +2 -2
package/index.dev.mjs
CHANGED
|
@@ -5267,7 +5267,10 @@ function getColumnApiForColumn(colOrColId, param) {
|
|
|
5267
5267
|
toggleSort(params = {
|
|
5268
5268
|
multiSortBehavior: "replace"
|
|
5269
5269
|
}) {
|
|
5270
|
-
column.
|
|
5270
|
+
return api.toggleSortingForColumn(column.id, params);
|
|
5271
|
+
},
|
|
5272
|
+
getSortDir() {
|
|
5273
|
+
return api.getSortingForColumn(column.id);
|
|
5271
5274
|
},
|
|
5272
5275
|
setFilter(value) {
|
|
5273
5276
|
return api.setColumnFilter(column.id, value);
|
|
@@ -5275,6 +5278,9 @@ function getColumnApiForColumn(colOrColId, param) {
|
|
|
5275
5278
|
clearFilter() {
|
|
5276
5279
|
return api.clearColumnFilter(column.id);
|
|
5277
5280
|
},
|
|
5281
|
+
getSortInfo() {
|
|
5282
|
+
return api.getSortInfoForColumn(column.id);
|
|
5283
|
+
},
|
|
5278
5284
|
setSort(sort) {
|
|
5279
5285
|
if (!sort) {
|
|
5280
5286
|
api.setSortInfoForColumn(column.id, null);
|
|
@@ -6511,7 +6517,7 @@ var useColumnPointerEvents = ({
|
|
|
6511
6517
|
target2.removeEventListener("pointerup", onPointerUp);
|
|
6512
6518
|
setProxyPosition(null);
|
|
6513
6519
|
if (!didDragAtLeastOnce && dragColumn.computedSortable) {
|
|
6514
|
-
dragColumn.
|
|
6520
|
+
api.toggleSortingForColumn(dragColumn.id, {
|
|
6515
6521
|
multiSortBehavior: multiSortBehavior === "replace" && (e2.ctrlKey || e2.metaKey) ? "append" : multiSortBehavior
|
|
6516
6522
|
});
|
|
6517
6523
|
}
|
|
@@ -10614,6 +10620,15 @@ var DataSourceApiImpl = class {
|
|
|
10614
10620
|
}
|
|
10615
10621
|
return result;
|
|
10616
10622
|
}
|
|
10623
|
+
setSortInfo(sortInfo) {
|
|
10624
|
+
const multiSort = this.getState().multiSort;
|
|
10625
|
+
if (Array.isArray(sortInfo)) {
|
|
10626
|
+
this.actions.sortInfo = sortInfo.length ? multiSort ? sortInfo : sortInfo[0] : null;
|
|
10627
|
+
return;
|
|
10628
|
+
}
|
|
10629
|
+
this.actions.sortInfo = sortInfo;
|
|
10630
|
+
return;
|
|
10631
|
+
}
|
|
10617
10632
|
};
|
|
10618
10633
|
function getCacheAffectedParts(state) {
|
|
10619
10634
|
const cache = state.cache;
|
|
@@ -13472,7 +13487,29 @@ function realignColumnContextMenu(param) {
|
|
|
13472
13487
|
return colId;
|
|
13473
13488
|
}
|
|
13474
13489
|
|
|
13490
|
+
// src/components/InfiniteTable/types/Utility.ts
|
|
13491
|
+
function notNullable(value) {
|
|
13492
|
+
if (value === null || value === void 0)
|
|
13493
|
+
return false;
|
|
13494
|
+
const testDummyForCompileError = value;
|
|
13495
|
+
return true;
|
|
13496
|
+
}
|
|
13497
|
+
|
|
13475
13498
|
// src/components/InfiniteTable/api/getImperativeApi.ts
|
|
13499
|
+
function isSortInfoForColumn(sortInfo, col) {
|
|
13500
|
+
if (sortInfo.id) {
|
|
13501
|
+
if (sortInfo.id === col.id) {
|
|
13502
|
+
return true;
|
|
13503
|
+
}
|
|
13504
|
+
return false;
|
|
13505
|
+
}
|
|
13506
|
+
if (sortInfo.field) {
|
|
13507
|
+
if (sortInfo.field === col.field) {
|
|
13508
|
+
return true;
|
|
13509
|
+
}
|
|
13510
|
+
}
|
|
13511
|
+
return false;
|
|
13512
|
+
}
|
|
13476
13513
|
var InfiniteTableApiImpl = class {
|
|
13477
13514
|
constructor(context) {
|
|
13478
13515
|
this.persistEdit = (arg) => __async(this, null, function* () {
|
|
@@ -13771,6 +13808,9 @@ var InfiniteTableApiImpl = class {
|
|
|
13771
13808
|
get dataSourceActions() {
|
|
13772
13809
|
return this.context.dataSourceActions;
|
|
13773
13810
|
}
|
|
13811
|
+
get dataSourceApi() {
|
|
13812
|
+
return this.context.dataSourceApi;
|
|
13813
|
+
}
|
|
13774
13814
|
focus() {
|
|
13775
13815
|
var _a;
|
|
13776
13816
|
(_a = this.getState().scrollerDOMRef.current) == null ? void 0 : _a.focus();
|
|
@@ -13779,12 +13819,27 @@ var InfiniteTableApiImpl = class {
|
|
|
13779
13819
|
this.actions.contextMenuVisibleFor = null;
|
|
13780
13820
|
this.actions.cellContextMenuVisibleFor = null;
|
|
13781
13821
|
}
|
|
13782
|
-
realignColumnContextMenu() {
|
|
13783
|
-
|
|
13822
|
+
realignColumnContextMenu(callback) {
|
|
13823
|
+
const param = {
|
|
13784
13824
|
actions: this.actions,
|
|
13785
13825
|
getState: this.getState,
|
|
13786
13826
|
getComputed: this.getComputed
|
|
13787
|
-
}
|
|
13827
|
+
};
|
|
13828
|
+
const delay = this.getState().columnMenuRealignDelay;
|
|
13829
|
+
if (!delay || delay < 0) {
|
|
13830
|
+
realignColumnContextMenu(param);
|
|
13831
|
+
callback == null ? void 0 : callback();
|
|
13832
|
+
}
|
|
13833
|
+
setTimeout(() => {
|
|
13834
|
+
if (this.isDestroyed()) {
|
|
13835
|
+
return;
|
|
13836
|
+
}
|
|
13837
|
+
realignColumnContextMenu(param);
|
|
13838
|
+
callback == null ? void 0 : callback();
|
|
13839
|
+
}, delay);
|
|
13840
|
+
}
|
|
13841
|
+
isDestroyed() {
|
|
13842
|
+
return !this.getState().domRef.current;
|
|
13788
13843
|
}
|
|
13789
13844
|
getColumnOrder() {
|
|
13790
13845
|
return this.getComputed().computedColumnOrder;
|
|
@@ -13891,29 +13946,121 @@ var InfiniteTableApiImpl = class {
|
|
|
13891
13946
|
}
|
|
13892
13947
|
}
|
|
13893
13948
|
}
|
|
13894
|
-
|
|
13949
|
+
toggleSortingForColumn(columnId, options) {
|
|
13895
13950
|
const col = this.getComputed().computedColumnsMap.get(columnId);
|
|
13896
13951
|
if (!col) {
|
|
13897
13952
|
return;
|
|
13898
13953
|
}
|
|
13954
|
+
let dir = this.getSortingForColumn(columnId);
|
|
13955
|
+
if (dir === null) {
|
|
13956
|
+
dir = 1;
|
|
13957
|
+
} else {
|
|
13958
|
+
dir = dir === 1 ? -1 : null;
|
|
13959
|
+
}
|
|
13960
|
+
this.setSortingForColumn(columnId, dir, options);
|
|
13961
|
+
}
|
|
13962
|
+
setSortingForColumn(columnId, dir, options) {
|
|
13963
|
+
const c = this.getComputed().computedColumnsMap.get(columnId);
|
|
13964
|
+
if (!c) {
|
|
13965
|
+
return;
|
|
13966
|
+
}
|
|
13967
|
+
const currentSorting = this.getSortingForColumn(columnId);
|
|
13968
|
+
if (currentSorting === dir) {
|
|
13969
|
+
if (this.getDataSourceState().multiSort === false) {
|
|
13970
|
+
return;
|
|
13971
|
+
}
|
|
13972
|
+
}
|
|
13899
13973
|
if (dir === null) {
|
|
13900
13974
|
this.setSortInfoForColumn(columnId, null, options);
|
|
13901
13975
|
return;
|
|
13902
13976
|
}
|
|
13903
|
-
const
|
|
13904
|
-
|
|
13977
|
+
const groupByForColumn = c.groupByForColumn;
|
|
13978
|
+
let field = c.field;
|
|
13979
|
+
const groupByForCol = groupByForColumn ? Array.isArray(groupByForColumn) ? groupByForColumn : [groupByForColumn] : [];
|
|
13980
|
+
const fieldArr = groupByForCol.map((c2) => {
|
|
13981
|
+
var _a;
|
|
13982
|
+
return c2.valueGetter ? (item) => c2.valueGetter({ data: item, field: c2.field }) : c2.field ? c2.field : (_a = c2.groupField) != null ? _a : void 0;
|
|
13983
|
+
}).filter(notNullable);
|
|
13984
|
+
if (fieldArr.length) {
|
|
13985
|
+
field = fieldArr;
|
|
13986
|
+
}
|
|
13987
|
+
const computedSortType = c.computedSortType;
|
|
13988
|
+
const newColumnSortInfo = {
|
|
13989
|
+
dir,
|
|
13990
|
+
id: c.id,
|
|
13991
|
+
field,
|
|
13992
|
+
type: computedSortType
|
|
13905
13993
|
};
|
|
13906
|
-
|
|
13907
|
-
|
|
13908
|
-
|
|
13994
|
+
if (c.valueGetter) {
|
|
13995
|
+
newColumnSortInfo.valueGetter = (data) => c.valueGetter({ data, field: c.field });
|
|
13996
|
+
}
|
|
13997
|
+
this.setSortInfoForColumn(columnId, newColumnSortInfo, options);
|
|
13998
|
+
}
|
|
13999
|
+
setSortInfoForColumn(columnId, columnSortInfo, options) {
|
|
14000
|
+
var _a, _b, _c;
|
|
14001
|
+
const dataSourceState = this.getDataSourceState();
|
|
14002
|
+
const col = this.getComputed().computedColumnsMap.get(columnId);
|
|
14003
|
+
if (!col) {
|
|
14004
|
+
return;
|
|
14005
|
+
}
|
|
14006
|
+
if (!dataSourceState.multiSort) {
|
|
14007
|
+
this.dataSourceApi.setSortInfo(columnSortInfo ? [columnSortInfo] : null);
|
|
14008
|
+
return;
|
|
14009
|
+
}
|
|
14010
|
+
const colField = col.field;
|
|
14011
|
+
const colInfo = {
|
|
14012
|
+
id: columnId,
|
|
14013
|
+
field: colField
|
|
14014
|
+
};
|
|
14015
|
+
let newSortInfo = (_b = (_a = dataSourceState.sortInfo) == null ? void 0 : _a.slice()) != null ? _b : [];
|
|
14016
|
+
if (columnSortInfo === null) {
|
|
14017
|
+
newSortInfo = newSortInfo.filter(
|
|
14018
|
+
(sortInfo) => !isSortInfoForColumn(sortInfo, colInfo)
|
|
14019
|
+
);
|
|
14020
|
+
this.dataSourceApi.setSortInfo(newSortInfo);
|
|
14021
|
+
return;
|
|
14022
|
+
}
|
|
14023
|
+
let matched = false;
|
|
14024
|
+
const multiSortBehavior = (_c = options == null ? void 0 : options.multiSortBehavior) != null ? _c : this.getState().multiSortBehavior;
|
|
14025
|
+
if (multiSortBehavior === "replace") {
|
|
14026
|
+
this.dataSourceApi.setSortInfo([columnSortInfo]);
|
|
14027
|
+
return;
|
|
14028
|
+
}
|
|
14029
|
+
newSortInfo = newSortInfo.map((sortInfo) => {
|
|
14030
|
+
if (matched) {
|
|
14031
|
+
return sortInfo;
|
|
14032
|
+
}
|
|
14033
|
+
if (isSortInfoForColumn(sortInfo, colInfo)) {
|
|
14034
|
+
matched = true;
|
|
14035
|
+
return columnSortInfo;
|
|
14036
|
+
}
|
|
14037
|
+
return sortInfo;
|
|
14038
|
+
});
|
|
14039
|
+
if (!matched) {
|
|
14040
|
+
newSortInfo.push(columnSortInfo);
|
|
14041
|
+
}
|
|
14042
|
+
this.dataSourceApi.setSortInfo(newSortInfo);
|
|
14043
|
+
}
|
|
14044
|
+
getSortTypeForColumn(columnId) {
|
|
14045
|
+
const col = this.getComputed().computedColumnsMap.get(columnId);
|
|
14046
|
+
if (!col) {
|
|
14047
|
+
return null;
|
|
13909
14048
|
}
|
|
13910
|
-
|
|
13911
|
-
|
|
14049
|
+
return col.computedSortType;
|
|
14050
|
+
}
|
|
14051
|
+
getSortInfoForColumn(columnId) {
|
|
14052
|
+
const col = this.getComputed().computedColumnsMap.get(columnId);
|
|
14053
|
+
if (!col) {
|
|
14054
|
+
return null;
|
|
13912
14055
|
}
|
|
13913
|
-
|
|
13914
|
-
|
|
14056
|
+
return col.computedSortInfo;
|
|
14057
|
+
}
|
|
14058
|
+
getSortingForColumn(columnId) {
|
|
14059
|
+
const sortInfo = this.getSortInfoForColumn(columnId);
|
|
14060
|
+
if (!sortInfo) {
|
|
14061
|
+
return null;
|
|
13915
14062
|
}
|
|
13916
|
-
|
|
14063
|
+
return sortInfo.dir;
|
|
13917
14064
|
}
|
|
13918
14065
|
setPinningForColumn(columnId, pinning) {
|
|
13919
14066
|
const columnPinning = __spreadValues({}, this.getState().columnPinning);
|
|
@@ -14034,69 +14181,6 @@ var InfiniteTableApiImpl = class {
|
|
|
14034
14181
|
this.dataSourceActions.filterValue = newFilterValue;
|
|
14035
14182
|
}
|
|
14036
14183
|
}
|
|
14037
|
-
setSortInfoForColumn(columnId, columnSortInfo, options) {
|
|
14038
|
-
var _a, _b, _c;
|
|
14039
|
-
const dataSourceState = this.getDataSourceState();
|
|
14040
|
-
const col = this.getComputed().computedColumnsMap.get(columnId);
|
|
14041
|
-
if (!col) {
|
|
14042
|
-
return;
|
|
14043
|
-
}
|
|
14044
|
-
if (!dataSourceState.multiSort) {
|
|
14045
|
-
this.dataSourceActions.sortInfo = columnSortInfo ? [columnSortInfo] : null;
|
|
14046
|
-
return;
|
|
14047
|
-
}
|
|
14048
|
-
const colField = col.field;
|
|
14049
|
-
let newSortInfo = (_b = (_a = dataSourceState.sortInfo) == null ? void 0 : _a.slice()) != null ? _b : [];
|
|
14050
|
-
if (columnSortInfo === null) {
|
|
14051
|
-
newSortInfo = newSortInfo.filter((sortInfo) => {
|
|
14052
|
-
if (sortInfo.id) {
|
|
14053
|
-
if (sortInfo.id === columnId) {
|
|
14054
|
-
return false;
|
|
14055
|
-
}
|
|
14056
|
-
return true;
|
|
14057
|
-
}
|
|
14058
|
-
if (sortInfo.field) {
|
|
14059
|
-
if (sortInfo.field === colField) {
|
|
14060
|
-
return false;
|
|
14061
|
-
}
|
|
14062
|
-
return true;
|
|
14063
|
-
}
|
|
14064
|
-
return true;
|
|
14065
|
-
});
|
|
14066
|
-
this.dataSourceActions.sortInfo = newSortInfo.length ? newSortInfo : null;
|
|
14067
|
-
return;
|
|
14068
|
-
}
|
|
14069
|
-
let matched = false;
|
|
14070
|
-
const multiSortBehavior = (_c = options == null ? void 0 : options.multiSortBehavior) != null ? _c : this.getState().multiSortBehavior;
|
|
14071
|
-
if (multiSortBehavior === "replace") {
|
|
14072
|
-
this.dataSourceActions.sortInfo = [columnSortInfo];
|
|
14073
|
-
} else {
|
|
14074
|
-
newSortInfo = newSortInfo.map((sortInfo) => {
|
|
14075
|
-
if (matched) {
|
|
14076
|
-
return sortInfo;
|
|
14077
|
-
}
|
|
14078
|
-
if (sortInfo.id) {
|
|
14079
|
-
if (sortInfo.id === columnId) {
|
|
14080
|
-
matched = true;
|
|
14081
|
-
return columnSortInfo;
|
|
14082
|
-
}
|
|
14083
|
-
return sortInfo;
|
|
14084
|
-
}
|
|
14085
|
-
if (sortInfo.field) {
|
|
14086
|
-
if (sortInfo.field === colField) {
|
|
14087
|
-
matched = true;
|
|
14088
|
-
return columnSortInfo;
|
|
14089
|
-
}
|
|
14090
|
-
return sortInfo;
|
|
14091
|
-
}
|
|
14092
|
-
return sortInfo;
|
|
14093
|
-
});
|
|
14094
|
-
if (!matched) {
|
|
14095
|
-
newSortInfo.push(columnSortInfo);
|
|
14096
|
-
}
|
|
14097
|
-
this.dataSourceActions.sortInfo = newSortInfo.length ? newSortInfo : null;
|
|
14098
|
-
}
|
|
14099
|
-
}
|
|
14100
14184
|
setVisibilityForColumn(columnId, visible) {
|
|
14101
14185
|
const columnVisibility = __spreadValues({}, this.getState().columnVisibility);
|
|
14102
14186
|
if (visible) {
|
|
@@ -14512,7 +14596,7 @@ function useCellRendering(param) {
|
|
|
14512
14596
|
}
|
|
14513
14597
|
|
|
14514
14598
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
14515
|
-
import {
|
|
14599
|
+
import { useEffect as useEffect28, useState as useState17 } from "react";
|
|
14516
14600
|
|
|
14517
14601
|
// src/components/InfiniteTable/utils/MultiRowSelector.ts
|
|
14518
14602
|
function ensureMinMax(start, end) {
|
|
@@ -14958,6 +15042,7 @@ var forwardProps4 = (setupState) => {
|
|
|
14958
15042
|
onScrollbarsChange: 1,
|
|
14959
15043
|
autoSizeColumnsKey: 1,
|
|
14960
15044
|
columnDefaultFlex: 1,
|
|
15045
|
+
columnMenuRealignDelay: (columnMenuRealignDelay) => columnMenuRealignDelay != null ? columnMenuRealignDelay : 50,
|
|
14961
15046
|
scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
|
|
14962
15047
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
14963
15048
|
resizableColumns: (resizableColumns) => resizableColumns != null ? resizableColumns : true,
|
|
@@ -15614,17 +15699,9 @@ function getColumnsWhenGrouping(params) {
|
|
|
15614
15699
|
};
|
|
15615
15700
|
}
|
|
15616
15701
|
|
|
15617
|
-
// src/components/InfiniteTable/hooks/
|
|
15702
|
+
// src/components/InfiniteTable/hooks/useComputedColumns.ts
|
|
15618
15703
|
import { useMemo as useMemo10 } from "react";
|
|
15619
15704
|
|
|
15620
|
-
// src/components/InfiniteTable/types/Utility.ts
|
|
15621
|
-
function notNullable(value) {
|
|
15622
|
-
if (value === null || value === void 0)
|
|
15623
|
-
return false;
|
|
15624
|
-
const testDummyForCompileError = value;
|
|
15625
|
-
return true;
|
|
15626
|
-
}
|
|
15627
|
-
|
|
15628
15705
|
// src/components/InfiniteTable/utils/adjustColumnOrderForPinning.ts
|
|
15629
15706
|
var order = ["start", void 0, "end"];
|
|
15630
15707
|
var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
|
|
@@ -15671,7 +15748,7 @@ function getColumnComputedType(column, columnTypes) {
|
|
|
15671
15748
|
);
|
|
15672
15749
|
}
|
|
15673
15750
|
|
|
15674
|
-
// src/components/InfiniteTable/utils/
|
|
15751
|
+
// src/components/InfiniteTable/utils/getComputedColumns.ts
|
|
15675
15752
|
var logError = err("getComputedVisibleColumns");
|
|
15676
15753
|
var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
|
|
15677
15754
|
return columnVisibility[colId] !== false;
|
|
@@ -15715,7 +15792,7 @@ function isGroupColumnSortable(column, fieldsToColumns) {
|
|
|
15715
15792
|
return acc && !!colSortable;
|
|
15716
15793
|
}, true);
|
|
15717
15794
|
}
|
|
15718
|
-
var
|
|
15795
|
+
var getComputedColumns = ({
|
|
15719
15796
|
columns,
|
|
15720
15797
|
bodySize,
|
|
15721
15798
|
columnMinWidth,
|
|
@@ -15730,7 +15807,6 @@ var getComputedVisibleColumns = ({
|
|
|
15730
15807
|
filterValue,
|
|
15731
15808
|
sortable,
|
|
15732
15809
|
sortInfo,
|
|
15733
|
-
setSortInfo,
|
|
15734
15810
|
multiSort,
|
|
15735
15811
|
filterTypes = defaultFilterTypes,
|
|
15736
15812
|
viewportReservedWidth,
|
|
@@ -16020,67 +16096,6 @@ var getComputedVisibleColumns = ({
|
|
|
16020
16096
|
computedLastInCategory,
|
|
16021
16097
|
computedFirst: theComputedVisibleIndex === 0,
|
|
16022
16098
|
computedLast,
|
|
16023
|
-
toggleSort: ({
|
|
16024
|
-
multiSortBehavior
|
|
16025
|
-
} = {
|
|
16026
|
-
multiSortBehavior: "replace"
|
|
16027
|
-
}) => {
|
|
16028
|
-
const currentSortInfo = computedSortInfo;
|
|
16029
|
-
let newColumnSortInfo;
|
|
16030
|
-
const groupByForColumn = result2.groupByForColumn;
|
|
16031
|
-
let field2 = c.field;
|
|
16032
|
-
const groupByForCol = groupByForColumn ? Array.isArray(groupByForColumn) ? groupByForColumn : [groupByForColumn] : [];
|
|
16033
|
-
const fieldArr = groupByForCol.map((c2) => {
|
|
16034
|
-
return c2.valueGetter ? (item) => c2.valueGetter({ data: item, field: c2.field }) : c2.field ? c2.field : void 0;
|
|
16035
|
-
}).filter(notNullable);
|
|
16036
|
-
if (fieldArr.length) {
|
|
16037
|
-
field2 = fieldArr;
|
|
16038
|
-
}
|
|
16039
|
-
if (!currentSortInfo) {
|
|
16040
|
-
newColumnSortInfo = {
|
|
16041
|
-
dir: 1,
|
|
16042
|
-
id,
|
|
16043
|
-
field: field2,
|
|
16044
|
-
type: computedSortType
|
|
16045
|
-
};
|
|
16046
|
-
} else {
|
|
16047
|
-
if (computedSortedDesc) {
|
|
16048
|
-
newColumnSortInfo = null;
|
|
16049
|
-
} else {
|
|
16050
|
-
newColumnSortInfo = __spreadProps(__spreadValues({}, computedSortInfo), {
|
|
16051
|
-
dir: -1
|
|
16052
|
-
});
|
|
16053
|
-
}
|
|
16054
|
-
}
|
|
16055
|
-
if (field2 && newColumnSortInfo && !newColumnSortInfo.field) {
|
|
16056
|
-
newColumnSortInfo.field = field2;
|
|
16057
|
-
}
|
|
16058
|
-
if (c.valueGetter && newColumnSortInfo && !newColumnSortInfo.valueGetter) {
|
|
16059
|
-
newColumnSortInfo.valueGetter = (data) => c.valueGetter({ data, field: c.field });
|
|
16060
|
-
}
|
|
16061
|
-
let finalSortInfo = sortInfo ? [...sortInfo] : [];
|
|
16062
|
-
if (multiSort) {
|
|
16063
|
-
if (multiSortBehavior === "append") {
|
|
16064
|
-
if (computedSortIndex === -1) {
|
|
16065
|
-
if (newColumnSortInfo) {
|
|
16066
|
-
finalSortInfo.push(newColumnSortInfo);
|
|
16067
|
-
}
|
|
16068
|
-
} else {
|
|
16069
|
-
finalSortInfo = finalSortInfo.map((info, index) => {
|
|
16070
|
-
if (index === computedSortIndex) {
|
|
16071
|
-
return newColumnSortInfo;
|
|
16072
|
-
}
|
|
16073
|
-
return info;
|
|
16074
|
-
}).filter((x) => x != null);
|
|
16075
|
-
}
|
|
16076
|
-
} else {
|
|
16077
|
-
finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
|
|
16078
|
-
}
|
|
16079
|
-
} else {
|
|
16080
|
-
finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
|
|
16081
|
-
}
|
|
16082
|
-
setSortInfo(finalSortInfo);
|
|
16083
|
-
},
|
|
16084
16099
|
id,
|
|
16085
16100
|
header: (_B = (_A = (_z = c.header) != null ? _z : colType.header) != null ? _A : c.name) != null ? _B : c.field
|
|
16086
16101
|
});
|
|
@@ -16171,8 +16186,8 @@ var useRerenderOnKeyChange = (map2) => {
|
|
|
16171
16186
|
return renderId;
|
|
16172
16187
|
};
|
|
16173
16188
|
|
|
16174
|
-
// src/components/InfiniteTable/hooks/
|
|
16175
|
-
var
|
|
16189
|
+
// src/components/InfiniteTable/hooks/useComputedColumns.ts
|
|
16190
|
+
var useComputedColumns = ({
|
|
16176
16191
|
columns,
|
|
16177
16192
|
bodySize,
|
|
16178
16193
|
columnMinWidth,
|
|
@@ -16185,7 +16200,6 @@ var useComputedVisibleColumns = ({
|
|
|
16185
16200
|
draggableColumns,
|
|
16186
16201
|
sortInfo,
|
|
16187
16202
|
multiSort,
|
|
16188
|
-
setSortInfo,
|
|
16189
16203
|
filterValue,
|
|
16190
16204
|
filterTypes,
|
|
16191
16205
|
columnOrder,
|
|
@@ -16224,7 +16238,7 @@ var useComputedVisibleColumns = ({
|
|
|
16224
16238
|
computedColumnsMapInInitialOrder,
|
|
16225
16239
|
fieldsToColumn
|
|
16226
16240
|
} = useMemo10(() => {
|
|
16227
|
-
return
|
|
16241
|
+
return getComputedColumns({
|
|
16228
16242
|
columns,
|
|
16229
16243
|
scrollbarWidth: scrollbarWidth2,
|
|
16230
16244
|
bodySize,
|
|
@@ -16240,7 +16254,6 @@ var useComputedVisibleColumns = ({
|
|
|
16240
16254
|
filterTypes,
|
|
16241
16255
|
sortable,
|
|
16242
16256
|
sortInfo,
|
|
16243
|
-
setSortInfo,
|
|
16244
16257
|
multiSort,
|
|
16245
16258
|
pinnedEndMaxWidth,
|
|
16246
16259
|
pinnedStartMaxWidth,
|
|
@@ -16265,7 +16278,6 @@ var useComputedVisibleColumns = ({
|
|
|
16265
16278
|
scrollbarWidth2,
|
|
16266
16279
|
sortable,
|
|
16267
16280
|
sortInfo,
|
|
16268
|
-
setSortInfo,
|
|
16269
16281
|
multiSort,
|
|
16270
16282
|
filterValue,
|
|
16271
16283
|
filterTypes,
|
|
@@ -16381,14 +16393,6 @@ function useComputed() {
|
|
|
16381
16393
|
const { multiSort, filterValue, filterTypes } = dataSourceState;
|
|
16382
16394
|
useColumnGroups();
|
|
16383
16395
|
const { toggleGroupRow } = useColumnsWhen();
|
|
16384
|
-
const setSortInfo = useCallback22(
|
|
16385
|
-
(sortInfo) => {
|
|
16386
|
-
var _a2;
|
|
16387
|
-
const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
16388
|
-
dataSourceActions.sortInfo = newSortInfo;
|
|
16389
|
-
},
|
|
16390
|
-
[getDataSourceState]
|
|
16391
|
-
);
|
|
16392
16396
|
const columns = componentState.computedColumns;
|
|
16393
16397
|
const {
|
|
16394
16398
|
computedColumnOrder,
|
|
@@ -16409,7 +16413,7 @@ function useComputed() {
|
|
|
16409
16413
|
computedColumnsMap,
|
|
16410
16414
|
computedColumnsMapInInitialOrder,
|
|
16411
16415
|
fieldsToColumn
|
|
16412
|
-
} =
|
|
16416
|
+
} = useComputedColumns({
|
|
16413
16417
|
columns,
|
|
16414
16418
|
// scrollbarWidth: scrollbars.vertical ? getScrollbarWidth() : 0,
|
|
16415
16419
|
// #scrollbarverticaltag
|
|
@@ -16433,7 +16437,6 @@ function useComputed() {
|
|
|
16433
16437
|
draggableColumns: componentState.draggableColumns,
|
|
16434
16438
|
sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
|
|
16435
16439
|
multiSort,
|
|
16436
|
-
setSortInfo,
|
|
16437
16440
|
columnOrder,
|
|
16438
16441
|
columnVisibility,
|
|
16439
16442
|
columnVisibilityAssumeVisible: true,
|
|
@@ -16660,7 +16663,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
16660
16663
|
const valid = useMemo11(() => {
|
|
16661
16664
|
let valid2 = isValidLicense(licenseKey, {
|
|
16662
16665
|
publishedAt: 1624970570587,
|
|
16663
|
-
version: "1.3.
|
|
16666
|
+
version: "1.3.22"
|
|
16664
16667
|
});
|
|
16665
16668
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
16666
16669
|
return true;
|
|
@@ -16750,7 +16753,7 @@ function useScrollToActiveRow(activeRowIndex, dataCount, imperativeApi) {
|
|
|
16750
16753
|
var toCSSVarName = (value) => `--infinite-${value}`;
|
|
16751
16754
|
|
|
16752
16755
|
// src/components/InfiniteTable/eventHandlers/index.ts
|
|
16753
|
-
import { useCallback as
|
|
16756
|
+
import { useCallback as useCallback22, useMemo as useMemo12, useEffect as useEffect31 } from "react";
|
|
16754
16757
|
|
|
16755
16758
|
// src/components/InfiniteTable/eventHandlers/onCellClick.ts
|
|
16756
16759
|
function onCellClick(context, event) {
|
|
@@ -17481,7 +17484,7 @@ function handleDOMEvents() {
|
|
|
17481
17484
|
}
|
|
17482
17485
|
function subscribeToDOMEvents() {
|
|
17483
17486
|
const { getState } = useInfiniteTable();
|
|
17484
|
-
const onKeyDown2 =
|
|
17487
|
+
const onKeyDown2 = useCallback22((event) => {
|
|
17485
17488
|
getState().keyDown(event);
|
|
17486
17489
|
}, []);
|
|
17487
17490
|
return { onKeyDown: onKeyDown2 };
|
|
@@ -17497,7 +17500,7 @@ import { useEffect as useEffect35 } from "react";
|
|
|
17497
17500
|
// src/components/hooks/useOverlay/index.tsx
|
|
17498
17501
|
import * as React52 from "react";
|
|
17499
17502
|
import {
|
|
17500
|
-
useCallback as
|
|
17503
|
+
useCallback as useCallback23,
|
|
17501
17504
|
useEffect as useEffect33,
|
|
17502
17505
|
useLayoutEffect as useLayoutEffect12,
|
|
17503
17506
|
useState as useState18
|
|
@@ -17901,7 +17904,7 @@ function OverlayContent(props) {
|
|
|
17901
17904
|
"div",
|
|
17902
17905
|
{
|
|
17903
17906
|
style: { position: "absolute", top: 0, left: 0 },
|
|
17904
|
-
ref:
|
|
17907
|
+
ref: useCallback23((node) => {
|
|
17905
17908
|
if (node) {
|
|
17906
17909
|
alignOverlayNode(node, props);
|
|
17907
17910
|
}
|
|
@@ -18003,7 +18006,7 @@ function useOverlay(params) {
|
|
|
18003
18006
|
const [handles] = useState18(() => /* @__PURE__ */ new Map());
|
|
18004
18007
|
const [handleToRealign, setHandleToRealign] = useState18(null);
|
|
18005
18008
|
const [realignTimestamp, setRealignTimestamp] = useState18(0);
|
|
18006
|
-
const getContentForPortal =
|
|
18009
|
+
const getContentForPortal = useCallback23(() => {
|
|
18007
18010
|
const contentForPortal = [];
|
|
18008
18011
|
for (const [_2, handle] of handles) {
|
|
18009
18012
|
contentForPortal.push(
|
|
@@ -18017,7 +18020,7 @@ function useOverlay(params) {
|
|
|
18017
18020
|
getContentForPortal(),
|
|
18018
18021
|
params.portalContainer
|
|
18019
18022
|
);
|
|
18020
|
-
const showOverlay =
|
|
18023
|
+
const showOverlay = useCallback23(
|
|
18021
18024
|
(content, params2) => {
|
|
18022
18025
|
const id = params2.id || getIdForReactOnlyChild(content) || getChangeDetect();
|
|
18023
18026
|
const key = `${id}`;
|
|
@@ -18235,7 +18238,7 @@ var deriveStateFromProps2 = (params) => {
|
|
|
18235
18238
|
// src/components/Menu/Menu.tsx
|
|
18236
18239
|
import * as React55 from "react";
|
|
18237
18240
|
import {
|
|
18238
|
-
useCallback as
|
|
18241
|
+
useCallback as useCallback25,
|
|
18239
18242
|
useLayoutEffect as useLayoutEffect13,
|
|
18240
18243
|
useRef as useRef28,
|
|
18241
18244
|
useState as useState20
|
|
@@ -18466,7 +18469,7 @@ function useMenuContext() {
|
|
|
18466
18469
|
}
|
|
18467
18470
|
|
|
18468
18471
|
// src/components/hooks/useMounted.ts
|
|
18469
|
-
import { useCallback as
|
|
18472
|
+
import { useCallback as useCallback24, useEffect as useEffect34, useRef as useRef27 } from "react";
|
|
18470
18473
|
function useMounted() {
|
|
18471
18474
|
let mountedRef = useRef27(true);
|
|
18472
18475
|
useEffect34(() => {
|
|
@@ -18475,7 +18478,7 @@ function useMounted() {
|
|
|
18475
18478
|
mountedRef.current = false;
|
|
18476
18479
|
};
|
|
18477
18480
|
}, []);
|
|
18478
|
-
const isMounted =
|
|
18481
|
+
const isMounted = useCallback24(() => mountedRef.current, []);
|
|
18479
18482
|
return isMounted;
|
|
18480
18483
|
}
|
|
18481
18484
|
|
|
@@ -18596,8 +18599,8 @@ function useSubmenus({
|
|
|
18596
18599
|
}).getHandlers();
|
|
18597
18600
|
});
|
|
18598
18601
|
return {
|
|
18599
|
-
onItemEnter:
|
|
18600
|
-
onItemLeave:
|
|
18602
|
+
onItemEnter: useCallback25(onItemEnter, []),
|
|
18603
|
+
onItemLeave: useCallback25(onItemLeave, [])
|
|
18601
18604
|
};
|
|
18602
18605
|
}
|
|
18603
18606
|
function MenuComponent(props) {
|
|
@@ -18622,10 +18625,10 @@ function MenuComponent(props) {
|
|
|
18622
18625
|
componentActions,
|
|
18623
18626
|
getState
|
|
18624
18627
|
} = useMenuContext();
|
|
18625
|
-
const setKeyboardActiveItemKey =
|
|
18628
|
+
const setKeyboardActiveItemKey = useCallback25((key) => {
|
|
18626
18629
|
componentActions.keyboardActiveItemKey = key;
|
|
18627
18630
|
}, []);
|
|
18628
|
-
const setActiveItemKey =
|
|
18631
|
+
const setActiveItemKey = useCallback25((key) => {
|
|
18629
18632
|
componentActions.activeItemKey = key;
|
|
18630
18633
|
}, []);
|
|
18631
18634
|
const isMounted = useMounted();
|
|
@@ -18833,7 +18836,7 @@ function MenuComponent(props) {
|
|
|
18833
18836
|
function onMenuBlur() {
|
|
18834
18837
|
componentActions.focused = false;
|
|
18835
18838
|
}
|
|
18836
|
-
const onMenuFocus =
|
|
18839
|
+
const onMenuFocus = useCallback25(function() {
|
|
18837
18840
|
componentActions.focused = true;
|
|
18838
18841
|
setTimeout(() => {
|
|
18839
18842
|
var _a, _b;
|
|
@@ -18863,7 +18866,7 @@ function MenuComponent(props) {
|
|
|
18863
18866
|
};
|
|
18864
18867
|
return result2;
|
|
18865
18868
|
});
|
|
18866
|
-
const refCallback =
|
|
18869
|
+
const refCallback = useCallback25((node) => {
|
|
18867
18870
|
if (node) {
|
|
18868
18871
|
domRef.current = node;
|
|
18869
18872
|
onShow == null ? void 0 : onShow(getState(), api);
|
|
@@ -19329,7 +19332,7 @@ function useColumnMenu() {
|
|
|
19329
19332
|
|
|
19330
19333
|
// src/components/InfiniteTable/components/FocusDetect.tsx
|
|
19331
19334
|
import * as React59 from "react";
|
|
19332
|
-
import { useCallback as
|
|
19335
|
+
import { useCallback as useCallback26 } from "react";
|
|
19333
19336
|
var style = {
|
|
19334
19337
|
width: 0,
|
|
19335
19338
|
height: 0,
|
|
@@ -19349,7 +19352,7 @@ function FocusDetect() {
|
|
|
19349
19352
|
} = useInfiniteTable();
|
|
19350
19353
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
19351
19354
|
const { focusDetectDOMRef } = getState();
|
|
19352
|
-
const onFocus =
|
|
19355
|
+
const onFocus = useCallback26(() => __async(this, null, function* () {
|
|
19353
19356
|
const context = {
|
|
19354
19357
|
getDataSourceState,
|
|
19355
19358
|
getComputed,
|