@infinite-table/infinite-react 0.2.7 → 0.2.10
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 +951 -3220
- package/index.esm.js +71 -42
- package/index.js +71 -42
- package/package.json +2 -2
package/index.esm.js
CHANGED
|
@@ -193,11 +193,11 @@ var require_common = __commonJS({
|
|
|
193
193
|
let enableOverride = null;
|
|
194
194
|
let namespacesCache;
|
|
195
195
|
let enabledCache;
|
|
196
|
-
function
|
|
197
|
-
if (!
|
|
196
|
+
function debug7(...args) {
|
|
197
|
+
if (!debug7.enabled) {
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
|
-
const self =
|
|
200
|
+
const self = debug7;
|
|
201
201
|
const curr = Number(new Date());
|
|
202
202
|
const ms = curr - (prevTime || curr);
|
|
203
203
|
self.diff = ms;
|
|
@@ -227,12 +227,12 @@ var require_common = __commonJS({
|
|
|
227
227
|
const logFn = self.log || createDebug.log;
|
|
228
228
|
logFn.apply(self, args);
|
|
229
229
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
Object.defineProperty(
|
|
230
|
+
debug7.namespace = namespace;
|
|
231
|
+
debug7.useColors = createDebug.useColors();
|
|
232
|
+
debug7.color = createDebug.selectColor(namespace);
|
|
233
|
+
debug7.extend = extend;
|
|
234
|
+
debug7.destroy = createDebug.destroy;
|
|
235
|
+
Object.defineProperty(debug7, "enabled", {
|
|
236
236
|
enumerable: true,
|
|
237
237
|
configurable: false,
|
|
238
238
|
get: () => {
|
|
@@ -250,9 +250,9 @@ var require_common = __commonJS({
|
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
252
|
if (typeof createDebug.init === "function") {
|
|
253
|
-
createDebug.init(
|
|
253
|
+
createDebug.init(debug7);
|
|
254
254
|
}
|
|
255
|
-
return
|
|
255
|
+
return debug7;
|
|
256
256
|
}
|
|
257
257
|
function extend(namespace, delimiter) {
|
|
258
258
|
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
@@ -822,8 +822,8 @@ var forwardProps = (setupState) => {
|
|
|
822
822
|
columns: (columns) => toMap(columns, setupState.propsCache.get("columns")),
|
|
823
823
|
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : {},
|
|
824
824
|
columnPinning: (columnPinning) => toMap(columnPinning, setupState.propsCache.get("columnPinning")),
|
|
825
|
-
columnSizing: (columnSizing) =>
|
|
826
|
-
columnTypes: (columnTypes) =>
|
|
825
|
+
columnSizing: (columnSizing) => columnSizing || {},
|
|
826
|
+
columnTypes: (columnTypes) => columnTypes || {},
|
|
827
827
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
828
828
|
columnGroups: (columnGroups) => toMap(columnGroups, setupState.propsCache.get("columnGroups"))
|
|
829
829
|
};
|
|
@@ -1192,7 +1192,7 @@ function getScrollbarWidth() {
|
|
|
1192
1192
|
// src/components/InfiniteTable/utils/getColumnComputedType.ts
|
|
1193
1193
|
var emptyType = Object.freeze({});
|
|
1194
1194
|
function getColumnComputedType(column, columnTypes) {
|
|
1195
|
-
const defaultType = columnTypes
|
|
1195
|
+
const defaultType = columnTypes["default"] || emptyType;
|
|
1196
1196
|
if (column.type === void 0) {
|
|
1197
1197
|
return defaultType;
|
|
1198
1198
|
}
|
|
@@ -1200,10 +1200,26 @@ function getColumnComputedType(column, columnTypes) {
|
|
|
1200
1200
|
return emptyType;
|
|
1201
1201
|
}
|
|
1202
1202
|
if (typeof column.type === "string") {
|
|
1203
|
-
const type = columnTypes
|
|
1203
|
+
const type = columnTypes[column.type] || emptyType;
|
|
1204
1204
|
return type;
|
|
1205
1205
|
}
|
|
1206
|
-
return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes
|
|
1206
|
+
return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes[columnType]), {});
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
// src/components/InfiniteTable/utils/assignFiltered.ts
|
|
1210
|
+
function assignFiltered(filterFn, target, ...rest) {
|
|
1211
|
+
let result = target;
|
|
1212
|
+
rest.forEach((obj) => {
|
|
1213
|
+
for (const key in obj) {
|
|
1214
|
+
if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
|
|
1215
|
+
result[key] = obj[key];
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
return result;
|
|
1220
|
+
}
|
|
1221
|
+
function assignNonNull(target, ...rest) {
|
|
1222
|
+
return assignFiltered((value) => value != null, target, ...rest);
|
|
1207
1223
|
}
|
|
1208
1224
|
|
|
1209
1225
|
// src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
|
|
@@ -1266,7 +1282,7 @@ var getComputedVisibleColumns = ({
|
|
|
1266
1282
|
maxSize: columnMaxWidth,
|
|
1267
1283
|
minSize: columnMinWidth,
|
|
1268
1284
|
items: visibleColumnOrder.map((colId) => {
|
|
1269
|
-
var _a, _b, _c, _d;
|
|
1285
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1270
1286
|
const column = columns.get(colId);
|
|
1271
1287
|
const colType = getColumnComputedType(column, columnTypes);
|
|
1272
1288
|
const colTypeSizing = {
|
|
@@ -1275,21 +1291,23 @@ var getComputedVisibleColumns = ({
|
|
|
1275
1291
|
width: colType == null ? void 0 : colType.defaultWidth,
|
|
1276
1292
|
flex: colType == null ? void 0 : colType.defaultFlex
|
|
1277
1293
|
};
|
|
1278
|
-
let colSizing =
|
|
1294
|
+
let colSizing = assignNonNull({
|
|
1279
1295
|
width: column == null ? void 0 : column.defaultWidth,
|
|
1280
|
-
flex: column == null ? void 0 : column.defaultFlex
|
|
1281
|
-
|
|
1296
|
+
flex: column == null ? void 0 : column.defaultFlex,
|
|
1297
|
+
minWidth: column == null ? void 0 : column.minWidth,
|
|
1298
|
+
maxWidth: column == null ? void 0 : column.maxWidth
|
|
1299
|
+
}, columnSizing[colId]);
|
|
1282
1300
|
if (colSizing.width != null) {
|
|
1283
1301
|
delete colTypeSizing.flex;
|
|
1284
1302
|
}
|
|
1285
1303
|
if (colSizing.flex != null) {
|
|
1286
1304
|
delete colTypeSizing.width;
|
|
1287
1305
|
}
|
|
1288
|
-
colSizing =
|
|
1306
|
+
colSizing = assignNonNull(colTypeSizing, colSizing);
|
|
1289
1307
|
let colFlex = (_a = colSizing.flex) != null ? _a : void 0;
|
|
1290
|
-
const colMinWidth = (_b = colSizing.minWidth) != null ? _b : columnMinWidth;
|
|
1291
|
-
const colMaxWidth = (
|
|
1292
|
-
let size = colFlex != void 0 ? void 0 : (
|
|
1308
|
+
const colMinWidth = (_c = (_b = colSizing.minWidth) != null ? _b : column == null ? void 0 : column.minWidth) != null ? _c : columnMinWidth;
|
|
1309
|
+
const colMaxWidth = (_e = (_d = colSizing.maxWidth) != null ? _d : column == null ? void 0 : column.maxWidth) != null ? _e : columnMaxWidth;
|
|
1310
|
+
let size = colFlex != void 0 ? void 0 : (_f = colSizing.width) != null ? _f : columnDefaultWidth;
|
|
1293
1311
|
if (!size && colFlex == void 0) {
|
|
1294
1312
|
size = colMinWidth;
|
|
1295
1313
|
}
|
|
@@ -1563,8 +1581,6 @@ var useComputedVisibleColumns = ({
|
|
|
1563
1581
|
columnVisibilityAssumeVisible,
|
|
1564
1582
|
columnSizing
|
|
1565
1583
|
}) => {
|
|
1566
|
-
const columnsSizingRenderId = useRerenderOnKeyChange(columnSizing);
|
|
1567
|
-
const columnTypesRenderId = useRerenderOnKeyChange(columnTypes);
|
|
1568
1584
|
const columnsRenderId = useRerenderOnKeyChange(columns);
|
|
1569
1585
|
const pinningRenderId = useRerenderOnKeyChange(columnPinning);
|
|
1570
1586
|
const {
|
|
@@ -1621,9 +1637,7 @@ var useComputedVisibleColumns = ({
|
|
|
1621
1637
|
pinnedStartMaxWidth,
|
|
1622
1638
|
columnPinning,
|
|
1623
1639
|
columnsRenderId,
|
|
1624
|
-
|
|
1625
|
-
pinningRenderId,
|
|
1626
|
-
columnTypesRenderId
|
|
1640
|
+
pinningRenderId
|
|
1627
1641
|
]);
|
|
1628
1642
|
const result = {
|
|
1629
1643
|
columns,
|
|
@@ -2936,7 +2950,7 @@ function enhancedFlatten(param) {
|
|
|
2936
2950
|
if (!pivot) {
|
|
2937
2951
|
const startIndex = result.length;
|
|
2938
2952
|
result.push(...items.map((item, index) => {
|
|
2939
|
-
|
|
2953
|
+
const rowInfo = {
|
|
2940
2954
|
id: item ? toPrimaryKey(item) : `${groupKeys}-${index}`,
|
|
2941
2955
|
data: item,
|
|
2942
2956
|
isGroupRow: false,
|
|
@@ -2950,6 +2964,10 @@ function enhancedFlatten(param) {
|
|
|
2950
2964
|
groupNesting,
|
|
2951
2965
|
groupCount: enhancedGroupData.groupCount
|
|
2952
2966
|
};
|
|
2967
|
+
parents.forEach((parent) => {
|
|
2968
|
+
parent.flatRowInfoList.push(rowInfo);
|
|
2969
|
+
});
|
|
2970
|
+
return rowInfo;
|
|
2953
2971
|
}));
|
|
2954
2972
|
}
|
|
2955
2973
|
} else {
|
|
@@ -4501,7 +4519,6 @@ function useComputed() {
|
|
|
4501
4519
|
column,
|
|
4502
4520
|
data,
|
|
4503
4521
|
dataArray,
|
|
4504
|
-
groupRowInfo: null,
|
|
4505
4522
|
rowInfo,
|
|
4506
4523
|
rowIndex: itemIndex
|
|
4507
4524
|
});
|
|
@@ -5496,7 +5513,9 @@ function InfiniteTableHeaderFn(props) {
|
|
|
5496
5513
|
}, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
|
|
5497
5514
|
useEffect14(() => {
|
|
5498
5515
|
const onScroll = (scrollPosition) => {
|
|
5499
|
-
domRef.current
|
|
5516
|
+
if (domRef.current) {
|
|
5517
|
+
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
5518
|
+
}
|
|
5500
5519
|
};
|
|
5501
5520
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
5502
5521
|
return removeOnScroll;
|
|
@@ -5774,7 +5793,9 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5774
5793
|
return;
|
|
5775
5794
|
}
|
|
5776
5795
|
const onScroll = (scrollPosition) => {
|
|
5777
|
-
|
|
5796
|
+
if (domRef.current) {
|
|
5797
|
+
UPDATE_SCROLL(domRef.current, scrollPosition);
|
|
5798
|
+
}
|
|
5778
5799
|
};
|
|
5779
5800
|
const removeOnScroll = scroller.onScroll(onScroll);
|
|
5780
5801
|
return removeOnScroll;
|
|
@@ -6206,7 +6227,6 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
6206
6227
|
dataArray: getData(),
|
|
6207
6228
|
column,
|
|
6208
6229
|
rowInfo,
|
|
6209
|
-
groupRowInfo,
|
|
6210
6230
|
rowIndex,
|
|
6211
6231
|
data: rowInfo.data
|
|
6212
6232
|
});
|
|
@@ -7390,11 +7410,12 @@ var VirtualBrain = class extends Logger {
|
|
|
7390
7410
|
|
|
7391
7411
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
7392
7412
|
import { useCallback as useCallback16 } from "react";
|
|
7413
|
+
var debug5 = dbg("useColumnSizeFn");
|
|
7393
7414
|
function useColumnSizeFn(computedUnpinnedColumns) {
|
|
7394
7415
|
const columnSize = useCallback16((index) => {
|
|
7395
7416
|
const column = computedUnpinnedColumns[index];
|
|
7396
7417
|
if (!column) {
|
|
7397
|
-
|
|
7418
|
+
debug5("cannot find column at index", index, computedUnpinnedColumns);
|
|
7398
7419
|
}
|
|
7399
7420
|
return column ? column.computedWidth : 0;
|
|
7400
7421
|
}, [computedUnpinnedColumns]);
|
|
@@ -7814,17 +7835,25 @@ var decode = (licenseKey) => {
|
|
|
7814
7835
|
};
|
|
7815
7836
|
|
|
7816
7837
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
7817
|
-
var
|
|
7838
|
+
var SANDPACK_REGEX = /(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g;
|
|
7839
|
+
var SANDBOX_REGEX = /(https):\/\/\S+(\.csb\.app)/g;
|
|
7818
7840
|
var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
7819
|
-
var
|
|
7820
|
-
|
|
7841
|
+
var isInsideSandpack = () => {
|
|
7842
|
+
const [_fullUrl, protocol, sandpackUrl] = Array.from(SANDPACK_REGEX.exec(origin) || []);
|
|
7843
|
+
return protocol === "https" && sandpackUrl === "sandpack.codesandbox.io";
|
|
7844
|
+
};
|
|
7845
|
+
var isInsideSandbox = () => {
|
|
7846
|
+
const [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
|
|
7847
|
+
return protocol === "https" && sandboxUrl === ".csb.app";
|
|
7848
|
+
};
|
|
7849
|
+
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
7821
7850
|
var useLicense = (licenseKey = "") => {
|
|
7822
7851
|
const valid = useMemo13(() => {
|
|
7823
7852
|
let valid2 = isValidLicense(licenseKey, {
|
|
7824
7853
|
publishedAt: 1624970570587,
|
|
7825
|
-
version: "0.2.
|
|
7854
|
+
version: "0.2.10"
|
|
7826
7855
|
});
|
|
7827
|
-
if (!licenseKey && !valid2 &&
|
|
7856
|
+
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
7828
7857
|
return true;
|
|
7829
7858
|
}
|
|
7830
7859
|
return valid2;
|
|
@@ -7840,7 +7869,7 @@ import {
|
|
|
7840
7869
|
} from "react";
|
|
7841
7870
|
import { useRef as useRef19 } from "react";
|
|
7842
7871
|
var error = err("CSSVariableWatch");
|
|
7843
|
-
var
|
|
7872
|
+
var debug6 = dbg("CSSVariableWatch");
|
|
7844
7873
|
var WRAPPER_STYLE = {
|
|
7845
7874
|
position: "absolute",
|
|
7846
7875
|
pointerEvents: "none",
|
|
@@ -7863,7 +7892,7 @@ var useCSSVariableWatch = (params) => {
|
|
|
7863
7892
|
const value = params.ref.current.getBoundingClientRect().height;
|
|
7864
7893
|
if (value) {
|
|
7865
7894
|
lastValueRef.current = value;
|
|
7866
|
-
|
|
7895
|
+
debug6(`Variable ${params.varName} found and equals ${value}.`);
|
|
7867
7896
|
params.onChange(value);
|
|
7868
7897
|
} else {
|
|
7869
7898
|
error(`Specified variable ${params.varName} not found or does not have a numeric value.`);
|
package/index.js
CHANGED
|
@@ -198,11 +198,11 @@ var require_common = __commonJS({
|
|
|
198
198
|
let enableOverride = null;
|
|
199
199
|
let namespacesCache;
|
|
200
200
|
let enabledCache;
|
|
201
|
-
function
|
|
202
|
-
if (!
|
|
201
|
+
function debug7(...args) {
|
|
202
|
+
if (!debug7.enabled) {
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
205
|
-
const self =
|
|
205
|
+
const self = debug7;
|
|
206
206
|
const curr = Number(new Date());
|
|
207
207
|
const ms = curr - (prevTime || curr);
|
|
208
208
|
self.diff = ms;
|
|
@@ -232,12 +232,12 @@ var require_common = __commonJS({
|
|
|
232
232
|
const logFn = self.log || createDebug.log;
|
|
233
233
|
logFn.apply(self, args);
|
|
234
234
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
Object.defineProperty(
|
|
235
|
+
debug7.namespace = namespace;
|
|
236
|
+
debug7.useColors = createDebug.useColors();
|
|
237
|
+
debug7.color = createDebug.selectColor(namespace);
|
|
238
|
+
debug7.extend = extend;
|
|
239
|
+
debug7.destroy = createDebug.destroy;
|
|
240
|
+
Object.defineProperty(debug7, "enabled", {
|
|
241
241
|
enumerable: true,
|
|
242
242
|
configurable: false,
|
|
243
243
|
get: () => {
|
|
@@ -255,9 +255,9 @@ var require_common = __commonJS({
|
|
|
255
255
|
}
|
|
256
256
|
});
|
|
257
257
|
if (typeof createDebug.init === "function") {
|
|
258
|
-
createDebug.init(
|
|
258
|
+
createDebug.init(debug7);
|
|
259
259
|
}
|
|
260
|
-
return
|
|
260
|
+
return debug7;
|
|
261
261
|
}
|
|
262
262
|
function extend(namespace, delimiter) {
|
|
263
263
|
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
@@ -839,8 +839,8 @@ var forwardProps = (setupState) => {
|
|
|
839
839
|
columns: (columns) => toMap(columns, setupState.propsCache.get("columns")),
|
|
840
840
|
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : {},
|
|
841
841
|
columnPinning: (columnPinning) => toMap(columnPinning, setupState.propsCache.get("columnPinning")),
|
|
842
|
-
columnSizing: (columnSizing) =>
|
|
843
|
-
columnTypes: (columnTypes) =>
|
|
842
|
+
columnSizing: (columnSizing) => columnSizing || {},
|
|
843
|
+
columnTypes: (columnTypes) => columnTypes || {},
|
|
844
844
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
845
845
|
columnGroups: (columnGroups) => toMap(columnGroups, setupState.propsCache.get("columnGroups"))
|
|
846
846
|
};
|
|
@@ -1201,7 +1201,7 @@ function getScrollbarWidth() {
|
|
|
1201
1201
|
// src/components/InfiniteTable/utils/getColumnComputedType.ts
|
|
1202
1202
|
var emptyType = Object.freeze({});
|
|
1203
1203
|
function getColumnComputedType(column, columnTypes) {
|
|
1204
|
-
const defaultType = columnTypes
|
|
1204
|
+
const defaultType = columnTypes["default"] || emptyType;
|
|
1205
1205
|
if (column.type === void 0) {
|
|
1206
1206
|
return defaultType;
|
|
1207
1207
|
}
|
|
@@ -1209,10 +1209,26 @@ function getColumnComputedType(column, columnTypes) {
|
|
|
1209
1209
|
return emptyType;
|
|
1210
1210
|
}
|
|
1211
1211
|
if (typeof column.type === "string") {
|
|
1212
|
-
const type = columnTypes
|
|
1212
|
+
const type = columnTypes[column.type] || emptyType;
|
|
1213
1213
|
return type;
|
|
1214
1214
|
}
|
|
1215
|
-
return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes
|
|
1215
|
+
return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes[columnType]), {});
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
// src/components/InfiniteTable/utils/assignFiltered.ts
|
|
1219
|
+
function assignFiltered(filterFn, target, ...rest) {
|
|
1220
|
+
let result = target;
|
|
1221
|
+
rest.forEach((obj) => {
|
|
1222
|
+
for (const key in obj) {
|
|
1223
|
+
if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
|
|
1224
|
+
result[key] = obj[key];
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
});
|
|
1228
|
+
return result;
|
|
1229
|
+
}
|
|
1230
|
+
function assignNonNull(target, ...rest) {
|
|
1231
|
+
return assignFiltered((value) => value != null, target, ...rest);
|
|
1216
1232
|
}
|
|
1217
1233
|
|
|
1218
1234
|
// src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
|
|
@@ -1275,7 +1291,7 @@ var getComputedVisibleColumns = ({
|
|
|
1275
1291
|
maxSize: columnMaxWidth,
|
|
1276
1292
|
minSize: columnMinWidth,
|
|
1277
1293
|
items: visibleColumnOrder.map((colId) => {
|
|
1278
|
-
var _a, _b, _c, _d;
|
|
1294
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1279
1295
|
const column = columns.get(colId);
|
|
1280
1296
|
const colType = getColumnComputedType(column, columnTypes);
|
|
1281
1297
|
const colTypeSizing = {
|
|
@@ -1284,21 +1300,23 @@ var getComputedVisibleColumns = ({
|
|
|
1284
1300
|
width: colType == null ? void 0 : colType.defaultWidth,
|
|
1285
1301
|
flex: colType == null ? void 0 : colType.defaultFlex
|
|
1286
1302
|
};
|
|
1287
|
-
let colSizing =
|
|
1303
|
+
let colSizing = assignNonNull({
|
|
1288
1304
|
width: column == null ? void 0 : column.defaultWidth,
|
|
1289
|
-
flex: column == null ? void 0 : column.defaultFlex
|
|
1290
|
-
|
|
1305
|
+
flex: column == null ? void 0 : column.defaultFlex,
|
|
1306
|
+
minWidth: column == null ? void 0 : column.minWidth,
|
|
1307
|
+
maxWidth: column == null ? void 0 : column.maxWidth
|
|
1308
|
+
}, columnSizing[colId]);
|
|
1291
1309
|
if (colSizing.width != null) {
|
|
1292
1310
|
delete colTypeSizing.flex;
|
|
1293
1311
|
}
|
|
1294
1312
|
if (colSizing.flex != null) {
|
|
1295
1313
|
delete colTypeSizing.width;
|
|
1296
1314
|
}
|
|
1297
|
-
colSizing =
|
|
1315
|
+
colSizing = assignNonNull(colTypeSizing, colSizing);
|
|
1298
1316
|
let colFlex = (_a = colSizing.flex) != null ? _a : void 0;
|
|
1299
|
-
const colMinWidth = (_b = colSizing.minWidth) != null ? _b : columnMinWidth;
|
|
1300
|
-
const colMaxWidth = (
|
|
1301
|
-
let size = colFlex != void 0 ? void 0 : (
|
|
1317
|
+
const colMinWidth = (_c = (_b = colSizing.minWidth) != null ? _b : column == null ? void 0 : column.minWidth) != null ? _c : columnMinWidth;
|
|
1318
|
+
const colMaxWidth = (_e = (_d = colSizing.maxWidth) != null ? _d : column == null ? void 0 : column.maxWidth) != null ? _e : columnMaxWidth;
|
|
1319
|
+
let size = colFlex != void 0 ? void 0 : (_f = colSizing.width) != null ? _f : columnDefaultWidth;
|
|
1302
1320
|
if (!size && colFlex == void 0) {
|
|
1303
1321
|
size = colMinWidth;
|
|
1304
1322
|
}
|
|
@@ -1572,8 +1590,6 @@ var useComputedVisibleColumns = ({
|
|
|
1572
1590
|
columnVisibilityAssumeVisible,
|
|
1573
1591
|
columnSizing
|
|
1574
1592
|
}) => {
|
|
1575
|
-
const columnsSizingRenderId = useRerenderOnKeyChange(columnSizing);
|
|
1576
|
-
const columnTypesRenderId = useRerenderOnKeyChange(columnTypes);
|
|
1577
1593
|
const columnsRenderId = useRerenderOnKeyChange(columns);
|
|
1578
1594
|
const pinningRenderId = useRerenderOnKeyChange(columnPinning);
|
|
1579
1595
|
const {
|
|
@@ -1630,9 +1646,7 @@ var useComputedVisibleColumns = ({
|
|
|
1630
1646
|
pinnedStartMaxWidth,
|
|
1631
1647
|
columnPinning,
|
|
1632
1648
|
columnsRenderId,
|
|
1633
|
-
|
|
1634
|
-
pinningRenderId,
|
|
1635
|
-
columnTypesRenderId
|
|
1649
|
+
pinningRenderId
|
|
1636
1650
|
]);
|
|
1637
1651
|
const result = {
|
|
1638
1652
|
columns,
|
|
@@ -2922,7 +2936,7 @@ function enhancedFlatten(param) {
|
|
|
2922
2936
|
if (!pivot) {
|
|
2923
2937
|
const startIndex = result.length;
|
|
2924
2938
|
result.push(...items.map((item, index) => {
|
|
2925
|
-
|
|
2939
|
+
const rowInfo = {
|
|
2926
2940
|
id: item ? toPrimaryKey(item) : `${groupKeys}-${index}`,
|
|
2927
2941
|
data: item,
|
|
2928
2942
|
isGroupRow: false,
|
|
@@ -2936,6 +2950,10 @@ function enhancedFlatten(param) {
|
|
|
2936
2950
|
groupNesting,
|
|
2937
2951
|
groupCount: enhancedGroupData.groupCount
|
|
2938
2952
|
};
|
|
2953
|
+
parents.forEach((parent) => {
|
|
2954
|
+
parent.flatRowInfoList.push(rowInfo);
|
|
2955
|
+
});
|
|
2956
|
+
return rowInfo;
|
|
2939
2957
|
}));
|
|
2940
2958
|
}
|
|
2941
2959
|
} else {
|
|
@@ -4487,7 +4505,6 @@ function useComputed() {
|
|
|
4487
4505
|
column,
|
|
4488
4506
|
data,
|
|
4489
4507
|
dataArray,
|
|
4490
|
-
groupRowInfo: null,
|
|
4491
4508
|
rowInfo,
|
|
4492
4509
|
rowIndex: itemIndex
|
|
4493
4510
|
});
|
|
@@ -5449,7 +5466,9 @@ function InfiniteTableHeaderFn(props) {
|
|
|
5449
5466
|
}, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
|
|
5450
5467
|
(0, import_react26.useEffect)(() => {
|
|
5451
5468
|
const onScroll = (scrollPosition) => {
|
|
5452
|
-
domRef.current
|
|
5469
|
+
if (domRef.current) {
|
|
5470
|
+
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
5471
|
+
}
|
|
5453
5472
|
};
|
|
5454
5473
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
5455
5474
|
return removeOnScroll;
|
|
@@ -5718,7 +5737,9 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5718
5737
|
return;
|
|
5719
5738
|
}
|
|
5720
5739
|
const onScroll = (scrollPosition) => {
|
|
5721
|
-
|
|
5740
|
+
if (domRef.current) {
|
|
5741
|
+
UPDATE_SCROLL(domRef.current, scrollPosition);
|
|
5742
|
+
}
|
|
5722
5743
|
};
|
|
5723
5744
|
const removeOnScroll = scroller.onScroll(onScroll);
|
|
5724
5745
|
return removeOnScroll;
|
|
@@ -6129,7 +6150,6 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
6129
6150
|
dataArray: getData(),
|
|
6130
6151
|
column,
|
|
6131
6152
|
rowInfo,
|
|
6132
|
-
groupRowInfo,
|
|
6133
6153
|
rowIndex,
|
|
6134
6154
|
data: rowInfo.data
|
|
6135
6155
|
});
|
|
@@ -7302,11 +7322,12 @@ var VirtualBrain = class extends Logger {
|
|
|
7302
7322
|
|
|
7303
7323
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
7304
7324
|
var import_react39 = __toModule(require("react"));
|
|
7325
|
+
var debug5 = dbg("useColumnSizeFn");
|
|
7305
7326
|
function useColumnSizeFn(computedUnpinnedColumns) {
|
|
7306
7327
|
const columnSize = (0, import_react39.useCallback)((index) => {
|
|
7307
7328
|
const column = computedUnpinnedColumns[index];
|
|
7308
7329
|
if (!column) {
|
|
7309
|
-
|
|
7330
|
+
debug5("cannot find column at index", index, computedUnpinnedColumns);
|
|
7310
7331
|
}
|
|
7311
7332
|
return column ? column.computedWidth : 0;
|
|
7312
7333
|
}, [computedUnpinnedColumns]);
|
|
@@ -7721,17 +7742,25 @@ var decode = (licenseKey) => {
|
|
|
7721
7742
|
};
|
|
7722
7743
|
|
|
7723
7744
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
7724
|
-
var
|
|
7745
|
+
var SANDPACK_REGEX = /(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g;
|
|
7746
|
+
var SANDBOX_REGEX = /(https):\/\/\S+(\.csb\.app)/g;
|
|
7725
7747
|
var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
7726
|
-
var
|
|
7727
|
-
|
|
7748
|
+
var isInsideSandpack = () => {
|
|
7749
|
+
const [_fullUrl, protocol, sandpackUrl] = Array.from(SANDPACK_REGEX.exec(origin) || []);
|
|
7750
|
+
return protocol === "https" && sandpackUrl === "sandpack.codesandbox.io";
|
|
7751
|
+
};
|
|
7752
|
+
var isInsideSandbox = () => {
|
|
7753
|
+
const [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
|
|
7754
|
+
return protocol === "https" && sandboxUrl === ".csb.app";
|
|
7755
|
+
};
|
|
7756
|
+
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
7728
7757
|
var useLicense = (licenseKey = "") => {
|
|
7729
7758
|
const valid = (0, import_react43.useMemo)(() => {
|
|
7730
7759
|
let valid2 = isValidLicense(licenseKey, {
|
|
7731
7760
|
publishedAt: 1624970570587,
|
|
7732
|
-
version: "0.2.
|
|
7761
|
+
version: "0.2.10"
|
|
7733
7762
|
});
|
|
7734
|
-
if (!licenseKey && !valid2 &&
|
|
7763
|
+
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
7735
7764
|
return true;
|
|
7736
7765
|
}
|
|
7737
7766
|
return valid2;
|
|
@@ -7743,7 +7772,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
7743
7772
|
var React32 = __toModule(require("react"));
|
|
7744
7773
|
var import_react44 = __toModule(require("react"));
|
|
7745
7774
|
var error = err("CSSVariableWatch");
|
|
7746
|
-
var
|
|
7775
|
+
var debug6 = dbg("CSSVariableWatch");
|
|
7747
7776
|
var WRAPPER_STYLE = {
|
|
7748
7777
|
position: "absolute",
|
|
7749
7778
|
pointerEvents: "none",
|
|
@@ -7766,7 +7795,7 @@ var useCSSVariableWatch = (params) => {
|
|
|
7766
7795
|
const value = params.ref.current.getBoundingClientRect().height;
|
|
7767
7796
|
if (value) {
|
|
7768
7797
|
lastValueRef.current = value;
|
|
7769
|
-
|
|
7798
|
+
debug6(`Variable ${params.varName} found and equals ${value}.`);
|
|
7770
7799
|
params.onChange(value);
|
|
7771
7800
|
} else {
|
|
7772
7801
|
error(`Specified variable ${params.varName} not found or does not have a numeric value.`);
|
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.2.
|
|
4
|
+
"version": "0.2.10",
|
|
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": 1646346500550
|
|
18
18
|
}
|