@infinite-table/infinite-react 0.3.12 → 0.3.15
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 +4 -0
- package/index.css +91 -51
- package/index.d.ts +7 -4
- package/index.esm.css +91 -51
- package/index.esm.js +1219 -540
- package/index.js +1263 -588
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -665,8 +665,8 @@ function debounce(fn, { wait }) {
|
|
|
665
665
|
}
|
|
666
666
|
|
|
667
667
|
// src/components/InfiniteTable/index.tsx
|
|
668
|
-
var
|
|
669
|
-
var
|
|
668
|
+
var React36 = __toModule(require("react"));
|
|
669
|
+
var import_react49 = __toModule(require("react"));
|
|
670
670
|
|
|
671
671
|
// src/utils/join.ts
|
|
672
672
|
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
@@ -704,13 +704,16 @@ var Logger = class {
|
|
|
704
704
|
// src/components/ResizeObserver/index.tsx
|
|
705
705
|
var React = __toModule(require("react"));
|
|
706
706
|
var import_react = __toModule(require("react"));
|
|
707
|
-
var setupResizeObserver = (node, callback) => {
|
|
707
|
+
var setupResizeObserver = (node, callback, config = { debounce: 0 }) => {
|
|
708
|
+
var _a;
|
|
709
|
+
const debounceTime = (_a = config.debounce) != null ? _a : 0;
|
|
708
710
|
const RO = window.ResizeObserver;
|
|
711
|
+
const onResizeCallback = debounceTime ? debounce(callback, { wait: debounceTime }) : callback;
|
|
709
712
|
const observer = new RO((entries) => {
|
|
710
|
-
var
|
|
713
|
+
var _a2;
|
|
711
714
|
const entry = entries[0];
|
|
712
715
|
let { width, height } = entry.contentRect;
|
|
713
|
-
if ((
|
|
716
|
+
if ((_a2 = entry.borderBoxSize) == null ? void 0 : _a2[0]) {
|
|
714
717
|
height = entry.borderBoxSize[0].blockSize;
|
|
715
718
|
width = entry.borderBoxSize[0].inlineSize;
|
|
716
719
|
} else {
|
|
@@ -718,14 +721,17 @@ var setupResizeObserver = (node, callback) => {
|
|
|
718
721
|
height = rect.height;
|
|
719
722
|
width = rect.width;
|
|
720
723
|
}
|
|
721
|
-
|
|
724
|
+
onResizeCallback({ width, height });
|
|
722
725
|
});
|
|
723
726
|
observer.observe(node);
|
|
724
727
|
return () => {
|
|
725
728
|
observer.disconnect();
|
|
726
729
|
};
|
|
727
730
|
};
|
|
728
|
-
var useResizeObserver = (ref, callback, config = {
|
|
731
|
+
var useResizeObserver = (ref, callback, config = {
|
|
732
|
+
earlyAttach: false,
|
|
733
|
+
debounce: 0
|
|
734
|
+
}) => {
|
|
729
735
|
const sizeRef = (0, import_react.useRef)({
|
|
730
736
|
width: 0,
|
|
731
737
|
height: 0
|
|
@@ -743,7 +749,7 @@ var useResizeObserver = (ref, callback, config = { earlyAttach: false }) => {
|
|
|
743
749
|
sizeRef.current = size;
|
|
744
750
|
callback2(size);
|
|
745
751
|
}
|
|
746
|
-
});
|
|
752
|
+
}, { debounce: config.debounce });
|
|
747
753
|
}
|
|
748
754
|
return () => {
|
|
749
755
|
if (disconnect) {
|
|
@@ -757,7 +763,7 @@ var useResizeObserver = (ref, callback, config = { earlyAttach: false }) => {
|
|
|
757
763
|
}
|
|
758
764
|
return () => {
|
|
759
765
|
};
|
|
760
|
-
}, [ref.current, callback, config.earlyAttach]);
|
|
766
|
+
}, [ref.current, callback, config.earlyAttach, config.debounce]);
|
|
761
767
|
(0, import_react.useLayoutEffect)(() => {
|
|
762
768
|
if (config.earlyAttach) {
|
|
763
769
|
return effectFn(callback);
|
|
@@ -1080,6 +1086,73 @@ var cancelRaf = getGlobal().cancelAnimationFrame || ((timeoutId) => {
|
|
|
1080
1086
|
return clearTimeout(timeoutId);
|
|
1081
1087
|
});
|
|
1082
1088
|
|
|
1089
|
+
// src/utils/stripVar.ts
|
|
1090
|
+
function stripVar(cssVariableWithVarString) {
|
|
1091
|
+
return cssVariableWithVarString.slice(4, -1);
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
// src/components/InfiniteTable/theme.css.ts
|
|
1095
|
+
var InternalVars = { currentColumnWidth: "var(--_1slvgu90)", currentColumnTransformX: "var(--_1slvgu91)", currentColumnTransformY: "var(--_1slvgu92)", activeCellRowOffset: "var(--_1slvgu93)", activeCellRowHeight: "var(--_1slvgu94)", activeCellOffsetX: "var(--_1slvgu95)", activeCellOffsetY: "var(--_1slvgu96)", scrollLeftForActiveCell: "var(--_1slvgu97)", scrollTopForActiveCell: "var(--_1slvgu98)", activeCellColWidth: "var(--_1slvgu99)", activeCellColOffset: "var(--_1slvgu9a)", columnWidthAtIndex: "var(--_1slvgu9b)", columnOffsetAtIndex: "var(--_1slvgu9c)" };
|
|
1096
|
+
var ThemeVars = { color: { accent: "var(--infinite-accent-color)", error: "var(--infinite-error-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", columnHeaderHeight: "var(--infinite-column-header-height)" }, HeaderCell: { draggingBackground: "var(--infinite-header-cell-dragging-background)", background: "var(--infinite-header-cell-background)", hoverBackground: "var(--infinite-header-cell-hover-background)", padding: "var(--infinite-header-cell-padding)", paddingX: "var(--infinite-header-cell-padding-x)", paddingY: "var(--infinite-header-cell-padding-y)", iconSize: "var(--infinite-header-cell-icon-size)", sortIconMargin: "var(--infinite-header-cell-sort-icon-margin)", resizeHandleActiveAreaWidth: "var(--infinite-resize-handle-active-area-width)", resizeHandleWidth: "var(--infinite-resize-handle-width)", resizeHandleHoverBackground: "var(--infinite-resize-handle-hover-background)", resizeHandleConstrainedHoverBackground: "var(--infinite-resize-handle-constrained-hover-background)" }, Cell: { padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)", color: "var(--infinite-cell-color)", activeBorderColor_R: "var(--infinite-active-cell-border-color--r)", activeBorderColor_G: "var(--infinite-active-cell-border-color--g)", activeBorderColor_B: "var(--infinite-active-cell-border-color--b)", activeBackgroundAlpha: "var(--infinite-active-cell-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-cell-background-alpha--table-unfocused)", activeBackground: "var(--infinite-active-cell-background)", activeBorderColor: "var(--infinite-active-cell-border-color)", activeBorderWidth: "var(--infinite-active-cell-border-width)", activeBorderStyle: "var(--infinite-active-cell-border-style)", activeBorder: "var(--infinite-active-cell-border)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", activeBackground: "var(--infinite-active-row-background)", activeBorderColor: "var(--infinite-active-row-border-color)", activeBorderWidth: "var(--infinite-active-row-border-width)", activeBorderStyle: "var(--infinite-active-row-border-style)", activeBorder: "var(--infinite-active-row-border)", activeBackgroundAlpha: "var(--infinite-active-row-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-row-background-alpha--table-unfocused)", hoverBackground: "var(--infinite-row-hover-background)", groupRowBackground: "var(--infinite-group-row-background)", groupRowColumnNesting: "var(--infinite-group-row-column-nesting)", groupNesting: "var(--infinite-dont-override-group-row-nesting-length)", pointerEventsWhileScrolling: "var(--infinite-row-pointer-events-while-scrolling)" }, ColumnCell: { background: "var(--infinite-column-cell-bg-dont-override)" } } };
|
|
1097
|
+
var columnHeaderHeightName = "column-header-height";
|
|
1098
|
+
|
|
1099
|
+
// src/utils/selectParent.ts
|
|
1100
|
+
function selectParent(el, selector) {
|
|
1101
|
+
let node = el;
|
|
1102
|
+
if (node && node.matches(selector)) {
|
|
1103
|
+
return node;
|
|
1104
|
+
}
|
|
1105
|
+
while (node = node.parentElement) {
|
|
1106
|
+
if (node.matches(selector)) {
|
|
1107
|
+
return node;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
return null;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
// src/components/InfiniteTable/internalProps.ts
|
|
1114
|
+
var rootClassName2 = "Infinite";
|
|
1115
|
+
var internalProps = {
|
|
1116
|
+
rootClassName: rootClassName2
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
// src/components/InfiniteTable/utils/infiniteDOMUtils.ts
|
|
1120
|
+
var InfiniteSelector = `.${internalProps.rootClassName}`;
|
|
1121
|
+
function getParentInfiniteNode(node) {
|
|
1122
|
+
return selectParent(node, InfiniteSelector);
|
|
1123
|
+
}
|
|
1124
|
+
var columnWidthAtIndex = stripVar(InternalVars.columnWidthAtIndex);
|
|
1125
|
+
var columnOffsetAtIndex = stripVar(InternalVars.columnOffsetAtIndex);
|
|
1126
|
+
function setInfiniteVarOnRoot(varName, varValue, node) {
|
|
1127
|
+
const infinite = node ? getParentInfiniteNode(node) : document.querySelector(InfiniteSelector);
|
|
1128
|
+
setInfiniteVarOnNode(varName, varValue, infinite);
|
|
1129
|
+
}
|
|
1130
|
+
function setInfiniteVarOnNode(varName, varValue, node) {
|
|
1131
|
+
if (node) {
|
|
1132
|
+
const prop = InternalVars[varName] ? stripVar(InternalVars[varName]) : varName;
|
|
1133
|
+
node.style.setProperty(prop, `${varValue}`);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
function setInfiniteVarsOnNode(vars, node) {
|
|
1137
|
+
if (node) {
|
|
1138
|
+
for (var varName in vars) {
|
|
1139
|
+
node.style.setProperty(InternalVars[varName] ? stripVar(InternalVars[varName]) : varName, `${vars[varName]}`);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
function setInfiniteColumnWidth(colIndex, colWidth, node) {
|
|
1144
|
+
setInfiniteVarOnRoot(`${columnWidthAtIndex}-${colIndex}`, typeof colWidth === "number" ? colWidth + "px" : colWidth, node);
|
|
1145
|
+
}
|
|
1146
|
+
function setInfiniteColumnOffset(colIndex, colOffset, node) {
|
|
1147
|
+
setInfiniteVarOnRoot(`${columnOffsetAtIndex}-${colIndex}`, typeof colOffset === "number" ? colOffset + "px" : colOffset, node);
|
|
1148
|
+
}
|
|
1149
|
+
function getCSSVarNameForColWidth(colIndex) {
|
|
1150
|
+
return `${columnWidthAtIndex}-${colIndex}`;
|
|
1151
|
+
}
|
|
1152
|
+
function getCSSVarNameForColOffset(colIndex) {
|
|
1153
|
+
return `${columnOffsetAtIndex}-${colIndex}`;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1083
1156
|
// src/components/VirtualBrain/MatrixBrain.ts
|
|
1084
1157
|
var import_binary_search = __toModule(require_binary_search());
|
|
1085
1158
|
var getRenderRangeCellCount = (range) => {
|
|
@@ -1115,13 +1188,13 @@ var MatrixBrain = class extends Logger {
|
|
|
1115
1188
|
this.extraSpanCells = [];
|
|
1116
1189
|
this.scrollPosition = { scrollLeft: 0, scrollTop: 0 };
|
|
1117
1190
|
this.onScrollFns = [];
|
|
1118
|
-
this.onRenderRangeChangeFns =
|
|
1119
|
-
this.onVerticalRenderRangeChangeFns =
|
|
1120
|
-
this.onHorizontalRenderRangeChangeFns =
|
|
1191
|
+
this.onRenderRangeChangeFns = new Set();
|
|
1192
|
+
this.onVerticalRenderRangeChangeFns = new Set();
|
|
1193
|
+
this.onHorizontalRenderRangeChangeFns = new Set();
|
|
1121
1194
|
this.onDestroyFns = [];
|
|
1122
1195
|
this.destroyed = false;
|
|
1123
|
-
this.onRenderCountChangeFns =
|
|
1124
|
-
this.onAvailableSizeChangeFns =
|
|
1196
|
+
this.onRenderCountChangeFns = new Set();
|
|
1197
|
+
this.onAvailableSizeChangeFns = new Set();
|
|
1125
1198
|
this.onScrollStartFns = [];
|
|
1126
1199
|
this.onScrollStopFns = [];
|
|
1127
1200
|
this.scrollTimeoutId = 0;
|
|
@@ -1285,14 +1358,16 @@ var MatrixBrain = class extends Logger {
|
|
|
1285
1358
|
}
|
|
1286
1359
|
const fns = this.onAvailableSizeChangeFns;
|
|
1287
1360
|
const range = this.getAvailableSize();
|
|
1288
|
-
|
|
1361
|
+
fns.forEach((fn) => {
|
|
1289
1362
|
raf2(() => {
|
|
1290
1363
|
if (this.destroyed) {
|
|
1291
1364
|
return;
|
|
1292
1365
|
}
|
|
1293
|
-
fns
|
|
1366
|
+
if (fns.has(fn)) {
|
|
1367
|
+
fn(range);
|
|
1368
|
+
}
|
|
1294
1369
|
});
|
|
1295
|
-
}
|
|
1370
|
+
});
|
|
1296
1371
|
};
|
|
1297
1372
|
this.notifyRenderRangeChange = () => {
|
|
1298
1373
|
if (this.destroyed) {
|
|
@@ -1300,14 +1375,16 @@ var MatrixBrain = class extends Logger {
|
|
|
1300
1375
|
}
|
|
1301
1376
|
const fns = this.onRenderRangeChangeFns;
|
|
1302
1377
|
const range = this.getRenderRange();
|
|
1303
|
-
|
|
1378
|
+
fns.forEach((fn) => {
|
|
1304
1379
|
raf2(() => {
|
|
1305
1380
|
if (this.destroyed) {
|
|
1306
1381
|
return;
|
|
1307
1382
|
}
|
|
1308
|
-
fns
|
|
1383
|
+
if (fns.has(fn)) {
|
|
1384
|
+
fn(range);
|
|
1385
|
+
}
|
|
1309
1386
|
});
|
|
1310
|
-
}
|
|
1387
|
+
});
|
|
1311
1388
|
};
|
|
1312
1389
|
this.notifyVerticalRenderRangeChange = () => {
|
|
1313
1390
|
if (this.destroyed) {
|
|
@@ -1315,14 +1392,16 @@ var MatrixBrain = class extends Logger {
|
|
|
1315
1392
|
}
|
|
1316
1393
|
const fns = this.onVerticalRenderRangeChangeFns;
|
|
1317
1394
|
const range = this.verticalRenderRange;
|
|
1318
|
-
|
|
1395
|
+
fns.forEach((fn) => {
|
|
1319
1396
|
raf2(() => {
|
|
1320
1397
|
if (this.destroyed) {
|
|
1321
1398
|
return;
|
|
1322
1399
|
}
|
|
1323
|
-
fns
|
|
1400
|
+
if (fns.has(fn)) {
|
|
1401
|
+
fn([range.startIndex, range.endIndex]);
|
|
1402
|
+
}
|
|
1324
1403
|
});
|
|
1325
|
-
}
|
|
1404
|
+
});
|
|
1326
1405
|
};
|
|
1327
1406
|
this.notifyHorizontalRenderRangeChange = () => {
|
|
1328
1407
|
if (this.destroyed) {
|
|
@@ -1330,14 +1409,16 @@ var MatrixBrain = class extends Logger {
|
|
|
1330
1409
|
}
|
|
1331
1410
|
const fns = this.onHorizontalRenderRangeChangeFns;
|
|
1332
1411
|
const range = this.horizontalRenderRange;
|
|
1333
|
-
|
|
1412
|
+
fns.forEach((fn) => {
|
|
1334
1413
|
raf2(() => {
|
|
1335
1414
|
if (this.destroyed) {
|
|
1336
1415
|
return;
|
|
1337
1416
|
}
|
|
1338
|
-
fns
|
|
1417
|
+
if (fns.has(fn)) {
|
|
1418
|
+
fn([range.startIndex, range.endIndex]);
|
|
1419
|
+
}
|
|
1339
1420
|
});
|
|
1340
|
-
}
|
|
1421
|
+
});
|
|
1341
1422
|
};
|
|
1342
1423
|
this.computeDirectionalRenderCount = (direction, itemSize, count, theSize) => {
|
|
1343
1424
|
let renderCount = 0;
|
|
@@ -1349,11 +1430,11 @@ var MatrixBrain = class extends Logger {
|
|
|
1349
1430
|
sizes.push(this.getItemSize(i, direction));
|
|
1350
1431
|
}
|
|
1351
1432
|
sizes.sort(SORT_ASC);
|
|
1352
|
-
let
|
|
1433
|
+
let sum2 = 0;
|
|
1353
1434
|
for (let i = 0; i < count; i++) {
|
|
1354
|
-
|
|
1435
|
+
sum2 += sizes[i];
|
|
1355
1436
|
renderCount++;
|
|
1356
|
-
if (
|
|
1437
|
+
if (sum2 > size) {
|
|
1357
1438
|
break;
|
|
1358
1439
|
}
|
|
1359
1440
|
}
|
|
@@ -1368,11 +1449,11 @@ var MatrixBrain = class extends Logger {
|
|
|
1368
1449
|
if (!this.fixedColsEnd) {
|
|
1369
1450
|
return 0;
|
|
1370
1451
|
}
|
|
1371
|
-
let
|
|
1452
|
+
let sum2 = 0;
|
|
1372
1453
|
for (let i = this.cols - this.fixedColsEnd; i < this.cols; i++) {
|
|
1373
|
-
|
|
1454
|
+
sum2 += this.getColWidth(i);
|
|
1374
1455
|
}
|
|
1375
|
-
return
|
|
1456
|
+
return sum2;
|
|
1376
1457
|
};
|
|
1377
1458
|
this.getFixedEndColsOffsets = () => {
|
|
1378
1459
|
if (!this.fixedColsEnd) {
|
|
@@ -1382,19 +1463,19 @@ var MatrixBrain = class extends Logger {
|
|
|
1382
1463
|
const { width } = this.getAvailableSize();
|
|
1383
1464
|
const offsets = [];
|
|
1384
1465
|
const widths = [];
|
|
1385
|
-
let
|
|
1466
|
+
let sum2 = 0;
|
|
1386
1467
|
for (let colIndex = this.cols - this.fixedColsEnd; colIndex < this.cols; colIndex++) {
|
|
1387
1468
|
const colWidth = this.getColWidth(colIndex);
|
|
1388
1469
|
widths.push(colWidth);
|
|
1389
|
-
|
|
1470
|
+
sum2 += colWidth;
|
|
1390
1471
|
}
|
|
1391
|
-
const baseOffset = width -
|
|
1392
|
-
|
|
1472
|
+
const baseOffset = width - sum2 + scrollLeft;
|
|
1473
|
+
sum2 = 0;
|
|
1393
1474
|
let index = 0;
|
|
1394
1475
|
for (let colIndex = this.cols - this.fixedColsEnd; colIndex < this.cols; colIndex++) {
|
|
1395
|
-
const offset = baseOffset +
|
|
1476
|
+
const offset = baseOffset + sum2;
|
|
1396
1477
|
offsets[colIndex] = offset;
|
|
1397
|
-
|
|
1478
|
+
sum2 += widths[index];
|
|
1398
1479
|
index++;
|
|
1399
1480
|
}
|
|
1400
1481
|
return offsets;
|
|
@@ -1407,19 +1488,19 @@ var MatrixBrain = class extends Logger {
|
|
|
1407
1488
|
const { height } = this.getAvailableSize();
|
|
1408
1489
|
const offsets = [];
|
|
1409
1490
|
const heights = [];
|
|
1410
|
-
let
|
|
1491
|
+
let sum2 = 0;
|
|
1411
1492
|
for (let rowIndex = this.rows - this.fixedRowsEnd; rowIndex < this.rows; rowIndex++) {
|
|
1412
1493
|
const rowHeight = this.getRowHeight(rowIndex);
|
|
1413
1494
|
heights.push(rowHeight);
|
|
1414
|
-
|
|
1495
|
+
sum2 += rowHeight;
|
|
1415
1496
|
}
|
|
1416
|
-
const baseOffset = height -
|
|
1417
|
-
|
|
1497
|
+
const baseOffset = height - sum2 + scrollTop;
|
|
1498
|
+
sum2 = 0;
|
|
1418
1499
|
let index = 0;
|
|
1419
1500
|
for (let rowIndex = this.rows - this.fixedRowsEnd; rowIndex < this.rows; rowIndex++) {
|
|
1420
|
-
const offset = baseOffset +
|
|
1501
|
+
const offset = baseOffset + sum2;
|
|
1421
1502
|
offsets[rowIndex] = offset;
|
|
1422
|
-
|
|
1503
|
+
sum2 += heights[index];
|
|
1423
1504
|
index++;
|
|
1424
1505
|
}
|
|
1425
1506
|
return offsets;
|
|
@@ -1428,31 +1509,31 @@ var MatrixBrain = class extends Logger {
|
|
|
1428
1509
|
if (!this.fixedColsStart) {
|
|
1429
1510
|
return 0;
|
|
1430
1511
|
}
|
|
1431
|
-
let
|
|
1512
|
+
let sum2 = 0;
|
|
1432
1513
|
for (let i = 0; i < this.fixedColsStart; i++) {
|
|
1433
|
-
|
|
1514
|
+
sum2 += this.getColWidth(i);
|
|
1434
1515
|
}
|
|
1435
|
-
return
|
|
1516
|
+
return sum2;
|
|
1436
1517
|
};
|
|
1437
1518
|
this.getFixedEndRowsHeight = () => {
|
|
1438
1519
|
if (!this.fixedRowsEnd) {
|
|
1439
1520
|
return 0;
|
|
1440
1521
|
}
|
|
1441
|
-
let
|
|
1522
|
+
let sum2 = 0;
|
|
1442
1523
|
for (let i = this.rows - this.fixedRowsEnd; i < this.rows; i++) {
|
|
1443
|
-
|
|
1524
|
+
sum2 += this.getRowHeight(i);
|
|
1444
1525
|
}
|
|
1445
|
-
return
|
|
1526
|
+
return sum2;
|
|
1446
1527
|
};
|
|
1447
1528
|
this.getFixedStartRowsHeight = () => {
|
|
1448
1529
|
if (!this.fixedRowsStart) {
|
|
1449
1530
|
return 0;
|
|
1450
1531
|
}
|
|
1451
|
-
let
|
|
1532
|
+
let sum2 = 0;
|
|
1452
1533
|
for (let i = 0; i < this.fixedRowsStart; i++) {
|
|
1453
|
-
|
|
1534
|
+
sum2 += this.getRowHeight(i);
|
|
1454
1535
|
}
|
|
1455
|
-
return
|
|
1536
|
+
return sum2;
|
|
1456
1537
|
};
|
|
1457
1538
|
this.computeRenderCount = (which = ALL_DIRECTIONS) => {
|
|
1458
1539
|
const recomputeHorizontal = which.horizontal;
|
|
@@ -1883,33 +1964,33 @@ var MatrixBrain = class extends Logger {
|
|
|
1883
1964
|
};
|
|
1884
1965
|
};
|
|
1885
1966
|
this.onRenderRangeChange = (fn) => {
|
|
1886
|
-
this.onRenderRangeChangeFns.
|
|
1967
|
+
this.onRenderRangeChangeFns.add(fn);
|
|
1887
1968
|
return () => {
|
|
1888
|
-
this.onRenderRangeChangeFns
|
|
1969
|
+
this.onRenderRangeChangeFns.delete(fn);
|
|
1889
1970
|
};
|
|
1890
1971
|
};
|
|
1891
1972
|
this.onVerticalRenderRangeChange = (fn) => {
|
|
1892
|
-
this.onVerticalRenderRangeChangeFns.
|
|
1973
|
+
this.onVerticalRenderRangeChangeFns.add(fn);
|
|
1893
1974
|
return () => {
|
|
1894
|
-
this.onVerticalRenderRangeChangeFns
|
|
1975
|
+
this.onVerticalRenderRangeChangeFns.delete(fn);
|
|
1895
1976
|
};
|
|
1896
1977
|
};
|
|
1897
1978
|
this.onHorizontalRenderRangeChange = (fn) => {
|
|
1898
|
-
this.onHorizontalRenderRangeChangeFns.
|
|
1979
|
+
this.onHorizontalRenderRangeChangeFns.add(fn);
|
|
1899
1980
|
return () => {
|
|
1900
|
-
this.onHorizontalRenderRangeChangeFns
|
|
1981
|
+
this.onHorizontalRenderRangeChangeFns.delete(fn);
|
|
1901
1982
|
};
|
|
1902
1983
|
};
|
|
1903
1984
|
this.onRenderCountChange = (fn) => {
|
|
1904
|
-
this.onRenderCountChangeFns.
|
|
1985
|
+
this.onRenderCountChangeFns.add(fn);
|
|
1905
1986
|
return () => {
|
|
1906
|
-
this.onRenderCountChangeFns
|
|
1987
|
+
this.onRenderCountChangeFns.delete(fn);
|
|
1907
1988
|
};
|
|
1908
1989
|
};
|
|
1909
1990
|
this.onAvailableSizeChange = (fn) => {
|
|
1910
|
-
this.onAvailableSizeChangeFns.
|
|
1991
|
+
this.onAvailableSizeChangeFns.add(fn);
|
|
1911
1992
|
return () => {
|
|
1912
|
-
this.onAvailableSizeChangeFns
|
|
1993
|
+
this.onAvailableSizeChangeFns.delete(fn);
|
|
1913
1994
|
};
|
|
1914
1995
|
};
|
|
1915
1996
|
this.onDestroy = (fn) => {
|
|
@@ -1937,10 +2018,10 @@ var MatrixBrain = class extends Logger {
|
|
|
1937
2018
|
this.onScrollFns = [];
|
|
1938
2019
|
this.onScrollStartFns = [];
|
|
1939
2020
|
this.onScrollStopFns = [];
|
|
1940
|
-
this.onRenderCountChangeFns =
|
|
1941
|
-
this.onRenderRangeChangeFns =
|
|
1942
|
-
this.onVerticalRenderRangeChangeFns =
|
|
1943
|
-
this.onHorizontalRenderRangeChangeFns =
|
|
2021
|
+
this.onRenderCountChangeFns = new Set();
|
|
2022
|
+
this.onRenderRangeChangeFns = new Set();
|
|
2023
|
+
this.onVerticalRenderRangeChangeFns = new Set();
|
|
2024
|
+
this.onHorizontalRenderRangeChangeFns = new Set();
|
|
1944
2025
|
};
|
|
1945
2026
|
this.reset();
|
|
1946
2027
|
}
|
|
@@ -1986,8 +2067,8 @@ var MatrixBrain = class extends Logger {
|
|
|
1986
2067
|
let { width, height } = size;
|
|
1987
2068
|
width = width != null ? width : this.width;
|
|
1988
2069
|
height = height != null ? height : this.height;
|
|
1989
|
-
const widthSame =
|
|
1990
|
-
const heightSame =
|
|
2070
|
+
const widthSame = width === this.width;
|
|
2071
|
+
const heightSame = height === this.height;
|
|
1991
2072
|
if (widthSame && heightSame) {
|
|
1992
2073
|
return;
|
|
1993
2074
|
}
|
|
@@ -2039,14 +2120,16 @@ var MatrixBrain = class extends Logger {
|
|
|
2039
2120
|
vertical: verticalRenderCount
|
|
2040
2121
|
};
|
|
2041
2122
|
const fns = this.onRenderCountChangeFns;
|
|
2042
|
-
|
|
2123
|
+
fns.forEach((fn) => {
|
|
2043
2124
|
raf2(() => {
|
|
2044
2125
|
if (this.destroyed) {
|
|
2045
2126
|
return;
|
|
2046
2127
|
}
|
|
2047
|
-
fns
|
|
2128
|
+
if (fns.has(fn)) {
|
|
2129
|
+
fn(renderCount);
|
|
2130
|
+
}
|
|
2048
2131
|
});
|
|
2049
|
-
}
|
|
2132
|
+
});
|
|
2050
2133
|
}
|
|
2051
2134
|
getItemSizeCacheFor(itemIndex, direction) {
|
|
2052
2135
|
return (direction === "horizontal" ? this.colWidthCache : this.rowHeightCache)[itemIndex];
|
|
@@ -2540,18 +2623,31 @@ var MappedCells = class extends Logger {
|
|
|
2540
2623
|
|
|
2541
2624
|
// src/components/HeadlessTable/ReactHeadlessTableRenderer.tsx
|
|
2542
2625
|
var ITEM_POSITION_WITH_TRANSFORM = true;
|
|
2626
|
+
var currentColumnTransformY = stripVar(InternalVars.currentColumnTransformY);
|
|
2627
|
+
var columnTransformX = stripVar(InternalVars.columnOffsetAtIndex);
|
|
2543
2628
|
var ReactHeadlessTableRenderer = class extends Logger {
|
|
2544
2629
|
constructor(brain) {
|
|
2545
2630
|
super("ReactHeadlessTableRenderer");
|
|
2546
2631
|
this.destroyed = false;
|
|
2547
2632
|
this.scrolling = false;
|
|
2548
2633
|
this.cellHoverClassNames = [];
|
|
2634
|
+
this.name = "";
|
|
2549
2635
|
this.itemDOMElements = [];
|
|
2550
2636
|
this.itemDOMRefs = [];
|
|
2551
2637
|
this.updaters = [];
|
|
2552
2638
|
this.items = [];
|
|
2553
2639
|
this.currentHoveredRow = -1;
|
|
2554
2640
|
this.hoverRowUpdatesInProgress = new Map();
|
|
2641
|
+
this.infiniteNode = null;
|
|
2642
|
+
this.setTransform = (element, _rowIndex, colIndex, x, y) => {
|
|
2643
|
+
const transformXVar = `${columnTransformX}-${colIndex}`;
|
|
2644
|
+
if (!this.infiniteNode) {
|
|
2645
|
+
this.infiniteNode = getParentInfiniteNode(element);
|
|
2646
|
+
}
|
|
2647
|
+
this.infiniteNode.style.setProperty(transformXVar, `${x}px`);
|
|
2648
|
+
element.style.setProperty(currentColumnTransformY, `${y}px`);
|
|
2649
|
+
element.style.transform = `translate3d(var(${transformXVar}), ${InternalVars.currentColumnTransformY}, 0)`;
|
|
2650
|
+
};
|
|
2555
2651
|
this.getFullyVisibleRowsRange = () => {
|
|
2556
2652
|
let {
|
|
2557
2653
|
start: [startRow],
|
|
@@ -2748,7 +2844,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2748
2844
|
extraCellsMap.set(`${rowIndex}:${colIndex}`, true);
|
|
2749
2845
|
});
|
|
2750
2846
|
}
|
|
2751
|
-
const renderCount = ranges.reduce((
|
|
2847
|
+
const renderCount = ranges.reduce((sum2, range2) => sum2 + getRenderRangeCellCount(range2), 0);
|
|
2752
2848
|
if (this.itemDOMElements.length >= renderCount) {
|
|
2753
2849
|
mappedCells.discardElementsStartingWith(renderCount, (elementIndex) => {
|
|
2754
2850
|
if (this.updaters[elementIndex]) {
|
|
@@ -3002,6 +3098,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3002
3098
|
if (this.scrolling) {
|
|
3003
3099
|
return;
|
|
3004
3100
|
}
|
|
3101
|
+
if (false) {
|
|
3102
|
+
return;
|
|
3103
|
+
}
|
|
3005
3104
|
if (this.hoverRowUpdatesInProgress.has(rowIndex)) {
|
|
3006
3105
|
return;
|
|
3007
3106
|
}
|
|
@@ -3017,6 +3116,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3017
3116
|
};
|
|
3018
3117
|
raf(() => {
|
|
3019
3118
|
checkHoverClass();
|
|
3119
|
+
if (false) {
|
|
3120
|
+
return;
|
|
3121
|
+
}
|
|
3020
3122
|
this.hoverRowUpdatesInProgress.delete(rowIndex);
|
|
3021
3123
|
});
|
|
3022
3124
|
};
|
|
@@ -3037,12 +3139,10 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3037
3139
|
const { x, y } = itemPosition;
|
|
3038
3140
|
if (itemElement) {
|
|
3039
3141
|
this.updateHoverClassNamesForRow(rowIndex);
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
itemElement.dataset.colIndex = colIndex;
|
|
3043
|
-
}
|
|
3142
|
+
itemElement.dataset.rowIndex = rowIndex;
|
|
3143
|
+
itemElement.dataset.colIndex = colIndex;
|
|
3044
3144
|
if (ITEM_POSITION_WITH_TRANSFORM) {
|
|
3045
|
-
itemElement
|
|
3145
|
+
this.setTransform(itemElement, rowIndex, colIndex, x, y);
|
|
3046
3146
|
itemElement.style.willChange = "transform";
|
|
3047
3147
|
itemElement.style.backfaceVisibility = "hidden";
|
|
3048
3148
|
const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
|
|
@@ -3087,39 +3187,39 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3087
3187
|
fn(rowIndex, colIndex, node, itemPosition, scrollPosition);
|
|
3088
3188
|
}
|
|
3089
3189
|
}
|
|
3090
|
-
|
|
3190
|
+
const adjustColStart = (_rowIndex, colIndex, node, { x, y }, { scrollLeft }) => {
|
|
3091
3191
|
node.style.zIndex = `${fixedColsStart - colIndex}`;
|
|
3092
|
-
node
|
|
3093
|
-
}
|
|
3094
|
-
|
|
3192
|
+
this.setTransform(node, _rowIndex, colIndex, x + scrollLeft, y);
|
|
3193
|
+
};
|
|
3194
|
+
const adjustRowStart = (rowIndex, _colIndex, node, coords, scrollPosition2) => {
|
|
3095
3195
|
node.style.zIndex = `${fixedRowsStart - rowIndex}`;
|
|
3096
|
-
node
|
|
3097
|
-
}
|
|
3098
|
-
|
|
3196
|
+
this.setTransform(node, rowIndex, _colIndex, coords.x, coords.y + scrollPosition2.scrollTop);
|
|
3197
|
+
};
|
|
3198
|
+
const adjustColEnd = (_rowIndex, colIndex, node, { y }) => {
|
|
3099
3199
|
node.style.zIndex = `${cols - colIndex}`;
|
|
3100
3200
|
const val = fixedEndColsOffsets[colIndex];
|
|
3101
|
-
node
|
|
3102
|
-
}
|
|
3103
|
-
|
|
3201
|
+
this.setTransform(node, _rowIndex, colIndex, val, y);
|
|
3202
|
+
};
|
|
3203
|
+
const adjustRowEnd = (rowIndex, _colIndex, node, coords) => {
|
|
3104
3204
|
node.style.zIndex = `${rows - rowIndex}`;
|
|
3105
|
-
node
|
|
3106
|
-
}
|
|
3107
|
-
|
|
3205
|
+
this.setTransform(node, rowIndex, _colIndex, coords.x, fixedEndRowsOffsets[rowIndex]);
|
|
3206
|
+
};
|
|
3207
|
+
const adjustColStartRowStart = (_rowIndex, _colIndex, node, { x, y }, scrollPosition2) => {
|
|
3108
3208
|
node.style.zIndex = `1000000`;
|
|
3109
|
-
node
|
|
3110
|
-
}
|
|
3111
|
-
|
|
3209
|
+
this.setTransform(node, _rowIndex, _colIndex, x + scrollPosition2.scrollLeft, y + scrollPosition2.scrollTop);
|
|
3210
|
+
};
|
|
3211
|
+
const adjustColStartRowEnd = (_rowIndex, _colIndex, node, { x }, scrollPosition2) => {
|
|
3112
3212
|
node.style.zIndex = `2000000`;
|
|
3113
|
-
node
|
|
3114
|
-
}
|
|
3115
|
-
|
|
3213
|
+
this.setTransform(node, _rowIndex, _colIndex, x + scrollPosition2.scrollLeft, fixedEndRowsOffsets[_rowIndex]);
|
|
3214
|
+
};
|
|
3215
|
+
const adjustColEndRowStart = (_rowIndex, colIndex, node, coords) => {
|
|
3116
3216
|
node.style.zIndex = `3000000`;
|
|
3117
|
-
node
|
|
3118
|
-
}
|
|
3119
|
-
|
|
3217
|
+
this.setTransform(node, _rowIndex, colIndex, fixedEndColsOffsets[colIndex], coords.y + scrollPosition.scrollTop);
|
|
3218
|
+
};
|
|
3219
|
+
const adjustColEndRowEnd = (rowIndex, colIndex, node) => {
|
|
3120
3220
|
node.style.zIndex = `4000000`;
|
|
3121
|
-
node
|
|
3122
|
-
}
|
|
3221
|
+
this.setTransform(node, rowIndex, colIndex, fixedEndColsOffsets[colIndex], fixedEndRowsOffsets[rowIndex]);
|
|
3222
|
+
};
|
|
3123
3223
|
if (fixedColsStart || fixedColsEnd) {
|
|
3124
3224
|
for (let rowIndex = startRow; rowIndex < endRow; rowIndex++) {
|
|
3125
3225
|
for (let colIndex = 0; colIndex < fixedColsStart; colIndex++) {
|
|
@@ -3350,14 +3450,12 @@ var useRerender = () => {
|
|
|
3350
3450
|
];
|
|
3351
3451
|
};
|
|
3352
3452
|
|
|
3353
|
-
// src/components/InfiniteTable/
|
|
3354
|
-
var
|
|
3355
|
-
var
|
|
3356
|
-
rootClassName: rootClassName2
|
|
3357
|
-
};
|
|
3453
|
+
// src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
|
|
3454
|
+
var ActiveCellIndicatorCls = { visible: "nxbq1c2 nxbq1c1 _16lm1iwf _16lm1iw3 _16lm1iwx _16lm1iwv", hidden: "nxbq1c3 nxbq1c1 _16lm1iwf _16lm1iw3 _16lm1iwx _16lm1iwv" };
|
|
3455
|
+
var ActiveIndicatorWrapperCls = "_16lm1iwf _16lm1iw3 _16lm1iwx _16lm1iwv _16lm1iwr";
|
|
3358
3456
|
|
|
3359
3457
|
// src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
|
|
3360
|
-
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0
|
|
3458
|
+
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwf _16lm1iw3 _16lm1iwu _16lm1iwv _16lm1iwx", hidden: "j26lrx2 j26lrx0 _16lm1iwf _16lm1iw3 _16lm1iwu _16lm1iwv _16lm1iwx" };
|
|
3361
3459
|
|
|
3362
3460
|
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
3363
3461
|
var { rootClassName: rootClassName3 } = internalProps;
|
|
@@ -3394,6 +3492,9 @@ var ActiveRowIndicatorFn = (props) => {
|
|
|
3394
3492
|
};
|
|
3395
3493
|
}, [brain]);
|
|
3396
3494
|
return /* @__PURE__ */ React10.createElement("div", {
|
|
3495
|
+
className: ActiveIndicatorWrapperCls,
|
|
3496
|
+
"data-name": "active-row"
|
|
3497
|
+
}, /* @__PURE__ */ React10.createElement("div", {
|
|
3397
3498
|
ref: domRef,
|
|
3398
3499
|
"data-name": "active-row-indicator",
|
|
3399
3500
|
className: `${baseCls} ${active ? ActiveRowIndicatorCls.visible : ActiveRowIndicatorCls.hidden}`,
|
|
@@ -3401,74 +3502,67 @@ var ActiveRowIndicatorFn = (props) => {
|
|
|
3401
3502
|
transform: `translate3d(0px, ${-brain.getScrollPosition().scrollTop + state.top}px,0)`,
|
|
3402
3503
|
height: state.rowHeight
|
|
3403
3504
|
} : void 0
|
|
3404
|
-
});
|
|
3505
|
+
}));
|
|
3405
3506
|
};
|
|
3406
3507
|
var ActiveRowIndicator = React10.memo(ActiveRowIndicatorFn);
|
|
3407
3508
|
|
|
3408
3509
|
// src/components/InfiniteTable/components/ActiveCellIndicator.tsx
|
|
3409
3510
|
var React11 = __toModule(require("react"));
|
|
3410
3511
|
var import_react10 = __toModule(require("react"));
|
|
3411
|
-
|
|
3412
|
-
// src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
|
|
3413
|
-
var ActiveCellIndicatorCls = { visible: "nxbq1c1 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu", hidden: "nxbq1c2 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu" };
|
|
3414
|
-
|
|
3415
|
-
// src/components/InfiniteTable/components/ActiveCellIndicator.tsx
|
|
3416
3512
|
var { rootClassName: rootClassName4 } = internalProps;
|
|
3417
3513
|
var baseCls2 = `${rootClassName4}-ActiveCellIndicator`;
|
|
3514
|
+
var ActiveStyle = {
|
|
3515
|
+
[stripVar(InternalVars.activeCellOffsetX)]: `calc( ${InternalVars.scrollLeftForActiveCell} + ${InternalVars.activeCellColOffset} )`,
|
|
3516
|
+
[stripVar(InternalVars.activeCellOffsetY)]: `calc( ${InternalVars.scrollTopForActiveCell} + ${InternalVars.activeCellRowOffset} )`,
|
|
3517
|
+
transform: `translate3d(${InternalVars.activeCellOffsetX}, ${InternalVars.activeCellOffsetY}, 0px)`,
|
|
3518
|
+
width: InternalVars.activeCellColWidth,
|
|
3519
|
+
height: InternalVars.activeCellRowHeight
|
|
3520
|
+
};
|
|
3418
3521
|
var ActiveCellIndicatorFn = (props) => {
|
|
3419
3522
|
const { brain } = props;
|
|
3420
|
-
const [
|
|
3421
|
-
const [state, setState] = (0, import_react10.useState)({
|
|
3422
|
-
top: 0,
|
|
3423
|
-
rowHeight: 0,
|
|
3424
|
-
colWidth: 0,
|
|
3425
|
-
left: 0
|
|
3426
|
-
});
|
|
3523
|
+
const [_rerenderId, rerender] = useRerender();
|
|
3427
3524
|
const domRef = (0, import_react10.useRef)(null);
|
|
3428
|
-
const stateRef = (0, import_react10.useRef)(state);
|
|
3429
3525
|
const active = props.activeCellIndex != null && brain.getRowCount() > props.activeCellIndex[0];
|
|
3430
3526
|
(0, import_react10.useLayoutEffect)(() => {
|
|
3431
3527
|
if (props.activeCellIndex == null) {
|
|
3432
3528
|
return;
|
|
3433
3529
|
}
|
|
3434
3530
|
const rowIndex = props.activeCellIndex[0];
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3531
|
+
const activeCellRowHeight = brain.getRowHeight(rowIndex);
|
|
3532
|
+
const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical");
|
|
3533
|
+
const node = domRef.current;
|
|
3534
|
+
const scrollPosition = brain.getScrollPosition();
|
|
3535
|
+
setInfiniteVarsOnNode({
|
|
3536
|
+
scrollTopForActiveCell: `${-scrollPosition.scrollTop}px`,
|
|
3537
|
+
scrollLeftForActiveCell: `${-scrollPosition.scrollLeft}px`,
|
|
3538
|
+
activeCellRowHeight: `${activeCellRowHeight}px`,
|
|
3539
|
+
activeCellRowOffset: `${activeCellRowOffset}px`
|
|
3540
|
+
}, node);
|
|
3541
|
+
}, [props.activeCellIndex]);
|
|
3442
3542
|
(0, import_react10.useEffect)(() => {
|
|
3443
|
-
const removeOnSCroll = brain.onScroll((
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3543
|
+
const removeOnSCroll = brain.onScroll((scrollPosition) => {
|
|
3544
|
+
setInfiniteVarsOnNode({
|
|
3545
|
+
scrollTopForActiveCell: `${-scrollPosition.scrollTop}px`,
|
|
3546
|
+
scrollLeftForActiveCell: `${-scrollPosition.scrollLeft}px`
|
|
3547
|
+
}, domRef.current);
|
|
3448
3548
|
});
|
|
3449
3549
|
const removeOnRenderCountChange = brain.onRenderCountChange(() => {
|
|
3450
3550
|
rerender();
|
|
3451
3551
|
});
|
|
3452
|
-
const removeOnAvailableSizeChange = brain.onAvailableSizeChange(() => {
|
|
3453
|
-
rerender();
|
|
3454
|
-
});
|
|
3455
3552
|
return () => {
|
|
3456
|
-
removeOnAvailableSizeChange();
|
|
3457
3553
|
removeOnRenderCountChange();
|
|
3458
3554
|
removeOnSCroll();
|
|
3459
3555
|
};
|
|
3460
3556
|
}, [brain]);
|
|
3461
|
-
const scrollPosition = brain.getScrollPosition();
|
|
3462
3557
|
return /* @__PURE__ */ React11.createElement("div", {
|
|
3558
|
+
className: ActiveIndicatorWrapperCls,
|
|
3559
|
+
"data-name": "active-cell"
|
|
3560
|
+
}, /* @__PURE__ */ React11.createElement("div", {
|
|
3463
3561
|
ref: domRef,
|
|
3464
3562
|
"data-name": "active-cell-indicator",
|
|
3465
3563
|
className: `${baseCls2} ${active ? ActiveCellIndicatorCls.visible : ActiveCellIndicatorCls.hidden}`,
|
|
3466
|
-
style: active ?
|
|
3467
|
-
|
|
3468
|
-
width: state.colWidth,
|
|
3469
|
-
height: state.rowHeight
|
|
3470
|
-
} : void 0
|
|
3471
|
-
});
|
|
3564
|
+
style: active ? ActiveStyle : void 0
|
|
3565
|
+
}));
|
|
3472
3566
|
};
|
|
3473
3567
|
var ActiveCellIndicator = React11.memo(ActiveCellIndicatorFn);
|
|
3474
3568
|
|
|
@@ -3538,7 +3632,7 @@ function HeadlessTable(props) {
|
|
|
3538
3632
|
};
|
|
3539
3633
|
brain.update(size);
|
|
3540
3634
|
};
|
|
3541
|
-
const remove = setupResizeObserver(node, onResize);
|
|
3635
|
+
const remove = setupResizeObserver(node, onResize, { debounce: 50 });
|
|
3542
3636
|
return remove;
|
|
3543
3637
|
}, []);
|
|
3544
3638
|
const onContainerScroll = (0, import_react11.useCallback)((scrollPos) => {
|
|
@@ -3890,45 +3984,45 @@ var useInternalProps = () => {
|
|
|
3890
3984
|
};
|
|
3891
3985
|
|
|
3892
3986
|
// src/components/InfiniteTable/utilities.css.ts
|
|
3893
|
-
var alignItems = { center: "
|
|
3894
|
-
var cssEllipsisClassName = "
|
|
3895
|
-
var cursor = { pointer: "_16lm1iwd" };
|
|
3896
|
-
var display = { flex: "
|
|
3897
|
-
var flex = { "1": "
|
|
3898
|
-
var flexFlow = { column: "
|
|
3899
|
-
var justifyContent = { center: "
|
|
3900
|
-
var left = { "0": "
|
|
3901
|
-
var overflow = { hidden: "
|
|
3987
|
+
var alignItems = { center: "_16lm1iw15", stretch: "_16lm1iw16" };
|
|
3988
|
+
var cssEllipsisClassName = "_16lm1iw1e _16lm1iw1f _16lm1iw1a";
|
|
3989
|
+
var cursor = { pointer: "_16lm1iwd", colResize: "_16lm1iwe" };
|
|
3990
|
+
var display = { flex: "_16lm1iwn", block: "_16lm1iwo", inlineBlock: "_16lm1iwp" };
|
|
3991
|
+
var flex = { "1": "_16lm1iwg", none: "_16lm1iwh" };
|
|
3992
|
+
var flexFlow = { column: "_16lm1iw13", row: "_16lm1iw14" };
|
|
3993
|
+
var justifyContent = { center: "_16lm1iw17", start: "_16lm1iw18", end: "_16lm1iw19" };
|
|
3994
|
+
var left = { "0": "_16lm1iwx", "100%": "_16lm1iwy" };
|
|
3995
|
+
var overflow = { hidden: "_16lm1iw1a", auto: "_16lm1iw1b", visible: "_16lm1iw1c" };
|
|
3902
3996
|
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
3903
|
-
var top = { "0": "
|
|
3997
|
+
var top = { "0": "_16lm1iwv", "100%": "_16lm1iww" };
|
|
3904
3998
|
var transformTranslateZero = "_16lm1iwa";
|
|
3905
|
-
var userSelect = { none: "
|
|
3906
|
-
var zIndex = { "1": "
|
|
3999
|
+
var userSelect = { none: "_16lm1iwq" };
|
|
4000
|
+
var zIndex = { "1": "_16lm1iwi", "10": "_16lm1iwj", "1000": "_16lm1iwk", "10000": "_16lm1iwl", "100000": "_16lm1iwm" };
|
|
3907
4001
|
|
|
3908
4002
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3909
4003
|
var InfiniteTableBody = React14.forwardRef(function InfiniteTableBody2(props, ref) {
|
|
3910
|
-
const { rootClassName:
|
|
4004
|
+
const { rootClassName: rootClassName13 } = useInternalProps();
|
|
3911
4005
|
return /* @__PURE__ */ React14.createElement("div", __spreadProps(__spreadValues({
|
|
3912
4006
|
ref
|
|
3913
4007
|
}, props), {
|
|
3914
|
-
className: join(`${
|
|
4008
|
+
className: join(`${rootClassName13}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
|
|
3915
4009
|
}));
|
|
3916
4010
|
});
|
|
3917
4011
|
|
|
3918
4012
|
// src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx
|
|
3919
4013
|
var React15 = __toModule(require("react"));
|
|
3920
4014
|
var InfiniteTableFooter = React15.forwardRef(function InfiniteTableFooter2(props, ref) {
|
|
3921
|
-
const { rootClassName:
|
|
4015
|
+
const { rootClassName: rootClassName13 } = useInternalProps();
|
|
3922
4016
|
return /* @__PURE__ */ React15.createElement("div", __spreadProps(__spreadValues({
|
|
3923
4017
|
ref
|
|
3924
4018
|
}, props), {
|
|
3925
|
-
className: join(`${
|
|
4019
|
+
className: join(`${rootClassName13}Footer`, position.relative, display.flex, flexFlow.row, props.className)
|
|
3926
4020
|
}));
|
|
3927
4021
|
});
|
|
3928
4022
|
|
|
3929
4023
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3930
|
-
var
|
|
3931
|
-
var
|
|
4024
|
+
var React22 = __toModule(require("react"));
|
|
4025
|
+
var import_react24 = __toModule(require("react"));
|
|
3932
4026
|
var import_react_dom = __toModule(require("react-dom"));
|
|
3933
4027
|
|
|
3934
4028
|
// src/components/DataSource/defaultFilterTypes.ts
|
|
@@ -4088,7 +4182,6 @@ var useColumnPointerEvents = ({
|
|
|
4088
4182
|
const [draggingDiff, setDraggingDiff] = (0, import_react17.useState)(null);
|
|
4089
4183
|
const [proxyOffset, setProxyOffset] = (0, import_react17.useState)(null);
|
|
4090
4184
|
const breakpointsRef = (0, import_react17.useRef)([]);
|
|
4091
|
-
const pointerMoveRef = (0, import_react17.useRef)(null);
|
|
4092
4185
|
const didDragRef = (0, import_react17.useRef)(false);
|
|
4093
4186
|
const initialClientPos = (0, import_react17.useRef)(null);
|
|
4094
4187
|
const currentDropIndexRef = (0, import_react17.useRef)(null);
|
|
@@ -4164,35 +4257,40 @@ var useColumnPointerEvents = ({
|
|
|
4164
4257
|
}
|
|
4165
4258
|
setDraggingDiff({ left: diffX, top: diffY });
|
|
4166
4259
|
};
|
|
4167
|
-
|
|
4260
|
+
const onPointerUp = (e2) => {
|
|
4261
|
+
const target2 = domRef.current;
|
|
4262
|
+
target2.style.cursor = cursorRef.current;
|
|
4263
|
+
target2.releasePointerCapture(e2.pointerId);
|
|
4264
|
+
target2.removeEventListener("pointermove", onPointerMove);
|
|
4265
|
+
target2.removeEventListener("pointerup", onPointerUp);
|
|
4266
|
+
setDraggingDiff(null);
|
|
4267
|
+
componentActions.columnShifts = null;
|
|
4268
|
+
componentActions.draggingColumnId = null;
|
|
4269
|
+
if (!didDragRef.current && column.computedSortable) {
|
|
4270
|
+
column.toggleSort();
|
|
4271
|
+
}
|
|
4272
|
+
const dropIndex = currentDropIndexRef.current;
|
|
4273
|
+
if (dropIndex != null && dropIndex !== columnIndex) {
|
|
4274
|
+
const newOrder = moveXatY(computedColumnOrder, columnIndex, dropIndex > columnIndex ? dropIndex - 1 : dropIndex);
|
|
4275
|
+
componentActions.columnOrder = newOrder;
|
|
4276
|
+
}
|
|
4277
|
+
breakpointsRef.current = [];
|
|
4278
|
+
didDragRef.current = false;
|
|
4279
|
+
initialClientPos.current = null;
|
|
4280
|
+
currentDropIndexRef.current = null;
|
|
4281
|
+
};
|
|
4168
4282
|
target.addEventListener("pointermove", onPointerMove);
|
|
4283
|
+
target.addEventListener("pointerup", onPointerUp);
|
|
4169
4284
|
target.setPointerCapture(e.pointerId);
|
|
4170
|
-
}, [
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
componentActions.draggingColumnId = null;
|
|
4179
|
-
if (!didDragRef.current && column.computedSortable) {
|
|
4180
|
-
column.toggleSort();
|
|
4181
|
-
}
|
|
4182
|
-
const dropIndex = currentDropIndexRef.current;
|
|
4183
|
-
if (dropIndex != null && dropIndex !== columnIndex) {
|
|
4184
|
-
const newOrder = moveXatY(computedColumnOrder, columnIndex, dropIndex > columnIndex ? dropIndex - 1 : dropIndex);
|
|
4185
|
-
componentActions.columnOrder = newOrder;
|
|
4186
|
-
}
|
|
4187
|
-
breakpointsRef.current = [];
|
|
4188
|
-
pointerMoveRef.current = null;
|
|
4189
|
-
didDragRef.current = false;
|
|
4190
|
-
initialClientPos.current = null;
|
|
4191
|
-
currentDropIndexRef.current = null;
|
|
4192
|
-
}, [column, columnIndex, componentActions, computedColumnOrder]);
|
|
4285
|
+
}, [
|
|
4286
|
+
columns,
|
|
4287
|
+
column,
|
|
4288
|
+
columnIndex,
|
|
4289
|
+
columnsArray,
|
|
4290
|
+
computedRemainingSpace,
|
|
4291
|
+
computedColumnOrder
|
|
4292
|
+
]);
|
|
4193
4293
|
return {
|
|
4194
|
-
onPointerUp: column.computedDraggable ? onPointerUp : () => {
|
|
4195
|
-
},
|
|
4196
4294
|
onPointerDown: column.computedDraggable ? onPointerDown : () => {
|
|
4197
4295
|
},
|
|
4198
4296
|
dragging,
|
|
@@ -4249,19 +4347,19 @@ var import_react19 = __toModule(require("react"));
|
|
|
4249
4347
|
|
|
4250
4348
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
4251
4349
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4252
|
-
var CellCls = "_1eexc2a5
|
|
4253
|
-
var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob117
|
|
4350
|
+
var CellCls = "_1eexc2a5 _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw2 _16lm1iw1d _16lm1iw1e";
|
|
4351
|
+
var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob117 _16lm1iws _16lm1iwu _16lm1iwn _16lm1iw14 _16lm1iw15", variantClassNames: { filtered: { false: "_12zfob118", true: "_12zfob119" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4254
4352
|
var HeaderCellProxy = "_12zfob10";
|
|
4255
|
-
var HeaderCellRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob1h
|
|
4256
|
-
var HeaderClsRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob17
|
|
4257
|
-
var HeaderFilterCls = "_12zfob11c
|
|
4258
|
-
var HeaderFilterEditorCls = "
|
|
4259
|
-
var HeaderGroupCls = "_12zfob11b
|
|
4353
|
+
var HeaderCellRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob1h _16lm1iwo", variantClassNames: { rowActive: { false: "_12zfob1i", true: "_12zfob1j" }, zebra: { false: "_12zfob1k", even: "_12zfob1l", odd: "_12zfob1m" }, dragging: { true: "_12zfob1n", false: "_12zfob1o" }, first: { true: "_12zfob1p", false: "_12zfob1q" }, last: { true: "_12zfob1r", false: "_12zfob1s" }, groupByField: { true: "_12zfob1t", false: "_12zfob1u" }, firstInCategory: { true: "_12zfob1v", false: "_12zfob1w" }, lastInCategory: { true: "_12zfob1x", false: "_12zfob1y" }, pinned: { start: "_12zfob1z", end: "_12zfob110", false: "_12zfob111" }, filtered: { true: "_12zfob112", false: "_12zfob113" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob114"], [{ pinned: "end", firstInCategory: true }, "_12zfob115"], [{ pinned: false, lastInCategory: true }, "_12zfob116"]] });
|
|
4354
|
+
var HeaderClsRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob17 _16lm1iwo _16lm1iw2", variantClassNames: { pinned: { start: "_12zfob18", end: "_12zfob19", false: "_12zfob1a" }, virtualized: { true: "_12zfob1b", false: "_12zfob1c" }, overflow: { true: "_12zfob1d", false: "_12zfob1e" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1f"], [{ overflow: true, pinned: "end" }, "_12zfob1g"]] });
|
|
4355
|
+
var HeaderFilterCls = "_12zfob11c _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw1";
|
|
4356
|
+
var HeaderFilterEditorCls = "_16lm1iwu _16lm1iws";
|
|
4357
|
+
var HeaderGroupCls = "_12zfob11b _16lm1iwn _16lm1iw14 _16lm1iw15";
|
|
4260
4358
|
var HeaderScrollbarPlaceholderCls = "_12zfob16 _16lm1iw2";
|
|
4261
4359
|
var HeaderSortIconCls = "_16lm1iw1";
|
|
4262
4360
|
var HeaderSortIconIndexCls = "_12zfob15";
|
|
4263
4361
|
var HeaderSortIconRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob12", center: "_12zfob13", end: "_12zfob14" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4264
|
-
var HeaderWrapperCls = "_12zfob11a
|
|
4362
|
+
var HeaderWrapperCls = "_12zfob11a _16lm1iw1a _16lm1iw1 _16lm1iwn _16lm1iw14";
|
|
4265
4363
|
|
|
4266
4364
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
4267
4365
|
var defaultLineStyle = {
|
|
@@ -4348,20 +4446,20 @@ var useInfiniteTableState = () => {
|
|
|
4348
4446
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
4349
4447
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4350
4448
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
4351
|
-
var ColumnCellCls = "_1eexc2a5
|
|
4449
|
+
var ColumnCellCls = "_1eexc2a5 _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw2 _16lm1iw1d _16lm1iw1e";
|
|
4352
4450
|
var ColumnCellRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1eexc2a7", variantClassNames: { dragging: { false: "_1eexc2a8", true: "_1eexc2a9" }, rowActive: { false: "_1eexc2aa", true: "_1eexc2ab" }, zebra: { false: "_1eexc2ac", even: "_1eexc2ad", odd: "_1eexc2ae" }, first: { true: "_1eexc2af", false: "_1eexc2ag" }, last: { true: "_1eexc2ah", false: "_1eexc2ai" }, groupByField: { true: "_1eexc2aj", false: "_1eexc2ak" }, firstInCategory: { true: "_1eexc2al", false: "_1eexc2am" }, lastInCategory: { true: "_1eexc2an", false: "_1eexc2ao" }, pinned: { start: "_1eexc2ap", end: "_1eexc2aq", false: "_1eexc2ar" }, filtered: { true: "_1eexc2as", false: "_1eexc2at" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2au"], [{ pinned: "end", firstInCategory: true }, "_1eexc2av"]] });
|
|
4353
4451
|
|
|
4354
4452
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4355
4453
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
4356
4454
|
var InfiniteTableCellClassName = `${rootClassName5}Cell`;
|
|
4357
4455
|
var InfiniteTableCellContentClassName = `${rootClassName5}Cell_content`;
|
|
4456
|
+
var columnWidthAtIndex2 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4358
4457
|
function InfiniteTableCellFn(props) {
|
|
4359
4458
|
var _b, _c, _d;
|
|
4360
4459
|
const _a = props, {
|
|
4361
4460
|
cssEllipsis = true,
|
|
4362
4461
|
virtualized = true,
|
|
4363
4462
|
skipColumnShifting = false,
|
|
4364
|
-
offsetProperty = "left",
|
|
4365
4463
|
contentStyle,
|
|
4366
4464
|
column,
|
|
4367
4465
|
domRef,
|
|
@@ -4369,7 +4467,6 @@ function InfiniteTableCellFn(props) {
|
|
|
4369
4467
|
contentClassName,
|
|
4370
4468
|
afterChildren,
|
|
4371
4469
|
beforeChildren,
|
|
4372
|
-
offset,
|
|
4373
4470
|
cellType,
|
|
4374
4471
|
cssPosition: _cssPosition,
|
|
4375
4472
|
renderChildren
|
|
@@ -4377,7 +4474,6 @@ function InfiniteTableCellFn(props) {
|
|
|
4377
4474
|
"cssEllipsis",
|
|
4378
4475
|
"virtualized",
|
|
4379
4476
|
"skipColumnShifting",
|
|
4380
|
-
"offsetProperty",
|
|
4381
4477
|
"contentStyle",
|
|
4382
4478
|
"column",
|
|
4383
4479
|
"domRef",
|
|
@@ -4385,7 +4481,6 @@ function InfiniteTableCellFn(props) {
|
|
|
4385
4481
|
"contentClassName",
|
|
4386
4482
|
"afterChildren",
|
|
4387
4483
|
"beforeChildren",
|
|
4388
|
-
"offset",
|
|
4389
4484
|
"cellType",
|
|
4390
4485
|
"cssPosition",
|
|
4391
4486
|
"renderChildren"
|
|
@@ -4394,10 +4489,10 @@ function InfiniteTableCellFn(props) {
|
|
|
4394
4489
|
const { columnShifts } = useInfiniteTableState();
|
|
4395
4490
|
const shifting = !!columnShifts;
|
|
4396
4491
|
const style = __spreadValues({
|
|
4397
|
-
width
|
|
4492
|
+
width: `var(${columnWidthAtIndex2}-${column.computedVisibleIndex})`
|
|
4398
4493
|
}, domProps.style);
|
|
4399
4494
|
if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
|
|
4400
|
-
const shiftLeft = columnShifts[column.computedVisibleIndex]
|
|
4495
|
+
const shiftLeft = columnShifts[column.computedVisibleIndex];
|
|
4401
4496
|
if (virtualized) {
|
|
4402
4497
|
style.left = shiftLeft;
|
|
4403
4498
|
} else {
|
|
@@ -4479,10 +4574,545 @@ function InfiniteTableColumnHeaderFilterEmpty() {
|
|
|
4479
4574
|
});
|
|
4480
4575
|
}
|
|
4481
4576
|
|
|
4482
|
-
// src/components/InfiniteTable/components/InfiniteTableHeader/
|
|
4483
|
-
var
|
|
4577
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx
|
|
4578
|
+
var React21 = __toModule(require("react"));
|
|
4579
|
+
var import_react23 = __toModule(require("react"));
|
|
4580
|
+
|
|
4581
|
+
// src/components/flexbox/index.ts
|
|
4582
|
+
var computeFlex = (params) => {
|
|
4583
|
+
const {
|
|
4584
|
+
availableSize,
|
|
4585
|
+
items,
|
|
4586
|
+
minSize: defaultMinSize,
|
|
4587
|
+
maxSize: defaultMaxSize
|
|
4588
|
+
} = params;
|
|
4589
|
+
if (availableSize < 0) {
|
|
4590
|
+
throw "The provided availableSize cannot be negative!";
|
|
4591
|
+
}
|
|
4592
|
+
let totalFixedSize = 0;
|
|
4593
|
+
let totalFlex = 0;
|
|
4594
|
+
let totalFlexCount = 0;
|
|
4595
|
+
const minSizes = [];
|
|
4596
|
+
const maxSizes = [];
|
|
4597
|
+
items.forEach((item, i) => {
|
|
4598
|
+
var _a, _b, _c, _d, _e;
|
|
4599
|
+
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
4600
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
4601
|
+
minSizes.push(minSize);
|
|
4602
|
+
maxSizes.push(maxSize);
|
|
4603
|
+
if (item.size != null) {
|
|
4604
|
+
if (maxSize != null && item.size > maxSize) {
|
|
4605
|
+
item.size = maxSize;
|
|
4606
|
+
}
|
|
4607
|
+
if (minSize != null && item.size < minSize) {
|
|
4608
|
+
item.size = minSize;
|
|
4609
|
+
}
|
|
4610
|
+
}
|
|
4611
|
+
const itemFlex = item.flex == 0 ? null : item.flex;
|
|
4612
|
+
if (item.size == null && itemFlex == null) {
|
|
4613
|
+
throw `Items must specify either a size or a flex property. Item at index ${i} doesn't have either of those.`;
|
|
4614
|
+
}
|
|
4615
|
+
if (itemFlex != null) {
|
|
4616
|
+
totalFlexCount += 1;
|
|
4617
|
+
}
|
|
4618
|
+
totalFlex += itemFlex != null ? itemFlex : 0;
|
|
4619
|
+
totalFixedSize += (_e = item.size) != null ? _e : 0;
|
|
4620
|
+
});
|
|
4621
|
+
let availableSizeForFlex = params.computeSpecialSpaceDistribution ? Math.max(availableSize, 0) : Math.max(availableSize - totalFixedSize, 0);
|
|
4622
|
+
let sizePerFlex = availableSizeForFlex / totalFlex;
|
|
4623
|
+
let maxxedFlexItems = {};
|
|
4624
|
+
let minnedFlexItems = {};
|
|
4625
|
+
let constrainedCount = 0;
|
|
4626
|
+
items.forEach((item, index) => {
|
|
4627
|
+
var _a, _b, _c, _d;
|
|
4628
|
+
if (item.flex != null) {
|
|
4629
|
+
const approxFlexSize = sizePerFlex * item.flex;
|
|
4630
|
+
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
4631
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
4632
|
+
let constrained = false;
|
|
4633
|
+
let substractSize = 0;
|
|
4634
|
+
if (maxSize != null && approxFlexSize > maxSize) {
|
|
4635
|
+
maxxedFlexItems[index] = true;
|
|
4636
|
+
constrained = true;
|
|
4637
|
+
substractSize = maxSize;
|
|
4638
|
+
}
|
|
4639
|
+
if (minSize != null && approxFlexSize < minSize) {
|
|
4640
|
+
minnedFlexItems[index] = true;
|
|
4641
|
+
constrained = true;
|
|
4642
|
+
substractSize = minSize;
|
|
4643
|
+
}
|
|
4644
|
+
if (constrained) {
|
|
4645
|
+
constrainedCount += 1;
|
|
4646
|
+
totalFlexCount -= 1;
|
|
4647
|
+
totalFlex -= item.flex;
|
|
4648
|
+
availableSizeForFlex -= substractSize;
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
});
|
|
4652
|
+
if (constrainedCount) {
|
|
4653
|
+
sizePerFlex = availableSizeForFlex / totalFlex;
|
|
4654
|
+
}
|
|
4655
|
+
let flexSizes = [];
|
|
4656
|
+
let currentFlexCount = 0;
|
|
4657
|
+
let remainingSizeForFlex = availableSizeForFlex;
|
|
4658
|
+
let remainingFlex = totalFlex;
|
|
4659
|
+
let totalTakenSize = 0;
|
|
4660
|
+
let flexSizeSum = 0;
|
|
4661
|
+
const computedSizes = [];
|
|
4662
|
+
const resultItems = items.map((item, index) => {
|
|
4663
|
+
var _a, _b, _c, _d, _e;
|
|
4664
|
+
const sizedItem = __spreadValues({}, item);
|
|
4665
|
+
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
4666
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
4667
|
+
let flexSize = 0;
|
|
4668
|
+
const maxxed = maxxedFlexItems[index];
|
|
4669
|
+
const minned = minnedFlexItems[index];
|
|
4670
|
+
const constrained = maxxed || minned;
|
|
4671
|
+
let computedSize = (_e = item.size) != null ? _e : 0;
|
|
4672
|
+
if (item.flex != null) {
|
|
4673
|
+
if (constrained) {
|
|
4674
|
+
if (minned) {
|
|
4675
|
+
flexSize = minSize;
|
|
4676
|
+
}
|
|
4677
|
+
if (maxxed) {
|
|
4678
|
+
flexSize = maxSize;
|
|
4679
|
+
}
|
|
4680
|
+
} else {
|
|
4681
|
+
currentFlexCount += 1;
|
|
4682
|
+
const constrain = (size) => {
|
|
4683
|
+
if (maxSize != null && size > maxSize) {
|
|
4684
|
+
size = maxSize;
|
|
4685
|
+
}
|
|
4686
|
+
if (minSize != null && size < minSize) {
|
|
4687
|
+
size = minSize;
|
|
4688
|
+
}
|
|
4689
|
+
return size;
|
|
4690
|
+
};
|
|
4691
|
+
if (currentFlexCount === totalFlexCount) {
|
|
4692
|
+
flexSize = constrain(remainingSizeForFlex);
|
|
4693
|
+
} else {
|
|
4694
|
+
flexSize = constrain(Math.round(item.flex * sizePerFlex));
|
|
4695
|
+
flexSizeSum += flexSize;
|
|
4696
|
+
remainingSizeForFlex = availableSizeForFlex - flexSizeSum;
|
|
4697
|
+
remainingFlex -= item.flex;
|
|
4698
|
+
sizePerFlex = remainingSizeForFlex / remainingFlex;
|
|
4699
|
+
}
|
|
4700
|
+
}
|
|
4701
|
+
computedSize = flexSize;
|
|
4702
|
+
sizedItem.flexSize = flexSize;
|
|
4703
|
+
}
|
|
4704
|
+
flexSizes.push(flexSize);
|
|
4705
|
+
computedSizes.push(computedSize);
|
|
4706
|
+
sizedItem.computedSize = computedSize;
|
|
4707
|
+
totalTakenSize += computedSize;
|
|
4708
|
+
return sizedItem;
|
|
4709
|
+
});
|
|
4710
|
+
return {
|
|
4711
|
+
items: resultItems,
|
|
4712
|
+
flexSizes,
|
|
4713
|
+
minSizes,
|
|
4714
|
+
maxSizes,
|
|
4715
|
+
computedSizes,
|
|
4716
|
+
remainingSize: Math.round(availableSize - totalTakenSize)
|
|
4717
|
+
};
|
|
4718
|
+
};
|
|
4719
|
+
function resizeClamp(value, min, max, direction) {
|
|
4720
|
+
if (min != null && value <= min) {
|
|
4721
|
+
return { value: min, clamped: "min", diff: (value - min) * direction };
|
|
4722
|
+
}
|
|
4723
|
+
if (max != null && value >= max) {
|
|
4724
|
+
return { value: max, clamped: "max", diff: (max - value) * direction };
|
|
4725
|
+
}
|
|
4726
|
+
return { value, clamped: false, diff: 0 };
|
|
4727
|
+
}
|
|
4728
|
+
var computeResize = (params) => {
|
|
4729
|
+
const { availableSize, reservedWidth = 0 } = params;
|
|
4730
|
+
const columnSizing = Object.keys(params.columnSizing).reduce((acc, key) => {
|
|
4731
|
+
acc[key] = __spreadValues({}, params.columnSizing[key]);
|
|
4732
|
+
return acc;
|
|
4733
|
+
}, {});
|
|
4734
|
+
if (availableSize < 0) {
|
|
4735
|
+
throw "The provided availableSize cannot be negative!";
|
|
4736
|
+
}
|
|
4737
|
+
let dragHandleOffset = params.dragHandleOffset;
|
|
4738
|
+
const firstIndex = params.dragHandlePositionAfter;
|
|
4739
|
+
const secondIndex = params.dragHandlePositionAfter + 1;
|
|
4740
|
+
const firstItem = params.items[firstIndex];
|
|
4741
|
+
const secondItem = params.items[secondIndex];
|
|
4742
|
+
const firstId = firstItem.id;
|
|
4743
|
+
const secondId = secondItem == null ? void 0 : secondItem.id;
|
|
4744
|
+
const firstSize = firstItem.computedWidth;
|
|
4745
|
+
const firstMinSize = firstItem.computedMinWidth;
|
|
4746
|
+
const firstMaxSize = firstItem.computedMaxWidth;
|
|
4747
|
+
const firstPropertyToAdjust = firstItem.computedFlex ? "flex" : "width";
|
|
4748
|
+
const secondSize = secondItem == null ? void 0 : secondItem.computedWidth;
|
|
4749
|
+
const secondMinSize = secondItem == null ? void 0 : secondItem.computedMinWidth;
|
|
4750
|
+
const secondMaxSize = secondItem == null ? void 0 : secondItem.computedMaxWidth;
|
|
4751
|
+
const secondPropertyToAdjust = (secondItem == null ? void 0 : secondItem.computedFlex) ? "flex" : "width";
|
|
4752
|
+
let maxReached = false;
|
|
4753
|
+
let minReached = false;
|
|
4754
|
+
const direction = dragHandleOffset > 0 ? 1 : -1;
|
|
4755
|
+
let {
|
|
4756
|
+
value: firstAdjustedSize,
|
|
4757
|
+
clamped: firstClamped,
|
|
4758
|
+
diff: firstDiff
|
|
4759
|
+
} = resizeClamp(firstSize + dragHandleOffset, firstMinSize, firstMaxSize, direction);
|
|
4760
|
+
if (params.shareSpaceOnResize) {
|
|
4761
|
+
if (secondItem == null) {
|
|
4762
|
+
columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
|
|
4763
|
+
[firstPropertyToAdjust]: firstAdjustedSize
|
|
4764
|
+
});
|
|
4765
|
+
minReached = firstClamped === "min";
|
|
4766
|
+
maxReached = firstClamped === "max";
|
|
4767
|
+
const adjustedDiff2 = firstAdjustedSize - firstSize;
|
|
4768
|
+
return {
|
|
4769
|
+
adjustedDiff: adjustedDiff2,
|
|
4770
|
+
reservedWidth,
|
|
4771
|
+
columnSizing,
|
|
4772
|
+
minReached,
|
|
4773
|
+
maxReached,
|
|
4774
|
+
constrained: minReached || maxReached
|
|
4775
|
+
};
|
|
4776
|
+
}
|
|
4777
|
+
let {
|
|
4778
|
+
value: secondAdjustedSize,
|
|
4779
|
+
clamped: secondClamped,
|
|
4780
|
+
diff: secondDiff
|
|
4781
|
+
} = resizeClamp(secondSize - dragHandleOffset, secondMinSize, secondMaxSize, direction);
|
|
4782
|
+
if (firstClamped && secondClamped) {
|
|
4783
|
+
if (Math.abs(firstDiff) > Math.abs(secondDiff)) {
|
|
4784
|
+
secondClamped = false;
|
|
4785
|
+
} else {
|
|
4786
|
+
firstClamped = false;
|
|
4787
|
+
}
|
|
4788
|
+
}
|
|
4789
|
+
if (!firstClamped && !secondClamped) {
|
|
4790
|
+
} else if (firstClamped) {
|
|
4791
|
+
const clampResultForSecond = resizeClamp(secondSize - dragHandleOffset - firstDiff, secondMinSize, secondMaxSize, direction);
|
|
4792
|
+
secondAdjustedSize = clampResultForSecond.value;
|
|
4793
|
+
secondClamped = clampResultForSecond.clamped;
|
|
4794
|
+
secondDiff = clampResultForSecond.diff;
|
|
4795
|
+
} else if (secondClamped) {
|
|
4796
|
+
const clampResultForFirst = resizeClamp(firstSize + dragHandleOffset + secondDiff, firstMinSize, firstMaxSize, direction);
|
|
4797
|
+
firstAdjustedSize = clampResultForFirst.value;
|
|
4798
|
+
firstClamped = clampResultForFirst.clamped;
|
|
4799
|
+
firstDiff = clampResultForFirst.diff;
|
|
4800
|
+
}
|
|
4801
|
+
columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
|
|
4802
|
+
[firstPropertyToAdjust]: firstAdjustedSize
|
|
4803
|
+
});
|
|
4804
|
+
columnSizing[secondId] = __spreadProps(__spreadValues({}, columnSizing[secondId]), {
|
|
4805
|
+
[secondPropertyToAdjust]: secondAdjustedSize
|
|
4806
|
+
});
|
|
4807
|
+
minReached = firstClamped === "min" || secondClamped === "min";
|
|
4808
|
+
maxReached = firstClamped === "max" || secondClamped === "max";
|
|
4809
|
+
} else {
|
|
4810
|
+
columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
|
|
4811
|
+
[firstPropertyToAdjust]: firstAdjustedSize
|
|
4812
|
+
});
|
|
4813
|
+
minReached = firstClamped === "min";
|
|
4814
|
+
maxReached = firstClamped === "max";
|
|
4815
|
+
}
|
|
4816
|
+
const adjustedDiff = firstAdjustedSize - firstSize;
|
|
4817
|
+
return {
|
|
4818
|
+
adjustedDiff,
|
|
4819
|
+
reservedWidth: !params.shareSpaceOnResize ? reservedWidth - adjustedDiff : reservedWidth,
|
|
4820
|
+
columnSizing,
|
|
4821
|
+
minReached,
|
|
4822
|
+
maxReached,
|
|
4823
|
+
constrained: minReached || maxReached
|
|
4824
|
+
};
|
|
4825
|
+
};
|
|
4826
|
+
function sum(a, b) {
|
|
4827
|
+
return a + b;
|
|
4828
|
+
}
|
|
4829
|
+
function cloneColumnSizing(columnSizing) {
|
|
4830
|
+
const newColumnSizing = Object.keys(columnSizing).reduce((acc, key) => {
|
|
4831
|
+
acc[key] = __spreadValues({}, columnSizing[key]);
|
|
4832
|
+
return acc;
|
|
4833
|
+
}, {});
|
|
4834
|
+
return newColumnSizing;
|
|
4835
|
+
}
|
|
4836
|
+
var computeGroupResize = (params) => {
|
|
4837
|
+
const { availableSize, reservedWidth = 0 } = params;
|
|
4838
|
+
const columnSizing = Object.keys(params.columnSizing).reduce((acc, key) => {
|
|
4839
|
+
acc[key] = __spreadValues({}, params.columnSizing[key]);
|
|
4840
|
+
return acc;
|
|
4841
|
+
}, {});
|
|
4842
|
+
if (availableSize < 0) {
|
|
4843
|
+
throw "The provided availableSize cannot be negative!";
|
|
4844
|
+
}
|
|
4845
|
+
let dragHandleOffset = params.dragHandleOffset;
|
|
4846
|
+
const beforeIndexes = [...new Array(params.columnGroupSize)].map((_, index) => params.dragHandlePositionAfter - index).reverse();
|
|
4847
|
+
const beforeItems = beforeIndexes.map((i) => params.items[i]);
|
|
4848
|
+
const beforeSizes = beforeItems.map((item) => item.computedWidth);
|
|
4849
|
+
const beforePropertiesToAdjust = beforeItems.map((item) => item.computedFlex ? "flex" : "width");
|
|
4850
|
+
let unresizableWidth = 0;
|
|
4851
|
+
const { computedSizes } = computeFlex({
|
|
4852
|
+
items: beforeItems.map((item) => {
|
|
4853
|
+
if (item.resizable === false) {
|
|
4854
|
+
unresizableWidth += item.computedWidth;
|
|
4855
|
+
}
|
|
4856
|
+
return {
|
|
4857
|
+
maxSize: item.computedMaxWidth,
|
|
4858
|
+
minSize: item.computedMinWidth,
|
|
4859
|
+
flex: item.resizable ? item.computedWidth : null,
|
|
4860
|
+
size: 0
|
|
4861
|
+
};
|
|
4862
|
+
}),
|
|
4863
|
+
computeSpecialSpaceDistribution: true,
|
|
4864
|
+
availableSize: Math.max(beforeSizes.reduce(sum, 0) + dragHandleOffset - unresizableWidth, 0)
|
|
4865
|
+
});
|
|
4866
|
+
const diffsForEachItem = beforeItems.map((item, index) => {
|
|
4867
|
+
return computedSizes[index] - item.computedWidth;
|
|
4868
|
+
});
|
|
4869
|
+
let groupMinReached = true;
|
|
4870
|
+
let groupMaxReached = true;
|
|
4871
|
+
let groupConstrained = true;
|
|
4872
|
+
const adjustedDiffs = [];
|
|
4873
|
+
diffsForEachItem.forEach((diff, i) => {
|
|
4874
|
+
const item = beforeItems[i];
|
|
4875
|
+
if (!item.resizable) {
|
|
4876
|
+
adjustedDiffs.push(0);
|
|
4877
|
+
return;
|
|
4878
|
+
}
|
|
4879
|
+
const propertyToAdjust = beforePropertiesToAdjust[i];
|
|
4880
|
+
const itemSize = beforeSizes[i];
|
|
4881
|
+
const currentColumnSizing = cloneColumnSizing(columnSizing);
|
|
4882
|
+
const { maxReached, minReached, constrained, adjustedDiff: adjustedDiff2 } = computeResize({
|
|
4883
|
+
availableSize: params.availableSize,
|
|
4884
|
+
reservedWidth: params.reservedWidth,
|
|
4885
|
+
dragHandleOffset: diff,
|
|
4886
|
+
dragHandlePositionAfter: beforeIndexes[i],
|
|
4887
|
+
shareSpaceOnResize: false,
|
|
4888
|
+
items: params.items,
|
|
4889
|
+
columnSizing: currentColumnSizing
|
|
4890
|
+
});
|
|
4891
|
+
columnSizing[item.id] = __spreadProps(__spreadValues({}, currentColumnSizing[item.id]), {
|
|
4892
|
+
[propertyToAdjust]: itemSize + adjustedDiff2
|
|
4893
|
+
});
|
|
4894
|
+
adjustedDiffs.push(adjustedDiff2);
|
|
4895
|
+
if (!maxReached) {
|
|
4896
|
+
groupMaxReached = false;
|
|
4897
|
+
}
|
|
4898
|
+
if (!minReached) {
|
|
4899
|
+
groupMinReached = false;
|
|
4900
|
+
}
|
|
4901
|
+
if (!constrained) {
|
|
4902
|
+
groupConstrained = false;
|
|
4903
|
+
}
|
|
4904
|
+
});
|
|
4905
|
+
const adjustedDiff = adjustedDiffs.reduce(sum, 0);
|
|
4906
|
+
return {
|
|
4907
|
+
minReached: groupMinReached,
|
|
4908
|
+
maxReached: groupMaxReached,
|
|
4909
|
+
constrained: groupConstrained,
|
|
4910
|
+
adjustedDiffs,
|
|
4911
|
+
adjustedDiff,
|
|
4912
|
+
columnSizing,
|
|
4913
|
+
reservedWidth: reservedWidth - adjustedDiff
|
|
4914
|
+
};
|
|
4915
|
+
};
|
|
4916
|
+
|
|
4917
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
|
|
4918
|
+
var import_react22 = __toModule(require("react"));
|
|
4919
|
+
|
|
4920
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/columnResizer.ts
|
|
4921
|
+
function getColumnResizer(colIndex, {
|
|
4922
|
+
columns,
|
|
4923
|
+
shareSpaceOnResize,
|
|
4924
|
+
domRef
|
|
4925
|
+
}) {
|
|
4926
|
+
const column = columns[colIndex];
|
|
4927
|
+
return {
|
|
4928
|
+
resize(diff) {
|
|
4929
|
+
setInfiniteColumnWidth(colIndex, column.computedWidth + diff, domRef.current);
|
|
4930
|
+
const nextColIndex = colIndex + 1;
|
|
4931
|
+
if (shareSpaceOnResize) {
|
|
4932
|
+
const nextColumn = columns[nextColIndex];
|
|
4933
|
+
if (!nextColumn) {
|
|
4934
|
+
return;
|
|
4935
|
+
}
|
|
4936
|
+
setInfiniteColumnWidth(nextColIndex, nextColumn.computedWidth - diff, domRef.current);
|
|
4937
|
+
setInfiniteColumnOffset(nextColIndex, nextColumn.computedOffset + diff, domRef.current);
|
|
4938
|
+
return;
|
|
4939
|
+
}
|
|
4940
|
+
for (let i = nextColIndex, len = columns.length; i < len; i++) {
|
|
4941
|
+
setInfiniteColumnOffset(i, columns[i].computedOffset + diff, domRef.current);
|
|
4942
|
+
}
|
|
4943
|
+
}
|
|
4944
|
+
};
|
|
4945
|
+
}
|
|
4946
|
+
function getColumnGroupResizer(colIndexes, config) {
|
|
4947
|
+
const lastColIndex = colIndexes[colIndexes.length - 1];
|
|
4948
|
+
return {
|
|
4949
|
+
resize(diffs) {
|
|
4950
|
+
const { columns, domRef } = config;
|
|
4951
|
+
let offset = columns[colIndexes[0]].computedOffset;
|
|
4952
|
+
let diffSum = 0;
|
|
4953
|
+
const node = domRef.current;
|
|
4954
|
+
diffs.forEach((diff, i) => {
|
|
4955
|
+
diffSum += diff;
|
|
4956
|
+
const colIndex = colIndexes[i];
|
|
4957
|
+
const column = columns[colIndex];
|
|
4958
|
+
const newWidth = column.computedWidth + diff;
|
|
4959
|
+
setInfiniteColumnWidth(colIndex, newWidth, node);
|
|
4960
|
+
if (offset) {
|
|
4961
|
+
setInfiniteColumnOffset(colIndex, offset, node);
|
|
4962
|
+
}
|
|
4963
|
+
offset += newWidth;
|
|
4964
|
+
});
|
|
4965
|
+
for (let i = lastColIndex + 1; i < columns.length; i++) {
|
|
4966
|
+
setInfiniteColumnOffset(i, columns[i].computedOffset + diffSum, node);
|
|
4967
|
+
}
|
|
4968
|
+
}
|
|
4969
|
+
};
|
|
4970
|
+
}
|
|
4971
|
+
|
|
4972
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts
|
|
4973
|
+
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4974
|
+
var ResizeHandleCls = "zneyzh0 _16lm1iw2 _16lm1iwv _16lm1iw11 _16lm1iwz _16lm1iwe";
|
|
4975
|
+
var ResizeHandleDraggerClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "zneyzh1 _16lm1iw2 _16lm1iwv _16lm1iwz", variantClassNames: { constrained: { false: "zneyzh2", true: "zneyzh3" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4976
|
+
|
|
4977
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
|
|
4484
4978
|
var { rootClassName: rootClassName7 } = internalProps;
|
|
4485
|
-
var
|
|
4979
|
+
var InfiniteTableHeaderCellResizeHandleCls = `${rootClassName7}HeaderCell_ResizeHandle`;
|
|
4980
|
+
function ResizeHandleFn(props) {
|
|
4981
|
+
const domRef = (0, import_react22.useRef)(null);
|
|
4982
|
+
const [constrained, setConstrained] = (0, import_react22.useState)(false);
|
|
4983
|
+
const constrainedRef = (0, import_react22.useRef)(constrained);
|
|
4984
|
+
constrainedRef.current = constrained;
|
|
4985
|
+
const onPointerDown = (e) => {
|
|
4986
|
+
e.stopPropagation();
|
|
4987
|
+
const shareSpaceOnResize = !!e.shiftKey;
|
|
4988
|
+
const pointerId = e.pointerId;
|
|
4989
|
+
const initialX = e.clientX;
|
|
4990
|
+
const target = e.target;
|
|
4991
|
+
target.setPointerCapture(pointerId);
|
|
4992
|
+
const resizer = getColumnResizer(props.columnIndex, {
|
|
4993
|
+
columns: props.columns,
|
|
4994
|
+
shareSpaceOnResize,
|
|
4995
|
+
domRef
|
|
4996
|
+
});
|
|
4997
|
+
const resizeDiff = (diff) => {
|
|
4998
|
+
const { adjustedDiff, constrained: constrained2 } = props.computeResize({
|
|
4999
|
+
diff,
|
|
5000
|
+
shareSpaceOnResize
|
|
5001
|
+
});
|
|
5002
|
+
if (constrainedRef.current !== constrained2) {
|
|
5003
|
+
setConstrained(constrained2);
|
|
5004
|
+
}
|
|
5005
|
+
resizer.resize(adjustedDiff);
|
|
5006
|
+
return adjustedDiff;
|
|
5007
|
+
};
|
|
5008
|
+
const onPointerMove = (e2) => {
|
|
5009
|
+
resizeDiff(Math.round(e2.clientX - initialX));
|
|
5010
|
+
};
|
|
5011
|
+
const onPointerUp = (e2) => {
|
|
5012
|
+
target.releasePointerCapture(pointerId);
|
|
5013
|
+
target.removeEventListener("pointermove", onPointerMove);
|
|
5014
|
+
target.removeEventListener("pointerup", onPointerUp);
|
|
5015
|
+
const diff = Math.round(e2.clientX - initialX);
|
|
5016
|
+
const adjustedDiff = resizeDiff(diff);
|
|
5017
|
+
props.onResize({ diff: adjustedDiff, shareSpaceOnResize });
|
|
5018
|
+
};
|
|
5019
|
+
target.addEventListener("pointermove", onPointerMove);
|
|
5020
|
+
target.addEventListener("pointerup", onPointerUp);
|
|
5021
|
+
};
|
|
5022
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", {
|
|
5023
|
+
ref: domRef,
|
|
5024
|
+
className: `${InfiniteTableHeaderCellResizeHandleCls} ${ResizeHandleCls}`,
|
|
5025
|
+
onPointerDown
|
|
5026
|
+
}, /* @__PURE__ */ import_react22.default.createElement("div", {
|
|
5027
|
+
className: ResizeHandleDraggerClsRecipe({
|
|
5028
|
+
constrained
|
|
5029
|
+
})
|
|
5030
|
+
}));
|
|
5031
|
+
}
|
|
5032
|
+
var ResizeHandle = import_react22.default.memo(ResizeHandleFn);
|
|
5033
|
+
|
|
5034
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx
|
|
5035
|
+
function useColumnResizeHandle(column) {
|
|
5036
|
+
const {
|
|
5037
|
+
computed: { computedVisibleColumns },
|
|
5038
|
+
componentState: { domRef },
|
|
5039
|
+
getState,
|
|
5040
|
+
getComputed,
|
|
5041
|
+
componentActions
|
|
5042
|
+
} = useInfiniteTable();
|
|
5043
|
+
const computeResizeForDiff = (0, import_react23.useCallback)(({
|
|
5044
|
+
diff,
|
|
5045
|
+
shareSpaceOnResize
|
|
5046
|
+
}) => {
|
|
5047
|
+
const state = getState();
|
|
5048
|
+
const { columnSizing, viewportReservedWidth, bodySize, activeCellIndex } = state;
|
|
5049
|
+
const columns = getComputed().computedVisibleColumns;
|
|
5050
|
+
let atLeastOneFlex = false;
|
|
5051
|
+
const columnSizingWithFlex = columns.reduce((acc, col) => {
|
|
5052
|
+
if (col.computedFlex) {
|
|
5053
|
+
acc[col.id] = __spreadProps(__spreadValues({}, columnSizing[col.id]), { flex: col.computedWidth });
|
|
5054
|
+
atLeastOneFlex = true;
|
|
5055
|
+
}
|
|
5056
|
+
return acc;
|
|
5057
|
+
}, {});
|
|
5058
|
+
const columnSizingForResize = atLeastOneFlex ? __spreadValues(__spreadValues({}, columnSizing), columnSizingWithFlex) : columnSizing;
|
|
5059
|
+
const result = computeResize({
|
|
5060
|
+
shareSpaceOnResize,
|
|
5061
|
+
availableSize: bodySize.width,
|
|
5062
|
+
reservedWidth: viewportReservedWidth || 0,
|
|
5063
|
+
dragHandleOffset: diff,
|
|
5064
|
+
dragHandlePositionAfter: column.computedVisibleIndex,
|
|
5065
|
+
columnSizing: columnSizingForResize,
|
|
5066
|
+
items: columns.map((c) => {
|
|
5067
|
+
return {
|
|
5068
|
+
id: c.id,
|
|
5069
|
+
computedFlex: c.computedFlex,
|
|
5070
|
+
computedWidth: c.computedWidth,
|
|
5071
|
+
computedMinWidth: c.computedMinWidth,
|
|
5072
|
+
computedMaxWidth: c.computedMaxWidth
|
|
5073
|
+
};
|
|
5074
|
+
})
|
|
5075
|
+
});
|
|
5076
|
+
if (activeCellIndex && activeCellIndex[1] >= column.computedVisibleIndex) {
|
|
5077
|
+
const activeColumn = columns[activeCellIndex[1]];
|
|
5078
|
+
const currentColumn = columns[column.computedVisibleIndex];
|
|
5079
|
+
if (activeCellIndex[1] === currentColumn.computedVisibleIndex) {
|
|
5080
|
+
setInfiniteColumnWidth(currentColumn.computedVisibleIndex, currentColumn.computedWidth + result.adjustedDiff, domRef.current);
|
|
5081
|
+
} else if (activeColumn) {
|
|
5082
|
+
setInfiniteColumnOffset(activeColumn.computedVisibleIndex, activeColumn.computedOffset + result.adjustedDiff, domRef.current);
|
|
5083
|
+
}
|
|
5084
|
+
if (shareSpaceOnResize && activeCellIndex[1] === currentColumn.computedVisibleIndex + 1 && activeColumn) {
|
|
5085
|
+
setInfiniteColumnWidth(activeColumn.computedVisibleIndex, activeColumn.computedWidth - result.adjustedDiff, domRef.current);
|
|
5086
|
+
}
|
|
5087
|
+
}
|
|
5088
|
+
return result;
|
|
5089
|
+
}, []);
|
|
5090
|
+
const onColumnResize = (0, import_react23.useCallback)(({
|
|
5091
|
+
diff,
|
|
5092
|
+
shareSpaceOnResize
|
|
5093
|
+
}) => {
|
|
5094
|
+
const { columnSizing, reservedWidth } = computeResizeForDiff({
|
|
5095
|
+
diff,
|
|
5096
|
+
shareSpaceOnResize
|
|
5097
|
+
});
|
|
5098
|
+
if (!shareSpaceOnResize) {
|
|
5099
|
+
componentActions.viewportReservedWidth = reservedWidth;
|
|
5100
|
+
}
|
|
5101
|
+
componentActions.columnSizing = columnSizing;
|
|
5102
|
+
}, []);
|
|
5103
|
+
const resizeHandle = column.computedResizable ? /* @__PURE__ */ React21.createElement(ResizeHandle, {
|
|
5104
|
+
columns: computedVisibleColumns,
|
|
5105
|
+
columnIndex: column.computedVisibleIndex,
|
|
5106
|
+
computeResize: computeResizeForDiff,
|
|
5107
|
+
onResize: onColumnResize
|
|
5108
|
+
}) : null;
|
|
5109
|
+
return resizeHandle;
|
|
5110
|
+
}
|
|
5111
|
+
|
|
5112
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
5113
|
+
var InfiniteTableHeaderCellContext = React22.createContext(null);
|
|
5114
|
+
var { rootClassName: rootClassName8 } = internalProps;
|
|
5115
|
+
var InfiniteTableHeaderCellClassName = `${rootClassName8}HeaderCell`;
|
|
4486
5116
|
function InfiniteTableHeaderCell(props) {
|
|
4487
5117
|
var _a, _b, _c, _d, _e;
|
|
4488
5118
|
const column = props.column;
|
|
@@ -4490,13 +5120,13 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4490
5120
|
const { onResize, height, width, headerOptions } = props;
|
|
4491
5121
|
const sortInfo = column.computedSortInfo;
|
|
4492
5122
|
let header = column.header;
|
|
4493
|
-
const ref = (0,
|
|
5123
|
+
const ref = (0, import_react24.useCallback)((node) => {
|
|
4494
5124
|
var _a2;
|
|
4495
5125
|
domRef.current = node;
|
|
4496
5126
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
4497
5127
|
}, [props.domRef]);
|
|
4498
5128
|
const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
|
|
4499
|
-
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */
|
|
5129
|
+
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ React22.createElement(SortIcon, {
|
|
4500
5130
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
4501
5131
|
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
|
|
4502
5132
|
align: column.align || "start"
|
|
@@ -4513,15 +5143,15 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4513
5143
|
const align = column.align || "start";
|
|
4514
5144
|
const renderChildren = () => {
|
|
4515
5145
|
if (header instanceof Function) {
|
|
4516
|
-
header = /* @__PURE__ */
|
|
5146
|
+
header = /* @__PURE__ */ React22.createElement(RenderHookComponent, {
|
|
4517
5147
|
render: header,
|
|
4518
5148
|
renderParam
|
|
4519
5149
|
});
|
|
4520
5150
|
}
|
|
4521
5151
|
header = header != null ? header : column.name;
|
|
4522
|
-
return /* @__PURE__ */
|
|
5152
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
|
|
4523
5153
|
};
|
|
4524
|
-
const domRef = (0,
|
|
5154
|
+
const domRef = (0, import_react24.useRef)(null);
|
|
4525
5155
|
const {
|
|
4526
5156
|
computed: {
|
|
4527
5157
|
computedRemainingSpace,
|
|
@@ -4535,7 +5165,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4535
5165
|
getState: getDataSourceState,
|
|
4536
5166
|
componentState: { filterDelay, filterTypes }
|
|
4537
5167
|
} = useDataSourceContextValue();
|
|
4538
|
-
(0,
|
|
5168
|
+
(0, import_react24.useEffect)(() => {
|
|
4539
5169
|
let clearOnResize = null;
|
|
4540
5170
|
const node = domRef.current;
|
|
4541
5171
|
if (onResize && node) {
|
|
@@ -4548,7 +5178,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4548
5178
|
const style = {
|
|
4549
5179
|
height
|
|
4550
5180
|
};
|
|
4551
|
-
const { onPointerDown,
|
|
5181
|
+
const { onPointerDown, dragging, draggingDiff, proxyOffset } = useColumnPointerEvents({
|
|
4552
5182
|
computedRemainingSpace,
|
|
4553
5183
|
columnId: column.id,
|
|
4554
5184
|
domRef,
|
|
@@ -4556,7 +5186,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4556
5186
|
});
|
|
4557
5187
|
let draggingProxy = null;
|
|
4558
5188
|
if (dragging) {
|
|
4559
|
-
draggingProxy = /* @__PURE__ */
|
|
5189
|
+
draggingProxy = /* @__PURE__ */ React22.createElement("div", {
|
|
4560
5190
|
className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
|
|
4561
5191
|
style: {
|
|
4562
5192
|
position: "absolute",
|
|
@@ -4573,7 +5203,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4573
5203
|
const contentRecipeVariants = {
|
|
4574
5204
|
filtered: column.computedFiltered
|
|
4575
5205
|
};
|
|
4576
|
-
const setFilterValue = (0,
|
|
5206
|
+
const setFilterValue = (0, import_react24.useCallback)((filterValue) => {
|
|
4577
5207
|
var _a2;
|
|
4578
5208
|
const state = getDataSourceState();
|
|
4579
5209
|
let newFilterValue = (_a2 = state.filterValue) != null ? _a2 : [];
|
|
@@ -4597,7 +5227,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4597
5227
|
});
|
|
4598
5228
|
dataSourceActions.filterValue = newFilterValue;
|
|
4599
5229
|
}, [column, filterTypes]);
|
|
4600
|
-
const debouncedOnFilterValueChange =
|
|
5230
|
+
const debouncedOnFilterValueChange = React22.useMemo(() => {
|
|
4601
5231
|
const fn = (filterValue) => {
|
|
4602
5232
|
let newFilterValueForColumn;
|
|
4603
5233
|
if (column.computedFilterValue) {
|
|
@@ -4634,10 +5264,10 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4634
5264
|
]);
|
|
4635
5265
|
const filterType = column.computedFilterType;
|
|
4636
5266
|
const FilterEditor = filterEditors[filterType] || defaultFilterEditors[filterType] || StringFilterEditor;
|
|
4637
|
-
const resizeHandle =
|
|
4638
|
-
return /* @__PURE__ */
|
|
5267
|
+
const resizeHandle = useColumnResizeHandle(column);
|
|
5268
|
+
return /* @__PURE__ */ React22.createElement(ContextProvider, {
|
|
4639
5269
|
value: renderParam
|
|
4640
|
-
}, /* @__PURE__ */
|
|
5270
|
+
}, /* @__PURE__ */ React22.createElement(InfiniteTableCell, {
|
|
4641
5271
|
domRef: ref,
|
|
4642
5272
|
cellType: "header",
|
|
4643
5273
|
column,
|
|
@@ -4647,12 +5277,11 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4647
5277
|
style,
|
|
4648
5278
|
width,
|
|
4649
5279
|
onPointerDown,
|
|
4650
|
-
onPointerUp,
|
|
4651
5280
|
contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
|
|
4652
5281
|
contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
|
|
4653
5282
|
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false, rowActive: false }), CellCls),
|
|
4654
5283
|
cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
|
|
4655
|
-
afterChildren: /* @__PURE__ */
|
|
5284
|
+
afterChildren: /* @__PURE__ */ React22.createElement(React22.Fragment, null, showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ React22.createElement(InfiniteTableColumnHeaderFilter, {
|
|
4656
5285
|
filterEditor: FilterEditor,
|
|
4657
5286
|
filterTypes,
|
|
4658
5287
|
onChange: debouncedOnFilterValueChange,
|
|
@@ -4660,17 +5289,17 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4660
5289
|
columnLabel: column.field || column.name || column.id,
|
|
4661
5290
|
columnFilterValue: column.computedFilterValue,
|
|
4662
5291
|
columnHeaderHeight
|
|
4663
|
-
}) : /* @__PURE__ */
|
|
5292
|
+
}) : /* @__PURE__ */ React22.createElement(InfiniteTableColumnHeaderFilterEmpty, null) : null, resizeHandle),
|
|
4664
5293
|
renderChildren
|
|
4665
5294
|
}), draggingProxy);
|
|
4666
5295
|
}
|
|
4667
5296
|
function useInfiniteHeaderCell() {
|
|
4668
|
-
const result = (0,
|
|
5297
|
+
const result = (0, import_react24.useContext)(InfiniteTableHeaderCellContext);
|
|
4669
5298
|
return result;
|
|
4670
5299
|
}
|
|
4671
5300
|
|
|
4672
5301
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4673
|
-
var
|
|
5302
|
+
var React27 = __toModule(require("react"));
|
|
4674
5303
|
|
|
4675
5304
|
// src/components/utils/getScrollbarWidth.ts
|
|
4676
5305
|
var scrollbarWidth;
|
|
@@ -4756,7 +5385,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, c
|
|
|
4756
5385
|
let groupOffset = 0;
|
|
4757
5386
|
map2.forEach((item) => {
|
|
4758
5387
|
if (!item.ref.columnGroup) {
|
|
4759
|
-
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((
|
|
5388
|
+
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum2, col) => sum2 + col.ref.computedWidth, 0);
|
|
4760
5389
|
item.groupOffset = groupOffset;
|
|
4761
5390
|
item.computedWidth = itemWidth;
|
|
4762
5391
|
if (item.type === "group") {
|
|
@@ -4781,7 +5410,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, c
|
|
|
4781
5410
|
}
|
|
4782
5411
|
function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
4783
5412
|
items.forEach((item) => {
|
|
4784
|
-
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((
|
|
5413
|
+
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum2, col) => sum2 + col.ref.computedWidth, 0);
|
|
4785
5414
|
item.computedWidth = itemWidth;
|
|
4786
5415
|
item.groupOffset = groupOffset;
|
|
4787
5416
|
if (item.type === "group") {
|
|
@@ -4792,36 +5421,186 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
4792
5421
|
}
|
|
4793
5422
|
|
|
4794
5423
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4795
|
-
var
|
|
4796
|
-
var
|
|
5424
|
+
var React26 = __toModule(require("react"));
|
|
5425
|
+
var import_react27 = __toModule(require("react"));
|
|
5426
|
+
|
|
5427
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
5428
|
+
var React25 = __toModule(require("react"));
|
|
5429
|
+
|
|
5430
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx
|
|
5431
|
+
var React24 = __toModule(require("react"));
|
|
5432
|
+
var import_react26 = __toModule(require("react"));
|
|
5433
|
+
|
|
5434
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/GroupResizeHandle.tsx
|
|
5435
|
+
var import_react25 = __toModule(require("react"));
|
|
5436
|
+
var { rootClassName: rootClassName9 } = internalProps;
|
|
5437
|
+
var InfiniteTableHeaderCellResizeHandleCls2 = `${rootClassName9}HeaderCell_ResizeHandle`;
|
|
5438
|
+
function GroupResizeHandleFn(props) {
|
|
5439
|
+
const domRef = (0, import_react25.useRef)(null);
|
|
5440
|
+
const [constrained, setConstrained] = (0, import_react25.useState)(false);
|
|
5441
|
+
const constrainedRef = (0, import_react25.useRef)(constrained);
|
|
5442
|
+
constrainedRef.current = constrained;
|
|
5443
|
+
const onPointerDown = (e) => {
|
|
5444
|
+
e.stopPropagation();
|
|
5445
|
+
const pointerId = e.pointerId;
|
|
5446
|
+
const initialX = e.clientX;
|
|
5447
|
+
const target = e.target;
|
|
5448
|
+
target.setPointerCapture(pointerId);
|
|
5449
|
+
let initialMove = true;
|
|
5450
|
+
const resizer = getColumnGroupResizer(props.groupColumns.map((c) => c.computedVisibleIndex), {
|
|
5451
|
+
columns: props.columns,
|
|
5452
|
+
domRef
|
|
5453
|
+
});
|
|
5454
|
+
const resizeDiff = (diff) => {
|
|
5455
|
+
const { constrained: constrained2, adjustedDiffs, adjustedDiff } = props.computeResize(diff);
|
|
5456
|
+
if (constrainedRef.current !== constrained2) {
|
|
5457
|
+
setConstrained(constrained2);
|
|
5458
|
+
}
|
|
5459
|
+
resizer.resize(adjustedDiffs);
|
|
5460
|
+
return adjustedDiff;
|
|
5461
|
+
};
|
|
5462
|
+
const onPointerMove = (e2) => {
|
|
5463
|
+
if (initialMove) {
|
|
5464
|
+
const maxDiff = props.groupColumns.reduce((diff, col) => {
|
|
5465
|
+
return diff + col.computedWidth - col.computedMinWidth;
|
|
5466
|
+
}, 0);
|
|
5467
|
+
const currentSize = props.brain.getAvailableSize();
|
|
5468
|
+
const newSize = {
|
|
5469
|
+
width: currentSize.width + maxDiff,
|
|
5470
|
+
height: currentSize.height
|
|
5471
|
+
};
|
|
5472
|
+
props.brain.setAvailableSize(newSize);
|
|
5473
|
+
initialMove = false;
|
|
5474
|
+
}
|
|
5475
|
+
resizeDiff(Math.round(e2.clientX - initialX));
|
|
5476
|
+
};
|
|
5477
|
+
const onPointerUp = (e2) => {
|
|
5478
|
+
target.releasePointerCapture(pointerId);
|
|
5479
|
+
target.removeEventListener("pointermove", onPointerMove);
|
|
5480
|
+
target.removeEventListener("pointerup", onPointerUp);
|
|
5481
|
+
const diff = Math.round(e2.clientX - initialX);
|
|
5482
|
+
const adjustedDiffs = resizeDiff(diff);
|
|
5483
|
+
props.onResize(adjustedDiffs);
|
|
5484
|
+
};
|
|
5485
|
+
target.addEventListener("pointermove", onPointerMove);
|
|
5486
|
+
target.addEventListener("pointerup", onPointerUp);
|
|
5487
|
+
};
|
|
5488
|
+
return /* @__PURE__ */ import_react25.default.createElement("div", {
|
|
5489
|
+
ref: domRef,
|
|
5490
|
+
className: `${InfiniteTableHeaderCellResizeHandleCls2} ${ResizeHandleCls}`,
|
|
5491
|
+
onPointerDown
|
|
5492
|
+
}, /* @__PURE__ */ import_react25.default.createElement("div", {
|
|
5493
|
+
style: props.style,
|
|
5494
|
+
className: ResizeHandleDraggerClsRecipe({
|
|
5495
|
+
constrained
|
|
5496
|
+
})
|
|
5497
|
+
}));
|
|
5498
|
+
}
|
|
5499
|
+
var GroupResizeHandle = import_react25.default.memo(GroupResizeHandleFn);
|
|
5500
|
+
|
|
5501
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx
|
|
5502
|
+
function useColumnGroupResizeHandle(groupColumns, config) {
|
|
5503
|
+
const { bodyBrain, groupHeight, columnGroup, columnGroupsMaxDepth } = config;
|
|
5504
|
+
const {
|
|
5505
|
+
computed: { computedVisibleColumns },
|
|
5506
|
+
getState,
|
|
5507
|
+
getComputed,
|
|
5508
|
+
componentActions
|
|
5509
|
+
} = useInfiniteTable();
|
|
5510
|
+
const lastColumnInGroup = groupColumns[groupColumns.length - 1];
|
|
5511
|
+
const computeResizeForDiff = (0, import_react26.useCallback)((diff) => {
|
|
5512
|
+
const state = getState();
|
|
5513
|
+
const { columnSizing, viewportReservedWidth, bodySize } = state;
|
|
5514
|
+
const columns = getComputed().computedVisibleColumns;
|
|
5515
|
+
let atLeastOneFlex = false;
|
|
5516
|
+
const columnSizingWithFlex = columns.reduce((acc, col) => {
|
|
5517
|
+
if (col.computedFlex) {
|
|
5518
|
+
acc[col.id] = __spreadProps(__spreadValues({}, columnSizing[col.id]), { flex: col.computedWidth });
|
|
5519
|
+
atLeastOneFlex = true;
|
|
5520
|
+
}
|
|
5521
|
+
return acc;
|
|
5522
|
+
}, {});
|
|
5523
|
+
const columnSizingForResize = atLeastOneFlex ? __spreadValues(__spreadValues({}, columnSizing), columnSizingWithFlex) : columnSizing;
|
|
5524
|
+
const result = computeGroupResize({
|
|
5525
|
+
availableSize: bodySize.width,
|
|
5526
|
+
reservedWidth: viewportReservedWidth || 0,
|
|
5527
|
+
dragHandleOffset: diff,
|
|
5528
|
+
dragHandlePositionAfter: lastColumnInGroup.computedVisibleIndex,
|
|
5529
|
+
columnSizing: columnSizingForResize,
|
|
5530
|
+
columnGroupSize: groupColumns.length,
|
|
5531
|
+
items: columns.map((c) => {
|
|
5532
|
+
return {
|
|
5533
|
+
id: c.id,
|
|
5534
|
+
resizable: c.computedResizable,
|
|
5535
|
+
computedFlex: c.computedFlex,
|
|
5536
|
+
computedWidth: c.computedWidth,
|
|
5537
|
+
computedMinWidth: c.computedMinWidth,
|
|
5538
|
+
computedMaxWidth: c.computedMaxWidth
|
|
5539
|
+
};
|
|
5540
|
+
})
|
|
5541
|
+
});
|
|
5542
|
+
return result;
|
|
5543
|
+
}, []);
|
|
5544
|
+
const onColumnResize = (0, import_react26.useCallback)((diff) => {
|
|
5545
|
+
const { columnSizing, reservedWidth } = computeResizeForDiff(diff);
|
|
5546
|
+
componentActions.viewportReservedWidth = reservedWidth;
|
|
5547
|
+
componentActions.columnSizing = columnSizing;
|
|
5548
|
+
}, []);
|
|
5549
|
+
const groupResizable = groupColumns.some((c) => c.computedResizable);
|
|
5550
|
+
const resizeHandle = groupResizable ? /* @__PURE__ */ React24.createElement(GroupResizeHandle, {
|
|
5551
|
+
brain: bodyBrain,
|
|
5552
|
+
style: {
|
|
5553
|
+
height: groupHeight * (columnGroupsMaxDepth - columnGroup.depth + 2)
|
|
5554
|
+
},
|
|
5555
|
+
columns: computedVisibleColumns,
|
|
5556
|
+
groupColumns,
|
|
5557
|
+
computeResize: computeResizeForDiff,
|
|
5558
|
+
onResize: onColumnResize
|
|
5559
|
+
}) : null;
|
|
5560
|
+
return resizeHandle;
|
|
5561
|
+
}
|
|
4797
5562
|
|
|
4798
5563
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
4799
|
-
var React21 = __toModule(require("react"));
|
|
4800
5564
|
var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
|
|
5565
|
+
var columnWidthAtIndex3 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4801
5566
|
function InfiniteTableHeaderGroup(props) {
|
|
4802
|
-
const {
|
|
5567
|
+
const {
|
|
5568
|
+
computed: { computedVisibleColumns }
|
|
5569
|
+
} = useInfiniteTable();
|
|
5570
|
+
const { columnGroup, height, columns, bodyBrain, columnGroupsMaxDepth } = props;
|
|
4803
5571
|
let { header } = columnGroup;
|
|
4804
5572
|
if (header instanceof Function) {
|
|
4805
5573
|
header = header({
|
|
4806
5574
|
columnGroup
|
|
4807
5575
|
});
|
|
4808
5576
|
}
|
|
4809
|
-
|
|
5577
|
+
const handle = useColumnGroupResizeHandle(columns, {
|
|
5578
|
+
bodyBrain,
|
|
5579
|
+
groupHeight: height,
|
|
5580
|
+
columnGroup,
|
|
5581
|
+
columnGroupsMaxDepth
|
|
5582
|
+
});
|
|
5583
|
+
const firstColumn = columns[0];
|
|
5584
|
+
const width = columns.length > 1 ? `calc( ` + columns.map((col) => `var(${columnWidthAtIndex3}-${col.computedVisibleIndex})`).join(" + ") + " )" : `var(${columnWidthAtIndex3}-${firstColumn.computedVisibleIndex})`;
|
|
5585
|
+
const zIndex2 = computedVisibleColumns.length * 10 - firstColumn.computedVisibleIndex * 10 + height * (columnGroupsMaxDepth - columnGroup.depth + 2);
|
|
5586
|
+
return /* @__PURE__ */ React25.createElement("div", {
|
|
4810
5587
|
ref: props.domRef,
|
|
4811
5588
|
"data-group-id": columnGroup.uniqueGroupId,
|
|
4812
5589
|
className: join(HeaderGroupCls, TableHeaderGroupClassName),
|
|
4813
|
-
style: { width, height }
|
|
4814
|
-
|
|
5590
|
+
style: { width, height },
|
|
5591
|
+
"data-z-index": zIndex2
|
|
5592
|
+
}, /* @__PURE__ */ React25.createElement("div", {
|
|
4815
5593
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4816
|
-
}, header));
|
|
5594
|
+
}, header), handle);
|
|
4817
5595
|
}
|
|
4818
5596
|
|
|
4819
5597
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4820
|
-
var { rootClassName:
|
|
4821
|
-
var TableHeaderClassName = `${
|
|
5598
|
+
var { rootClassName: rootClassName10 } = internalProps;
|
|
5599
|
+
var TableHeaderClassName = `${rootClassName10}Header`;
|
|
4822
5600
|
function InfiniteTableHeaderFn(props) {
|
|
4823
5601
|
const {
|
|
4824
|
-
|
|
5602
|
+
bodyBrain,
|
|
5603
|
+
headerBrain: brain,
|
|
4825
5604
|
columns,
|
|
4826
5605
|
style,
|
|
4827
5606
|
className,
|
|
@@ -4834,7 +5613,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4834
5613
|
componentState: { headerBrain, headerOptions }
|
|
4835
5614
|
} = useInfiniteTable();
|
|
4836
5615
|
const { computedVisibleColumnsMap, showColumnFilters } = computed;
|
|
4837
|
-
(0,
|
|
5616
|
+
(0, import_react27.useEffect)(() => {
|
|
4838
5617
|
const onScroll = (scrollPosition) => {
|
|
4839
5618
|
if (domRef.current) {
|
|
4840
5619
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
@@ -4843,7 +5622,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4843
5622
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4844
5623
|
return removeOnScroll;
|
|
4845
5624
|
}, [brain]);
|
|
4846
|
-
const domRef = (0,
|
|
5625
|
+
const domRef = (0, import_react27.useRef)(null);
|
|
4847
5626
|
const headerCls = HeaderClsRecipe({
|
|
4848
5627
|
overflow: false,
|
|
4849
5628
|
virtualized: true
|
|
@@ -4853,7 +5632,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4853
5632
|
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4854
5633
|
style: __spreadProps(__spreadValues({}, style), { height: columnHeaderHeight })
|
|
4855
5634
|
};
|
|
4856
|
-
const renderCell = (0,
|
|
5635
|
+
const renderCell = (0, import_react27.useCallback)((params) => {
|
|
4857
5636
|
const {
|
|
4858
5637
|
rowIndex,
|
|
4859
5638
|
colIndex,
|
|
@@ -4878,7 +5657,9 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4878
5657
|
computedWidth: colGroupItem.computedWidth,
|
|
4879
5658
|
groupOffset: colGroupItem.groupOffset
|
|
4880
5659
|
});
|
|
4881
|
-
return /* @__PURE__ */
|
|
5660
|
+
return /* @__PURE__ */ React26.createElement(InfiniteTableHeaderGroup, {
|
|
5661
|
+
bodyBrain,
|
|
5662
|
+
columnGroupsMaxDepth,
|
|
4882
5663
|
domRef: domRef2,
|
|
4883
5664
|
columns: columns2,
|
|
4884
5665
|
width: widthWithColspan,
|
|
@@ -4886,7 +5667,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4886
5667
|
columnGroup: computedColumnGroup
|
|
4887
5668
|
});
|
|
4888
5669
|
}
|
|
4889
|
-
return /* @__PURE__ */
|
|
5670
|
+
return /* @__PURE__ */ React26.createElement(InfiniteTableHeaderCell, {
|
|
4890
5671
|
domRef: domRef2,
|
|
4891
5672
|
column,
|
|
4892
5673
|
headerOptions,
|
|
@@ -4902,17 +5683,18 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4902
5683
|
columnGroupsMaxDepth,
|
|
4903
5684
|
showColumnFilters
|
|
4904
5685
|
]);
|
|
4905
|
-
return /* @__PURE__ */
|
|
5686
|
+
return /* @__PURE__ */ React26.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React26.createElement(RawTable, {
|
|
5687
|
+
name: "header",
|
|
4906
5688
|
renderCell,
|
|
4907
5689
|
brain: headerBrain,
|
|
4908
5690
|
cellHoverClassNames: []
|
|
4909
5691
|
}));
|
|
4910
5692
|
}
|
|
4911
|
-
var InfiniteTableHeader =
|
|
5693
|
+
var InfiniteTableHeader = React26.memo(InfiniteTableHeaderFn);
|
|
4912
5694
|
|
|
4913
5695
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4914
5696
|
function TableHeaderWrapper(props) {
|
|
4915
|
-
const {
|
|
5697
|
+
const { headerBrain, bodyBrain, scrollbars } = props;
|
|
4916
5698
|
const tableContextValue = useInfiniteTable();
|
|
4917
5699
|
const {
|
|
4918
5700
|
computedPinnedStartColumns,
|
|
@@ -4931,13 +5713,13 @@ function TableHeaderWrapper(props) {
|
|
|
4931
5713
|
} = tableContextValue;
|
|
4932
5714
|
const rows = !computedColumnGroups || !computedColumnGroups.size ? 1 : columnGroupsMaxDepth + 2;
|
|
4933
5715
|
const height = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
|
|
4934
|
-
const columnAndGroupTreeInfo =
|
|
5716
|
+
const columnAndGroupTreeInfo = React27.useMemo(() => {
|
|
4935
5717
|
if (!computedColumnGroups || !computedColumnGroups.size) {
|
|
4936
5718
|
return void 0;
|
|
4937
5719
|
}
|
|
4938
5720
|
return buildColumnAndGroupTree(computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth);
|
|
4939
5721
|
}, [computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap]);
|
|
4940
|
-
const cellspan =
|
|
5722
|
+
const cellspan = React27.useCallback(({ rowIndex, colIndex }) => {
|
|
4941
5723
|
const column = computedVisibleColumns[colIndex];
|
|
4942
5724
|
const rowspan2 = 1;
|
|
4943
5725
|
const colspan2 = 1;
|
|
@@ -4970,12 +5752,12 @@ function TableHeaderWrapper(props) {
|
|
|
4970
5752
|
rows,
|
|
4971
5753
|
columnGroupsDepthsMap
|
|
4972
5754
|
]);
|
|
4973
|
-
const rowspan =
|
|
4974
|
-
const colspan =
|
|
4975
|
-
const rowHeight =
|
|
5755
|
+
const rowspan = React27.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
|
|
5756
|
+
const colspan = React27.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
|
|
5757
|
+
const rowHeight = React27.useCallback((index) => {
|
|
4976
5758
|
return showColumnFilters ? index < rows - 1 ? columnHeaderHeight : 2 * columnHeaderHeight : columnHeaderHeight;
|
|
4977
5759
|
}, [rows, showColumnFilters, columnHeaderHeight]);
|
|
4978
|
-
useMatrixBrain(
|
|
5760
|
+
useMatrixBrain(headerBrain, {
|
|
4979
5761
|
colWidth: columnSize,
|
|
4980
5762
|
rowHeight,
|
|
4981
5763
|
rows,
|
|
@@ -4987,21 +5769,22 @@ function TableHeaderWrapper(props) {
|
|
|
4987
5769
|
fixedColsEnd: computedPinnedEndColumns.length,
|
|
4988
5770
|
fixedColsStart: computedPinnedStartColumns.length
|
|
4989
5771
|
});
|
|
4990
|
-
const header = /* @__PURE__ */
|
|
5772
|
+
const header = /* @__PURE__ */ React27.createElement(InfiniteTableHeader, {
|
|
4991
5773
|
columns: computedVisibleColumns,
|
|
4992
|
-
|
|
5774
|
+
headerBrain,
|
|
5775
|
+
bodyBrain,
|
|
4993
5776
|
columnHeaderHeight: height,
|
|
4994
5777
|
columnGroupsMaxDepth,
|
|
4995
5778
|
columnAndGroupTreeInfo
|
|
4996
5779
|
});
|
|
4997
|
-
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */
|
|
5780
|
+
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ React27.createElement("div", {
|
|
4998
5781
|
className: HeaderScrollbarPlaceholderCls,
|
|
4999
5782
|
style: {
|
|
5000
5783
|
zIndex: 1e3,
|
|
5001
5784
|
width: getScrollbarWidth()
|
|
5002
5785
|
}
|
|
5003
5786
|
}) : null;
|
|
5004
|
-
return /* @__PURE__ */
|
|
5787
|
+
return /* @__PURE__ */ React27.createElement("div", {
|
|
5005
5788
|
className: HeaderWrapperCls,
|
|
5006
5789
|
style: {
|
|
5007
5790
|
height
|
|
@@ -5010,8 +5793,8 @@ function TableHeaderWrapper(props) {
|
|
|
5010
5793
|
}
|
|
5011
5794
|
|
|
5012
5795
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
5013
|
-
var
|
|
5014
|
-
var
|
|
5796
|
+
var React28 = __toModule(require("react"));
|
|
5797
|
+
var import_react28 = __toModule(require("react"));
|
|
5015
5798
|
|
|
5016
5799
|
// src/components/utils/decamelize.ts
|
|
5017
5800
|
function decamelize(str, options) {
|
|
@@ -5019,17 +5802,13 @@ function decamelize(str, options) {
|
|
|
5019
5802
|
return str.replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2").replace(new RegExp("(" + separator + "[A-Z])([A-Z])", "g"), "$1" + separator + "$2").toLowerCase();
|
|
5020
5803
|
}
|
|
5021
5804
|
|
|
5022
|
-
// src/components/InfiniteTable/theme.css.ts
|
|
5023
|
-
var ThemeVars = { color: { accent: "var(--infinite-accent-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", columnHeaderHeight: "var(--infinite-column-header-height)" }, HeaderCell: { draggingBackground: "var(--infinite-header-cell-dragging-background)", background: "var(--infinite-header-cell-background)", padding: "var(--infinite-header-cell-padding)", paddingX: "var(--infinite-header-cell-padding-x)", paddingY: "var(--infinite-header-cell-padding-y)", iconSize: "var(--infinite-header-cell-icon-size)", sortIconMargin: "var(--infinite-header-cell-sort-icon-margin)" }, Cell: { padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)", color: "var(--infinite-cell-color)", activeBorderColor_R: "var(--infinite-active-cell-border-color--r)", activeBorderColor_G: "var(--infinite-active-cell-border-color--g)", activeBorderColor_B: "var(--infinite-active-cell-border-color--b)", activeBackgroundAlpha: "var(--infinite-active-cell-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-cell-background-alpha--table-unfocused)", activeBackground: "var(--infinite-active-cell-background)", activeBorderColor: "var(--infinite-active-cell-border-color)", activeBorderWidth: "var(--infinite-active-cell-border-width)", activeBorderStyle: "var(--infinite-active-cell-border-style)", activeBorder: "var(--infinite-active-cell-border)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", activeBackground: "var(--infinite-active-row-background)", activeBorderColor: "var(--infinite-active-row-border-color)", activeBorderWidth: "var(--infinite-active-row-border-width)", activeBorderStyle: "var(--infinite-active-row-border-style)", activeBorder: "var(--infinite-active-row-border)", activeBackgroundAlpha: "var(--infinite-active-row-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-row-background-alpha--table-unfocused)", hoverBackground: "var(--infinite-row-hover-background)", groupRowBackground: "var(--infinite-group-row-background)", groupRowColumnNesting: "var(--infinite-group-row-column-nesting)", groupNesting: "var(--infinite-dont-override-group-row-nesting-length)", pointerEventsWhileScrolling: "var(--infinite-row-pointer-events-while-scrolling)" }, ColumnCell: { background: "var(--infinite-column-cell-bg-dont-override)" } } };
|
|
5024
|
-
var columnHeaderHeightName = "column-header-height";
|
|
5025
|
-
|
|
5026
5805
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5027
|
-
var
|
|
5806
|
+
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5028
5807
|
var FooterCls = "_16lm1iw1";
|
|
5029
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
5030
|
-
var InfiniteClsRecipe = (0,
|
|
5031
|
-
var InfiniteClsShiftingColumns = "
|
|
5032
|
-
var PinnedRowsContainerClsVariants = (0,
|
|
5808
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwn _16lm1iw13 _16lm1iw0";
|
|
5809
|
+
var InfiniteClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { focused: { true: "_1yeub2v2", false: "_1yeub2v3" }, focusedWithin: { true: "_1yeub2v4", false: "_1yeub2v5" }, hasPinnedStart: { true: "_1yeub2v6", false: "_1yeub2v7" }, hasPinnedEnd: { true: "_1yeub2v8", false: "_1yeub2v9" }, hasPinnedStartOverflow: { true: "_1yeub2va", false: "_1yeub2vb" }, hasPinnedEndOverflow: { true: "_1yeub2vc", false: "_1yeub2vd" } }, defaultVariants: {}, compoundVariants: [[{ focused: false, focusedWithin: false }, "_1yeub2ve"]] });
|
|
5810
|
+
var InfiniteClsShiftingColumns = "_16lm1iwq";
|
|
5811
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5033
5812
|
|
|
5034
5813
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
5035
5814
|
var defaultStyle = {
|
|
@@ -5058,10 +5837,10 @@ var enforceStyle = (node, style) => {
|
|
|
5058
5837
|
node.style.setProperty(decamelize(propertyName), propertyValue, "important");
|
|
5059
5838
|
}
|
|
5060
5839
|
};
|
|
5061
|
-
var InfiniteTableLicenseFooter =
|
|
5062
|
-
const { rootClassName:
|
|
5063
|
-
const domRef =
|
|
5064
|
-
const domCallback =
|
|
5840
|
+
var InfiniteTableLicenseFooter = React28.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
|
|
5841
|
+
const { rootClassName: rootClassName13 } = useInternalProps();
|
|
5842
|
+
const domRef = React28.useRef(null);
|
|
5843
|
+
const domCallback = React28.useCallback((node) => {
|
|
5065
5844
|
domRef.current = node;
|
|
5066
5845
|
if (!ref) {
|
|
5067
5846
|
return;
|
|
@@ -5072,7 +5851,7 @@ var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicens
|
|
|
5072
5851
|
ref.current = node;
|
|
5073
5852
|
}
|
|
5074
5853
|
}, []);
|
|
5075
|
-
(0,
|
|
5854
|
+
(0, import_react28.useEffect)(() => {
|
|
5076
5855
|
const forceStyle = () => {
|
|
5077
5856
|
requestAnimationFrame(() => {
|
|
5078
5857
|
var _a;
|
|
@@ -5086,12 +5865,12 @@ var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicens
|
|
|
5086
5865
|
clearInterval(intervalId);
|
|
5087
5866
|
};
|
|
5088
5867
|
}, []);
|
|
5089
|
-
return /* @__PURE__ */
|
|
5868
|
+
return /* @__PURE__ */ React28.createElement("div", __spreadProps(__spreadValues({
|
|
5090
5869
|
ref: domCallback
|
|
5091
5870
|
}, props), {
|
|
5092
|
-
className: join(`${
|
|
5871
|
+
className: join(`${rootClassName13}-Footer`, FooterCls, props.className),
|
|
5093
5872
|
style: defaultStyle
|
|
5094
|
-
}), "Powered by", " ", /* @__PURE__ */
|
|
5873
|
+
}), "Powered by", " ", /* @__PURE__ */ React28.createElement("a", {
|
|
5095
5874
|
href: "https://infinite-table.com",
|
|
5096
5875
|
rel: "noopener noreferrer",
|
|
5097
5876
|
role: "link",
|
|
@@ -5100,11 +5879,11 @@ var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicens
|
|
|
5100
5879
|
});
|
|
5101
5880
|
|
|
5102
5881
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5103
|
-
var
|
|
5104
|
-
var
|
|
5105
|
-
var { rootClassName:
|
|
5106
|
-
var InfiniteTableColumnCellContext =
|
|
5107
|
-
var InfiniteTableColumnCellClassName = `${
|
|
5882
|
+
var React29 = __toModule(require("react"));
|
|
5883
|
+
var import_react29 = __toModule(require("react"));
|
|
5884
|
+
var { rootClassName: rootClassName11 } = internalProps;
|
|
5885
|
+
var InfiniteTableColumnCellContext = React29.createContext(null);
|
|
5886
|
+
var InfiniteTableColumnCellClassName = `${rootClassName11}ColumnCell`;
|
|
5108
5887
|
function isColumnWithField(c) {
|
|
5109
5888
|
return typeof c.field === "string";
|
|
5110
5889
|
}
|
|
@@ -5118,9 +5897,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5118
5897
|
column,
|
|
5119
5898
|
onMouseLeave,
|
|
5120
5899
|
onMouseEnter,
|
|
5121
|
-
offsetProperty,
|
|
5122
5900
|
toggleGroupRow,
|
|
5123
|
-
virtualized,
|
|
5124
5901
|
rowIndex,
|
|
5125
5902
|
rowHeight,
|
|
5126
5903
|
domRef,
|
|
@@ -5128,7 +5905,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5128
5905
|
showZebraRows
|
|
5129
5906
|
} = props;
|
|
5130
5907
|
if (!column) {
|
|
5131
|
-
return /* @__PURE__ */
|
|
5908
|
+
return /* @__PURE__ */ React29.createElement("div", {
|
|
5132
5909
|
ref: domRef
|
|
5133
5910
|
}, "no column");
|
|
5134
5911
|
}
|
|
@@ -5161,7 +5938,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5161
5938
|
value
|
|
5162
5939
|
});
|
|
5163
5940
|
}
|
|
5164
|
-
const onClick = (0,
|
|
5941
|
+
const onClick = (0, import_react29.useCallback)(() => {
|
|
5165
5942
|
if (keyboardNavigation === "row") {
|
|
5166
5943
|
componentActions.activeRowIndex = rowIndex;
|
|
5167
5944
|
return;
|
|
@@ -5201,7 +5978,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5201
5978
|
isGroupRow,
|
|
5202
5979
|
rowIndex,
|
|
5203
5980
|
toggleGroupRow,
|
|
5204
|
-
toggleCurrentGroupRow: (0,
|
|
5981
|
+
toggleCurrentGroupRow: (0, import_react29.useCallback)(() => {
|
|
5205
5982
|
if (!rowInfo.isGroupRow) {
|
|
5206
5983
|
return;
|
|
5207
5984
|
}
|
|
@@ -5210,13 +5987,13 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5210
5987
|
groupBy: computedDataSource.groupBy,
|
|
5211
5988
|
pivotBy: computedDataSource.pivotBy
|
|
5212
5989
|
});
|
|
5213
|
-
const renderChildren = (0,
|
|
5990
|
+
const renderChildren = (0, import_react29.useCallback)(() => {
|
|
5214
5991
|
if (hidden) {
|
|
5215
5992
|
return null;
|
|
5216
5993
|
}
|
|
5217
5994
|
const renderFn = column.render || column.renderValue;
|
|
5218
5995
|
if (renderFn) {
|
|
5219
|
-
return /* @__PURE__ */
|
|
5996
|
+
return /* @__PURE__ */ React29.createElement(RenderHookComponent, {
|
|
5220
5997
|
render: renderFn,
|
|
5221
5998
|
renderParam
|
|
5222
5999
|
});
|
|
@@ -5233,18 +6010,15 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5233
6010
|
style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
|
|
5234
6011
|
}
|
|
5235
6012
|
style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
|
|
5236
|
-
style.width = width;
|
|
5237
6013
|
style.height = rowHeight;
|
|
5238
|
-
const memoizedStyle = (0,
|
|
6014
|
+
const memoizedStyle = (0, import_react29.useMemo)(() => style, [!style ? null : JSON.stringify(style)]);
|
|
5239
6015
|
const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
|
|
5240
6016
|
const zebra = showZebraRows ? odd ? "odd" : "even" : false;
|
|
5241
6017
|
const cellProps = {
|
|
5242
6018
|
domRef,
|
|
5243
|
-
offsetProperty,
|
|
5244
6019
|
cellType: "body",
|
|
5245
6020
|
column,
|
|
5246
6021
|
width,
|
|
5247
|
-
offset: virtualized ? 0 : column.computedPinningOffset,
|
|
5248
6022
|
style: memoizedStyle,
|
|
5249
6023
|
onMouseLeave,
|
|
5250
6024
|
onMouseEnter,
|
|
@@ -5254,44 +6028,44 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5254
6028
|
renderChildren
|
|
5255
6029
|
};
|
|
5256
6030
|
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
5257
|
-
return /* @__PURE__ */
|
|
6031
|
+
return /* @__PURE__ */ React29.createElement(ContextProvider, {
|
|
5258
6032
|
value: renderParam
|
|
5259
|
-
}, /* @__PURE__ */
|
|
6033
|
+
}, /* @__PURE__ */ React29.createElement(InfiniteTableCell, __spreadValues({}, cellProps)));
|
|
5260
6034
|
}
|
|
5261
|
-
var InfiniteTableColumnCell =
|
|
6035
|
+
var InfiniteTableColumnCell = React29.memo(InfiniteTableColumnCellFn);
|
|
5262
6036
|
function useInfiniteColumnCell() {
|
|
5263
|
-
const result = (0,
|
|
6037
|
+
const result = (0, import_react29.useContext)(InfiniteTableColumnCellContext);
|
|
5264
6038
|
return result;
|
|
5265
6039
|
}
|
|
5266
6040
|
|
|
5267
6041
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
5268
|
-
var
|
|
6042
|
+
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5269
6043
|
var GroupRowExpanderCls = "_7pupv0b";
|
|
5270
|
-
var RowClsRecipe = (0,
|
|
6044
|
+
var RowClsRecipe = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "_7pupv00", variantClassNames: { zebra: { false: "_7pupv02", even: "_7pupv03", odd: "_7pupv04" }, groupRow: { true: "_7pupv05", false: "_7pupv06" }, inlineGroupRow: { true: "_7pupv07", false: "_7pupv08" }, showHoverRows: { true: "_7pupv09", false: "_7pupv0a" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5271
6045
|
var RowHoverCls = "_7pupv01";
|
|
5272
6046
|
|
|
5273
6047
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
5274
|
-
var
|
|
6048
|
+
var React30 = __toModule(require("react"));
|
|
5275
6049
|
|
|
5276
6050
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
5277
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
5278
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
6051
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz" };
|
|
6052
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz";
|
|
5279
6053
|
var LoadMaskTextCls = "qy58ya4";
|
|
5280
6054
|
|
|
5281
6055
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
5282
|
-
var { rootClassName:
|
|
5283
|
-
var baseCls3 = `${
|
|
6056
|
+
var { rootClassName: rootClassName12 } = internalProps;
|
|
6057
|
+
var baseCls3 = `${rootClassName12}-LoadMask`;
|
|
5284
6058
|
function LoadMaskFn(props) {
|
|
5285
6059
|
const { visible, children = "Loading" } = props;
|
|
5286
|
-
return /* @__PURE__ */
|
|
6060
|
+
return /* @__PURE__ */ React30.createElement("div", {
|
|
5287
6061
|
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls3}`
|
|
5288
|
-
}, /* @__PURE__ */
|
|
6062
|
+
}, /* @__PURE__ */ React30.createElement("div", {
|
|
5289
6063
|
className: `${LoadMaskOverlayCls} ${baseCls3}-Overlay`
|
|
5290
|
-
}), /* @__PURE__ */
|
|
6064
|
+
}), /* @__PURE__ */ React30.createElement("div", {
|
|
5291
6065
|
className: `${LoadMaskTextCls} ${baseCls3}-Text`
|
|
5292
6066
|
}, children));
|
|
5293
6067
|
}
|
|
5294
|
-
var LoadMask =
|
|
6068
|
+
var LoadMask = React30.memo(LoadMaskFn);
|
|
5295
6069
|
|
|
5296
6070
|
// src/components/InfiniteTable/getImperativeApi.ts
|
|
5297
6071
|
function getImperativeApi(getState, getComputed, getDataSourceState, componentActions) {
|
|
@@ -5356,7 +6130,7 @@ function getImperativeApi(getState, getComputed, getDataSourceState, componentAc
|
|
|
5356
6130
|
}
|
|
5357
6131
|
|
|
5358
6132
|
// src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
|
|
5359
|
-
var
|
|
6133
|
+
var import_react30 = __toModule(require("react"));
|
|
5360
6134
|
var OFFSET = 10;
|
|
5361
6135
|
function getColumnContentMaxWidths(domRef, options) {
|
|
5362
6136
|
var _a;
|
|
@@ -5392,9 +6166,15 @@ function getColumnContentMaxWidths(domRef, options) {
|
|
|
5392
6166
|
cell.childNodes.forEach((child) => {
|
|
5393
6167
|
if (child !== content) {
|
|
5394
6168
|
const el = child;
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
6169
|
+
let elWidth = Math.max(el.offsetWidth, parseInt(el.style.width, 10));
|
|
6170
|
+
if (isNaN(elWidth)) {
|
|
6171
|
+
elWidth = 0;
|
|
6172
|
+
}
|
|
6173
|
+
otherElementsLength += elWidth;
|
|
6174
|
+
if (elWidth > 0) {
|
|
6175
|
+
const style = getGlobal().getComputedStyle(el);
|
|
6176
|
+
otherElementsLength += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
|
|
6177
|
+
}
|
|
5398
6178
|
}
|
|
5399
6179
|
});
|
|
5400
6180
|
measuredWidth += otherElementsLength;
|
|
@@ -5416,11 +6196,11 @@ function useAutoSizeColumns() {
|
|
|
5416
6196
|
componentActions,
|
|
5417
6197
|
componentState: { domRef, ready, autoSizeColumnsKey, brain }
|
|
5418
6198
|
} = useComponentState();
|
|
5419
|
-
const [refreshId, setRefreshId] = (0,
|
|
6199
|
+
const [refreshId, setRefreshId] = (0, import_react30.useState)(0);
|
|
5420
6200
|
const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
|
|
5421
6201
|
const getTheKey = useLatest(theKey);
|
|
5422
|
-
const lastExecutedIdentifierRef = (0,
|
|
5423
|
-
(0,
|
|
6202
|
+
const lastExecutedIdentifierRef = (0, import_react30.useRef)(null);
|
|
6203
|
+
(0, import_react30.useEffect)(() => {
|
|
5424
6204
|
const key = getTheKey();
|
|
5425
6205
|
if (key == null) {
|
|
5426
6206
|
return;
|
|
@@ -5433,7 +6213,7 @@ function useAutoSizeColumns() {
|
|
|
5433
6213
|
};
|
|
5434
6214
|
return brain.onRenderRangeChange(onChange);
|
|
5435
6215
|
}, [brain]);
|
|
5436
|
-
(0,
|
|
6216
|
+
(0, import_react30.useEffect)(() => {
|
|
5437
6217
|
var _a;
|
|
5438
6218
|
if (theKey == null) {
|
|
5439
6219
|
return;
|
|
@@ -5478,8 +6258,8 @@ function useAutoSizeColumns() {
|
|
|
5478
6258
|
}
|
|
5479
6259
|
|
|
5480
6260
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
5481
|
-
var
|
|
5482
|
-
var
|
|
6261
|
+
var import_react31 = __toModule(require("react"));
|
|
6262
|
+
var import_react32 = __toModule(require("react"));
|
|
5483
6263
|
|
|
5484
6264
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
5485
6265
|
function useYourBrain(param) {
|
|
@@ -5549,13 +6329,13 @@ function useCellRendering(param) {
|
|
|
5549
6329
|
bodySize,
|
|
5550
6330
|
rowspan
|
|
5551
6331
|
});
|
|
5552
|
-
const scrollTopMaxRef = (0,
|
|
5553
|
-
(0,
|
|
6332
|
+
const scrollTopMaxRef = (0, import_react31.useRef)(0);
|
|
6333
|
+
(0, import_react31.useEffect)(() => {
|
|
5554
6334
|
return brain.onRenderCountChange(() => {
|
|
5555
6335
|
scrollTopMaxRef.current = brain.scrollTopMax;
|
|
5556
6336
|
});
|
|
5557
6337
|
}, [brain]);
|
|
5558
|
-
(0,
|
|
6338
|
+
(0, import_react31.useEffect)(() => {
|
|
5559
6339
|
return brain.onScrollStop((scrollPosition) => {
|
|
5560
6340
|
const { scrollTop } = scrollPosition;
|
|
5561
6341
|
if (scrollTop === 0) {
|
|
@@ -5572,7 +6352,7 @@ function useCellRendering(param) {
|
|
|
5572
6352
|
}
|
|
5573
6353
|
});
|
|
5574
6354
|
}, [brain, onScrollToTop, onScrollToBottom]);
|
|
5575
|
-
(0,
|
|
6355
|
+
(0, import_react31.useEffect)(() => {
|
|
5576
6356
|
if (!bodySize.height) {
|
|
5577
6357
|
return;
|
|
5578
6358
|
}
|
|
@@ -5583,10 +6363,10 @@ function useCellRendering(param) {
|
|
|
5583
6363
|
}
|
|
5584
6364
|
}, [!!bodySize.height]);
|
|
5585
6365
|
const [, rerender] = useRerender();
|
|
5586
|
-
(0,
|
|
6366
|
+
(0, import_react31.useEffect)(() => {
|
|
5587
6367
|
rerender();
|
|
5588
6368
|
}, [dataSourceState]);
|
|
5589
|
-
const renderCell = (0,
|
|
6369
|
+
const renderCell = (0, import_react31.useCallback)((params) => {
|
|
5590
6370
|
const {
|
|
5591
6371
|
rowIndex,
|
|
5592
6372
|
colIndex,
|
|
@@ -5621,7 +6401,7 @@ function useCellRendering(param) {
|
|
|
5621
6401
|
rowStyle,
|
|
5622
6402
|
rowClassName
|
|
5623
6403
|
};
|
|
5624
|
-
return /* @__PURE__ */
|
|
6404
|
+
return /* @__PURE__ */ import_react32.default.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
|
|
5625
6405
|
}, [
|
|
5626
6406
|
rowHeight,
|
|
5627
6407
|
getData,
|
|
@@ -5639,13 +6419,13 @@ function useCellRendering(param) {
|
|
|
5639
6419
|
}
|
|
5640
6420
|
|
|
5641
6421
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
5642
|
-
var
|
|
6422
|
+
var import_react46 = __toModule(require("react"));
|
|
5643
6423
|
|
|
5644
6424
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
5645
|
-
var
|
|
6425
|
+
var import_react34 = __toModule(require("react"));
|
|
5646
6426
|
|
|
5647
6427
|
// src/components/hooks/useInterceptedMap.ts
|
|
5648
|
-
var
|
|
6428
|
+
var import_react33 = __toModule(require("react"));
|
|
5649
6429
|
function interceptMap(map2, fns) {
|
|
5650
6430
|
const { set, delete: deleteKey, clear } = map2;
|
|
5651
6431
|
if (fns.set) {
|
|
@@ -5733,7 +6513,7 @@ function useColumnGroups() {
|
|
|
5733
6513
|
componentActions,
|
|
5734
6514
|
getComponentState
|
|
5735
6515
|
} = useComponentState();
|
|
5736
|
-
(0,
|
|
6516
|
+
(0, import_react34.useEffect)(() => {
|
|
5737
6517
|
const recompute = () => {
|
|
5738
6518
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
5739
6519
|
};
|
|
@@ -5744,7 +6524,7 @@ function useColumnGroups() {
|
|
|
5744
6524
|
set: update
|
|
5745
6525
|
});
|
|
5746
6526
|
}, [computedColumnGroups]);
|
|
5747
|
-
(0,
|
|
6527
|
+
(0, import_react34.useEffect)(() => {
|
|
5748
6528
|
return interceptMap(collapsedColumnGroups, {
|
|
5749
6529
|
set: (key, visibleCol) => {
|
|
5750
6530
|
const colIds = key.slice(1);
|
|
@@ -5779,10 +6559,10 @@ function useColumnGroups() {
|
|
|
5779
6559
|
}
|
|
5780
6560
|
|
|
5781
6561
|
// src/components/InfiniteTable/hooks/useColumnRowspan.ts
|
|
5782
|
-
var
|
|
6562
|
+
var import_react35 = __toModule(require("react"));
|
|
5783
6563
|
function useColumnRowspan(computedVisibleColumns) {
|
|
5784
6564
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
5785
|
-
const rowspan = (0,
|
|
6565
|
+
const rowspan = (0, import_react35.useMemo)(() => {
|
|
5786
6566
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
5787
6567
|
return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
|
|
5788
6568
|
const dataArray = getDataSourceState().dataArray;
|
|
@@ -5808,10 +6588,10 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
5808
6588
|
}
|
|
5809
6589
|
|
|
5810
6590
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
5811
|
-
var
|
|
6591
|
+
var import_react36 = __toModule(require("react"));
|
|
5812
6592
|
var debug4 = dbg("useColumnSizeFn");
|
|
5813
6593
|
function useColumnSizeFn(columns) {
|
|
5814
|
-
const columnSize = (0,
|
|
6594
|
+
const columnSize = (0, import_react36.useCallback)((index) => {
|
|
5815
6595
|
const column = columns[index];
|
|
5816
6596
|
if (false) {
|
|
5817
6597
|
debug4("cannot find column at index", index, columns);
|
|
@@ -5822,15 +6602,10 @@ function useColumnSizeFn(columns) {
|
|
|
5822
6602
|
}
|
|
5823
6603
|
|
|
5824
6604
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
5825
|
-
var
|
|
6605
|
+
var import_react42 = __toModule(require("react"));
|
|
5826
6606
|
|
|
5827
6607
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
5828
|
-
var
|
|
5829
|
-
|
|
5830
|
-
// src/utils/stripVar.ts
|
|
5831
|
-
function stripVar(cssVariableWithVarString) {
|
|
5832
|
-
return cssVariableWithVarString.slice(4, -1);
|
|
5833
|
-
}
|
|
6608
|
+
var React34 = __toModule(require("react"));
|
|
5834
6609
|
|
|
5835
6610
|
// src/components/DataSource/state/rowInfoStatus.ts
|
|
5836
6611
|
var showLoadingIcon = (rowInfo) => {
|
|
@@ -5841,19 +6616,19 @@ var showLoadingIcon = (rowInfo) => {
|
|
|
5841
6616
|
};
|
|
5842
6617
|
|
|
5843
6618
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5844
|
-
var
|
|
5845
|
-
var
|
|
6619
|
+
var React32 = __toModule(require("react"));
|
|
6620
|
+
var import_react37 = __toModule(require("react"));
|
|
5846
6621
|
|
|
5847
6622
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
5848
|
-
var
|
|
5849
|
-
var ExpanderIconCls = "_16lm1iw6
|
|
5850
|
-
var ExpanderIconClsVariants = (0,
|
|
6623
|
+
var import_createRuntimeFn6 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
6624
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwh _16lm1iwd";
|
|
6625
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn6.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5851
6626
|
|
|
5852
6627
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5853
6628
|
function ExpanderIcon(props) {
|
|
5854
6629
|
var _a;
|
|
5855
6630
|
const { size = 24 } = props;
|
|
5856
|
-
const [expanded, setExpanded] = (0,
|
|
6631
|
+
const [expanded, setExpanded] = (0, import_react37.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
5857
6632
|
const onClick = () => {
|
|
5858
6633
|
var _a2;
|
|
5859
6634
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
@@ -5861,12 +6636,12 @@ function ExpanderIcon(props) {
|
|
|
5861
6636
|
setExpanded(!expanded);
|
|
5862
6637
|
}
|
|
5863
6638
|
};
|
|
5864
|
-
|
|
6639
|
+
React32.useEffect(() => {
|
|
5865
6640
|
if (isControlled("expanded", props)) {
|
|
5866
6641
|
setExpanded(props.expanded);
|
|
5867
6642
|
}
|
|
5868
6643
|
}, [props.expanded]);
|
|
5869
|
-
return /* @__PURE__ */
|
|
6644
|
+
return /* @__PURE__ */ React32.createElement("svg", {
|
|
5870
6645
|
"data-name": "expander-icon",
|
|
5871
6646
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5872
6647
|
height: `${size}px`,
|
|
@@ -5877,20 +6652,20 @@ function ExpanderIcon(props) {
|
|
|
5877
6652
|
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
5878
6653
|
expanded
|
|
5879
6654
|
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
5880
|
-
}, /* @__PURE__ */
|
|
6655
|
+
}, /* @__PURE__ */ React32.createElement("path", {
|
|
5881
6656
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
5882
6657
|
}));
|
|
5883
6658
|
}
|
|
5884
6659
|
|
|
5885
6660
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5886
|
-
var
|
|
6661
|
+
var React33 = __toModule(require("react"));
|
|
5887
6662
|
|
|
5888
6663
|
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
5889
|
-
var LoadingIconCls = "_16lm1iw8
|
|
6664
|
+
var LoadingIconCls = "_16lm1iw8 _16lm1iwh _16lm1iwd";
|
|
5890
6665
|
|
|
5891
6666
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5892
6667
|
var LoadingIcon = (props) => {
|
|
5893
|
-
return /* @__PURE__ */
|
|
6668
|
+
return /* @__PURE__ */ React33.createElement("svg", {
|
|
5894
6669
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5895
6670
|
style: {
|
|
5896
6671
|
margin: "auto",
|
|
@@ -5902,14 +6677,14 @@ var LoadingIcon = (props) => {
|
|
|
5902
6677
|
viewBox: "0 0 100 100",
|
|
5903
6678
|
preserveAspectRatio: "xMidYMid",
|
|
5904
6679
|
className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
|
|
5905
|
-
}, /* @__PURE__ */
|
|
6680
|
+
}, /* @__PURE__ */ React33.createElement("circle", {
|
|
5906
6681
|
cx: "50",
|
|
5907
6682
|
cy: "50",
|
|
5908
6683
|
fill: "none",
|
|
5909
6684
|
strokeWidth: "10",
|
|
5910
6685
|
r: "35",
|
|
5911
6686
|
strokeDasharray: "164.93361431346415 56.97787143782138"
|
|
5912
|
-
}, /* @__PURE__ */
|
|
6687
|
+
}, /* @__PURE__ */ React33.createElement("animateTransform", {
|
|
5913
6688
|
attributeName: "transform",
|
|
5914
6689
|
type: "rotate",
|
|
5915
6690
|
repeatCount: "indefinite",
|
|
@@ -5929,7 +6704,7 @@ function getGroupColumnRender({
|
|
|
5929
6704
|
var _a, _b, _c;
|
|
5930
6705
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5931
6706
|
if (column.renderValue) {
|
|
5932
|
-
value = /* @__PURE__ */
|
|
6707
|
+
value = /* @__PURE__ */ React34.createElement(RenderHookComponent, {
|
|
5933
6708
|
render: column.renderValue,
|
|
5934
6709
|
renderParam: renderOptions
|
|
5935
6710
|
});
|
|
@@ -5959,22 +6734,22 @@ function getGroupColumnRender({
|
|
|
5959
6734
|
const showExpanderIcon = pivotBy ? (((_b = groupRowInfo.groupKeys) == null ? void 0 : _b.length) || 0) < (groupBy == null ? void 0 : groupBy.length) : (((_c = groupRowInfo.groupKeys) == null ? void 0 : _c.length) || 0) <= (groupBy == null ? void 0 : groupBy.length);
|
|
5960
6735
|
const isLoading = showLoadingIcon(groupRowInfo);
|
|
5961
6736
|
if (isLoading) {
|
|
5962
|
-
icon = /* @__PURE__ */
|
|
6737
|
+
icon = /* @__PURE__ */ React34.createElement(LoadingIcon, null);
|
|
5963
6738
|
} else if (showExpanderIcon) {
|
|
5964
|
-
const defaultIcon = /* @__PURE__ */
|
|
6739
|
+
const defaultIcon = /* @__PURE__ */ React34.createElement(ExpanderIcon, {
|
|
5965
6740
|
expanded: !collapsed,
|
|
5966
6741
|
onChange: () => {
|
|
5967
6742
|
toggleGroupRow(groupKeys);
|
|
5968
6743
|
}
|
|
5969
6744
|
});
|
|
5970
|
-
icon = column.renderGroupIcon ? /* @__PURE__ */
|
|
6745
|
+
icon = column.renderGroupIcon ? /* @__PURE__ */ React34.createElement(RenderHookComponent, {
|
|
5971
6746
|
render: column.renderGroupIcon,
|
|
5972
6747
|
renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
|
|
5973
6748
|
}) : defaultIcon;
|
|
5974
6749
|
}
|
|
5975
|
-
return /* @__PURE__ */
|
|
6750
|
+
return /* @__PURE__ */ React34.createElement("div", {
|
|
5976
6751
|
className: join(display.flex, alignItems.center)
|
|
5977
|
-
}, icon, /* @__PURE__ */
|
|
6752
|
+
}, icon, /* @__PURE__ */ React34.createElement("div", {
|
|
5978
6753
|
className: cssEllipsisClassName
|
|
5979
6754
|
}, value != null ? value : null));
|
|
5980
6755
|
};
|
|
@@ -6019,9 +6794,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
6019
6794
|
const showExpanderIcon = rowInfo.isGroupRow ? pivotBy ? (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < (groupBy == null ? void 0 : groupBy.length) : (((_b = rowInfo.groupKeys) == null ? void 0 : _b.length) || 0) <= (groupBy == null ? void 0 : groupBy.length) : false;
|
|
6020
6795
|
const isLoading = showLoadingIcon(rowInfo);
|
|
6021
6796
|
if (isLoading) {
|
|
6022
|
-
icon = /* @__PURE__ */
|
|
6797
|
+
icon = /* @__PURE__ */ React34.createElement(LoadingIcon, null);
|
|
6023
6798
|
} else if (showExpanderIcon) {
|
|
6024
|
-
const defaultIcon = /* @__PURE__ */
|
|
6799
|
+
const defaultIcon = /* @__PURE__ */ React34.createElement(ExpanderIcon, {
|
|
6025
6800
|
expanded: !collapsed,
|
|
6026
6801
|
onChange: () => {
|
|
6027
6802
|
if (!rowInfo.isGroupRow) {
|
|
@@ -6036,9 +6811,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
6036
6811
|
icon = column.renderGroupIcon(renderParam);
|
|
6037
6812
|
}
|
|
6038
6813
|
}
|
|
6039
|
-
return /* @__PURE__ */
|
|
6814
|
+
return /* @__PURE__ */ React34.createElement("div", {
|
|
6040
6815
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
6041
|
-
}, icon, /* @__PURE__ */
|
|
6816
|
+
}, icon, /* @__PURE__ */ React34.createElement("div", {
|
|
6042
6817
|
className: cssEllipsisClassName
|
|
6043
6818
|
}, value != null ? value : null));
|
|
6044
6819
|
}
|
|
@@ -6054,11 +6829,11 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
6054
6829
|
}
|
|
6055
6830
|
|
|
6056
6831
|
// src/components/InfiniteTable/hooks/useEffectWithRaf.ts
|
|
6057
|
-
var
|
|
6832
|
+
var import_react38 = __toModule(require("react"));
|
|
6058
6833
|
function useEffectWithRaf(fn, deps) {
|
|
6059
|
-
const rafId = (0,
|
|
6060
|
-
const removeFnRaf = (0,
|
|
6061
|
-
(0,
|
|
6834
|
+
const rafId = (0, import_react38.useRef)(0);
|
|
6835
|
+
const removeFnRaf = (0, import_react38.useRef)();
|
|
6836
|
+
(0, import_react38.useEffect)(() => {
|
|
6062
6837
|
rafId.current = requestAnimationFrame(() => {
|
|
6063
6838
|
removeFnRaf.current = fn();
|
|
6064
6839
|
});
|
|
@@ -6075,7 +6850,7 @@ function useEffectWithRaf(fn, deps) {
|
|
|
6075
6850
|
}
|
|
6076
6851
|
|
|
6077
6852
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
6078
|
-
var
|
|
6853
|
+
var import_react41 = __toModule(require("react"));
|
|
6079
6854
|
|
|
6080
6855
|
// src/utils/groupAndPivot/index.ts
|
|
6081
6856
|
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
@@ -6528,7 +7303,7 @@ function enhancedFlatten(param) {
|
|
|
6528
7303
|
}
|
|
6529
7304
|
|
|
6530
7305
|
// src/components/DataSource/index.tsx
|
|
6531
|
-
var
|
|
7306
|
+
var React35 = __toModule(require("react"));
|
|
6532
7307
|
|
|
6533
7308
|
// src/utils/multisort/sortTypes.ts
|
|
6534
7309
|
var numberComparator = function(first, second) {
|
|
@@ -6716,15 +7491,15 @@ var GroupRowsState = class {
|
|
|
6716
7491
|
};
|
|
6717
7492
|
|
|
6718
7493
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
6719
|
-
var
|
|
7494
|
+
var import_react40 = __toModule(require("react"));
|
|
6720
7495
|
|
|
6721
7496
|
// src/components/hooks/useEffectWithChanges.ts
|
|
6722
|
-
var
|
|
7497
|
+
var import_react39 = __toModule(require("react"));
|
|
6723
7498
|
function useEffectWithChanges(fn, deps) {
|
|
6724
|
-
const prevRef = (0,
|
|
6725
|
-
const oldValuesRef = (0,
|
|
7499
|
+
const prevRef = (0, import_react39.useRef)({});
|
|
7500
|
+
const oldValuesRef = (0, import_react39.useRef)({});
|
|
6726
7501
|
const oldValues = oldValuesRef.current;
|
|
6727
|
-
const changesRef = (0,
|
|
7502
|
+
const changesRef = (0, import_react39.useRef)({});
|
|
6728
7503
|
const changes = changesRef.current;
|
|
6729
7504
|
const useEffectDeps = [];
|
|
6730
7505
|
for (const k in deps) {
|
|
@@ -6737,7 +7512,7 @@ function useEffectWithChanges(fn, deps) {
|
|
|
6737
7512
|
}
|
|
6738
7513
|
}
|
|
6739
7514
|
prevRef.current = deps;
|
|
6740
|
-
(0,
|
|
7515
|
+
(0, import_react39.useEffect)(() => {
|
|
6741
7516
|
const changes2 = changesRef.current;
|
|
6742
7517
|
const result = fn(changes2, oldValues);
|
|
6743
7518
|
changesRef.current = {};
|
|
@@ -7005,12 +7780,12 @@ function useLoadData() {
|
|
|
7005
7780
|
livePaginationCursor,
|
|
7006
7781
|
cursorId: stateCursorId
|
|
7007
7782
|
} = componentState;
|
|
7008
|
-
const [scrollbars, setScrollbars] = (0,
|
|
7783
|
+
const [scrollbars, setScrollbars] = (0, import_react40.useState)({
|
|
7009
7784
|
vertical: false,
|
|
7010
7785
|
horizontal: false
|
|
7011
7786
|
});
|
|
7012
|
-
const scrollbarsRef = (0,
|
|
7013
|
-
(0,
|
|
7787
|
+
const scrollbarsRef = (0, import_react40.useRef)(scrollbars);
|
|
7788
|
+
(0, import_react40.useEffect)(() => {
|
|
7014
7789
|
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
7015
7790
|
if (!scrollbars2) {
|
|
7016
7791
|
return;
|
|
@@ -7020,7 +7795,7 @@ function useLoadData() {
|
|
|
7020
7795
|
});
|
|
7021
7796
|
return () => notifyScrollbarsChange.destroy();
|
|
7022
7797
|
}, [notifyScrollbarsChange]);
|
|
7023
|
-
(0,
|
|
7798
|
+
(0, import_react40.useEffect)(() => {
|
|
7024
7799
|
if (!livePagination) {
|
|
7025
7800
|
return;
|
|
7026
7801
|
}
|
|
@@ -7034,7 +7809,7 @@ function useLoadData() {
|
|
|
7034
7809
|
});
|
|
7035
7810
|
return () => cancelAnimationFrame(frameId);
|
|
7036
7811
|
}, [livePaginationCursor]);
|
|
7037
|
-
(0,
|
|
7812
|
+
(0, import_react40.useEffect)(() => {
|
|
7038
7813
|
if (!livePagination || livePaginationCursor !== void 0) {
|
|
7039
7814
|
return;
|
|
7040
7815
|
}
|
|
@@ -7048,7 +7823,7 @@ function useLoadData() {
|
|
|
7048
7823
|
});
|
|
7049
7824
|
return () => cancelAnimationFrame(frameId);
|
|
7050
7825
|
}, [dataArray.length, livePaginationCursor]);
|
|
7051
|
-
(0,
|
|
7826
|
+
(0, import_react40.useEffect)(() => {
|
|
7052
7827
|
const state = getComponentState();
|
|
7053
7828
|
const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2, dataArray: dataArray2 } = state;
|
|
7054
7829
|
if (!scrollbars.vertical && livePagination2) {
|
|
@@ -7066,7 +7841,7 @@ function useLoadData() {
|
|
|
7066
7841
|
filterValue,
|
|
7067
7842
|
cursorId: livePagination ? stateCursorId : null
|
|
7068
7843
|
};
|
|
7069
|
-
const initialRef = (0,
|
|
7844
|
+
const initialRef = (0, import_react40.useRef)(true);
|
|
7070
7845
|
useLazyLoadRange();
|
|
7071
7846
|
useEffectWithChanges(() => {
|
|
7072
7847
|
const componentState2 = getComponentState();
|
|
@@ -7098,7 +7873,7 @@ function useLazyLoadRange() {
|
|
|
7098
7873
|
componentActions: actions,
|
|
7099
7874
|
componentState
|
|
7100
7875
|
} = useComponentState();
|
|
7101
|
-
(0,
|
|
7876
|
+
(0, import_react40.useEffect)(() => {
|
|
7102
7877
|
actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
|
|
7103
7878
|
}, [componentState.data, componentState.dataParams]);
|
|
7104
7879
|
const {
|
|
@@ -7107,7 +7882,7 @@ function useLazyLoadRange() {
|
|
|
7107
7882
|
dataArray,
|
|
7108
7883
|
scrollStopDelayUpdatedByTable
|
|
7109
7884
|
} = componentState;
|
|
7110
|
-
const latestRenderRangeRef = (0,
|
|
7885
|
+
const latestRenderRangeRef = (0, import_react40.useRef)(null);
|
|
7111
7886
|
const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
|
|
7112
7887
|
const componentState2 = getComponentState();
|
|
7113
7888
|
renderRange = renderRange || latestRenderRangeRef.current;
|
|
@@ -7126,8 +7901,8 @@ function useLazyLoadRange() {
|
|
|
7126
7901
|
componentActions: actions
|
|
7127
7902
|
}, cache);
|
|
7128
7903
|
};
|
|
7129
|
-
const debouncedLoadRange = (0,
|
|
7130
|
-
(0,
|
|
7904
|
+
const debouncedLoadRange = (0, import_react40.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
7905
|
+
(0, import_react40.useEffect)(() => {
|
|
7131
7906
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
7132
7907
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
7133
7908
|
latestRenderRangeRef.current = renderRange;
|
|
@@ -7136,7 +7911,7 @@ function useLazyLoadRange() {
|
|
|
7136
7911
|
}
|
|
7137
7912
|
return;
|
|
7138
7913
|
}, [lazyLoadBatchSize]);
|
|
7139
|
-
(0,
|
|
7914
|
+
(0, import_react40.useEffect)(() => {
|
|
7140
7915
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
7141
7916
|
debouncedLoadRange();
|
|
7142
7917
|
}
|
|
@@ -7939,7 +8714,7 @@ function DataSourceWithContext(props) {
|
|
|
7939
8714
|
if (typeof children === "function") {
|
|
7940
8715
|
children = children(computedValues);
|
|
7941
8716
|
}
|
|
7942
|
-
return /* @__PURE__ */
|
|
8717
|
+
return /* @__PURE__ */ React35.createElement(React35.Fragment, null, children);
|
|
7943
8718
|
}
|
|
7944
8719
|
var DataSourceRoot = getComponentStateRoot({
|
|
7945
8720
|
initSetupState,
|
|
@@ -7962,14 +8737,14 @@ function DataSourceCmp({ children }) {
|
|
|
7962
8737
|
globalThis.getDataSourceState = getState;
|
|
7963
8738
|
}
|
|
7964
8739
|
useLoadData();
|
|
7965
|
-
return /* @__PURE__ */
|
|
8740
|
+
return /* @__PURE__ */ React35.createElement(DataSourceContext.Provider, {
|
|
7966
8741
|
value: contextValue
|
|
7967
|
-
}, /* @__PURE__ */
|
|
8742
|
+
}, /* @__PURE__ */ React35.createElement(DataSourceWithContext, {
|
|
7968
8743
|
children
|
|
7969
8744
|
}));
|
|
7970
8745
|
}
|
|
7971
8746
|
function DataSource(props) {
|
|
7972
|
-
return /* @__PURE__ */
|
|
8747
|
+
return /* @__PURE__ */ React35.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React35.createElement(DataSourceCmp, {
|
|
7973
8748
|
children: props.children
|
|
7974
8749
|
}));
|
|
7975
8750
|
}
|
|
@@ -7977,7 +8752,7 @@ function DataSource(props) {
|
|
|
7977
8752
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
7978
8753
|
function useToggleGroupRow() {
|
|
7979
8754
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
7980
|
-
const toggleGroupRow = (0,
|
|
8755
|
+
const toggleGroupRow = (0, import_react41.useCallback)((groupKeys) => {
|
|
7981
8756
|
const state = getDataSourceState();
|
|
7982
8757
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
7983
8758
|
newState.toggleGroupRow(groupKeys);
|
|
@@ -8009,7 +8784,7 @@ function useToggleGroupRow() {
|
|
|
8009
8784
|
|
|
8010
8785
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
8011
8786
|
function useGroupByMap(groupBy) {
|
|
8012
|
-
const groupByMap = (0,
|
|
8787
|
+
const groupByMap = (0, import_react42.useMemo)(() => {
|
|
8013
8788
|
return groupBy.reduce((acc, groupBy2, index) => {
|
|
8014
8789
|
acc.set(groupBy2.field, {
|
|
8015
8790
|
groupBy: groupBy2,
|
|
@@ -8033,13 +8808,13 @@ function useColumnsWhen() {
|
|
|
8033
8808
|
}
|
|
8034
8809
|
} = useComponentState();
|
|
8035
8810
|
const groupByMap = useGroupByMap(groupBy);
|
|
8036
|
-
(0,
|
|
8811
|
+
(0, import_react42.useEffect)(() => {
|
|
8037
8812
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
8038
8813
|
}, [groupRenderStrategy]);
|
|
8039
|
-
(0,
|
|
8814
|
+
(0, import_react42.useEffect)(() => {
|
|
8040
8815
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
8041
8816
|
}, [pivotTotalColumnPosition]);
|
|
8042
|
-
(0,
|
|
8817
|
+
(0, import_react42.useEffect)(() => {
|
|
8043
8818
|
if (pivotGrandTotalColumnPosition != void 0) {
|
|
8044
8819
|
dataSourceActions.pivotGrandTotalColumnPosition = pivotGrandTotalColumnPosition;
|
|
8045
8820
|
}
|
|
@@ -8113,7 +8888,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
8113
8888
|
});
|
|
8114
8889
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
8115
8890
|
}
|
|
8116
|
-
(0,
|
|
8891
|
+
(0, import_react42.useEffect)(() => {
|
|
8117
8892
|
const update = () => {
|
|
8118
8893
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
8119
8894
|
};
|
|
@@ -8142,7 +8917,7 @@ function useColumnsWhenGrouping() {
|
|
|
8142
8917
|
}
|
|
8143
8918
|
} = useComponentState();
|
|
8144
8919
|
const toggleGroupRow = useToggleGroupRow();
|
|
8145
|
-
(0,
|
|
8920
|
+
(0, import_react42.useEffect)(() => {
|
|
8146
8921
|
const update = () => {
|
|
8147
8922
|
const columnsWhenGrouping = getColumnsWhenGrouping({
|
|
8148
8923
|
columns,
|
|
@@ -8278,7 +9053,7 @@ function useHideColumns(groupByMap) {
|
|
|
8278
9053
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
8279
9054
|
hideEmptyGroupColumns
|
|
8280
9055
|
]);
|
|
8281
|
-
(0,
|
|
9056
|
+
(0, import_react42.useEffect)(() => {
|
|
8282
9057
|
const isGrouped = groupBy.length > 0;
|
|
8283
9058
|
const currentState = getComponentState();
|
|
8284
9059
|
const { controlledColumnVisibility, columnVisibility } = currentState;
|
|
@@ -8393,145 +9168,7 @@ function getColumnsWhenGrouping(params) {
|
|
|
8393
9168
|
}
|
|
8394
9169
|
|
|
8395
9170
|
// src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
|
|
8396
|
-
var
|
|
8397
|
-
|
|
8398
|
-
// src/components/flexbox/index.ts
|
|
8399
|
-
var computeFlex = (params) => {
|
|
8400
|
-
const {
|
|
8401
|
-
availableSize,
|
|
8402
|
-
items,
|
|
8403
|
-
minSize: defaultMinSize,
|
|
8404
|
-
maxSize: defaultMaxSize
|
|
8405
|
-
} = params;
|
|
8406
|
-
if (availableSize < 0) {
|
|
8407
|
-
throw "The provided availableSize cannot be negative!";
|
|
8408
|
-
}
|
|
8409
|
-
let totalFixedSize = 0;
|
|
8410
|
-
let totalFlex = 0;
|
|
8411
|
-
let totalFlexCount = 0;
|
|
8412
|
-
const minSizes = [];
|
|
8413
|
-
const maxSizes = [];
|
|
8414
|
-
items.forEach((item, i) => {
|
|
8415
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8416
|
-
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
8417
|
-
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
8418
|
-
minSizes.push(minSize);
|
|
8419
|
-
maxSizes.push(maxSize);
|
|
8420
|
-
if (item.size != null) {
|
|
8421
|
-
if (maxSize != null && item.size > maxSize) {
|
|
8422
|
-
item.size = maxSize;
|
|
8423
|
-
}
|
|
8424
|
-
if (minSize != null && item.size < minSize) {
|
|
8425
|
-
item.size = minSize;
|
|
8426
|
-
}
|
|
8427
|
-
}
|
|
8428
|
-
if (item.size == null && item.flex == null) {
|
|
8429
|
-
throw `Items must specify either a size or a flex property. Item at index ${i} doesn't have either of those.`;
|
|
8430
|
-
}
|
|
8431
|
-
if (item.flex != null) {
|
|
8432
|
-
totalFlexCount += 1;
|
|
8433
|
-
}
|
|
8434
|
-
totalFlex += (_e = item.flex) != null ? _e : 0;
|
|
8435
|
-
totalFixedSize += (_f = item.size) != null ? _f : 0;
|
|
8436
|
-
});
|
|
8437
|
-
let availableSizeForFlex = Math.max(availableSize - totalFixedSize, 0);
|
|
8438
|
-
let sizePerFlex = availableSizeForFlex / totalFlex;
|
|
8439
|
-
let maxxedFlexItems = {};
|
|
8440
|
-
let minnedFlexItems = {};
|
|
8441
|
-
let constrainedCount = 0;
|
|
8442
|
-
items.forEach((item, index) => {
|
|
8443
|
-
var _a, _b, _c, _d;
|
|
8444
|
-
if (item.flex != null) {
|
|
8445
|
-
const approxFlexSize = sizePerFlex * item.flex;
|
|
8446
|
-
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
8447
|
-
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
8448
|
-
let constrained = false;
|
|
8449
|
-
let substractSize = 0;
|
|
8450
|
-
if (maxSize != null && approxFlexSize > maxSize) {
|
|
8451
|
-
maxxedFlexItems[index] = true;
|
|
8452
|
-
constrained = true;
|
|
8453
|
-
substractSize = maxSize;
|
|
8454
|
-
}
|
|
8455
|
-
if (minSize != null && approxFlexSize < minSize) {
|
|
8456
|
-
minnedFlexItems[index] = true;
|
|
8457
|
-
constrained = true;
|
|
8458
|
-
substractSize = minSize;
|
|
8459
|
-
}
|
|
8460
|
-
if (constrained) {
|
|
8461
|
-
constrainedCount += 1;
|
|
8462
|
-
totalFlexCount -= 1;
|
|
8463
|
-
totalFlex -= item.flex;
|
|
8464
|
-
availableSizeForFlex -= substractSize;
|
|
8465
|
-
}
|
|
8466
|
-
}
|
|
8467
|
-
});
|
|
8468
|
-
if (constrainedCount) {
|
|
8469
|
-
sizePerFlex = availableSizeForFlex / totalFlex;
|
|
8470
|
-
}
|
|
8471
|
-
let flexSizes = [];
|
|
8472
|
-
let currentFlexCount = 0;
|
|
8473
|
-
let remainingSizeForFlex = availableSizeForFlex;
|
|
8474
|
-
let remainingFlex = totalFlex;
|
|
8475
|
-
let totalTakenSize = 0;
|
|
8476
|
-
let flexSizeSum = 0;
|
|
8477
|
-
const computedSizes = [];
|
|
8478
|
-
const resultItems = items.map((item, index) => {
|
|
8479
|
-
var _a, _b, _c, _d, _e;
|
|
8480
|
-
const sizedItem = __spreadValues({}, item);
|
|
8481
|
-
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
8482
|
-
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
8483
|
-
let flexSize = 0;
|
|
8484
|
-
const maxxed = maxxedFlexItems[index];
|
|
8485
|
-
const minned = minnedFlexItems[index];
|
|
8486
|
-
const constrained = maxxed || minned;
|
|
8487
|
-
let computedSize = (_e = item.size) != null ? _e : 0;
|
|
8488
|
-
if (item.flex != null) {
|
|
8489
|
-
if (constrained) {
|
|
8490
|
-
if (minned) {
|
|
8491
|
-
flexSize = minSize;
|
|
8492
|
-
}
|
|
8493
|
-
if (maxxed) {
|
|
8494
|
-
flexSize = maxSize;
|
|
8495
|
-
}
|
|
8496
|
-
} else {
|
|
8497
|
-
currentFlexCount += 1;
|
|
8498
|
-
const constrain = (size) => {
|
|
8499
|
-
if (maxSize != null && size > maxSize) {
|
|
8500
|
-
size = maxSize;
|
|
8501
|
-
}
|
|
8502
|
-
if (minSize != null && size < minSize) {
|
|
8503
|
-
size = minSize;
|
|
8504
|
-
}
|
|
8505
|
-
return size;
|
|
8506
|
-
};
|
|
8507
|
-
if (currentFlexCount === totalFlexCount) {
|
|
8508
|
-
flexSize = constrain(remainingSizeForFlex);
|
|
8509
|
-
} else {
|
|
8510
|
-
flexSize = constrain(Math.round(item.flex * sizePerFlex));
|
|
8511
|
-
flexSizeSum += flexSize;
|
|
8512
|
-
remainingSizeForFlex = availableSizeForFlex - flexSizeSum;
|
|
8513
|
-
remainingFlex -= item.flex;
|
|
8514
|
-
sizePerFlex = remainingSizeForFlex / remainingFlex;
|
|
8515
|
-
}
|
|
8516
|
-
}
|
|
8517
|
-
computedSize = flexSize;
|
|
8518
|
-
sizedItem.flexSize = flexSize;
|
|
8519
|
-
}
|
|
8520
|
-
flexSizes.push(flexSize);
|
|
8521
|
-
computedSizes.push(computedSize);
|
|
8522
|
-
sizedItem.computedSize = computedSize;
|
|
8523
|
-
totalTakenSize += computedSize;
|
|
8524
|
-
return sizedItem;
|
|
8525
|
-
});
|
|
8526
|
-
return {
|
|
8527
|
-
items: resultItems,
|
|
8528
|
-
flexSizes,
|
|
8529
|
-
minSizes,
|
|
8530
|
-
maxSizes,
|
|
8531
|
-
computedSizes,
|
|
8532
|
-
remainingSize: Math.round(availableSize - totalTakenSize)
|
|
8533
|
-
};
|
|
8534
|
-
};
|
|
9171
|
+
var import_react44 = __toModule(require("react"));
|
|
8535
9172
|
|
|
8536
9173
|
// src/components/InfiniteTable/utils/adjustColumnOrderForPinning.ts
|
|
8537
9174
|
var order = ["start", void 0, "end"];
|
|
@@ -8725,8 +9362,8 @@ var getComputedVisibleColumns = ({
|
|
|
8725
9362
|
const computedSortIndex = (_c = sortingInfo == null ? void 0 : sortingInfo.index) != null ? _c : -1;
|
|
8726
9363
|
const computedWidth = computedSizes[i];
|
|
8727
9364
|
const computedFlex = flexSizes[i] || null;
|
|
8728
|
-
const computedMinWidth = minSizes[i] ||
|
|
8729
|
-
const computedMaxWidth = maxSizes[i] ||
|
|
9365
|
+
const computedMinWidth = minSizes[i] || 0;
|
|
9366
|
+
const computedMaxWidth = maxSizes[i] || 1e4;
|
|
8730
9367
|
const computedPinned = getComputedPinned(id, columnPinning);
|
|
8731
9368
|
const computedLast = i === visibleColumnOrder.length - 1;
|
|
8732
9369
|
const computedPinningOffset = computedPinned === "start" ? computedPinnedStartColumnsWidth : computedPinned === "end" ? computedPinnedEndColumnsWidth : computedOffset - computedPinnedStartColumnsWidth;
|
|
@@ -8879,10 +9516,10 @@ var getComputedVisibleColumns = ({
|
|
|
8879
9516
|
};
|
|
8880
9517
|
|
|
8881
9518
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
8882
|
-
var
|
|
9519
|
+
var import_react43 = __toModule(require("react"));
|
|
8883
9520
|
var useRerenderOnKeyChange = (map2) => {
|
|
8884
9521
|
const [renderId, rerender] = useRerender();
|
|
8885
|
-
(0,
|
|
9522
|
+
(0, import_react43.useEffect)(() => {
|
|
8886
9523
|
const update = rafFn(rerender);
|
|
8887
9524
|
return interceptMap(map2, {
|
|
8888
9525
|
set: update,
|
|
@@ -8936,7 +9573,7 @@ var useComputedVisibleColumns = ({
|
|
|
8936
9573
|
computedPinnedEndOffset,
|
|
8937
9574
|
computedPinnedEndWidth,
|
|
8938
9575
|
computedPinnedStartWidth
|
|
8939
|
-
} = (0,
|
|
9576
|
+
} = (0, import_react44.useMemo)(() => {
|
|
8940
9577
|
return getComputedVisibleColumns({
|
|
8941
9578
|
columns,
|
|
8942
9579
|
bodySize,
|
|
@@ -8968,6 +9605,7 @@ var useComputedVisibleColumns = ({
|
|
|
8968
9605
|
columnMinWidth,
|
|
8969
9606
|
columnMaxWidth,
|
|
8970
9607
|
columnDefaultWidth,
|
|
9608
|
+
viewportReservedWidth,
|
|
8971
9609
|
sortable,
|
|
8972
9610
|
sortInfo,
|
|
8973
9611
|
setSortInfo,
|
|
@@ -8976,6 +9614,7 @@ var useComputedVisibleColumns = ({
|
|
|
8976
9614
|
columnOrder,
|
|
8977
9615
|
columnVisibility,
|
|
8978
9616
|
columnVisibilityAssumeVisible,
|
|
9617
|
+
resizableColumns,
|
|
8979
9618
|
pinnedEndMaxWidth,
|
|
8980
9619
|
pinnedStartMaxWidth,
|
|
8981
9620
|
columnSizing,
|
|
@@ -9005,7 +9644,7 @@ var useComputedVisibleColumns = ({
|
|
|
9005
9644
|
};
|
|
9006
9645
|
|
|
9007
9646
|
// src/components/InfiniteTable/hooks/useScrollbars.ts
|
|
9008
|
-
var
|
|
9647
|
+
var import_react45 = __toModule(require("react"));
|
|
9009
9648
|
var INITIAL_SCROLLBARS = {
|
|
9010
9649
|
vertical: false,
|
|
9011
9650
|
horizontal: false
|
|
@@ -9013,8 +9652,8 @@ var INITIAL_SCROLLBARS = {
|
|
|
9013
9652
|
function useScrollbars(brain) {
|
|
9014
9653
|
const { getComponentState: getInfiniteTableState } = useComponentState();
|
|
9015
9654
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
9016
|
-
const [scrollbars, setScrollbars] = (0,
|
|
9017
|
-
(0,
|
|
9655
|
+
const [scrollbars, setScrollbars] = (0, import_react45.useState)(INITIAL_SCROLLBARS);
|
|
9656
|
+
(0, import_react45.useEffect)(() => {
|
|
9018
9657
|
return brain.onRenderCountChange(() => {
|
|
9019
9658
|
const { scrollTopMax, scrollLeftMax } = brain;
|
|
9020
9659
|
setScrollbars({
|
|
@@ -9023,7 +9662,7 @@ function useScrollbars(brain) {
|
|
|
9023
9662
|
});
|
|
9024
9663
|
});
|
|
9025
9664
|
}, [brain]);
|
|
9026
|
-
(0,
|
|
9665
|
+
(0, import_react45.useLayoutEffect)(() => {
|
|
9027
9666
|
const dataSourceState = getDataSourceState();
|
|
9028
9667
|
const { onScrollbarsChange } = getInfiniteTableState();
|
|
9029
9668
|
const { notifyScrollbarsChange } = dataSourceState;
|
|
@@ -9054,7 +9693,7 @@ function useComputed() {
|
|
|
9054
9693
|
bodySize,
|
|
9055
9694
|
showSeparatePivotColumnForSingleAggregation
|
|
9056
9695
|
} = componentState;
|
|
9057
|
-
(0,
|
|
9696
|
+
(0, import_react46.useState)(() => {
|
|
9058
9697
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
9059
9698
|
if (rowHeight) {
|
|
9060
9699
|
componentActions.rowHeight = rowHeight;
|
|
@@ -9066,13 +9705,13 @@ function useComputed() {
|
|
|
9066
9705
|
}
|
|
9067
9706
|
});
|
|
9068
9707
|
});
|
|
9069
|
-
(0,
|
|
9708
|
+
(0, import_react46.useEffect)(() => {
|
|
9070
9709
|
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
9071
9710
|
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
9072
9711
|
const { multiSort, filterValue } = dataSourceState;
|
|
9073
9712
|
useColumnGroups();
|
|
9074
9713
|
const { toggleGroupRow } = useColumnsWhen();
|
|
9075
|
-
const setSortInfo = (0,
|
|
9714
|
+
const setSortInfo = (0, import_react46.useCallback)((sortInfo) => {
|
|
9076
9715
|
var _a2;
|
|
9077
9716
|
const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
9078
9717
|
dataSourceActions.sortInfo = newSortInfo;
|
|
@@ -9150,6 +9789,10 @@ function useComputed() {
|
|
|
9150
9789
|
}
|
|
9151
9790
|
|
|
9152
9791
|
// src/components/InfiniteTable/hooks/useDOMProps.ts
|
|
9792
|
+
var columnWidthAtIndex4 = stripVar(InternalVars.columnWidthAtIndex);
|
|
9793
|
+
var columnOffsetAtIndex2 = stripVar(InternalVars.columnOffsetAtIndex);
|
|
9794
|
+
var activeCellColWidth = stripVar(InternalVars.activeCellColWidth);
|
|
9795
|
+
var activeCellColOffset = stripVar(InternalVars.activeCellColOffset);
|
|
9153
9796
|
function useDOMProps(initialDOMProps) {
|
|
9154
9797
|
const { computed, componentState, componentActions } = useInfiniteTable();
|
|
9155
9798
|
const {
|
|
@@ -9160,9 +9803,24 @@ function useDOMProps(initialDOMProps) {
|
|
|
9160
9803
|
onBlurWithin,
|
|
9161
9804
|
onFocusWithin,
|
|
9162
9805
|
onSelfFocus,
|
|
9163
|
-
onSelfBlur
|
|
9806
|
+
onSelfBlur,
|
|
9807
|
+
activeCellIndex
|
|
9164
9808
|
} = componentState;
|
|
9165
|
-
const {
|
|
9809
|
+
const {
|
|
9810
|
+
computedPinnedStartColumnsWidth,
|
|
9811
|
+
computedPinnedEndColumnsWidth,
|
|
9812
|
+
computedVisibleColumns
|
|
9813
|
+
} = computed;
|
|
9814
|
+
const cssVars = computedVisibleColumns.reduce((vars, col) => {
|
|
9815
|
+
const index = col.computedVisibleIndex;
|
|
9816
|
+
vars[`${columnWidthAtIndex4}-${index}`] = col.computedWidth + "px";
|
|
9817
|
+
vars[`${columnOffsetAtIndex2}-${index}`] = col.computedOffset + "px";
|
|
9818
|
+
return vars;
|
|
9819
|
+
}, {});
|
|
9820
|
+
if (activeCellIndex != null) {
|
|
9821
|
+
cssVars[activeCellColWidth] = `var(${getCSSVarNameForColWidth(activeCellIndex[1])})`;
|
|
9822
|
+
cssVars[activeCellColOffset] = `var(${getCSSVarNameForColOffset(activeCellIndex[1])})`;
|
|
9823
|
+
}
|
|
9166
9824
|
const setFocused = rafFn((focused2) => {
|
|
9167
9825
|
componentActions.focused = focused2;
|
|
9168
9826
|
});
|
|
@@ -9217,7 +9875,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
9217
9875
|
focusedWithin
|
|
9218
9876
|
}));
|
|
9219
9877
|
domProps.className = className;
|
|
9220
|
-
domProps.style = __spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style);
|
|
9878
|
+
domProps.style = __spreadValues(__spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style), cssVars);
|
|
9221
9879
|
if (focused) {
|
|
9222
9880
|
if (componentState.focusedStyle) {
|
|
9223
9881
|
Object.assign(domProps.style, componentState.focusedStyle);
|
|
@@ -9232,7 +9890,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
9232
9890
|
}
|
|
9233
9891
|
|
|
9234
9892
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
9235
|
-
var
|
|
9893
|
+
var import_react47 = __toModule(require("react"));
|
|
9236
9894
|
|
|
9237
9895
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
9238
9896
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -9390,10 +10048,10 @@ var isInsideSandbox = () => {
|
|
|
9390
10048
|
};
|
|
9391
10049
|
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
9392
10050
|
var useLicense = (licenseKey = "") => {
|
|
9393
|
-
const valid = (0,
|
|
10051
|
+
const valid = (0, import_react47.useMemo)(() => {
|
|
9394
10052
|
let valid2 = isValidLicense(licenseKey, {
|
|
9395
10053
|
publishedAt: 1624970570587,
|
|
9396
|
-
version: "0.3.
|
|
10054
|
+
version: "0.3.15"
|
|
9397
10055
|
});
|
|
9398
10056
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
9399
10057
|
return true;
|
|
@@ -9524,10 +10182,23 @@ function handleCellNavigation(options) {
|
|
|
9524
10182
|
actions.activeCellIndex = [rowIndex, colIndex];
|
|
9525
10183
|
return true;
|
|
9526
10184
|
}
|
|
10185
|
+
var validKeys = {
|
|
10186
|
+
ArrowUp: true,
|
|
10187
|
+
ArrowDown: true,
|
|
10188
|
+
ArrowLeft: true,
|
|
10189
|
+
ArrowRight: true,
|
|
10190
|
+
PageUp: true,
|
|
10191
|
+
PageDown: true,
|
|
10192
|
+
Home: true,
|
|
10193
|
+
End: true
|
|
10194
|
+
};
|
|
9527
10195
|
function handleKeyboardNavigation(options) {
|
|
9528
10196
|
const { getState } = options;
|
|
9529
10197
|
const state = getState();
|
|
9530
10198
|
const { activeRowIndex, activeCellIndex, keyboardNavigation } = state;
|
|
10199
|
+
if (!validKeys[options.key]) {
|
|
10200
|
+
return false;
|
|
10201
|
+
}
|
|
9531
10202
|
if (activeRowIndex != null && keyboardNavigation === "row") {
|
|
9532
10203
|
return handleRowNavigation(options);
|
|
9533
10204
|
}
|
|
@@ -9538,7 +10209,7 @@ function handleKeyboardNavigation(options) {
|
|
|
9538
10209
|
}
|
|
9539
10210
|
|
|
9540
10211
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
9541
|
-
var
|
|
10212
|
+
var import_react48 = __toModule(require("react"));
|
|
9542
10213
|
|
|
9543
10214
|
// src/components/VirtualBrain/ScrollListener.ts
|
|
9544
10215
|
var initialScrollPosition = {
|
|
@@ -9618,6 +10289,7 @@ function initSetupState2() {
|
|
|
9618
10289
|
});
|
|
9619
10290
|
if (false) {
|
|
9620
10291
|
globalThis.brain = brain;
|
|
10292
|
+
globalThis.headerBrain = headerBrain;
|
|
9621
10293
|
}
|
|
9622
10294
|
const { renderer, onRenderUpdater } = createRenderer2(brain);
|
|
9623
10295
|
brain.onAvailableSizeChange((size) => {
|
|
@@ -9633,9 +10305,10 @@ function initSetupState2() {
|
|
|
9633
10305
|
brain,
|
|
9634
10306
|
headerBrain,
|
|
9635
10307
|
columnShifts: null,
|
|
9636
|
-
domRef: (0,
|
|
9637
|
-
scrollerDOMRef: (0,
|
|
9638
|
-
portalDOMRef: (0,
|
|
10308
|
+
domRef: (0, import_react48.createRef)(),
|
|
10309
|
+
scrollerDOMRef: (0, import_react48.createRef)(),
|
|
10310
|
+
portalDOMRef: (0, import_react48.createRef)(),
|
|
10311
|
+
activeCellIndicatorDOMRef: (0, import_react48.createRef)(),
|
|
9639
10312
|
onRowHeightCSSVarChange: buildSubscriptionCallback(),
|
|
9640
10313
|
onColumnHeaderHeightCSSVarChange: buildSubscriptionCallback(),
|
|
9641
10314
|
bodySize: {
|
|
@@ -9691,7 +10364,7 @@ var forwardProps3 = (setupState) => {
|
|
|
9691
10364
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
9692
10365
|
resizableColumns: (resizableColumns) => resizableColumns != null ? resizableColumns : true,
|
|
9693
10366
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
9694
|
-
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth :
|
|
10367
|
+
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 5e3,
|
|
9695
10368
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
9696
10369
|
columnCssEllipsis: (columnCssEllipsis) => columnCssEllipsis != null ? columnCssEllipsis : true,
|
|
9697
10370
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
@@ -9794,7 +10467,7 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
9794
10467
|
getParentState: () => useDataSource(),
|
|
9795
10468
|
debugName: "InfiniteTable"
|
|
9796
10469
|
});
|
|
9797
|
-
var InfiniteTableComponent =
|
|
10470
|
+
var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
9798
10471
|
var _a;
|
|
9799
10472
|
const {
|
|
9800
10473
|
componentState,
|
|
@@ -9808,7 +10481,7 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9808
10481
|
getState: getDataSourceState,
|
|
9809
10482
|
componentActions: dataSourceActions
|
|
9810
10483
|
} = useDataSourceContextValue();
|
|
9811
|
-
const [imperativeApi] = (0,
|
|
10484
|
+
const [imperativeApi] = (0, import_react49.useState)(() => {
|
|
9812
10485
|
return getImperativeApi(getState, getComputed, getDataSourceState, actions);
|
|
9813
10486
|
});
|
|
9814
10487
|
const {
|
|
@@ -9832,14 +10505,14 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9832
10505
|
activeCellIndex,
|
|
9833
10506
|
onRenderUpdater
|
|
9834
10507
|
} = componentState;
|
|
9835
|
-
(0,
|
|
10508
|
+
(0, import_react49.useEffect)(() => {
|
|
9836
10509
|
if (activeRowIndex != null) {
|
|
9837
10510
|
imperativeApi.scrollRowIntoView(activeRowIndex, {
|
|
9838
10511
|
offset: 30
|
|
9839
10512
|
});
|
|
9840
10513
|
}
|
|
9841
10514
|
}, [activeRowIndex]);
|
|
9842
|
-
(0,
|
|
10515
|
+
(0, import_react49.useEffect)(() => {
|
|
9843
10516
|
if (activeCellIndex != null) {
|
|
9844
10517
|
imperativeApi.scrollCellIntoView(activeCellIndex[0], activeCellIndex[1], {
|
|
9845
10518
|
offset: 30
|
|
@@ -9856,7 +10529,7 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9856
10529
|
bodySize,
|
|
9857
10530
|
computed
|
|
9858
10531
|
});
|
|
9859
|
-
|
|
10532
|
+
React36.useEffect(() => {
|
|
9860
10533
|
const dataSourceState = getDataSourceState();
|
|
9861
10534
|
const onChange = debounce((renderRange) => {
|
|
9862
10535
|
dataSourceState.notifyRenderRangeChange({
|
|
@@ -9869,12 +10542,12 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9869
10542
|
const licenseValid = useLicense(licenseKey);
|
|
9870
10543
|
const domProps = useDOMProps(componentState.domProps);
|
|
9871
10544
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
9872
|
-
|
|
10545
|
+
React36.useEffect(() => {
|
|
9873
10546
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
9874
10547
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
9875
10548
|
}, [scrollStopDelay]);
|
|
9876
10549
|
useAutoSizeColumns();
|
|
9877
|
-
const onKeyDown = (0,
|
|
10550
|
+
const onKeyDown = (0, import_react49.useCallback)((event) => {
|
|
9878
10551
|
if (handleKeyboardNavigation({
|
|
9879
10552
|
getState,
|
|
9880
10553
|
actions,
|
|
@@ -9886,13 +10559,14 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9886
10559
|
event.preventDefault();
|
|
9887
10560
|
}
|
|
9888
10561
|
}, []);
|
|
9889
|
-
return /* @__PURE__ */
|
|
10562
|
+
return /* @__PURE__ */ React36.createElement("div", __spreadValues({
|
|
9890
10563
|
onKeyDown,
|
|
9891
10564
|
ref: domRef
|
|
9892
|
-
}, domProps), header ? /* @__PURE__ */
|
|
9893
|
-
|
|
10565
|
+
}, domProps), header ? /* @__PURE__ */ React36.createElement(TableHeaderWrapper, {
|
|
10566
|
+
bodyBrain: brain,
|
|
10567
|
+
headerBrain,
|
|
9894
10568
|
scrollbars
|
|
9895
|
-
}) : null, /* @__PURE__ */
|
|
10569
|
+
}) : null, /* @__PURE__ */ React36.createElement(InfiniteTableBody, null, /* @__PURE__ */ React36.createElement(HeadlessTable, {
|
|
9896
10570
|
tabIndex: 0,
|
|
9897
10571
|
activeRowIndex: componentState.ready && keyboardNavigation === "row" ? activeRowIndex : null,
|
|
9898
10572
|
activeCellIndex: componentState.ready && keyboardNavigation === "cell" ? activeCellIndex : null,
|
|
@@ -9903,18 +10577,18 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9903
10577
|
renderCell,
|
|
9904
10578
|
cellHoverClassNames: HOVERED_CLASS_NAMES,
|
|
9905
10579
|
scrollerDOMRef
|
|
9906
|
-
}), /* @__PURE__ */
|
|
10580
|
+
}), /* @__PURE__ */ React36.createElement(LoadMaskCmp, {
|
|
9907
10581
|
visible: loading
|
|
9908
|
-
}, loadingText)), /* @__PURE__ */
|
|
10582
|
+
}, loadingText)), /* @__PURE__ */ React36.createElement("div", {
|
|
9909
10583
|
ref: portalDOMRef,
|
|
9910
10584
|
className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
9911
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
10585
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ React36.createElement(CSSVariableWatch, {
|
|
9912
10586
|
varName: rowHeightCSSVar,
|
|
9913
10587
|
onChange: onRowHeightCSSVarChange
|
|
9914
|
-
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */
|
|
10588
|
+
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ React36.createElement(CSSVariableWatch, {
|
|
9915
10589
|
varName: columnHeaderHeightCSSVar,
|
|
9916
10590
|
onChange: onColumnHeaderHeightCSSVarChange
|
|
9917
|
-
}) : null, /* @__PURE__ */
|
|
10591
|
+
}) : null, /* @__PURE__ */ React36.createElement(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ React36.createElement(InfiniteTableLicenseFooter, null));
|
|
9918
10592
|
});
|
|
9919
10593
|
function InfiniteTableContextProvider() {
|
|
9920
10594
|
const { componentActions, componentState } = useComponentState();
|
|
@@ -9934,33 +10608,34 @@ function InfiniteTableContextProvider() {
|
|
|
9934
10608
|
getState
|
|
9935
10609
|
};
|
|
9936
10610
|
useResizeObserver(scrollerDOMRef, (size) => {
|
|
9937
|
-
var _a, _b;
|
|
9938
10611
|
const bodySize = {
|
|
9939
10612
|
width: size.width,
|
|
9940
10613
|
height: size.height
|
|
9941
10614
|
};
|
|
9942
|
-
bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
|
|
9943
10615
|
componentActions.bodySize = bodySize;
|
|
9944
|
-
}, { earlyAttach: true });
|
|
9945
|
-
|
|
10616
|
+
}, { earlyAttach: true, debounce: 50 });
|
|
10617
|
+
React36.useEffect(() => {
|
|
9946
10618
|
return () => {
|
|
9947
10619
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
9948
10620
|
componentState.onColumnHeaderHeightCSSVarChange.destroy();
|
|
9949
10621
|
};
|
|
9950
10622
|
}, []);
|
|
9951
|
-
|
|
10623
|
+
React36.useEffect(() => {
|
|
9952
10624
|
if (scrollerDOMRef.current) {
|
|
9953
10625
|
scrollerDOMRef.current.scrollTop = 0;
|
|
9954
10626
|
}
|
|
9955
10627
|
}, [scrollTopKey, scrollerDOMRef]);
|
|
9956
10628
|
const TableContext2 = getInfiniteTableContext();
|
|
9957
|
-
return /* @__PURE__ */
|
|
10629
|
+
return /* @__PURE__ */ React36.createElement(TableContext2.Provider, {
|
|
9958
10630
|
value: contextValue
|
|
9959
|
-
}, /* @__PURE__ */
|
|
10631
|
+
}, /* @__PURE__ */ React36.createElement(InfiniteTableComponent, null));
|
|
9960
10632
|
}
|
|
9961
10633
|
function InfiniteTable(props) {
|
|
9962
|
-
const table = /* @__PURE__ */
|
|
9963
|
-
|
|
10634
|
+
const table = /* @__PURE__ */ React36.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React36.createElement(InfiniteTableContextProvider, null));
|
|
10635
|
+
if (false) {
|
|
10636
|
+
return /* @__PURE__ */ React36.createElement(React36.StrictMode, null, table);
|
|
10637
|
+
}
|
|
10638
|
+
return table;
|
|
9964
10639
|
}
|
|
9965
10640
|
InfiniteTable.defaultProps = {
|
|
9966
10641
|
rowHeight: 40,
|