@infinite-table/infinite-react 0.3.1 → 0.3.2
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 +2 -0
- package/index.esm.js +49 -46
- package/index.js +49 -46
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -760,6 +760,7 @@ declare type DataSourceRemoteData<T> = {
|
|
|
760
760
|
data: T[] | LazyGroupDataItem<T>[];
|
|
761
761
|
mappings?: DataSourceMappings;
|
|
762
762
|
cache?: boolean;
|
|
763
|
+
error?: string;
|
|
763
764
|
totalCount?: number;
|
|
764
765
|
livePaginationCursor?: DataSourceLivePaginationCursorValue;
|
|
765
766
|
};
|
|
@@ -988,6 +989,7 @@ declare type InfiniteTable_HasGrouping_RowInfoGroup<T> = {
|
|
|
988
989
|
* in the order in which they are visible in the table
|
|
989
990
|
*/
|
|
990
991
|
deepRowInfoArray: (InfiniteTable_HasGrouping_RowInfoNormal<T> | InfiniteTable_HasGrouping_RowInfoGroup<T>)[];
|
|
992
|
+
error?: string;
|
|
991
993
|
reducerResults?: Record<string, AggregationReducerResult>;
|
|
992
994
|
/**
|
|
993
995
|
* The count of all leaf nodes (normal rows) that are inside this group.
|
package/index.esm.js
CHANGED
|
@@ -2820,7 +2820,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2820
2820
|
this.hoverRowUpdatesInProgress.delete(rowIndex);
|
|
2821
2821
|
});
|
|
2822
2822
|
};
|
|
2823
|
-
this.updateElementPosition = (elementIndex) => {
|
|
2823
|
+
this.updateElementPosition = (elementIndex, options) => {
|
|
2824
2824
|
const itemElement = this.itemDOMElements[elementIndex];
|
|
2825
2825
|
const cell = this.mappedCells.getRenderedCellAtElement(elementIndex);
|
|
2826
2826
|
if (cell == null) {
|
|
@@ -2845,7 +2845,8 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2845
2845
|
itemElement.style.transform = `translate3d(${x}px, ${y}px, 0)`;
|
|
2846
2846
|
itemElement.style.willChange = "transform";
|
|
2847
2847
|
itemElement.style.backfaceVisibility = "hidden";
|
|
2848
|
-
|
|
2848
|
+
const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
|
|
2849
|
+
itemElement.style.zIndex = hidden ? "-1" : "auto";
|
|
2849
2850
|
} else {
|
|
2850
2851
|
itemElement.style.display = "";
|
|
2851
2852
|
itemElement.style.left = `${x}px`;
|
|
@@ -3040,6 +3041,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3040
3041
|
const heightWithRowspan = rowspan === 1 ? height : this.brain.getRowHeightWithSpan(rowIndex, colIndex, rowspan);
|
|
3041
3042
|
const widthWithColspan = colspan === 1 ? width : this.brain.getColWidthWithSpan(rowIndex, colIndex, colspan);
|
|
3042
3043
|
const { row: rowFixed, col: colFixed } = this.isCellFixed(rowIndex, colIndex);
|
|
3044
|
+
const hidden = !!covered;
|
|
3043
3045
|
const renderedNode = renderCell({
|
|
3044
3046
|
rowIndex,
|
|
3045
3047
|
colIndex,
|
|
@@ -3049,7 +3051,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3049
3051
|
colspan,
|
|
3050
3052
|
rowFixed,
|
|
3051
3053
|
colFixed,
|
|
3052
|
-
hidden
|
|
3054
|
+
hidden,
|
|
3053
3055
|
heightWithRowspan,
|
|
3054
3056
|
widthWithColspan,
|
|
3055
3057
|
onMouseEnter: this.onMouseEnter.bind(null, rowIndex),
|
|
@@ -3066,7 +3068,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3066
3068
|
this.debug(`Render cell ${rowIndex},${colIndex} at element ${elementIndex}`);
|
|
3067
3069
|
}
|
|
3068
3070
|
itemUpdater(renderedNode);
|
|
3069
|
-
this.updateElementPosition(elementIndex);
|
|
3071
|
+
this.updateElementPosition(elementIndex, { hidden, rowspan, colspan });
|
|
3070
3072
|
return;
|
|
3071
3073
|
}
|
|
3072
3074
|
reset() {
|
|
@@ -5128,6 +5130,9 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
5128
5130
|
return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
|
|
5129
5131
|
const dataArray = getDataSourceState().dataArray;
|
|
5130
5132
|
const rowInfo = dataArray[rowIndex];
|
|
5133
|
+
if (!rowInfo) {
|
|
5134
|
+
return 1;
|
|
5135
|
+
}
|
|
5131
5136
|
const data = rowInfo.data;
|
|
5132
5137
|
const column = computedVisibleColumns[colIndex];
|
|
5133
5138
|
if (!column || !column.rowspan) {
|
|
@@ -5521,10 +5526,8 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5521
5526
|
}
|
|
5522
5527
|
const dataObject = dataArray[i].data;
|
|
5523
5528
|
const dataKeys = dataArray[i].keys;
|
|
5524
|
-
const item = dataObject;
|
|
5525
5529
|
if (dataKeys.length) {
|
|
5526
|
-
const
|
|
5527
|
-
const key = item[groupByProperty];
|
|
5530
|
+
const key = dataKeys[dataKeys.length - 1];
|
|
5528
5531
|
currentGroupKeys.push(key);
|
|
5529
5532
|
}
|
|
5530
5533
|
const deepMapGroupValue = {
|
|
@@ -5687,6 +5690,7 @@ function flatten(groupResult) {
|
|
|
5687
5690
|
return result;
|
|
5688
5691
|
}
|
|
5689
5692
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
5693
|
+
var _a;
|
|
5690
5694
|
const { groupBy, groupKeys, collapsed, parents, reducers, lazyLoad } = options;
|
|
5691
5695
|
const groupNesting = groupKeys.length;
|
|
5692
5696
|
const {
|
|
@@ -5695,9 +5699,9 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5695
5699
|
pivotDeepMap,
|
|
5696
5700
|
commonData
|
|
5697
5701
|
} = deepMapValue;
|
|
5698
|
-
let data = null;
|
|
5702
|
+
let data = commonData != null ? commonData : null;
|
|
5699
5703
|
if (Object.keys(reducerResults).length > 0) {
|
|
5700
|
-
data =
|
|
5704
|
+
data = __spreadValues({}, commonData);
|
|
5701
5705
|
for (const key in reducers)
|
|
5702
5706
|
if (reducers.hasOwnProperty(key)) {
|
|
5703
5707
|
const reducer = reducers[key];
|
|
@@ -5708,7 +5712,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5708
5712
|
}
|
|
5709
5713
|
}
|
|
5710
5714
|
let selfLoaded = true;
|
|
5711
|
-
let theValue = groupKeys[groupKeys.length - 1];
|
|
5715
|
+
let theValue = (_a = data != null ? data[groupBy[groupKeys.length - 1]] : null) != null ? _a : groupKeys[groupKeys.length - 1];
|
|
5712
5716
|
if (typeof theValue === "string" && theValue.startsWith(NOT_LOADED_YET_KEY_PREFIX)) {
|
|
5713
5717
|
selfLoaded = false;
|
|
5714
5718
|
theValue = null;
|
|
@@ -5722,6 +5726,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5722
5726
|
collapsed,
|
|
5723
5727
|
dataSourceHasGrouping: true,
|
|
5724
5728
|
selfLoaded,
|
|
5729
|
+
error: options.error,
|
|
5725
5730
|
parents,
|
|
5726
5731
|
deepRowInfoArray: [],
|
|
5727
5732
|
collapsedChildrenCount: 0,
|
|
@@ -5785,6 +5790,7 @@ function enhancedFlatten(param) {
|
|
|
5785
5790
|
indexInParentGroups: Array.from(indexInParentGroups),
|
|
5786
5791
|
indexInAll: result.length,
|
|
5787
5792
|
groupKeys,
|
|
5793
|
+
error: deepMapValue.error,
|
|
5788
5794
|
childrenLoading: deepMapValue.childrenLoading,
|
|
5789
5795
|
childrenAvailable: deepMapValue.childrenAvailable,
|
|
5790
5796
|
directChildrenCount: groupKeys.length === groupByStrings.length ? deepMapValue.items.length : deepMap.getDirectChildrenSizeFor(groupKeys),
|
|
@@ -5984,6 +5990,25 @@ function useEffectWithChanges(fn, deps) {
|
|
|
5984
5990
|
}, useEffectDeps);
|
|
5985
5991
|
}
|
|
5986
5992
|
|
|
5993
|
+
// src/components/InfiniteTable/utils/assignFiltered.ts
|
|
5994
|
+
function assignFiltered(filterFn, target, ...rest) {
|
|
5995
|
+
const result = target;
|
|
5996
|
+
rest.forEach((obj) => {
|
|
5997
|
+
for (const key in obj) {
|
|
5998
|
+
if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
|
|
5999
|
+
result[key] = obj[key];
|
|
6000
|
+
}
|
|
6001
|
+
}
|
|
6002
|
+
});
|
|
6003
|
+
return result;
|
|
6004
|
+
}
|
|
6005
|
+
function assignNonNull(target, ...rest) {
|
|
6006
|
+
return assignFiltered((value) => value != null, target, ...rest);
|
|
6007
|
+
}
|
|
6008
|
+
function assignExcept(exceptKeys, target, ...rest) {
|
|
6009
|
+
return assignFiltered((_value, key) => !(key in exceptKeys), target, ...rest);
|
|
6010
|
+
}
|
|
6011
|
+
|
|
5987
6012
|
// src/components/DataSource/privateHooks/getChangeDetect.ts
|
|
5988
6013
|
function getChangeDetect() {
|
|
5989
6014
|
var _a;
|
|
@@ -6099,7 +6124,7 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6099
6124
|
}
|
|
6100
6125
|
if (componentState.lazyLoad) {
|
|
6101
6126
|
let resolveRemoteData = function(keys, remoteData2, parentKeys) {
|
|
6102
|
-
var _a, _b, _c
|
|
6127
|
+
var _a, _b, _c;
|
|
6103
6128
|
const theKey = [LAZY_ROOT_KEY_FOR_GROUPS, ...keys];
|
|
6104
6129
|
const dataArray2 = remoteData2.data;
|
|
6105
6130
|
const newGroupRowInfo = {
|
|
@@ -6107,28 +6132,22 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6107
6132
|
childrenLoading: false,
|
|
6108
6133
|
childrenAvailable: true,
|
|
6109
6134
|
totalCount: (_a = remoteData2.totalCount) != null ? _a : dataArray2.length,
|
|
6110
|
-
children: dataArray2
|
|
6135
|
+
children: dataArray2,
|
|
6136
|
+
error: remoteData2.error
|
|
6111
6137
|
};
|
|
6112
6138
|
const childDatasets = [];
|
|
6113
6139
|
if (dataParams.lazyLoadBatchSize && !parentKeys) {
|
|
6114
6140
|
const existingGroupRowInfo = lazyGroupData.get(theKey);
|
|
6115
|
-
const
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
};
|
|
6122
|
-
if (existingGroupRowInfo) {
|
|
6123
|
-
existingGroupRowInfo.cache = newGroupRowInfo.cache;
|
|
6124
|
-
existingGroupRowInfo.totalCount = newGroupRowInfo.totalCount;
|
|
6125
|
-
existingGroupRowInfo.childrenLoading = false;
|
|
6126
|
-
existingGroupRowInfo.childrenAvailable = true;
|
|
6127
|
-
existingGroupRowInfo.error = newGroupRowInfo.error;
|
|
6141
|
+
const isGroupNew = !existingGroupRowInfo;
|
|
6142
|
+
const currentGroupRowInfo = assignExcept({
|
|
6143
|
+
children: true
|
|
6144
|
+
}, existingGroupRowInfo || {}, newGroupRowInfo);
|
|
6145
|
+
if (isGroupNew) {
|
|
6146
|
+
currentGroupRowInfo.chidren = [];
|
|
6128
6147
|
}
|
|
6129
6148
|
currentGroupRowInfo.children.length = currentGroupRowInfo.totalCount;
|
|
6130
|
-
const start = (
|
|
6131
|
-
const end = Math.min((
|
|
6149
|
+
const start = (_b = dataParams.lazyLoadStartIndex) != null ? _b : 0;
|
|
6150
|
+
const end = Math.min((_c = remoteData2.totalCount) != null ? _c : dataArray2.length, start + dataParams.lazyLoadBatchSize);
|
|
6132
6151
|
for (let i = start; i < end; i++) {
|
|
6133
6152
|
const it = newGroupRowInfo.children[i - start];
|
|
6134
6153
|
if (!it) {
|
|
@@ -6142,13 +6161,13 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6142
6161
|
});
|
|
6143
6162
|
}
|
|
6144
6163
|
}
|
|
6145
|
-
if (
|
|
6164
|
+
if (isGroupNew) {
|
|
6146
6165
|
lazyGroupData.set(theKey, currentGroupRowInfo);
|
|
6147
6166
|
}
|
|
6148
6167
|
} else {
|
|
6149
6168
|
if (parentKeys) {
|
|
6150
6169
|
newGroupRowInfo.children.forEach((child) => {
|
|
6151
|
-
if (child.dataset) {
|
|
6170
|
+
if (child && child.dataset) {
|
|
6152
6171
|
childDatasets.push({
|
|
6153
6172
|
keys: child.keys,
|
|
6154
6173
|
dataset: child.dataset
|
|
@@ -7750,22 +7769,6 @@ function getColumnComputedType(column, columnTypes) {
|
|
|
7750
7769
|
return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes[columnType]), {});
|
|
7751
7770
|
}
|
|
7752
7771
|
|
|
7753
|
-
// src/components/InfiniteTable/utils/assignFiltered.ts
|
|
7754
|
-
function assignFiltered(filterFn, target, ...rest) {
|
|
7755
|
-
let result = target;
|
|
7756
|
-
rest.forEach((obj) => {
|
|
7757
|
-
for (const key in obj) {
|
|
7758
|
-
if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
|
|
7759
|
-
result[key] = obj[key];
|
|
7760
|
-
}
|
|
7761
|
-
}
|
|
7762
|
-
});
|
|
7763
|
-
return result;
|
|
7764
|
-
}
|
|
7765
|
-
function assignNonNull(target, ...rest) {
|
|
7766
|
-
return assignFiltered((value) => value != null, target, ...rest);
|
|
7767
|
-
}
|
|
7768
|
-
|
|
7769
7772
|
// src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
|
|
7770
7773
|
var logError = err("getComputedVisibleColumns");
|
|
7771
7774
|
var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
|
|
@@ -8532,7 +8535,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
8532
8535
|
const valid = useMemo10(() => {
|
|
8533
8536
|
let valid2 = isValidLicense(licenseKey, {
|
|
8534
8537
|
publishedAt: 1624970570587,
|
|
8535
|
-
version: "0.3.
|
|
8538
|
+
version: "0.3.2"
|
|
8536
8539
|
});
|
|
8537
8540
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
8538
8541
|
return true;
|
package/index.js
CHANGED
|
@@ -2807,7 +2807,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2807
2807
|
this.hoverRowUpdatesInProgress.delete(rowIndex);
|
|
2808
2808
|
});
|
|
2809
2809
|
};
|
|
2810
|
-
this.updateElementPosition = (elementIndex) => {
|
|
2810
|
+
this.updateElementPosition = (elementIndex, options) => {
|
|
2811
2811
|
const itemElement = this.itemDOMElements[elementIndex];
|
|
2812
2812
|
const cell = this.mappedCells.getRenderedCellAtElement(elementIndex);
|
|
2813
2813
|
if (cell == null) {
|
|
@@ -2832,7 +2832,8 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2832
2832
|
itemElement.style.transform = `translate3d(${x}px, ${y}px, 0)`;
|
|
2833
2833
|
itemElement.style.willChange = "transform";
|
|
2834
2834
|
itemElement.style.backfaceVisibility = "hidden";
|
|
2835
|
-
|
|
2835
|
+
const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
|
|
2836
|
+
itemElement.style.zIndex = hidden ? "-1" : "auto";
|
|
2836
2837
|
} else {
|
|
2837
2838
|
itemElement.style.display = "";
|
|
2838
2839
|
itemElement.style.left = `${x}px`;
|
|
@@ -3027,6 +3028,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3027
3028
|
const heightWithRowspan = rowspan === 1 ? height : this.brain.getRowHeightWithSpan(rowIndex, colIndex, rowspan);
|
|
3028
3029
|
const widthWithColspan = colspan === 1 ? width : this.brain.getColWidthWithSpan(rowIndex, colIndex, colspan);
|
|
3029
3030
|
const { row: rowFixed, col: colFixed } = this.isCellFixed(rowIndex, colIndex);
|
|
3031
|
+
const hidden = !!covered;
|
|
3030
3032
|
const renderedNode = renderCell({
|
|
3031
3033
|
rowIndex,
|
|
3032
3034
|
colIndex,
|
|
@@ -3036,7 +3038,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3036
3038
|
colspan,
|
|
3037
3039
|
rowFixed,
|
|
3038
3040
|
colFixed,
|
|
3039
|
-
hidden
|
|
3041
|
+
hidden,
|
|
3040
3042
|
heightWithRowspan,
|
|
3041
3043
|
widthWithColspan,
|
|
3042
3044
|
onMouseEnter: this.onMouseEnter.bind(null, rowIndex),
|
|
@@ -3053,7 +3055,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3053
3055
|
this.debug(`Render cell ${rowIndex},${colIndex} at element ${elementIndex}`);
|
|
3054
3056
|
}
|
|
3055
3057
|
itemUpdater(renderedNode);
|
|
3056
|
-
this.updateElementPosition(elementIndex);
|
|
3058
|
+
this.updateElementPosition(elementIndex, { hidden, rowspan, colspan });
|
|
3057
3059
|
return;
|
|
3058
3060
|
}
|
|
3059
3061
|
reset() {
|
|
@@ -5062,6 +5064,9 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
5062
5064
|
return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
|
|
5063
5065
|
const dataArray = getDataSourceState().dataArray;
|
|
5064
5066
|
const rowInfo = dataArray[rowIndex];
|
|
5067
|
+
if (!rowInfo) {
|
|
5068
|
+
return 1;
|
|
5069
|
+
}
|
|
5065
5070
|
const data = rowInfo.data;
|
|
5066
5071
|
const column = computedVisibleColumns[colIndex];
|
|
5067
5072
|
if (!column || !column.rowspan) {
|
|
@@ -5448,10 +5453,8 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5448
5453
|
}
|
|
5449
5454
|
const dataObject = dataArray[i].data;
|
|
5450
5455
|
const dataKeys = dataArray[i].keys;
|
|
5451
|
-
const item = dataObject;
|
|
5452
5456
|
if (dataKeys.length) {
|
|
5453
|
-
const
|
|
5454
|
-
const key = item[groupByProperty];
|
|
5457
|
+
const key = dataKeys[dataKeys.length - 1];
|
|
5455
5458
|
currentGroupKeys.push(key);
|
|
5456
5459
|
}
|
|
5457
5460
|
const deepMapGroupValue = {
|
|
@@ -5614,6 +5617,7 @@ function flatten(groupResult) {
|
|
|
5614
5617
|
return result;
|
|
5615
5618
|
}
|
|
5616
5619
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
5620
|
+
var _a;
|
|
5617
5621
|
const { groupBy, groupKeys, collapsed, parents, reducers, lazyLoad } = options;
|
|
5618
5622
|
const groupNesting = groupKeys.length;
|
|
5619
5623
|
const {
|
|
@@ -5622,9 +5626,9 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5622
5626
|
pivotDeepMap,
|
|
5623
5627
|
commonData
|
|
5624
5628
|
} = deepMapValue;
|
|
5625
|
-
let data = null;
|
|
5629
|
+
let data = commonData != null ? commonData : null;
|
|
5626
5630
|
if (Object.keys(reducerResults).length > 0) {
|
|
5627
|
-
data =
|
|
5631
|
+
data = __spreadValues({}, commonData);
|
|
5628
5632
|
for (const key in reducers)
|
|
5629
5633
|
if (reducers.hasOwnProperty(key)) {
|
|
5630
5634
|
const reducer = reducers[key];
|
|
@@ -5635,7 +5639,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5635
5639
|
}
|
|
5636
5640
|
}
|
|
5637
5641
|
let selfLoaded = true;
|
|
5638
|
-
let theValue = groupKeys[groupKeys.length - 1];
|
|
5642
|
+
let theValue = (_a = data != null ? data[groupBy[groupKeys.length - 1]] : null) != null ? _a : groupKeys[groupKeys.length - 1];
|
|
5639
5643
|
if (typeof theValue === "string" && theValue.startsWith(NOT_LOADED_YET_KEY_PREFIX)) {
|
|
5640
5644
|
selfLoaded = false;
|
|
5641
5645
|
theValue = null;
|
|
@@ -5649,6 +5653,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5649
5653
|
collapsed,
|
|
5650
5654
|
dataSourceHasGrouping: true,
|
|
5651
5655
|
selfLoaded,
|
|
5656
|
+
error: options.error,
|
|
5652
5657
|
parents,
|
|
5653
5658
|
deepRowInfoArray: [],
|
|
5654
5659
|
collapsedChildrenCount: 0,
|
|
@@ -5712,6 +5717,7 @@ function enhancedFlatten(param) {
|
|
|
5712
5717
|
indexInParentGroups: Array.from(indexInParentGroups),
|
|
5713
5718
|
indexInAll: result.length,
|
|
5714
5719
|
groupKeys,
|
|
5720
|
+
error: deepMapValue.error,
|
|
5715
5721
|
childrenLoading: deepMapValue.childrenLoading,
|
|
5716
5722
|
childrenAvailable: deepMapValue.childrenAvailable,
|
|
5717
5723
|
directChildrenCount: groupKeys.length === groupByStrings.length ? deepMapValue.items.length : deepMap.getDirectChildrenSizeFor(groupKeys),
|
|
@@ -5908,6 +5914,25 @@ function useEffectWithChanges(fn, deps) {
|
|
|
5908
5914
|
}, useEffectDeps);
|
|
5909
5915
|
}
|
|
5910
5916
|
|
|
5917
|
+
// src/components/InfiniteTable/utils/assignFiltered.ts
|
|
5918
|
+
function assignFiltered(filterFn, target, ...rest) {
|
|
5919
|
+
const result = target;
|
|
5920
|
+
rest.forEach((obj) => {
|
|
5921
|
+
for (const key in obj) {
|
|
5922
|
+
if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
|
|
5923
|
+
result[key] = obj[key];
|
|
5924
|
+
}
|
|
5925
|
+
}
|
|
5926
|
+
});
|
|
5927
|
+
return result;
|
|
5928
|
+
}
|
|
5929
|
+
function assignNonNull(target, ...rest) {
|
|
5930
|
+
return assignFiltered((value) => value != null, target, ...rest);
|
|
5931
|
+
}
|
|
5932
|
+
function assignExcept(exceptKeys, target, ...rest) {
|
|
5933
|
+
return assignFiltered((_value, key) => !(key in exceptKeys), target, ...rest);
|
|
5934
|
+
}
|
|
5935
|
+
|
|
5911
5936
|
// src/components/DataSource/privateHooks/getChangeDetect.ts
|
|
5912
5937
|
function getChangeDetect() {
|
|
5913
5938
|
var _a;
|
|
@@ -6023,7 +6048,7 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6023
6048
|
}
|
|
6024
6049
|
if (componentState.lazyLoad) {
|
|
6025
6050
|
let resolveRemoteData = function(keys, remoteData2, parentKeys) {
|
|
6026
|
-
var _a, _b, _c
|
|
6051
|
+
var _a, _b, _c;
|
|
6027
6052
|
const theKey = [LAZY_ROOT_KEY_FOR_GROUPS, ...keys];
|
|
6028
6053
|
const dataArray2 = remoteData2.data;
|
|
6029
6054
|
const newGroupRowInfo = {
|
|
@@ -6031,28 +6056,22 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6031
6056
|
childrenLoading: false,
|
|
6032
6057
|
childrenAvailable: true,
|
|
6033
6058
|
totalCount: (_a = remoteData2.totalCount) != null ? _a : dataArray2.length,
|
|
6034
|
-
children: dataArray2
|
|
6059
|
+
children: dataArray2,
|
|
6060
|
+
error: remoteData2.error
|
|
6035
6061
|
};
|
|
6036
6062
|
const childDatasets = [];
|
|
6037
6063
|
if (dataParams.lazyLoadBatchSize && !parentKeys) {
|
|
6038
6064
|
const existingGroupRowInfo = lazyGroupData.get(theKey);
|
|
6039
|
-
const
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
};
|
|
6046
|
-
if (existingGroupRowInfo) {
|
|
6047
|
-
existingGroupRowInfo.cache = newGroupRowInfo.cache;
|
|
6048
|
-
existingGroupRowInfo.totalCount = newGroupRowInfo.totalCount;
|
|
6049
|
-
existingGroupRowInfo.childrenLoading = false;
|
|
6050
|
-
existingGroupRowInfo.childrenAvailable = true;
|
|
6051
|
-
existingGroupRowInfo.error = newGroupRowInfo.error;
|
|
6065
|
+
const isGroupNew = !existingGroupRowInfo;
|
|
6066
|
+
const currentGroupRowInfo = assignExcept({
|
|
6067
|
+
children: true
|
|
6068
|
+
}, existingGroupRowInfo || {}, newGroupRowInfo);
|
|
6069
|
+
if (isGroupNew) {
|
|
6070
|
+
currentGroupRowInfo.chidren = [];
|
|
6052
6071
|
}
|
|
6053
6072
|
currentGroupRowInfo.children.length = currentGroupRowInfo.totalCount;
|
|
6054
|
-
const start = (
|
|
6055
|
-
const end = Math.min((
|
|
6073
|
+
const start = (_b = dataParams.lazyLoadStartIndex) != null ? _b : 0;
|
|
6074
|
+
const end = Math.min((_c = remoteData2.totalCount) != null ? _c : dataArray2.length, start + dataParams.lazyLoadBatchSize);
|
|
6056
6075
|
for (let i = start; i < end; i++) {
|
|
6057
6076
|
const it = newGroupRowInfo.children[i - start];
|
|
6058
6077
|
if (!it) {
|
|
@@ -6066,13 +6085,13 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6066
6085
|
});
|
|
6067
6086
|
}
|
|
6068
6087
|
}
|
|
6069
|
-
if (
|
|
6088
|
+
if (isGroupNew) {
|
|
6070
6089
|
lazyGroupData.set(theKey, currentGroupRowInfo);
|
|
6071
6090
|
}
|
|
6072
6091
|
} else {
|
|
6073
6092
|
if (parentKeys) {
|
|
6074
6093
|
newGroupRowInfo.children.forEach((child) => {
|
|
6075
|
-
if (child.dataset) {
|
|
6094
|
+
if (child && child.dataset) {
|
|
6076
6095
|
childDatasets.push({
|
|
6077
6096
|
keys: child.keys,
|
|
6078
6097
|
dataset: child.dataset
|
|
@@ -7674,22 +7693,6 @@ function getColumnComputedType(column, columnTypes) {
|
|
|
7674
7693
|
return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes[columnType]), {});
|
|
7675
7694
|
}
|
|
7676
7695
|
|
|
7677
|
-
// src/components/InfiniteTable/utils/assignFiltered.ts
|
|
7678
|
-
function assignFiltered(filterFn, target, ...rest) {
|
|
7679
|
-
let result = target;
|
|
7680
|
-
rest.forEach((obj) => {
|
|
7681
|
-
for (const key in obj) {
|
|
7682
|
-
if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
|
|
7683
|
-
result[key] = obj[key];
|
|
7684
|
-
}
|
|
7685
|
-
}
|
|
7686
|
-
});
|
|
7687
|
-
return result;
|
|
7688
|
-
}
|
|
7689
|
-
function assignNonNull(target, ...rest) {
|
|
7690
|
-
return assignFiltered((value) => value != null, target, ...rest);
|
|
7691
|
-
}
|
|
7692
|
-
|
|
7693
7696
|
// src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
|
|
7694
7697
|
var logError = err("getComputedVisibleColumns");
|
|
7695
7698
|
var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
|
|
@@ -8456,7 +8459,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
8456
8459
|
const valid = (0, import_react39.useMemo)(() => {
|
|
8457
8460
|
let valid2 = isValidLicense(licenseKey, {
|
|
8458
8461
|
publishedAt: 1624970570587,
|
|
8459
|
-
version: "0.3.
|
|
8462
|
+
version: "0.3.2"
|
|
8460
8463
|
});
|
|
8461
8464
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
8462
8465
|
return true;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infinite-table/infinite-react",
|
|
3
3
|
"description": "Infinite Table for React",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.2",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.esm.js",
|
|
7
7
|
"typings": "index.d.ts",
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
},
|
|
15
15
|
"license": "Commercial & Open Source",
|
|
16
16
|
"//": "will be updated at build time",
|
|
17
|
-
"publishedAt":
|
|
17
|
+
"publishedAt": 1651670850272
|
|
18
18
|
}
|