@infinite-table/infinite-react 0.0.7 → 0.0.8
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/README.md +11 -71
- package/index.d.ts +85 -40
- package/index.esm.js +164 -76
- package/index.js +164 -76
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -482,14 +482,14 @@ var require_browser = __commonJS({
|
|
|
482
482
|
} else {
|
|
483
483
|
exports.storage.removeItem("debug");
|
|
484
484
|
}
|
|
485
|
-
} catch (
|
|
485
|
+
} catch (error2) {
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
function load() {
|
|
489
489
|
let r;
|
|
490
490
|
try {
|
|
491
491
|
r = exports.storage.getItem("debug");
|
|
492
|
-
} catch (
|
|
492
|
+
} catch (error2) {
|
|
493
493
|
}
|
|
494
494
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
495
495
|
r = process.env.DEBUG;
|
|
@@ -499,7 +499,7 @@ var require_browser = __commonJS({
|
|
|
499
499
|
function localstorage() {
|
|
500
500
|
try {
|
|
501
501
|
return localStorage;
|
|
502
|
-
} catch (
|
|
502
|
+
} catch (error2) {
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
505
|
module2.exports = require_common()(exports);
|
|
@@ -507,8 +507,8 @@ var require_browser = __commonJS({
|
|
|
507
507
|
formatters.j = function(v) {
|
|
508
508
|
try {
|
|
509
509
|
return JSON.stringify(v);
|
|
510
|
-
} catch (
|
|
511
|
-
return "[UnexpectedJSONParseError]: " +
|
|
510
|
+
} catch (error2) {
|
|
511
|
+
return "[UnexpectedJSONParseError]: " + error2.message;
|
|
512
512
|
}
|
|
513
513
|
};
|
|
514
514
|
}
|
|
@@ -793,6 +793,15 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
793
793
|
}
|
|
794
794
|
|
|
795
795
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
796
|
+
function toMap(mapOrObject) {
|
|
797
|
+
if (!mapOrObject) {
|
|
798
|
+
return new Map();
|
|
799
|
+
}
|
|
800
|
+
if (mapOrObject instanceof Map) {
|
|
801
|
+
return mapOrObject;
|
|
802
|
+
}
|
|
803
|
+
return new Map(Object.entries(mapOrObject));
|
|
804
|
+
}
|
|
796
805
|
function initSetupState() {
|
|
797
806
|
const columnsGeneratedForGrouping = new Map();
|
|
798
807
|
return {
|
|
@@ -822,7 +831,10 @@ function initSetupState() {
|
|
|
822
831
|
}
|
|
823
832
|
var forwardProps = () => {
|
|
824
833
|
return {
|
|
825
|
-
columns:
|
|
834
|
+
columns: (columns) => {
|
|
835
|
+
var _a;
|
|
836
|
+
return (_a = toMap(columns)) != null ? _a : new Map();
|
|
837
|
+
},
|
|
826
838
|
components: 1,
|
|
827
839
|
loadingText: 1,
|
|
828
840
|
pivotColumns: 1,
|
|
@@ -848,15 +860,16 @@ var forwardProps = () => {
|
|
|
848
860
|
pivotColumn: 1,
|
|
849
861
|
pivotRowLabelsColumn: 1,
|
|
850
862
|
pivotColumnGroups: 1,
|
|
863
|
+
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
851
864
|
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
852
865
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
853
866
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
854
|
-
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth :
|
|
867
|
+
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
855
868
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
856
869
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
857
870
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
858
871
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
859
|
-
licenseKey: (licenseKey) => licenseKey ||
|
|
872
|
+
licenseKey: (licenseKey) => licenseKey || "",
|
|
860
873
|
columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
|
|
861
874
|
header: (header) => header != null ? header : true,
|
|
862
875
|
showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
|
|
@@ -866,6 +879,14 @@ var forwardProps = () => {
|
|
|
866
879
|
headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
|
|
867
880
|
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : new Map(),
|
|
868
881
|
columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
|
|
882
|
+
columnSizing: (columnSizing) => {
|
|
883
|
+
var _a;
|
|
884
|
+
return (_a = toMap(columnSizing)) != null ? _a : new Map();
|
|
885
|
+
},
|
|
886
|
+
columnTypes: (columnTypes) => {
|
|
887
|
+
var _a;
|
|
888
|
+
return (_a = toMap(columnTypes)) != null ? _a : new Map();
|
|
889
|
+
},
|
|
869
890
|
columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
|
|
870
891
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
871
892
|
columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
|
|
@@ -900,7 +921,7 @@ var mapPropsToState = (params) => {
|
|
|
900
921
|
return {
|
|
901
922
|
groupRenderStrategy,
|
|
902
923
|
groupRowsBy,
|
|
903
|
-
computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy ||
|
|
924
|
+
computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns,
|
|
904
925
|
virtualizeHeader,
|
|
905
926
|
columnGroupsDepthsMap,
|
|
906
927
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
@@ -1032,7 +1053,7 @@ var computeFlex = (params) => {
|
|
|
1032
1053
|
items.forEach((item, i) => {
|
|
1033
1054
|
var _a, _b, _c, _d, _e, _f;
|
|
1034
1055
|
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
1035
|
-
let minSize = (_d = (_c = item.
|
|
1056
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
1036
1057
|
if (item.size != null) {
|
|
1037
1058
|
if (maxSize != null && item.size > maxSize) {
|
|
1038
1059
|
item.size = maxSize;
|
|
@@ -1060,7 +1081,7 @@ var computeFlex = (params) => {
|
|
|
1060
1081
|
if (item.flex != null) {
|
|
1061
1082
|
const approxFlexSize = sizePerFlex * item.flex;
|
|
1062
1083
|
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
1063
|
-
let minSize = (_d = (_c = item.
|
|
1084
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
1064
1085
|
let constrained = false;
|
|
1065
1086
|
let substractSize = 0;
|
|
1066
1087
|
if (maxSize != null && approxFlexSize > maxSize) {
|
|
@@ -1195,8 +1216,52 @@ var Logger = class {
|
|
|
1195
1216
|
}
|
|
1196
1217
|
};
|
|
1197
1218
|
|
|
1219
|
+
// src/utils/getGlobal.ts
|
|
1220
|
+
function getGlobal() {
|
|
1221
|
+
return globalThis;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
// src/components/utils/getScrollbarWidth.ts
|
|
1225
|
+
var scrollbarWidth;
|
|
1226
|
+
function getScrollbarWidth() {
|
|
1227
|
+
var _a, _b;
|
|
1228
|
+
if (scrollbarWidth != null) {
|
|
1229
|
+
return scrollbarWidth;
|
|
1230
|
+
}
|
|
1231
|
+
const doc = (_a = getGlobal().document) != null ? _a : null;
|
|
1232
|
+
if (!doc) {
|
|
1233
|
+
return 0;
|
|
1234
|
+
}
|
|
1235
|
+
const outer = doc.createElement("div");
|
|
1236
|
+
outer.style.visibility = "hidden";
|
|
1237
|
+
outer.style.overflow = "scroll";
|
|
1238
|
+
doc.body.appendChild(outer);
|
|
1239
|
+
const inner = doc.createElement("div");
|
|
1240
|
+
outer.appendChild(inner);
|
|
1241
|
+
scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
|
1242
|
+
(_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
|
|
1243
|
+
return scrollbarWidth;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
// src/components/InfiniteTable/utils/getColumnComputedType.ts
|
|
1247
|
+
var emptyType = Object.freeze({});
|
|
1248
|
+
function getColumnComputedType(column, columnTypes) {
|
|
1249
|
+
const defaultType = columnTypes.get("default") || emptyType;
|
|
1250
|
+
if (column.type === void 0) {
|
|
1251
|
+
return defaultType;
|
|
1252
|
+
}
|
|
1253
|
+
if (column.type === null) {
|
|
1254
|
+
return emptyType;
|
|
1255
|
+
}
|
|
1256
|
+
if (typeof column.type === "string") {
|
|
1257
|
+
const type = columnTypes.get(column.type) || emptyType;
|
|
1258
|
+
return type;
|
|
1259
|
+
}
|
|
1260
|
+
return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes.get(columnType)), {});
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1198
1263
|
// src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
|
|
1199
|
-
var
|
|
1264
|
+
var logError = err("getComputedVisibleColumns");
|
|
1200
1265
|
var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
|
|
1201
1266
|
return !columnVisibility.has(colId) || columnVisibility.get(colId) !== false;
|
|
1202
1267
|
};
|
|
@@ -1217,22 +1282,26 @@ var getComputedVisibleColumns = ({
|
|
|
1217
1282
|
sortInfo,
|
|
1218
1283
|
setSortInfo,
|
|
1219
1284
|
multiSort,
|
|
1285
|
+
viewportReservedWidth,
|
|
1220
1286
|
draggableColumns,
|
|
1221
1287
|
columnOrder,
|
|
1222
1288
|
columnPinning,
|
|
1289
|
+
columnSizing,
|
|
1290
|
+
columnTypes,
|
|
1223
1291
|
columnVisibility,
|
|
1224
1292
|
columnVisibilityAssumeVisible
|
|
1225
1293
|
}) => {
|
|
1226
1294
|
let computedOffset = 0;
|
|
1227
1295
|
const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
|
|
1228
|
-
const visibleColumnOrder = normalizedColumnOrder.filter(
|
|
1229
|
-
|
|
1230
|
-
let col = columns.get(columnId);
|
|
1296
|
+
const visibleColumnOrder = normalizedColumnOrder.filter((colId) => {
|
|
1297
|
+
let col = columns.get(colId);
|
|
1231
1298
|
if (!col) {
|
|
1232
|
-
|
|
1299
|
+
logError(`Column with id "${colId}" specified in columnOrder array cannot be found in the columns map.`);
|
|
1300
|
+
return false;
|
|
1233
1301
|
}
|
|
1234
|
-
return
|
|
1235
|
-
})
|
|
1302
|
+
return isColumnVisible(columnVisibility, columnVisibilityAssumeVisible, colId);
|
|
1303
|
+
});
|
|
1304
|
+
const columnsArray = visibleColumnOrder.map((columnId) => columns.get(columnId)).filter(Boolean);
|
|
1236
1305
|
const sortedMap = (sortInfo != null ? sortInfo : []).reduce((acc, info, index) => {
|
|
1237
1306
|
if (info.id) {
|
|
1238
1307
|
acc[info.id] = { sortInfo: info, index };
|
|
@@ -1246,20 +1315,39 @@ var getComputedVisibleColumns = ({
|
|
|
1246
1315
|
return acc;
|
|
1247
1316
|
}, {});
|
|
1248
1317
|
const flexResult = computeFlex({
|
|
1249
|
-
availableSize: bodySize.width,
|
|
1318
|
+
availableSize: Math.max(bodySize.width - (viewportReservedWidth != null ? viewportReservedWidth : 0) - getScrollbarWidth(), 0),
|
|
1250
1319
|
maxSize: columnMaxWidth,
|
|
1251
1320
|
minSize: columnMinWidth,
|
|
1252
|
-
items:
|
|
1253
|
-
var _a, _b;
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1321
|
+
items: visibleColumnOrder.map((colId) => {
|
|
1322
|
+
var _a, _b, _c, _d;
|
|
1323
|
+
const column = columns.get(colId);
|
|
1324
|
+
const colType = getColumnComputedType(column, columnTypes);
|
|
1325
|
+
const colTypeSizing = {
|
|
1326
|
+
minWidth: colType == null ? void 0 : colType.minWidth,
|
|
1327
|
+
maxWidth: colType == null ? void 0 : colType.maxWidth,
|
|
1328
|
+
width: colType == null ? void 0 : colType.width,
|
|
1329
|
+
flex: colType == null ? void 0 : colType.flex
|
|
1330
|
+
};
|
|
1331
|
+
let colSizing = columnSizing.get(colId) || {};
|
|
1332
|
+
if (colSizing.width != null) {
|
|
1333
|
+
delete colTypeSizing.flex;
|
|
1334
|
+
}
|
|
1335
|
+
if (colSizing.flex != null) {
|
|
1336
|
+
delete colTypeSizing.width;
|
|
1337
|
+
}
|
|
1338
|
+
colSizing = Object.assign(colTypeSizing, colSizing);
|
|
1339
|
+
let colFlex = (_a = colSizing.flex) != null ? _a : void 0;
|
|
1340
|
+
const colMinWidth = (_b = colSizing.minWidth) != null ? _b : columnMinWidth;
|
|
1341
|
+
const colMaxWidth = (_c = colSizing.maxWidth) != null ? _c : columnMaxWidth;
|
|
1342
|
+
let size = colFlex != void 0 ? void 0 : (_d = colSizing.width) != null ? _d : columnDefaultWidth;
|
|
1343
|
+
if (!size && colFlex == void 0) {
|
|
1344
|
+
size = colMinWidth;
|
|
1257
1345
|
}
|
|
1258
1346
|
return {
|
|
1259
1347
|
size,
|
|
1260
|
-
flex:
|
|
1261
|
-
minSize:
|
|
1262
|
-
maxSize:
|
|
1348
|
+
flex: colFlex,
|
|
1349
|
+
minSize: colMinWidth,
|
|
1350
|
+
maxSize: colMaxWidth
|
|
1263
1351
|
};
|
|
1264
1352
|
})
|
|
1265
1353
|
});
|
|
@@ -1294,6 +1382,7 @@ var getComputedVisibleColumns = ({
|
|
|
1294
1382
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1295
1383
|
const id = visibleColumnOrder[i];
|
|
1296
1384
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
1385
|
+
const colType = getColumnComputedType(c, columnTypes);
|
|
1297
1386
|
const sortingInfo = sortedMap[id] ? sortedMap[id] : c.field ? (_a = sortedMap[c.field]) != null ? _a : null : null;
|
|
1298
1387
|
const computedSortInfo = (_b = sortingInfo == null ? void 0 : sortingInfo.sortInfo) != null ? _b : null;
|
|
1299
1388
|
const computedSorted = !!computedSortInfo;
|
|
@@ -1349,8 +1438,10 @@ var getComputedVisibleColumns = ({
|
|
|
1349
1438
|
const computedFirstInCategory = computedPinned !== prevPinned;
|
|
1350
1439
|
const computedLastInCategory = computedLast || computedPinned !== getComputedPinned(nextColumnId, columnPinning);
|
|
1351
1440
|
const result2 = __spreadProps(__spreadValues({
|
|
1352
|
-
align:
|
|
1353
|
-
verticalAlign:
|
|
1441
|
+
align: colType.align,
|
|
1442
|
+
verticalAlign: colType.verticalAlign,
|
|
1443
|
+
renderValue: colType.renderValue,
|
|
1444
|
+
render: colType.render
|
|
1354
1445
|
}, c), {
|
|
1355
1446
|
computedWidth,
|
|
1356
1447
|
computedAbsoluteOffset,
|
|
@@ -1512,11 +1603,16 @@ var useComputedVisibleColumns = ({
|
|
|
1512
1603
|
setSortInfo,
|
|
1513
1604
|
columnOrder,
|
|
1514
1605
|
columnPinning,
|
|
1606
|
+
columnTypes,
|
|
1515
1607
|
pinnedEndMaxWidth,
|
|
1516
1608
|
pinnedStartMaxWidth,
|
|
1609
|
+
viewportReservedWidth,
|
|
1517
1610
|
columnVisibility,
|
|
1518
|
-
columnVisibilityAssumeVisible
|
|
1611
|
+
columnVisibilityAssumeVisible,
|
|
1612
|
+
columnSizing
|
|
1519
1613
|
}) => {
|
|
1614
|
+
const columnsSizingRenderId = useRerenderOnKeyChange(columnSizing);
|
|
1615
|
+
const columnTypesRenderId = useRerenderOnKeyChange(columnTypes);
|
|
1520
1616
|
const columnsRenderId = useRerenderOnKeyChange(columns);
|
|
1521
1617
|
const visibilityRenderId = useRerenderOnKeyChange(columnVisibility);
|
|
1522
1618
|
const pinningRenderId = useRerenderOnKeyChange(columnPinning);
|
|
@@ -1542,6 +1638,7 @@ var useComputedVisibleColumns = ({
|
|
|
1542
1638
|
columnMinWidth,
|
|
1543
1639
|
columnMaxWidth,
|
|
1544
1640
|
columnDefaultWidth,
|
|
1641
|
+
viewportReservedWidth,
|
|
1545
1642
|
sortable,
|
|
1546
1643
|
sortInfo,
|
|
1547
1644
|
setSortInfo,
|
|
@@ -1551,6 +1648,8 @@ var useComputedVisibleColumns = ({
|
|
|
1551
1648
|
draggableColumns,
|
|
1552
1649
|
columnOrder,
|
|
1553
1650
|
columnPinning,
|
|
1651
|
+
columnSizing,
|
|
1652
|
+
columnTypes,
|
|
1554
1653
|
columnVisibility,
|
|
1555
1654
|
columnVisibilityAssumeVisible: columnVisibilityAssumeVisible != null ? columnVisibilityAssumeVisible : true
|
|
1556
1655
|
});
|
|
@@ -1572,7 +1671,9 @@ var useComputedVisibleColumns = ({
|
|
|
1572
1671
|
columnPinning,
|
|
1573
1672
|
columnsRenderId,
|
|
1574
1673
|
visibilityRenderId,
|
|
1575
|
-
|
|
1674
|
+
columnsSizingRenderId,
|
|
1675
|
+
pinningRenderId,
|
|
1676
|
+
columnTypesRenderId
|
|
1576
1677
|
]);
|
|
1577
1678
|
const result = {
|
|
1578
1679
|
columns,
|
|
@@ -2972,15 +3073,17 @@ function enhancedFlatten(param) {
|
|
|
2972
3073
|
}
|
|
2973
3074
|
|
|
2974
3075
|
// src/utils/multisort/sortTypes.ts
|
|
3076
|
+
var numberComparator = function(first, second) {
|
|
3077
|
+
return first - second;
|
|
3078
|
+
};
|
|
3079
|
+
var stringComparator = function(first, second) {
|
|
3080
|
+
first = `${first}`;
|
|
3081
|
+
second = `${second}`;
|
|
3082
|
+
return first.localeCompare(second);
|
|
3083
|
+
};
|
|
2975
3084
|
var sortTypes = {
|
|
2976
|
-
number:
|
|
2977
|
-
|
|
2978
|
-
},
|
|
2979
|
-
string: function(first, second) {
|
|
2980
|
-
first = `${first}`;
|
|
2981
|
-
second = `${second}`;
|
|
2982
|
-
return first.localeCompare(second);
|
|
2983
|
-
}
|
|
3085
|
+
number: numberComparator,
|
|
3086
|
+
string: stringComparator
|
|
2984
3087
|
};
|
|
2985
3088
|
var sortTypes_default = sortTypes;
|
|
2986
3089
|
|
|
@@ -3535,20 +3638,22 @@ function getColumnsWhenGrouping(params) {
|
|
|
3535
3638
|
const computedColumns = new Map();
|
|
3536
3639
|
if (groupRenderStrategy === "multi-column") {
|
|
3537
3640
|
groupRowsBy.forEach((groupByForColumn, groupIndexForColumn, arr) => {
|
|
3538
|
-
|
|
3641
|
+
const generatedGroupColumn = getColumnForGroupBy({
|
|
3539
3642
|
groupByForColumn,
|
|
3540
3643
|
groupRowsBy,
|
|
3541
3644
|
groupIndexForColumn,
|
|
3542
3645
|
groupCount: arr.length,
|
|
3543
3646
|
groupRenderStrategy
|
|
3544
|
-
}, toggleGroupRow, groupColumn)
|
|
3647
|
+
}, toggleGroupRow, groupColumn);
|
|
3648
|
+
computedColumns.set(generatedGroupColumn.id || `group-by-${groupByForColumn.field}`, generatedGroupColumn);
|
|
3545
3649
|
});
|
|
3546
3650
|
} else if (groupRenderStrategy === "single-column") {
|
|
3547
|
-
|
|
3651
|
+
const singleGroupColumn = getSingleGroupColumn({
|
|
3548
3652
|
groupCount: groupRowsBy.length,
|
|
3549
3653
|
groupRowsBy,
|
|
3550
3654
|
groupRenderStrategy
|
|
3551
|
-
}, toggleGroupRow, groupColumn)
|
|
3655
|
+
}, toggleGroupRow, groupColumn);
|
|
3656
|
+
computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
|
|
3552
3657
|
}
|
|
3553
3658
|
columns.forEach((col, colId) => {
|
|
3554
3659
|
computedColumns.set(colId, col);
|
|
@@ -3564,7 +3669,14 @@ function useComputed() {
|
|
|
3564
3669
|
componentActions: dataSourceActions,
|
|
3565
3670
|
componentState: dataSourceState
|
|
3566
3671
|
} = useDataSourceContextValue();
|
|
3567
|
-
const {
|
|
3672
|
+
const {
|
|
3673
|
+
columnOrder,
|
|
3674
|
+
columnVisibility,
|
|
3675
|
+
columnPinning,
|
|
3676
|
+
columnSizing,
|
|
3677
|
+
columnTypes,
|
|
3678
|
+
bodySize
|
|
3679
|
+
} = componentState;
|
|
3568
3680
|
(0, import_react19.useState)(() => {
|
|
3569
3681
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
3570
3682
|
if (rowHeight) {
|
|
@@ -3609,6 +3721,7 @@ function useComputed() {
|
|
|
3609
3721
|
pinnedStartMaxWidth: componentState.pinnedStartMaxWidth,
|
|
3610
3722
|
pinnedEndMaxWidth: componentState.pinnedEndMaxWidth,
|
|
3611
3723
|
bodySize,
|
|
3724
|
+
viewportReservedWidth: componentState.viewportReservedWidth,
|
|
3612
3725
|
sortable: componentState.sortable,
|
|
3613
3726
|
draggableColumns: componentState.draggableColumns,
|
|
3614
3727
|
sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
|
|
@@ -3617,7 +3730,9 @@ function useComputed() {
|
|
|
3617
3730
|
columnOrder,
|
|
3618
3731
|
columnVisibility,
|
|
3619
3732
|
columnVisibilityAssumeVisible: true,
|
|
3620
|
-
columnPinning
|
|
3733
|
+
columnPinning,
|
|
3734
|
+
columnSizing,
|
|
3735
|
+
columnTypes
|
|
3621
3736
|
});
|
|
3622
3737
|
const unpinnedColumnWidths = computedUnpinnedColumns.map((c) => c.computedWidth);
|
|
3623
3738
|
let sortedUnpinnedColumnWidths = [...unpinnedColumnWidths].sort(sortAscending);
|
|
@@ -3688,33 +3803,6 @@ var InfiniteTableBody = React10.forwardRef(function InfiniteTableBody2(props, re
|
|
|
3688
3803
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
3689
3804
|
var React22 = __toModule(require("react"));
|
|
3690
3805
|
|
|
3691
|
-
// src/utils/getGlobal.ts
|
|
3692
|
-
function getGlobal() {
|
|
3693
|
-
return globalThis;
|
|
3694
|
-
}
|
|
3695
|
-
|
|
3696
|
-
// src/components/utils/getScrollbarWidth.ts
|
|
3697
|
-
var scrollbarWidth;
|
|
3698
|
-
function getScrollbarWidth() {
|
|
3699
|
-
var _a, _b;
|
|
3700
|
-
if (scrollbarWidth != null) {
|
|
3701
|
-
return scrollbarWidth;
|
|
3702
|
-
}
|
|
3703
|
-
const doc = (_a = getGlobal().document) != null ? _a : null;
|
|
3704
|
-
if (!doc) {
|
|
3705
|
-
return 0;
|
|
3706
|
-
}
|
|
3707
|
-
const outer = doc.createElement("div");
|
|
3708
|
-
outer.style.visibility = "hidden";
|
|
3709
|
-
outer.style.overflow = "scroll";
|
|
3710
|
-
doc.body.appendChild(outer);
|
|
3711
|
-
const inner = doc.createElement("div");
|
|
3712
|
-
outer.appendChild(inner);
|
|
3713
|
-
scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
|
3714
|
-
(_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
|
|
3715
|
-
return scrollbarWidth;
|
|
3716
|
-
}
|
|
3717
|
-
|
|
3718
3806
|
// src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx
|
|
3719
3807
|
var React11 = __toModule(require("react"));
|
|
3720
3808
|
function HorizontalScrollbarPlaceholderFn(props) {
|
|
@@ -6875,11 +6963,11 @@ var SANDBOX_REGEX = /(https):\/\/\d+\-\d+\-\d\-(sandpack\.codesandbox\.io)/g;
|
|
|
6875
6963
|
var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
6876
6964
|
var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
|
|
6877
6965
|
var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
|
|
6878
|
-
var useLicense = (licenseKey) => {
|
|
6966
|
+
var useLicense = (licenseKey = "") => {
|
|
6879
6967
|
const valid = (0, import_react43.useMemo)(() => {
|
|
6880
6968
|
let valid2 = isValidLicense(licenseKey, {
|
|
6881
6969
|
publishedAt: 1624970570587,
|
|
6882
|
-
version: "0.0.
|
|
6970
|
+
version: "0.0.8"
|
|
6883
6971
|
});
|
|
6884
6972
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
6885
6973
|
return true;
|
|
@@ -6892,7 +6980,7 @@ var useLicense = (licenseKey) => {
|
|
|
6892
6980
|
// src/components/CSSVariableWatch.tsx
|
|
6893
6981
|
var React34 = __toModule(require("react"));
|
|
6894
6982
|
var import_react44 = __toModule(require("react"));
|
|
6895
|
-
var
|
|
6983
|
+
var error = err("CSSVariableWatch");
|
|
6896
6984
|
var debug5 = dbg("CSSVariableWatch");
|
|
6897
6985
|
var WRAPPER_STYLE = {
|
|
6898
6986
|
position: "absolute",
|
|
@@ -6919,7 +7007,7 @@ var useCSSVariableWatch = (params) => {
|
|
|
6919
7007
|
debug5(`Variable ${params.varName} found and equals ${value}.`);
|
|
6920
7008
|
params.onChange(value);
|
|
6921
7009
|
} else {
|
|
6922
|
-
|
|
7010
|
+
error(`Specified variable ${params.varName} not found or does not have a numeric value.`);
|
|
6923
7011
|
}
|
|
6924
7012
|
}, []);
|
|
6925
7013
|
};
|
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.0.
|
|
4
|
+
"version": "0.0.8",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.esm.js",
|
|
7
7
|
"typings": "index.d.ts",
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
},
|
|
16
16
|
"license": "Commercial & Open Source",
|
|
17
17
|
"//": "will be updated at build time",
|
|
18
|
-
"publishedAt":
|
|
18
|
+
"publishedAt": 1639747608830
|
|
19
19
|
}
|