@infinite-table/infinite-react 1.3.21 → 1.3.23
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 +13 -5
- package/index.dev.js +162 -169
- package/index.dev.mjs +180 -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;
|
|
@@ -11065,7 +11080,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
11065
11080
|
columnGroups.set(
|
|
11066
11081
|
parentColumnGroupId,
|
|
11067
11082
|
prepareColumnGroup({
|
|
11068
|
-
header: pivotGroupKey
|
|
11083
|
+
header: `${pivotGroupKey}`,
|
|
11069
11084
|
columnGroup: columnGroupId,
|
|
11070
11085
|
pivotBy,
|
|
11071
11086
|
pivotGroupKeys: keys,
|
|
@@ -11076,7 +11091,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
11076
11091
|
);
|
|
11077
11092
|
}
|
|
11078
11093
|
aggregationReducers.forEach((reducer, index) => {
|
|
11079
|
-
const header = isSingleAggregationColumn ? keys[keys.length - 1] : reducer.name || reducer.id;
|
|
11094
|
+
const header = isSingleAggregationColumn ? `${keys[keys.length - 1]}` : reducer.name || reducer.id;
|
|
11080
11095
|
const computedPivotColumn = prepareColumn({
|
|
11081
11096
|
pivotBy,
|
|
11082
11097
|
pivotColumn: true,
|
|
@@ -11108,7 +11123,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
11108
11123
|
colGroupId,
|
|
11109
11124
|
prepareColumnGroup({
|
|
11110
11125
|
columnGroup: parentKeys.length ? parentKeys.join("/") : void 0,
|
|
11111
|
-
header: keys[keys.length - 1]
|
|
11126
|
+
header: `${keys[keys.length - 1]}`,
|
|
11112
11127
|
pivotBy,
|
|
11113
11128
|
pivotGroupKeys: keys,
|
|
11114
11129
|
pivotIndex: keys.length - 1,
|
|
@@ -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();
|
|
@@ -13791,10 +13831,16 @@ var InfiniteTableApiImpl = class {
|
|
|
13791
13831
|
callback == null ? void 0 : callback();
|
|
13792
13832
|
}
|
|
13793
13833
|
setTimeout(() => {
|
|
13834
|
+
if (this.isDestroyed()) {
|
|
13835
|
+
return;
|
|
13836
|
+
}
|
|
13794
13837
|
realignColumnContextMenu(param);
|
|
13795
13838
|
callback == null ? void 0 : callback();
|
|
13796
13839
|
}, delay);
|
|
13797
13840
|
}
|
|
13841
|
+
isDestroyed() {
|
|
13842
|
+
return !this.getState().domRef.current;
|
|
13843
|
+
}
|
|
13798
13844
|
getColumnOrder() {
|
|
13799
13845
|
return this.getComputed().computedColumnOrder;
|
|
13800
13846
|
}
|
|
@@ -13900,29 +13946,121 @@ var InfiniteTableApiImpl = class {
|
|
|
13900
13946
|
}
|
|
13901
13947
|
}
|
|
13902
13948
|
}
|
|
13903
|
-
|
|
13949
|
+
toggleSortingForColumn(columnId, options) {
|
|
13904
13950
|
const col = this.getComputed().computedColumnsMap.get(columnId);
|
|
13905
13951
|
if (!col) {
|
|
13906
13952
|
return;
|
|
13907
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
|
+
}
|
|
13908
13973
|
if (dir === null) {
|
|
13909
13974
|
this.setSortInfoForColumn(columnId, null, options);
|
|
13910
13975
|
return;
|
|
13911
13976
|
}
|
|
13912
|
-
const
|
|
13913
|
-
|
|
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
|
|
13914
13993
|
};
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
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;
|
|
13918
14048
|
}
|
|
13919
|
-
|
|
13920
|
-
|
|
14049
|
+
return col.computedSortType;
|
|
14050
|
+
}
|
|
14051
|
+
getSortInfoForColumn(columnId) {
|
|
14052
|
+
const col = this.getComputed().computedColumnsMap.get(columnId);
|
|
14053
|
+
if (!col) {
|
|
14054
|
+
return null;
|
|
13921
14055
|
}
|
|
13922
|
-
|
|
13923
|
-
|
|
14056
|
+
return col.computedSortInfo;
|
|
14057
|
+
}
|
|
14058
|
+
getSortingForColumn(columnId) {
|
|
14059
|
+
const sortInfo = this.getSortInfoForColumn(columnId);
|
|
14060
|
+
if (!sortInfo) {
|
|
14061
|
+
return null;
|
|
13924
14062
|
}
|
|
13925
|
-
|
|
14063
|
+
return sortInfo.dir;
|
|
13926
14064
|
}
|
|
13927
14065
|
setPinningForColumn(columnId, pinning) {
|
|
13928
14066
|
const columnPinning = __spreadValues({}, this.getState().columnPinning);
|
|
@@ -14043,69 +14181,6 @@ var InfiniteTableApiImpl = class {
|
|
|
14043
14181
|
this.dataSourceActions.filterValue = newFilterValue;
|
|
14044
14182
|
}
|
|
14045
14183
|
}
|
|
14046
|
-
setSortInfoForColumn(columnId, columnSortInfo, options) {
|
|
14047
|
-
var _a, _b, _c;
|
|
14048
|
-
const dataSourceState = this.getDataSourceState();
|
|
14049
|
-
const col = this.getComputed().computedColumnsMap.get(columnId);
|
|
14050
|
-
if (!col) {
|
|
14051
|
-
return;
|
|
14052
|
-
}
|
|
14053
|
-
if (!dataSourceState.multiSort) {
|
|
14054
|
-
this.dataSourceActions.sortInfo = columnSortInfo ? [columnSortInfo] : null;
|
|
14055
|
-
return;
|
|
14056
|
-
}
|
|
14057
|
-
const colField = col.field;
|
|
14058
|
-
let newSortInfo = (_b = (_a = dataSourceState.sortInfo) == null ? void 0 : _a.slice()) != null ? _b : [];
|
|
14059
|
-
if (columnSortInfo === null) {
|
|
14060
|
-
newSortInfo = newSortInfo.filter((sortInfo) => {
|
|
14061
|
-
if (sortInfo.id) {
|
|
14062
|
-
if (sortInfo.id === columnId) {
|
|
14063
|
-
return false;
|
|
14064
|
-
}
|
|
14065
|
-
return true;
|
|
14066
|
-
}
|
|
14067
|
-
if (sortInfo.field) {
|
|
14068
|
-
if (sortInfo.field === colField) {
|
|
14069
|
-
return false;
|
|
14070
|
-
}
|
|
14071
|
-
return true;
|
|
14072
|
-
}
|
|
14073
|
-
return true;
|
|
14074
|
-
});
|
|
14075
|
-
this.dataSourceActions.sortInfo = newSortInfo.length ? newSortInfo : null;
|
|
14076
|
-
return;
|
|
14077
|
-
}
|
|
14078
|
-
let matched = false;
|
|
14079
|
-
const multiSortBehavior = (_c = options == null ? void 0 : options.multiSortBehavior) != null ? _c : this.getState().multiSortBehavior;
|
|
14080
|
-
if (multiSortBehavior === "replace") {
|
|
14081
|
-
this.dataSourceActions.sortInfo = [columnSortInfo];
|
|
14082
|
-
} else {
|
|
14083
|
-
newSortInfo = newSortInfo.map((sortInfo) => {
|
|
14084
|
-
if (matched) {
|
|
14085
|
-
return sortInfo;
|
|
14086
|
-
}
|
|
14087
|
-
if (sortInfo.id) {
|
|
14088
|
-
if (sortInfo.id === columnId) {
|
|
14089
|
-
matched = true;
|
|
14090
|
-
return columnSortInfo;
|
|
14091
|
-
}
|
|
14092
|
-
return sortInfo;
|
|
14093
|
-
}
|
|
14094
|
-
if (sortInfo.field) {
|
|
14095
|
-
if (sortInfo.field === colField) {
|
|
14096
|
-
matched = true;
|
|
14097
|
-
return columnSortInfo;
|
|
14098
|
-
}
|
|
14099
|
-
return sortInfo;
|
|
14100
|
-
}
|
|
14101
|
-
return sortInfo;
|
|
14102
|
-
});
|
|
14103
|
-
if (!matched) {
|
|
14104
|
-
newSortInfo.push(columnSortInfo);
|
|
14105
|
-
}
|
|
14106
|
-
this.dataSourceActions.sortInfo = newSortInfo.length ? newSortInfo : null;
|
|
14107
|
-
}
|
|
14108
|
-
}
|
|
14109
14184
|
setVisibilityForColumn(columnId, visible) {
|
|
14110
14185
|
const columnVisibility = __spreadValues({}, this.getState().columnVisibility);
|
|
14111
14186
|
if (visible) {
|
|
@@ -14521,7 +14596,7 @@ function useCellRendering(param) {
|
|
|
14521
14596
|
}
|
|
14522
14597
|
|
|
14523
14598
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
14524
|
-
import {
|
|
14599
|
+
import { useEffect as useEffect28, useState as useState17 } from "react";
|
|
14525
14600
|
|
|
14526
14601
|
// src/components/InfiniteTable/utils/MultiRowSelector.ts
|
|
14527
14602
|
function ensureMinMax(start, end) {
|
|
@@ -15624,17 +15699,9 @@ function getColumnsWhenGrouping(params) {
|
|
|
15624
15699
|
};
|
|
15625
15700
|
}
|
|
15626
15701
|
|
|
15627
|
-
// src/components/InfiniteTable/hooks/
|
|
15702
|
+
// src/components/InfiniteTable/hooks/useComputedColumns.ts
|
|
15628
15703
|
import { useMemo as useMemo10 } from "react";
|
|
15629
15704
|
|
|
15630
|
-
// src/components/InfiniteTable/types/Utility.ts
|
|
15631
|
-
function notNullable(value) {
|
|
15632
|
-
if (value === null || value === void 0)
|
|
15633
|
-
return false;
|
|
15634
|
-
const testDummyForCompileError = value;
|
|
15635
|
-
return true;
|
|
15636
|
-
}
|
|
15637
|
-
|
|
15638
15705
|
// src/components/InfiniteTable/utils/adjustColumnOrderForPinning.ts
|
|
15639
15706
|
var order = ["start", void 0, "end"];
|
|
15640
15707
|
var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
|
|
@@ -15681,7 +15748,7 @@ function getColumnComputedType(column, columnTypes) {
|
|
|
15681
15748
|
);
|
|
15682
15749
|
}
|
|
15683
15750
|
|
|
15684
|
-
// src/components/InfiniteTable/utils/
|
|
15751
|
+
// src/components/InfiniteTable/utils/getComputedColumns.ts
|
|
15685
15752
|
var logError = err("getComputedVisibleColumns");
|
|
15686
15753
|
var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
|
|
15687
15754
|
return columnVisibility[colId] !== false;
|
|
@@ -15725,7 +15792,7 @@ function isGroupColumnSortable(column, fieldsToColumns) {
|
|
|
15725
15792
|
return acc && !!colSortable;
|
|
15726
15793
|
}, true);
|
|
15727
15794
|
}
|
|
15728
|
-
var
|
|
15795
|
+
var getComputedColumns = ({
|
|
15729
15796
|
columns,
|
|
15730
15797
|
bodySize,
|
|
15731
15798
|
columnMinWidth,
|
|
@@ -15740,7 +15807,6 @@ var getComputedVisibleColumns = ({
|
|
|
15740
15807
|
filterValue,
|
|
15741
15808
|
sortable,
|
|
15742
15809
|
sortInfo,
|
|
15743
|
-
setSortInfo,
|
|
15744
15810
|
multiSort,
|
|
15745
15811
|
filterTypes = defaultFilterTypes,
|
|
15746
15812
|
viewportReservedWidth,
|
|
@@ -16030,67 +16096,6 @@ var getComputedVisibleColumns = ({
|
|
|
16030
16096
|
computedLastInCategory,
|
|
16031
16097
|
computedFirst: theComputedVisibleIndex === 0,
|
|
16032
16098
|
computedLast,
|
|
16033
|
-
toggleSort: ({
|
|
16034
|
-
multiSortBehavior
|
|
16035
|
-
} = {
|
|
16036
|
-
multiSortBehavior: "replace"
|
|
16037
|
-
}) => {
|
|
16038
|
-
const currentSortInfo = computedSortInfo;
|
|
16039
|
-
let newColumnSortInfo;
|
|
16040
|
-
const groupByForColumn = result2.groupByForColumn;
|
|
16041
|
-
let field2 = c.field;
|
|
16042
|
-
const groupByForCol = groupByForColumn ? Array.isArray(groupByForColumn) ? groupByForColumn : [groupByForColumn] : [];
|
|
16043
|
-
const fieldArr = groupByForCol.map((c2) => {
|
|
16044
|
-
return c2.valueGetter ? (item) => c2.valueGetter({ data: item, field: c2.field }) : c2.field ? c2.field : void 0;
|
|
16045
|
-
}).filter(notNullable);
|
|
16046
|
-
if (fieldArr.length) {
|
|
16047
|
-
field2 = fieldArr;
|
|
16048
|
-
}
|
|
16049
|
-
if (!currentSortInfo) {
|
|
16050
|
-
newColumnSortInfo = {
|
|
16051
|
-
dir: 1,
|
|
16052
|
-
id,
|
|
16053
|
-
field: field2,
|
|
16054
|
-
type: computedSortType
|
|
16055
|
-
};
|
|
16056
|
-
} else {
|
|
16057
|
-
if (computedSortedDesc) {
|
|
16058
|
-
newColumnSortInfo = null;
|
|
16059
|
-
} else {
|
|
16060
|
-
newColumnSortInfo = __spreadProps(__spreadValues({}, computedSortInfo), {
|
|
16061
|
-
dir: -1
|
|
16062
|
-
});
|
|
16063
|
-
}
|
|
16064
|
-
}
|
|
16065
|
-
if (field2 && newColumnSortInfo && !newColumnSortInfo.field) {
|
|
16066
|
-
newColumnSortInfo.field = field2;
|
|
16067
|
-
}
|
|
16068
|
-
if (c.valueGetter && newColumnSortInfo && !newColumnSortInfo.valueGetter) {
|
|
16069
|
-
newColumnSortInfo.valueGetter = (data) => c.valueGetter({ data, field: c.field });
|
|
16070
|
-
}
|
|
16071
|
-
let finalSortInfo = sortInfo ? [...sortInfo] : [];
|
|
16072
|
-
if (multiSort) {
|
|
16073
|
-
if (multiSortBehavior === "append") {
|
|
16074
|
-
if (computedSortIndex === -1) {
|
|
16075
|
-
if (newColumnSortInfo) {
|
|
16076
|
-
finalSortInfo.push(newColumnSortInfo);
|
|
16077
|
-
}
|
|
16078
|
-
} else {
|
|
16079
|
-
finalSortInfo = finalSortInfo.map((info, index) => {
|
|
16080
|
-
if (index === computedSortIndex) {
|
|
16081
|
-
return newColumnSortInfo;
|
|
16082
|
-
}
|
|
16083
|
-
return info;
|
|
16084
|
-
}).filter((x) => x != null);
|
|
16085
|
-
}
|
|
16086
|
-
} else {
|
|
16087
|
-
finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
|
|
16088
|
-
}
|
|
16089
|
-
} else {
|
|
16090
|
-
finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
|
|
16091
|
-
}
|
|
16092
|
-
setSortInfo(finalSortInfo);
|
|
16093
|
-
},
|
|
16094
16099
|
id,
|
|
16095
16100
|
header: (_B = (_A = (_z = c.header) != null ? _z : colType.header) != null ? _A : c.name) != null ? _B : c.field
|
|
16096
16101
|
});
|
|
@@ -16181,8 +16186,8 @@ var useRerenderOnKeyChange = (map2) => {
|
|
|
16181
16186
|
return renderId;
|
|
16182
16187
|
};
|
|
16183
16188
|
|
|
16184
|
-
// src/components/InfiniteTable/hooks/
|
|
16185
|
-
var
|
|
16189
|
+
// src/components/InfiniteTable/hooks/useComputedColumns.ts
|
|
16190
|
+
var useComputedColumns = ({
|
|
16186
16191
|
columns,
|
|
16187
16192
|
bodySize,
|
|
16188
16193
|
columnMinWidth,
|
|
@@ -16195,7 +16200,6 @@ var useComputedVisibleColumns = ({
|
|
|
16195
16200
|
draggableColumns,
|
|
16196
16201
|
sortInfo,
|
|
16197
16202
|
multiSort,
|
|
16198
|
-
setSortInfo,
|
|
16199
16203
|
filterValue,
|
|
16200
16204
|
filterTypes,
|
|
16201
16205
|
columnOrder,
|
|
@@ -16234,7 +16238,7 @@ var useComputedVisibleColumns = ({
|
|
|
16234
16238
|
computedColumnsMapInInitialOrder,
|
|
16235
16239
|
fieldsToColumn
|
|
16236
16240
|
} = useMemo10(() => {
|
|
16237
|
-
return
|
|
16241
|
+
return getComputedColumns({
|
|
16238
16242
|
columns,
|
|
16239
16243
|
scrollbarWidth: scrollbarWidth2,
|
|
16240
16244
|
bodySize,
|
|
@@ -16250,7 +16254,6 @@ var useComputedVisibleColumns = ({
|
|
|
16250
16254
|
filterTypes,
|
|
16251
16255
|
sortable,
|
|
16252
16256
|
sortInfo,
|
|
16253
|
-
setSortInfo,
|
|
16254
16257
|
multiSort,
|
|
16255
16258
|
pinnedEndMaxWidth,
|
|
16256
16259
|
pinnedStartMaxWidth,
|
|
@@ -16275,7 +16278,6 @@ var useComputedVisibleColumns = ({
|
|
|
16275
16278
|
scrollbarWidth2,
|
|
16276
16279
|
sortable,
|
|
16277
16280
|
sortInfo,
|
|
16278
|
-
setSortInfo,
|
|
16279
16281
|
multiSort,
|
|
16280
16282
|
filterValue,
|
|
16281
16283
|
filterTypes,
|
|
@@ -16391,14 +16393,6 @@ function useComputed() {
|
|
|
16391
16393
|
const { multiSort, filterValue, filterTypes } = dataSourceState;
|
|
16392
16394
|
useColumnGroups();
|
|
16393
16395
|
const { toggleGroupRow } = useColumnsWhen();
|
|
16394
|
-
const setSortInfo = useCallback22(
|
|
16395
|
-
(sortInfo) => {
|
|
16396
|
-
var _a2;
|
|
16397
|
-
const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
16398
|
-
dataSourceActions.sortInfo = newSortInfo;
|
|
16399
|
-
},
|
|
16400
|
-
[getDataSourceState]
|
|
16401
|
-
);
|
|
16402
16396
|
const columns = componentState.computedColumns;
|
|
16403
16397
|
const {
|
|
16404
16398
|
computedColumnOrder,
|
|
@@ -16419,7 +16413,7 @@ function useComputed() {
|
|
|
16419
16413
|
computedColumnsMap,
|
|
16420
16414
|
computedColumnsMapInInitialOrder,
|
|
16421
16415
|
fieldsToColumn
|
|
16422
|
-
} =
|
|
16416
|
+
} = useComputedColumns({
|
|
16423
16417
|
columns,
|
|
16424
16418
|
// scrollbarWidth: scrollbars.vertical ? getScrollbarWidth() : 0,
|
|
16425
16419
|
// #scrollbarverticaltag
|
|
@@ -16443,7 +16437,6 @@ function useComputed() {
|
|
|
16443
16437
|
draggableColumns: componentState.draggableColumns,
|
|
16444
16438
|
sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
|
|
16445
16439
|
multiSort,
|
|
16446
|
-
setSortInfo,
|
|
16447
16440
|
columnOrder,
|
|
16448
16441
|
columnVisibility,
|
|
16449
16442
|
columnVisibilityAssumeVisible: true,
|
|
@@ -16670,7 +16663,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
16670
16663
|
const valid = useMemo11(() => {
|
|
16671
16664
|
let valid2 = isValidLicense(licenseKey, {
|
|
16672
16665
|
publishedAt: 1624970570587,
|
|
16673
|
-
version: "1.3.
|
|
16666
|
+
version: "1.3.23"
|
|
16674
16667
|
});
|
|
16675
16668
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
16676
16669
|
return true;
|
|
@@ -16760,7 +16753,7 @@ function useScrollToActiveRow(activeRowIndex, dataCount, imperativeApi) {
|
|
|
16760
16753
|
var toCSSVarName = (value) => `--infinite-${value}`;
|
|
16761
16754
|
|
|
16762
16755
|
// src/components/InfiniteTable/eventHandlers/index.ts
|
|
16763
|
-
import { useCallback as
|
|
16756
|
+
import { useCallback as useCallback22, useMemo as useMemo12, useEffect as useEffect31 } from "react";
|
|
16764
16757
|
|
|
16765
16758
|
// src/components/InfiniteTable/eventHandlers/onCellClick.ts
|
|
16766
16759
|
function onCellClick(context, event) {
|
|
@@ -17491,7 +17484,7 @@ function handleDOMEvents() {
|
|
|
17491
17484
|
}
|
|
17492
17485
|
function subscribeToDOMEvents() {
|
|
17493
17486
|
const { getState } = useInfiniteTable();
|
|
17494
|
-
const onKeyDown2 =
|
|
17487
|
+
const onKeyDown2 = useCallback22((event) => {
|
|
17495
17488
|
getState().keyDown(event);
|
|
17496
17489
|
}, []);
|
|
17497
17490
|
return { onKeyDown: onKeyDown2 };
|
|
@@ -17507,7 +17500,7 @@ import { useEffect as useEffect35 } from "react";
|
|
|
17507
17500
|
// src/components/hooks/useOverlay/index.tsx
|
|
17508
17501
|
import * as React52 from "react";
|
|
17509
17502
|
import {
|
|
17510
|
-
useCallback as
|
|
17503
|
+
useCallback as useCallback23,
|
|
17511
17504
|
useEffect as useEffect33,
|
|
17512
17505
|
useLayoutEffect as useLayoutEffect12,
|
|
17513
17506
|
useState as useState18
|
|
@@ -17911,7 +17904,7 @@ function OverlayContent(props) {
|
|
|
17911
17904
|
"div",
|
|
17912
17905
|
{
|
|
17913
17906
|
style: { position: "absolute", top: 0, left: 0 },
|
|
17914
|
-
ref:
|
|
17907
|
+
ref: useCallback23((node) => {
|
|
17915
17908
|
if (node) {
|
|
17916
17909
|
alignOverlayNode(node, props);
|
|
17917
17910
|
}
|
|
@@ -18013,7 +18006,7 @@ function useOverlay(params) {
|
|
|
18013
18006
|
const [handles] = useState18(() => /* @__PURE__ */ new Map());
|
|
18014
18007
|
const [handleToRealign, setHandleToRealign] = useState18(null);
|
|
18015
18008
|
const [realignTimestamp, setRealignTimestamp] = useState18(0);
|
|
18016
|
-
const getContentForPortal =
|
|
18009
|
+
const getContentForPortal = useCallback23(() => {
|
|
18017
18010
|
const contentForPortal = [];
|
|
18018
18011
|
for (const [_2, handle] of handles) {
|
|
18019
18012
|
contentForPortal.push(
|
|
@@ -18027,7 +18020,7 @@ function useOverlay(params) {
|
|
|
18027
18020
|
getContentForPortal(),
|
|
18028
18021
|
params.portalContainer
|
|
18029
18022
|
);
|
|
18030
|
-
const showOverlay =
|
|
18023
|
+
const showOverlay = useCallback23(
|
|
18031
18024
|
(content, params2) => {
|
|
18032
18025
|
const id = params2.id || getIdForReactOnlyChild(content) || getChangeDetect();
|
|
18033
18026
|
const key = `${id}`;
|
|
@@ -18245,7 +18238,7 @@ var deriveStateFromProps2 = (params) => {
|
|
|
18245
18238
|
// src/components/Menu/Menu.tsx
|
|
18246
18239
|
import * as React55 from "react";
|
|
18247
18240
|
import {
|
|
18248
|
-
useCallback as
|
|
18241
|
+
useCallback as useCallback25,
|
|
18249
18242
|
useLayoutEffect as useLayoutEffect13,
|
|
18250
18243
|
useRef as useRef28,
|
|
18251
18244
|
useState as useState20
|
|
@@ -18476,7 +18469,7 @@ function useMenuContext() {
|
|
|
18476
18469
|
}
|
|
18477
18470
|
|
|
18478
18471
|
// src/components/hooks/useMounted.ts
|
|
18479
|
-
import { useCallback as
|
|
18472
|
+
import { useCallback as useCallback24, useEffect as useEffect34, useRef as useRef27 } from "react";
|
|
18480
18473
|
function useMounted() {
|
|
18481
18474
|
let mountedRef = useRef27(true);
|
|
18482
18475
|
useEffect34(() => {
|
|
@@ -18485,7 +18478,7 @@ function useMounted() {
|
|
|
18485
18478
|
mountedRef.current = false;
|
|
18486
18479
|
};
|
|
18487
18480
|
}, []);
|
|
18488
|
-
const isMounted =
|
|
18481
|
+
const isMounted = useCallback24(() => mountedRef.current, []);
|
|
18489
18482
|
return isMounted;
|
|
18490
18483
|
}
|
|
18491
18484
|
|
|
@@ -18606,8 +18599,8 @@ function useSubmenus({
|
|
|
18606
18599
|
}).getHandlers();
|
|
18607
18600
|
});
|
|
18608
18601
|
return {
|
|
18609
|
-
onItemEnter:
|
|
18610
|
-
onItemLeave:
|
|
18602
|
+
onItemEnter: useCallback25(onItemEnter, []),
|
|
18603
|
+
onItemLeave: useCallback25(onItemLeave, [])
|
|
18611
18604
|
};
|
|
18612
18605
|
}
|
|
18613
18606
|
function MenuComponent(props) {
|
|
@@ -18632,10 +18625,10 @@ function MenuComponent(props) {
|
|
|
18632
18625
|
componentActions,
|
|
18633
18626
|
getState
|
|
18634
18627
|
} = useMenuContext();
|
|
18635
|
-
const setKeyboardActiveItemKey =
|
|
18628
|
+
const setKeyboardActiveItemKey = useCallback25((key) => {
|
|
18636
18629
|
componentActions.keyboardActiveItemKey = key;
|
|
18637
18630
|
}, []);
|
|
18638
|
-
const setActiveItemKey =
|
|
18631
|
+
const setActiveItemKey = useCallback25((key) => {
|
|
18639
18632
|
componentActions.activeItemKey = key;
|
|
18640
18633
|
}, []);
|
|
18641
18634
|
const isMounted = useMounted();
|
|
@@ -18843,7 +18836,7 @@ function MenuComponent(props) {
|
|
|
18843
18836
|
function onMenuBlur() {
|
|
18844
18837
|
componentActions.focused = false;
|
|
18845
18838
|
}
|
|
18846
|
-
const onMenuFocus =
|
|
18839
|
+
const onMenuFocus = useCallback25(function() {
|
|
18847
18840
|
componentActions.focused = true;
|
|
18848
18841
|
setTimeout(() => {
|
|
18849
18842
|
var _a, _b;
|
|
@@ -18873,7 +18866,7 @@ function MenuComponent(props) {
|
|
|
18873
18866
|
};
|
|
18874
18867
|
return result2;
|
|
18875
18868
|
});
|
|
18876
|
-
const refCallback =
|
|
18869
|
+
const refCallback = useCallback25((node) => {
|
|
18877
18870
|
if (node) {
|
|
18878
18871
|
domRef.current = node;
|
|
18879
18872
|
onShow == null ? void 0 : onShow(getState(), api);
|
|
@@ -19339,7 +19332,7 @@ function useColumnMenu() {
|
|
|
19339
19332
|
|
|
19340
19333
|
// src/components/InfiniteTable/components/FocusDetect.tsx
|
|
19341
19334
|
import * as React59 from "react";
|
|
19342
|
-
import { useCallback as
|
|
19335
|
+
import { useCallback as useCallback26 } from "react";
|
|
19343
19336
|
var style = {
|
|
19344
19337
|
width: 0,
|
|
19345
19338
|
height: 0,
|
|
@@ -19359,7 +19352,7 @@ function FocusDetect() {
|
|
|
19359
19352
|
} = useInfiniteTable();
|
|
19360
19353
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
19361
19354
|
const { focusDetectDOMRef } = getState();
|
|
19362
|
-
const onFocus =
|
|
19355
|
+
const onFocus = useCallback26(() => __async(this, null, function* () {
|
|
19363
19356
|
const context = {
|
|
19364
19357
|
getDataSourceState,
|
|
19365
19358
|
getComputed,
|