@infinite-table/infinite-react 0.3.12 → 0.3.13
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 +1214 -544
- package/index.js +1258 -592
- 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,62 @@ 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 [rerenderId, rerender] = useRerender();
|
|
3421
|
-
const [state, setState] = (0, import_react10.useState)({
|
|
3422
|
-
top: 0,
|
|
3423
|
-
rowHeight: 0,
|
|
3424
|
-
colWidth: 0,
|
|
3425
|
-
left: 0
|
|
3426
|
-
});
|
|
3427
3523
|
const domRef = (0, import_react10.useRef)(null);
|
|
3428
|
-
const stateRef = (0, import_react10.useRef)(state);
|
|
3429
3524
|
const active = props.activeCellIndex != null && brain.getRowCount() > props.activeCellIndex[0];
|
|
3430
3525
|
(0, import_react10.useLayoutEffect)(() => {
|
|
3431
3526
|
if (props.activeCellIndex == null) {
|
|
3432
3527
|
return;
|
|
3433
3528
|
}
|
|
3434
3529
|
const rowIndex = props.activeCellIndex[0];
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3530
|
+
const activeCellRowHeight = brain.getRowHeight(rowIndex);
|
|
3531
|
+
const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical");
|
|
3532
|
+
const node = domRef.current;
|
|
3533
|
+
const scrollPosition = brain.getScrollPosition();
|
|
3534
|
+
setInfiniteVarsOnNode({
|
|
3535
|
+
scrollTopForActiveCell: `${-scrollPosition.scrollTop}px`,
|
|
3536
|
+
scrollLeftForActiveCell: `${-scrollPosition.scrollLeft}px`,
|
|
3537
|
+
activeCellRowHeight: `${activeCellRowHeight}px`,
|
|
3538
|
+
activeCellRowOffset: `${activeCellRowOffset}px`
|
|
3539
|
+
}, node);
|
|
3540
|
+
}, [props.activeCellIndex]);
|
|
3442
3541
|
(0, import_react10.useEffect)(() => {
|
|
3443
|
-
const removeOnSCroll = brain.onScroll((
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
});
|
|
3449
|
-
const removeOnRenderCountChange = brain.onRenderCountChange(() => {
|
|
3450
|
-
rerender();
|
|
3451
|
-
});
|
|
3452
|
-
const removeOnAvailableSizeChange = brain.onAvailableSizeChange(() => {
|
|
3453
|
-
rerender();
|
|
3542
|
+
const removeOnSCroll = brain.onScroll((scrollPosition) => {
|
|
3543
|
+
setInfiniteVarsOnNode({
|
|
3544
|
+
scrollTopForActiveCell: `${-scrollPosition.scrollTop}px`,
|
|
3545
|
+
scrollLeftForActiveCell: `${-scrollPosition.scrollLeft}px`
|
|
3546
|
+
}, domRef.current);
|
|
3454
3547
|
});
|
|
3455
3548
|
return () => {
|
|
3456
|
-
removeOnAvailableSizeChange();
|
|
3457
|
-
removeOnRenderCountChange();
|
|
3458
3549
|
removeOnSCroll();
|
|
3459
3550
|
};
|
|
3460
3551
|
}, [brain]);
|
|
3461
|
-
const scrollPosition = brain.getScrollPosition();
|
|
3462
3552
|
return /* @__PURE__ */ React11.createElement("div", {
|
|
3553
|
+
className: ActiveIndicatorWrapperCls,
|
|
3554
|
+
"data-name": "active-cell"
|
|
3555
|
+
}, /* @__PURE__ */ React11.createElement("div", {
|
|
3463
3556
|
ref: domRef,
|
|
3464
3557
|
"data-name": "active-cell-indicator",
|
|
3465
3558
|
className: `${baseCls2} ${active ? ActiveCellIndicatorCls.visible : ActiveCellIndicatorCls.hidden}`,
|
|
3466
|
-
style: active ?
|
|
3467
|
-
|
|
3468
|
-
width: state.colWidth,
|
|
3469
|
-
height: state.rowHeight
|
|
3470
|
-
} : void 0
|
|
3471
|
-
});
|
|
3559
|
+
style: active ? ActiveStyle : void 0
|
|
3560
|
+
}));
|
|
3472
3561
|
};
|
|
3473
3562
|
var ActiveCellIndicator = React11.memo(ActiveCellIndicatorFn);
|
|
3474
3563
|
|
|
@@ -3538,7 +3627,7 @@ function HeadlessTable(props) {
|
|
|
3538
3627
|
};
|
|
3539
3628
|
brain.update(size);
|
|
3540
3629
|
};
|
|
3541
|
-
const remove = setupResizeObserver(node, onResize);
|
|
3630
|
+
const remove = setupResizeObserver(node, onResize, { debounce: 50 });
|
|
3542
3631
|
return remove;
|
|
3543
3632
|
}, []);
|
|
3544
3633
|
const onContainerScroll = (0, import_react11.useCallback)((scrollPos) => {
|
|
@@ -3890,45 +3979,45 @@ var useInternalProps = () => {
|
|
|
3890
3979
|
};
|
|
3891
3980
|
|
|
3892
3981
|
// 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: "
|
|
3982
|
+
var alignItems = { center: "_16lm1iw15", stretch: "_16lm1iw16" };
|
|
3983
|
+
var cssEllipsisClassName = "_16lm1iw1e _16lm1iw1f _16lm1iw1a";
|
|
3984
|
+
var cursor = { pointer: "_16lm1iwd", colResize: "_16lm1iwe" };
|
|
3985
|
+
var display = { flex: "_16lm1iwn", block: "_16lm1iwo", inlineBlock: "_16lm1iwp" };
|
|
3986
|
+
var flex = { "1": "_16lm1iwg", none: "_16lm1iwh" };
|
|
3987
|
+
var flexFlow = { column: "_16lm1iw13", row: "_16lm1iw14" };
|
|
3988
|
+
var justifyContent = { center: "_16lm1iw17", start: "_16lm1iw18", end: "_16lm1iw19" };
|
|
3989
|
+
var left = { "0": "_16lm1iwx", "100%": "_16lm1iwy" };
|
|
3990
|
+
var overflow = { hidden: "_16lm1iw1a", auto: "_16lm1iw1b", visible: "_16lm1iw1c" };
|
|
3902
3991
|
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
3903
|
-
var top = { "0": "
|
|
3992
|
+
var top = { "0": "_16lm1iwv", "100%": "_16lm1iww" };
|
|
3904
3993
|
var transformTranslateZero = "_16lm1iwa";
|
|
3905
|
-
var userSelect = { none: "
|
|
3906
|
-
var zIndex = { "1": "
|
|
3994
|
+
var userSelect = { none: "_16lm1iwq" };
|
|
3995
|
+
var zIndex = { "1": "_16lm1iwi", "10": "_16lm1iwj", "1000": "_16lm1iwk", "10000": "_16lm1iwl", "100000": "_16lm1iwm" };
|
|
3907
3996
|
|
|
3908
3997
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3909
3998
|
var InfiniteTableBody = React14.forwardRef(function InfiniteTableBody2(props, ref) {
|
|
3910
|
-
const { rootClassName:
|
|
3999
|
+
const { rootClassName: rootClassName13 } = useInternalProps();
|
|
3911
4000
|
return /* @__PURE__ */ React14.createElement("div", __spreadProps(__spreadValues({
|
|
3912
4001
|
ref
|
|
3913
4002
|
}, props), {
|
|
3914
|
-
className: join(`${
|
|
4003
|
+
className: join(`${rootClassName13}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
|
|
3915
4004
|
}));
|
|
3916
4005
|
});
|
|
3917
4006
|
|
|
3918
4007
|
// src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx
|
|
3919
4008
|
var React15 = __toModule(require("react"));
|
|
3920
4009
|
var InfiniteTableFooter = React15.forwardRef(function InfiniteTableFooter2(props, ref) {
|
|
3921
|
-
const { rootClassName:
|
|
4010
|
+
const { rootClassName: rootClassName13 } = useInternalProps();
|
|
3922
4011
|
return /* @__PURE__ */ React15.createElement("div", __spreadProps(__spreadValues({
|
|
3923
4012
|
ref
|
|
3924
4013
|
}, props), {
|
|
3925
|
-
className: join(`${
|
|
4014
|
+
className: join(`${rootClassName13}Footer`, position.relative, display.flex, flexFlow.row, props.className)
|
|
3926
4015
|
}));
|
|
3927
4016
|
});
|
|
3928
4017
|
|
|
3929
4018
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3930
|
-
var
|
|
3931
|
-
var
|
|
4019
|
+
var React22 = __toModule(require("react"));
|
|
4020
|
+
var import_react24 = __toModule(require("react"));
|
|
3932
4021
|
var import_react_dom = __toModule(require("react-dom"));
|
|
3933
4022
|
|
|
3934
4023
|
// src/components/DataSource/defaultFilterTypes.ts
|
|
@@ -4088,7 +4177,6 @@ var useColumnPointerEvents = ({
|
|
|
4088
4177
|
const [draggingDiff, setDraggingDiff] = (0, import_react17.useState)(null);
|
|
4089
4178
|
const [proxyOffset, setProxyOffset] = (0, import_react17.useState)(null);
|
|
4090
4179
|
const breakpointsRef = (0, import_react17.useRef)([]);
|
|
4091
|
-
const pointerMoveRef = (0, import_react17.useRef)(null);
|
|
4092
4180
|
const didDragRef = (0, import_react17.useRef)(false);
|
|
4093
4181
|
const initialClientPos = (0, import_react17.useRef)(null);
|
|
4094
4182
|
const currentDropIndexRef = (0, import_react17.useRef)(null);
|
|
@@ -4164,35 +4252,40 @@ var useColumnPointerEvents = ({
|
|
|
4164
4252
|
}
|
|
4165
4253
|
setDraggingDiff({ left: diffX, top: diffY });
|
|
4166
4254
|
};
|
|
4167
|
-
|
|
4255
|
+
const onPointerUp = (e2) => {
|
|
4256
|
+
const target2 = domRef.current;
|
|
4257
|
+
target2.style.cursor = cursorRef.current;
|
|
4258
|
+
target2.releasePointerCapture(e2.pointerId);
|
|
4259
|
+
target2.removeEventListener("pointermove", onPointerMove);
|
|
4260
|
+
target2.removeEventListener("pointerup", onPointerUp);
|
|
4261
|
+
setDraggingDiff(null);
|
|
4262
|
+
componentActions.columnShifts = null;
|
|
4263
|
+
componentActions.draggingColumnId = null;
|
|
4264
|
+
if (!didDragRef.current && column.computedSortable) {
|
|
4265
|
+
column.toggleSort();
|
|
4266
|
+
}
|
|
4267
|
+
const dropIndex = currentDropIndexRef.current;
|
|
4268
|
+
if (dropIndex != null && dropIndex !== columnIndex) {
|
|
4269
|
+
const newOrder = moveXatY(computedColumnOrder, columnIndex, dropIndex > columnIndex ? dropIndex - 1 : dropIndex);
|
|
4270
|
+
componentActions.columnOrder = newOrder;
|
|
4271
|
+
}
|
|
4272
|
+
breakpointsRef.current = [];
|
|
4273
|
+
didDragRef.current = false;
|
|
4274
|
+
initialClientPos.current = null;
|
|
4275
|
+
currentDropIndexRef.current = null;
|
|
4276
|
+
};
|
|
4168
4277
|
target.addEventListener("pointermove", onPointerMove);
|
|
4278
|
+
target.addEventListener("pointerup", onPointerUp);
|
|
4169
4279
|
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]);
|
|
4280
|
+
}, [
|
|
4281
|
+
columns,
|
|
4282
|
+
column,
|
|
4283
|
+
columnIndex,
|
|
4284
|
+
columnsArray,
|
|
4285
|
+
computedRemainingSpace,
|
|
4286
|
+
computedColumnOrder
|
|
4287
|
+
]);
|
|
4193
4288
|
return {
|
|
4194
|
-
onPointerUp: column.computedDraggable ? onPointerUp : () => {
|
|
4195
|
-
},
|
|
4196
4289
|
onPointerDown: column.computedDraggable ? onPointerDown : () => {
|
|
4197
4290
|
},
|
|
4198
4291
|
dragging,
|
|
@@ -4249,19 +4342,19 @@ var import_react19 = __toModule(require("react"));
|
|
|
4249
4342
|
|
|
4250
4343
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
4251
4344
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4252
|
-
var CellCls = "_1eexc2a5
|
|
4253
|
-
var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob117
|
|
4345
|
+
var CellCls = "_1eexc2a5 _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw2 _16lm1iw1d _16lm1iw1e";
|
|
4346
|
+
var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob117 _16lm1iws _16lm1iwu _16lm1iwn _16lm1iw14 _16lm1iw15", variantClassNames: { filtered: { false: "_12zfob118", true: "_12zfob119" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4254
4347
|
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
|
|
4348
|
+
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"]] });
|
|
4349
|
+
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"]] });
|
|
4350
|
+
var HeaderFilterCls = "_12zfob11c _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw1";
|
|
4351
|
+
var HeaderFilterEditorCls = "_16lm1iwu _16lm1iws";
|
|
4352
|
+
var HeaderGroupCls = "_12zfob11b _16lm1iwn _16lm1iw14 _16lm1iw15";
|
|
4260
4353
|
var HeaderScrollbarPlaceholderCls = "_12zfob16 _16lm1iw2";
|
|
4261
4354
|
var HeaderSortIconCls = "_16lm1iw1";
|
|
4262
4355
|
var HeaderSortIconIndexCls = "_12zfob15";
|
|
4263
4356
|
var HeaderSortIconRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob12", center: "_12zfob13", end: "_12zfob14" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4264
|
-
var HeaderWrapperCls = "_12zfob11a
|
|
4357
|
+
var HeaderWrapperCls = "_12zfob11a _16lm1iw1a _16lm1iw1 _16lm1iwn _16lm1iw14";
|
|
4265
4358
|
|
|
4266
4359
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
4267
4360
|
var defaultLineStyle = {
|
|
@@ -4348,20 +4441,20 @@ var useInfiniteTableState = () => {
|
|
|
4348
4441
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
4349
4442
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4350
4443
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
4351
|
-
var ColumnCellCls = "_1eexc2a5
|
|
4444
|
+
var ColumnCellCls = "_1eexc2a5 _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw2 _16lm1iw1d _16lm1iw1e";
|
|
4352
4445
|
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
4446
|
|
|
4354
4447
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4355
4448
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
4356
4449
|
var InfiniteTableCellClassName = `${rootClassName5}Cell`;
|
|
4357
4450
|
var InfiniteTableCellContentClassName = `${rootClassName5}Cell_content`;
|
|
4451
|
+
var columnWidthAtIndex2 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4358
4452
|
function InfiniteTableCellFn(props) {
|
|
4359
4453
|
var _b, _c, _d;
|
|
4360
4454
|
const _a = props, {
|
|
4361
4455
|
cssEllipsis = true,
|
|
4362
4456
|
virtualized = true,
|
|
4363
4457
|
skipColumnShifting = false,
|
|
4364
|
-
offsetProperty = "left",
|
|
4365
4458
|
contentStyle,
|
|
4366
4459
|
column,
|
|
4367
4460
|
domRef,
|
|
@@ -4369,7 +4462,6 @@ function InfiniteTableCellFn(props) {
|
|
|
4369
4462
|
contentClassName,
|
|
4370
4463
|
afterChildren,
|
|
4371
4464
|
beforeChildren,
|
|
4372
|
-
offset,
|
|
4373
4465
|
cellType,
|
|
4374
4466
|
cssPosition: _cssPosition,
|
|
4375
4467
|
renderChildren
|
|
@@ -4377,7 +4469,6 @@ function InfiniteTableCellFn(props) {
|
|
|
4377
4469
|
"cssEllipsis",
|
|
4378
4470
|
"virtualized",
|
|
4379
4471
|
"skipColumnShifting",
|
|
4380
|
-
"offsetProperty",
|
|
4381
4472
|
"contentStyle",
|
|
4382
4473
|
"column",
|
|
4383
4474
|
"domRef",
|
|
@@ -4385,7 +4476,6 @@ function InfiniteTableCellFn(props) {
|
|
|
4385
4476
|
"contentClassName",
|
|
4386
4477
|
"afterChildren",
|
|
4387
4478
|
"beforeChildren",
|
|
4388
|
-
"offset",
|
|
4389
4479
|
"cellType",
|
|
4390
4480
|
"cssPosition",
|
|
4391
4481
|
"renderChildren"
|
|
@@ -4394,10 +4484,10 @@ function InfiniteTableCellFn(props) {
|
|
|
4394
4484
|
const { columnShifts } = useInfiniteTableState();
|
|
4395
4485
|
const shifting = !!columnShifts;
|
|
4396
4486
|
const style = __spreadValues({
|
|
4397
|
-
width
|
|
4487
|
+
width: `var(${columnWidthAtIndex2}-${column.computedVisibleIndex})`
|
|
4398
4488
|
}, domProps.style);
|
|
4399
4489
|
if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
|
|
4400
|
-
const shiftLeft = columnShifts[column.computedVisibleIndex]
|
|
4490
|
+
const shiftLeft = columnShifts[column.computedVisibleIndex];
|
|
4401
4491
|
if (virtualized) {
|
|
4402
4492
|
style.left = shiftLeft;
|
|
4403
4493
|
} else {
|
|
@@ -4479,10 +4569,542 @@ function InfiniteTableColumnHeaderFilterEmpty() {
|
|
|
4479
4569
|
});
|
|
4480
4570
|
}
|
|
4481
4571
|
|
|
4482
|
-
// src/components/InfiniteTable/components/InfiniteTableHeader/
|
|
4483
|
-
var
|
|
4572
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx
|
|
4573
|
+
var React21 = __toModule(require("react"));
|
|
4574
|
+
var import_react23 = __toModule(require("react"));
|
|
4575
|
+
|
|
4576
|
+
// src/components/flexbox/index.ts
|
|
4577
|
+
var computeFlex = (params) => {
|
|
4578
|
+
const {
|
|
4579
|
+
availableSize,
|
|
4580
|
+
items,
|
|
4581
|
+
minSize: defaultMinSize,
|
|
4582
|
+
maxSize: defaultMaxSize
|
|
4583
|
+
} = params;
|
|
4584
|
+
if (availableSize < 0) {
|
|
4585
|
+
throw "The provided availableSize cannot be negative!";
|
|
4586
|
+
}
|
|
4587
|
+
let totalFixedSize = 0;
|
|
4588
|
+
let totalFlex = 0;
|
|
4589
|
+
let totalFlexCount = 0;
|
|
4590
|
+
const minSizes = [];
|
|
4591
|
+
const maxSizes = [];
|
|
4592
|
+
items.forEach((item, i) => {
|
|
4593
|
+
var _a, _b, _c, _d, _e;
|
|
4594
|
+
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
4595
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
4596
|
+
minSizes.push(minSize);
|
|
4597
|
+
maxSizes.push(maxSize);
|
|
4598
|
+
if (item.size != null) {
|
|
4599
|
+
if (maxSize != null && item.size > maxSize) {
|
|
4600
|
+
item.size = maxSize;
|
|
4601
|
+
}
|
|
4602
|
+
if (minSize != null && item.size < minSize) {
|
|
4603
|
+
item.size = minSize;
|
|
4604
|
+
}
|
|
4605
|
+
}
|
|
4606
|
+
const itemFlex = item.flex == 0 ? null : item.flex;
|
|
4607
|
+
if (item.size == null && itemFlex == null) {
|
|
4608
|
+
throw `Items must specify either a size or a flex property. Item at index ${i} doesn't have either of those.`;
|
|
4609
|
+
}
|
|
4610
|
+
if (itemFlex != null) {
|
|
4611
|
+
totalFlexCount += 1;
|
|
4612
|
+
}
|
|
4613
|
+
totalFlex += itemFlex != null ? itemFlex : 0;
|
|
4614
|
+
totalFixedSize += (_e = item.size) != null ? _e : 0;
|
|
4615
|
+
});
|
|
4616
|
+
let availableSizeForFlex = Math.max(availableSize - totalFixedSize, 0);
|
|
4617
|
+
let sizePerFlex = availableSizeForFlex / totalFlex;
|
|
4618
|
+
let maxxedFlexItems = {};
|
|
4619
|
+
let minnedFlexItems = {};
|
|
4620
|
+
let constrainedCount = 0;
|
|
4621
|
+
items.forEach((item, index) => {
|
|
4622
|
+
var _a, _b, _c, _d;
|
|
4623
|
+
if (item.flex != null) {
|
|
4624
|
+
const approxFlexSize = sizePerFlex * item.flex;
|
|
4625
|
+
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
4626
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
4627
|
+
let constrained = false;
|
|
4628
|
+
let substractSize = 0;
|
|
4629
|
+
if (maxSize != null && approxFlexSize > maxSize) {
|
|
4630
|
+
maxxedFlexItems[index] = true;
|
|
4631
|
+
constrained = true;
|
|
4632
|
+
substractSize = maxSize;
|
|
4633
|
+
}
|
|
4634
|
+
if (minSize != null && approxFlexSize < minSize) {
|
|
4635
|
+
minnedFlexItems[index] = true;
|
|
4636
|
+
constrained = true;
|
|
4637
|
+
substractSize = minSize;
|
|
4638
|
+
}
|
|
4639
|
+
if (constrained) {
|
|
4640
|
+
constrainedCount += 1;
|
|
4641
|
+
totalFlexCount -= 1;
|
|
4642
|
+
totalFlex -= item.flex;
|
|
4643
|
+
availableSizeForFlex -= substractSize;
|
|
4644
|
+
}
|
|
4645
|
+
}
|
|
4646
|
+
});
|
|
4647
|
+
if (constrainedCount) {
|
|
4648
|
+
sizePerFlex = availableSizeForFlex / totalFlex;
|
|
4649
|
+
}
|
|
4650
|
+
let flexSizes = [];
|
|
4651
|
+
let currentFlexCount = 0;
|
|
4652
|
+
let remainingSizeForFlex = availableSizeForFlex;
|
|
4653
|
+
let remainingFlex = totalFlex;
|
|
4654
|
+
let totalTakenSize = 0;
|
|
4655
|
+
let flexSizeSum = 0;
|
|
4656
|
+
const computedSizes = [];
|
|
4657
|
+
const resultItems = items.map((item, index) => {
|
|
4658
|
+
var _a, _b, _c, _d, _e;
|
|
4659
|
+
const sizedItem = __spreadValues({}, item);
|
|
4660
|
+
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
4661
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
4662
|
+
let flexSize = 0;
|
|
4663
|
+
const maxxed = maxxedFlexItems[index];
|
|
4664
|
+
const minned = minnedFlexItems[index];
|
|
4665
|
+
const constrained = maxxed || minned;
|
|
4666
|
+
let computedSize = (_e = item.size) != null ? _e : 0;
|
|
4667
|
+
if (item.flex != null) {
|
|
4668
|
+
if (constrained) {
|
|
4669
|
+
if (minned) {
|
|
4670
|
+
flexSize = minSize;
|
|
4671
|
+
}
|
|
4672
|
+
if (maxxed) {
|
|
4673
|
+
flexSize = maxSize;
|
|
4674
|
+
}
|
|
4675
|
+
} else {
|
|
4676
|
+
currentFlexCount += 1;
|
|
4677
|
+
const constrain = (size) => {
|
|
4678
|
+
if (maxSize != null && size > maxSize) {
|
|
4679
|
+
size = maxSize;
|
|
4680
|
+
}
|
|
4681
|
+
if (minSize != null && size < minSize) {
|
|
4682
|
+
size = minSize;
|
|
4683
|
+
}
|
|
4684
|
+
return size;
|
|
4685
|
+
};
|
|
4686
|
+
if (currentFlexCount === totalFlexCount) {
|
|
4687
|
+
flexSize = constrain(remainingSizeForFlex);
|
|
4688
|
+
} else {
|
|
4689
|
+
flexSize = constrain(Math.round(item.flex * sizePerFlex));
|
|
4690
|
+
flexSizeSum += flexSize;
|
|
4691
|
+
remainingSizeForFlex = availableSizeForFlex - flexSizeSum;
|
|
4692
|
+
remainingFlex -= item.flex;
|
|
4693
|
+
sizePerFlex = remainingSizeForFlex / remainingFlex;
|
|
4694
|
+
}
|
|
4695
|
+
}
|
|
4696
|
+
computedSize = flexSize;
|
|
4697
|
+
sizedItem.flexSize = flexSize;
|
|
4698
|
+
}
|
|
4699
|
+
flexSizes.push(flexSize);
|
|
4700
|
+
computedSizes.push(computedSize);
|
|
4701
|
+
sizedItem.computedSize = computedSize;
|
|
4702
|
+
totalTakenSize += computedSize;
|
|
4703
|
+
return sizedItem;
|
|
4704
|
+
});
|
|
4705
|
+
return {
|
|
4706
|
+
items: resultItems,
|
|
4707
|
+
flexSizes,
|
|
4708
|
+
minSizes,
|
|
4709
|
+
maxSizes,
|
|
4710
|
+
computedSizes,
|
|
4711
|
+
remainingSize: Math.round(availableSize - totalTakenSize)
|
|
4712
|
+
};
|
|
4713
|
+
};
|
|
4714
|
+
function resizeClamp(value, min, max, direction) {
|
|
4715
|
+
if (min != null && value <= min) {
|
|
4716
|
+
return { value: min, clamped: "min", diff: (value - min) * direction };
|
|
4717
|
+
}
|
|
4718
|
+
if (max != null && value >= max) {
|
|
4719
|
+
return { value: max, clamped: "max", diff: (max - value) * direction };
|
|
4720
|
+
}
|
|
4721
|
+
return { value, clamped: false, diff: 0 };
|
|
4722
|
+
}
|
|
4723
|
+
var computeResize = (params) => {
|
|
4724
|
+
const { availableSize, reservedWidth = 0 } = params;
|
|
4725
|
+
const columnSizing = Object.keys(params.columnSizing).reduce((acc, key) => {
|
|
4726
|
+
acc[key] = __spreadValues({}, params.columnSizing[key]);
|
|
4727
|
+
return acc;
|
|
4728
|
+
}, {});
|
|
4729
|
+
if (availableSize < 0) {
|
|
4730
|
+
throw "The provided availableSize cannot be negative!";
|
|
4731
|
+
}
|
|
4732
|
+
let dragHandleOffset = params.dragHandleOffset;
|
|
4733
|
+
const firstIndex = params.dragHandlePositionAfter;
|
|
4734
|
+
const secondIndex = params.dragHandlePositionAfter + 1;
|
|
4735
|
+
const firstItem = params.items[firstIndex];
|
|
4736
|
+
const secondItem = params.items[secondIndex];
|
|
4737
|
+
const firstId = firstItem.id;
|
|
4738
|
+
const secondId = secondItem == null ? void 0 : secondItem.id;
|
|
4739
|
+
const firstSize = firstItem.computedWidth;
|
|
4740
|
+
const firstMinSize = firstItem.computedMinWidth;
|
|
4741
|
+
const firstMaxSize = firstItem.computedMaxWidth;
|
|
4742
|
+
const firstPropertyToAdjust = firstItem.computedFlex ? "flex" : "width";
|
|
4743
|
+
const secondSize = secondItem == null ? void 0 : secondItem.computedWidth;
|
|
4744
|
+
const secondMinSize = secondItem == null ? void 0 : secondItem.computedMinWidth;
|
|
4745
|
+
const secondMaxSize = secondItem == null ? void 0 : secondItem.computedMaxWidth;
|
|
4746
|
+
const secondPropertyToAdjust = (secondItem == null ? void 0 : secondItem.computedFlex) ? "flex" : "width";
|
|
4747
|
+
let maxReached = false;
|
|
4748
|
+
let minReached = false;
|
|
4749
|
+
const direction = dragHandleOffset > 0 ? 1 : -1;
|
|
4750
|
+
let {
|
|
4751
|
+
value: firstAdjustedSize,
|
|
4752
|
+
clamped: firstClamped,
|
|
4753
|
+
diff: firstDiff
|
|
4754
|
+
} = resizeClamp(firstSize + dragHandleOffset, firstMinSize, firstMaxSize, direction);
|
|
4755
|
+
if (params.shareSpaceOnResize) {
|
|
4756
|
+
if (secondItem == null) {
|
|
4757
|
+
columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
|
|
4758
|
+
[firstPropertyToAdjust]: firstAdjustedSize
|
|
4759
|
+
});
|
|
4760
|
+
minReached = firstClamped === "min";
|
|
4761
|
+
maxReached = firstClamped === "max";
|
|
4762
|
+
const adjustedDiff2 = firstAdjustedSize - firstSize;
|
|
4763
|
+
return {
|
|
4764
|
+
adjustedDiff: adjustedDiff2,
|
|
4765
|
+
reservedWidth,
|
|
4766
|
+
columnSizing,
|
|
4767
|
+
minReached,
|
|
4768
|
+
maxReached,
|
|
4769
|
+
constrained: minReached || maxReached
|
|
4770
|
+
};
|
|
4771
|
+
}
|
|
4772
|
+
let {
|
|
4773
|
+
value: secondAdjustedSize,
|
|
4774
|
+
clamped: secondClamped,
|
|
4775
|
+
diff: secondDiff
|
|
4776
|
+
} = resizeClamp(secondSize - dragHandleOffset, secondMinSize, secondMaxSize, direction);
|
|
4777
|
+
if (firstClamped && secondClamped) {
|
|
4778
|
+
if (Math.abs(firstDiff) > Math.abs(secondDiff)) {
|
|
4779
|
+
secondClamped = false;
|
|
4780
|
+
} else {
|
|
4781
|
+
firstClamped = false;
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
if (!firstClamped && !secondClamped) {
|
|
4785
|
+
} else if (firstClamped) {
|
|
4786
|
+
const clampResultForSecond = resizeClamp(secondSize - dragHandleOffset - firstDiff, secondMinSize, secondMaxSize, direction);
|
|
4787
|
+
secondAdjustedSize = clampResultForSecond.value;
|
|
4788
|
+
secondClamped = clampResultForSecond.clamped;
|
|
4789
|
+
secondDiff = clampResultForSecond.diff;
|
|
4790
|
+
} else if (secondClamped) {
|
|
4791
|
+
const clampResultForFirst = resizeClamp(firstSize + dragHandleOffset + secondDiff, firstMinSize, firstMaxSize, direction);
|
|
4792
|
+
firstAdjustedSize = clampResultForFirst.value;
|
|
4793
|
+
firstClamped = clampResultForFirst.clamped;
|
|
4794
|
+
firstDiff = clampResultForFirst.diff;
|
|
4795
|
+
}
|
|
4796
|
+
columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
|
|
4797
|
+
[firstPropertyToAdjust]: firstAdjustedSize
|
|
4798
|
+
});
|
|
4799
|
+
columnSizing[secondId] = __spreadProps(__spreadValues({}, columnSizing[secondId]), {
|
|
4800
|
+
[secondPropertyToAdjust]: secondAdjustedSize
|
|
4801
|
+
});
|
|
4802
|
+
minReached = firstClamped === "min" || secondClamped === "min";
|
|
4803
|
+
maxReached = firstClamped === "max" || secondClamped === "max";
|
|
4804
|
+
} else {
|
|
4805
|
+
columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
|
|
4806
|
+
[firstPropertyToAdjust]: firstAdjustedSize
|
|
4807
|
+
});
|
|
4808
|
+
minReached = firstClamped === "min";
|
|
4809
|
+
maxReached = firstClamped === "max";
|
|
4810
|
+
}
|
|
4811
|
+
const adjustedDiff = firstAdjustedSize - firstSize;
|
|
4812
|
+
return {
|
|
4813
|
+
adjustedDiff,
|
|
4814
|
+
reservedWidth: !params.shareSpaceOnResize ? reservedWidth - adjustedDiff : reservedWidth,
|
|
4815
|
+
columnSizing,
|
|
4816
|
+
minReached,
|
|
4817
|
+
maxReached,
|
|
4818
|
+
constrained: minReached || maxReached
|
|
4819
|
+
};
|
|
4820
|
+
};
|
|
4821
|
+
function sum(a, b) {
|
|
4822
|
+
return a + b;
|
|
4823
|
+
}
|
|
4824
|
+
function cloneColumnSizing(columnSizing) {
|
|
4825
|
+
const newColumnSizing = Object.keys(columnSizing).reduce((acc, key) => {
|
|
4826
|
+
acc[key] = __spreadValues({}, columnSizing[key]);
|
|
4827
|
+
return acc;
|
|
4828
|
+
}, {});
|
|
4829
|
+
return newColumnSizing;
|
|
4830
|
+
}
|
|
4831
|
+
var computeGroupResize = (params) => {
|
|
4832
|
+
const { availableSize, reservedWidth = 0 } = params;
|
|
4833
|
+
const columnSizing = Object.keys(params.columnSizing).reduce((acc, key) => {
|
|
4834
|
+
acc[key] = __spreadValues({}, params.columnSizing[key]);
|
|
4835
|
+
return acc;
|
|
4836
|
+
}, {});
|
|
4837
|
+
if (availableSize < 0) {
|
|
4838
|
+
throw "The provided availableSize cannot be negative!";
|
|
4839
|
+
}
|
|
4840
|
+
let dragHandleOffset = params.dragHandleOffset;
|
|
4841
|
+
const beforeIndexes = [...new Array(params.columnGroupSize)].map((_, index) => params.dragHandlePositionAfter - index).reverse();
|
|
4842
|
+
const beforeItems = beforeIndexes.map((i) => params.items[i]);
|
|
4843
|
+
const beforeSizes = beforeItems.map((item) => item.computedWidth);
|
|
4844
|
+
const beforePropertiesToAdjust = beforeItems.map((item) => item.computedFlex ? "flex" : "width");
|
|
4845
|
+
let unresizableWidth = 0;
|
|
4846
|
+
const { computedSizes } = computeFlex({
|
|
4847
|
+
items: beforeItems.map((item) => {
|
|
4848
|
+
if (item.resizable === false) {
|
|
4849
|
+
unresizableWidth += item.computedWidth;
|
|
4850
|
+
}
|
|
4851
|
+
return {
|
|
4852
|
+
flex: item.resizable ? item.computedWidth : null,
|
|
4853
|
+
size: 0
|
|
4854
|
+
};
|
|
4855
|
+
}),
|
|
4856
|
+
availableSize: Math.max(beforeSizes.reduce(sum, 0) + dragHandleOffset - unresizableWidth, 0)
|
|
4857
|
+
});
|
|
4858
|
+
const diffsForEachItem = beforeItems.map((item, index) => {
|
|
4859
|
+
return computedSizes[index] - item.computedWidth;
|
|
4860
|
+
});
|
|
4861
|
+
let groupMinReached = true;
|
|
4862
|
+
let groupMaxReached = true;
|
|
4863
|
+
let groupConstrained = true;
|
|
4864
|
+
const adjustedDiffs = [];
|
|
4865
|
+
diffsForEachItem.forEach((diff, i) => {
|
|
4866
|
+
const item = beforeItems[i];
|
|
4867
|
+
if (!item.resizable) {
|
|
4868
|
+
adjustedDiffs.push(0);
|
|
4869
|
+
return;
|
|
4870
|
+
}
|
|
4871
|
+
const propertyToAdjust = beforePropertiesToAdjust[i];
|
|
4872
|
+
const itemSize = beforeSizes[i];
|
|
4873
|
+
const currentColumnSizing = cloneColumnSizing(columnSizing);
|
|
4874
|
+
const { maxReached, minReached, constrained, adjustedDiff: adjustedDiff2 } = computeResize({
|
|
4875
|
+
availableSize: params.availableSize,
|
|
4876
|
+
reservedWidth: params.reservedWidth,
|
|
4877
|
+
dragHandleOffset: diff,
|
|
4878
|
+
dragHandlePositionAfter: beforeIndexes[i],
|
|
4879
|
+
shareSpaceOnResize: false,
|
|
4880
|
+
items: params.items,
|
|
4881
|
+
columnSizing: currentColumnSizing
|
|
4882
|
+
});
|
|
4883
|
+
columnSizing[item.id] = __spreadProps(__spreadValues({}, currentColumnSizing[item.id]), {
|
|
4884
|
+
[propertyToAdjust]: itemSize + adjustedDiff2
|
|
4885
|
+
});
|
|
4886
|
+
adjustedDiffs.push(adjustedDiff2);
|
|
4887
|
+
if (!maxReached) {
|
|
4888
|
+
groupMaxReached = false;
|
|
4889
|
+
}
|
|
4890
|
+
if (!minReached) {
|
|
4891
|
+
groupMinReached = false;
|
|
4892
|
+
}
|
|
4893
|
+
if (!constrained) {
|
|
4894
|
+
groupConstrained = false;
|
|
4895
|
+
}
|
|
4896
|
+
});
|
|
4897
|
+
const adjustedDiff = adjustedDiffs.reduce(sum, 0);
|
|
4898
|
+
return {
|
|
4899
|
+
minReached: groupMinReached,
|
|
4900
|
+
maxReached: groupMaxReached,
|
|
4901
|
+
constrained: groupConstrained,
|
|
4902
|
+
adjustedDiffs,
|
|
4903
|
+
adjustedDiff,
|
|
4904
|
+
columnSizing,
|
|
4905
|
+
reservedWidth: reservedWidth - adjustedDiff
|
|
4906
|
+
};
|
|
4907
|
+
};
|
|
4908
|
+
|
|
4909
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
|
|
4910
|
+
var import_react22 = __toModule(require("react"));
|
|
4911
|
+
|
|
4912
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/columnResizer.ts
|
|
4913
|
+
function getColumnResizer(colIndex, {
|
|
4914
|
+
columns,
|
|
4915
|
+
shareSpaceOnResize,
|
|
4916
|
+
domRef
|
|
4917
|
+
}) {
|
|
4918
|
+
const column = columns[colIndex];
|
|
4919
|
+
return {
|
|
4920
|
+
resize(diff) {
|
|
4921
|
+
setInfiniteColumnWidth(colIndex, column.computedWidth + diff, domRef.current);
|
|
4922
|
+
const nextColIndex = colIndex + 1;
|
|
4923
|
+
if (shareSpaceOnResize) {
|
|
4924
|
+
const nextColumn = columns[nextColIndex];
|
|
4925
|
+
if (!nextColumn) {
|
|
4926
|
+
return;
|
|
4927
|
+
}
|
|
4928
|
+
setInfiniteColumnWidth(nextColIndex, nextColumn.computedWidth - diff, domRef.current);
|
|
4929
|
+
setInfiniteColumnOffset(nextColIndex, nextColumn.computedOffset + diff, domRef.current);
|
|
4930
|
+
return;
|
|
4931
|
+
}
|
|
4932
|
+
for (let i = nextColIndex, len = columns.length; i < len; i++) {
|
|
4933
|
+
setInfiniteColumnOffset(i, columns[i].computedOffset + diff, domRef.current);
|
|
4934
|
+
}
|
|
4935
|
+
}
|
|
4936
|
+
};
|
|
4937
|
+
}
|
|
4938
|
+
function getColumnGroupResizer(colIndexes, config) {
|
|
4939
|
+
const lastColIndex = colIndexes[colIndexes.length - 1];
|
|
4940
|
+
return {
|
|
4941
|
+
resize(diffs) {
|
|
4942
|
+
const { columns, domRef } = config;
|
|
4943
|
+
let offset = columns[colIndexes[0]].computedOffset;
|
|
4944
|
+
let diffSum = 0;
|
|
4945
|
+
const node = domRef.current;
|
|
4946
|
+
diffs.forEach((diff, i) => {
|
|
4947
|
+
diffSum += diff;
|
|
4948
|
+
const colIndex = colIndexes[i];
|
|
4949
|
+
const column = columns[colIndex];
|
|
4950
|
+
const newWidth = column.computedWidth + diff;
|
|
4951
|
+
setInfiniteColumnWidth(colIndex, newWidth, node);
|
|
4952
|
+
if (offset) {
|
|
4953
|
+
setInfiniteColumnOffset(colIndex, offset, node);
|
|
4954
|
+
}
|
|
4955
|
+
offset += newWidth;
|
|
4956
|
+
});
|
|
4957
|
+
for (let i = lastColIndex + 1; i < columns.length; i++) {
|
|
4958
|
+
setInfiniteColumnOffset(i, columns[i].computedOffset + diffSum, node);
|
|
4959
|
+
}
|
|
4960
|
+
}
|
|
4961
|
+
};
|
|
4962
|
+
}
|
|
4963
|
+
|
|
4964
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts
|
|
4965
|
+
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4966
|
+
var ResizeHandleCls = "zneyzh0 _16lm1iw2 _16lm1iwv _16lm1iw11 _16lm1iwz _16lm1iwe";
|
|
4967
|
+
var ResizeHandleDraggerClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "zneyzh1 _16lm1iw2 _16lm1iwv _16lm1iwz", variantClassNames: { constrained: { false: "zneyzh2", true: "zneyzh3" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4968
|
+
|
|
4969
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
|
|
4484
4970
|
var { rootClassName: rootClassName7 } = internalProps;
|
|
4485
|
-
var
|
|
4971
|
+
var InfiniteTableHeaderCellResizeHandleCls = `${rootClassName7}HeaderCell_ResizeHandle`;
|
|
4972
|
+
function ResizeHandleFn(props) {
|
|
4973
|
+
const domRef = (0, import_react22.useRef)(null);
|
|
4974
|
+
const [constrained, setConstrained] = (0, import_react22.useState)(false);
|
|
4975
|
+
const constrainedRef = (0, import_react22.useRef)(constrained);
|
|
4976
|
+
constrainedRef.current = constrained;
|
|
4977
|
+
const onPointerDown = (e) => {
|
|
4978
|
+
e.stopPropagation();
|
|
4979
|
+
const shareSpaceOnResize = !!e.shiftKey;
|
|
4980
|
+
const pointerId = e.pointerId;
|
|
4981
|
+
const initialX = e.clientX;
|
|
4982
|
+
const target = e.target;
|
|
4983
|
+
target.setPointerCapture(pointerId);
|
|
4984
|
+
const resizer = getColumnResizer(props.columnIndex, {
|
|
4985
|
+
columns: props.columns,
|
|
4986
|
+
shareSpaceOnResize,
|
|
4987
|
+
domRef
|
|
4988
|
+
});
|
|
4989
|
+
const resizeDiff = (diff) => {
|
|
4990
|
+
const { adjustedDiff, constrained: constrained2 } = props.computeResize({
|
|
4991
|
+
diff,
|
|
4992
|
+
shareSpaceOnResize
|
|
4993
|
+
});
|
|
4994
|
+
if (constrainedRef.current !== constrained2) {
|
|
4995
|
+
setConstrained(constrained2);
|
|
4996
|
+
}
|
|
4997
|
+
resizer.resize(adjustedDiff);
|
|
4998
|
+
return adjustedDiff;
|
|
4999
|
+
};
|
|
5000
|
+
const onPointerMove = (e2) => {
|
|
5001
|
+
resizeDiff(Math.round(e2.clientX - initialX));
|
|
5002
|
+
};
|
|
5003
|
+
const onPointerUp = (e2) => {
|
|
5004
|
+
target.releasePointerCapture(pointerId);
|
|
5005
|
+
target.removeEventListener("pointermove", onPointerMove);
|
|
5006
|
+
target.removeEventListener("pointerup", onPointerUp);
|
|
5007
|
+
const diff = Math.round(e2.clientX - initialX);
|
|
5008
|
+
const adjustedDiff = resizeDiff(diff);
|
|
5009
|
+
props.onResize({ diff: adjustedDiff, shareSpaceOnResize });
|
|
5010
|
+
};
|
|
5011
|
+
target.addEventListener("pointermove", onPointerMove);
|
|
5012
|
+
target.addEventListener("pointerup", onPointerUp);
|
|
5013
|
+
};
|
|
5014
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", {
|
|
5015
|
+
ref: domRef,
|
|
5016
|
+
className: `${InfiniteTableHeaderCellResizeHandleCls} ${ResizeHandleCls}`,
|
|
5017
|
+
onPointerDown
|
|
5018
|
+
}, /* @__PURE__ */ import_react22.default.createElement("div", {
|
|
5019
|
+
className: ResizeHandleDraggerClsRecipe({
|
|
5020
|
+
constrained
|
|
5021
|
+
})
|
|
5022
|
+
}));
|
|
5023
|
+
}
|
|
5024
|
+
var ResizeHandle = import_react22.default.memo(ResizeHandleFn);
|
|
5025
|
+
|
|
5026
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx
|
|
5027
|
+
function useColumnResizeHandle(column) {
|
|
5028
|
+
const {
|
|
5029
|
+
computed: { computedVisibleColumns },
|
|
5030
|
+
componentState: { domRef },
|
|
5031
|
+
getState,
|
|
5032
|
+
getComputed,
|
|
5033
|
+
componentActions
|
|
5034
|
+
} = useInfiniteTable();
|
|
5035
|
+
const computeResizeForDiff = (0, import_react23.useCallback)(({
|
|
5036
|
+
diff,
|
|
5037
|
+
shareSpaceOnResize
|
|
5038
|
+
}) => {
|
|
5039
|
+
const state = getState();
|
|
5040
|
+
const { columnSizing, viewportReservedWidth, bodySize, activeCellIndex } = state;
|
|
5041
|
+
const columns = getComputed().computedVisibleColumns;
|
|
5042
|
+
let atLeastOneFlex = false;
|
|
5043
|
+
const columnSizingWithFlex = columns.reduce((acc, col) => {
|
|
5044
|
+
if (col.computedFlex) {
|
|
5045
|
+
acc[col.id] = { flex: col.computedWidth };
|
|
5046
|
+
atLeastOneFlex = true;
|
|
5047
|
+
}
|
|
5048
|
+
return acc;
|
|
5049
|
+
}, {});
|
|
5050
|
+
const columnSizingForResize = atLeastOneFlex ? __spreadValues(__spreadValues({}, columnSizing), columnSizingWithFlex) : columnSizing;
|
|
5051
|
+
const result = computeResize({
|
|
5052
|
+
shareSpaceOnResize,
|
|
5053
|
+
availableSize: bodySize.width,
|
|
5054
|
+
reservedWidth: viewportReservedWidth || 0,
|
|
5055
|
+
dragHandleOffset: diff,
|
|
5056
|
+
dragHandlePositionAfter: column.computedVisibleIndex,
|
|
5057
|
+
columnSizing: columnSizingForResize,
|
|
5058
|
+
items: columns.map((c) => {
|
|
5059
|
+
return {
|
|
5060
|
+
id: c.id,
|
|
5061
|
+
computedFlex: c.computedFlex,
|
|
5062
|
+
computedWidth: c.computedWidth,
|
|
5063
|
+
computedMinWidth: c.computedMinWidth,
|
|
5064
|
+
computedMaxWidth: c.computedMaxWidth
|
|
5065
|
+
};
|
|
5066
|
+
})
|
|
5067
|
+
});
|
|
5068
|
+
if (activeCellIndex && activeCellIndex[1] >= column.computedVisibleIndex) {
|
|
5069
|
+
const activeColumn = columns[activeCellIndex[1]];
|
|
5070
|
+
const currentColumn = columns[column.computedVisibleIndex];
|
|
5071
|
+
if (activeCellIndex[1] === currentColumn.computedVisibleIndex) {
|
|
5072
|
+
setInfiniteColumnWidth(currentColumn.computedVisibleIndex, currentColumn.computedWidth + result.adjustedDiff, domRef.current);
|
|
5073
|
+
} else if (activeColumn) {
|
|
5074
|
+
setInfiniteColumnOffset(activeColumn.computedVisibleIndex, activeColumn.computedOffset + result.adjustedDiff, domRef.current);
|
|
5075
|
+
}
|
|
5076
|
+
if (shareSpaceOnResize && activeCellIndex[1] === currentColumn.computedVisibleIndex + 1 && activeColumn) {
|
|
5077
|
+
setInfiniteColumnWidth(activeColumn.computedVisibleIndex, activeColumn.computedWidth - result.adjustedDiff, domRef.current);
|
|
5078
|
+
}
|
|
5079
|
+
}
|
|
5080
|
+
return result;
|
|
5081
|
+
}, []);
|
|
5082
|
+
const onColumnResize = (0, import_react23.useCallback)(({
|
|
5083
|
+
diff,
|
|
5084
|
+
shareSpaceOnResize
|
|
5085
|
+
}) => {
|
|
5086
|
+
const { columnSizing, reservedWidth } = computeResizeForDiff({
|
|
5087
|
+
diff,
|
|
5088
|
+
shareSpaceOnResize
|
|
5089
|
+
});
|
|
5090
|
+
if (!shareSpaceOnResize) {
|
|
5091
|
+
componentActions.viewportReservedWidth = reservedWidth;
|
|
5092
|
+
}
|
|
5093
|
+
componentActions.columnSizing = columnSizing;
|
|
5094
|
+
}, []);
|
|
5095
|
+
const resizeHandle = column.computedResizable ? /* @__PURE__ */ React21.createElement(ResizeHandle, {
|
|
5096
|
+
columns: computedVisibleColumns,
|
|
5097
|
+
columnIndex: column.computedVisibleIndex,
|
|
5098
|
+
computeResize: computeResizeForDiff,
|
|
5099
|
+
onResize: onColumnResize
|
|
5100
|
+
}) : null;
|
|
5101
|
+
return resizeHandle;
|
|
5102
|
+
}
|
|
5103
|
+
|
|
5104
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
5105
|
+
var InfiniteTableHeaderCellContext = React22.createContext(null);
|
|
5106
|
+
var { rootClassName: rootClassName8 } = internalProps;
|
|
5107
|
+
var InfiniteTableHeaderCellClassName = `${rootClassName8}HeaderCell`;
|
|
4486
5108
|
function InfiniteTableHeaderCell(props) {
|
|
4487
5109
|
var _a, _b, _c, _d, _e;
|
|
4488
5110
|
const column = props.column;
|
|
@@ -4490,13 +5112,13 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4490
5112
|
const { onResize, height, width, headerOptions } = props;
|
|
4491
5113
|
const sortInfo = column.computedSortInfo;
|
|
4492
5114
|
let header = column.header;
|
|
4493
|
-
const ref = (0,
|
|
5115
|
+
const ref = (0, import_react24.useCallback)((node) => {
|
|
4494
5116
|
var _a2;
|
|
4495
5117
|
domRef.current = node;
|
|
4496
5118
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
4497
5119
|
}, [props.domRef]);
|
|
4498
5120
|
const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
|
|
4499
|
-
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */
|
|
5121
|
+
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ React22.createElement(SortIcon, {
|
|
4500
5122
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
4501
5123
|
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
|
|
4502
5124
|
align: column.align || "start"
|
|
@@ -4513,15 +5135,15 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4513
5135
|
const align = column.align || "start";
|
|
4514
5136
|
const renderChildren = () => {
|
|
4515
5137
|
if (header instanceof Function) {
|
|
4516
|
-
header = /* @__PURE__ */
|
|
5138
|
+
header = /* @__PURE__ */ React22.createElement(RenderHookComponent, {
|
|
4517
5139
|
render: header,
|
|
4518
5140
|
renderParam
|
|
4519
5141
|
});
|
|
4520
5142
|
}
|
|
4521
5143
|
header = header != null ? header : column.name;
|
|
4522
|
-
return /* @__PURE__ */
|
|
5144
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
|
|
4523
5145
|
};
|
|
4524
|
-
const domRef = (0,
|
|
5146
|
+
const domRef = (0, import_react24.useRef)(null);
|
|
4525
5147
|
const {
|
|
4526
5148
|
computed: {
|
|
4527
5149
|
computedRemainingSpace,
|
|
@@ -4535,7 +5157,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4535
5157
|
getState: getDataSourceState,
|
|
4536
5158
|
componentState: { filterDelay, filterTypes }
|
|
4537
5159
|
} = useDataSourceContextValue();
|
|
4538
|
-
(0,
|
|
5160
|
+
(0, import_react24.useEffect)(() => {
|
|
4539
5161
|
let clearOnResize = null;
|
|
4540
5162
|
const node = domRef.current;
|
|
4541
5163
|
if (onResize && node) {
|
|
@@ -4548,7 +5170,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4548
5170
|
const style = {
|
|
4549
5171
|
height
|
|
4550
5172
|
};
|
|
4551
|
-
const { onPointerDown,
|
|
5173
|
+
const { onPointerDown, dragging, draggingDiff, proxyOffset } = useColumnPointerEvents({
|
|
4552
5174
|
computedRemainingSpace,
|
|
4553
5175
|
columnId: column.id,
|
|
4554
5176
|
domRef,
|
|
@@ -4556,7 +5178,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4556
5178
|
});
|
|
4557
5179
|
let draggingProxy = null;
|
|
4558
5180
|
if (dragging) {
|
|
4559
|
-
draggingProxy = /* @__PURE__ */
|
|
5181
|
+
draggingProxy = /* @__PURE__ */ React22.createElement("div", {
|
|
4560
5182
|
className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
|
|
4561
5183
|
style: {
|
|
4562
5184
|
position: "absolute",
|
|
@@ -4573,7 +5195,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4573
5195
|
const contentRecipeVariants = {
|
|
4574
5196
|
filtered: column.computedFiltered
|
|
4575
5197
|
};
|
|
4576
|
-
const setFilterValue = (0,
|
|
5198
|
+
const setFilterValue = (0, import_react24.useCallback)((filterValue) => {
|
|
4577
5199
|
var _a2;
|
|
4578
5200
|
const state = getDataSourceState();
|
|
4579
5201
|
let newFilterValue = (_a2 = state.filterValue) != null ? _a2 : [];
|
|
@@ -4597,7 +5219,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4597
5219
|
});
|
|
4598
5220
|
dataSourceActions.filterValue = newFilterValue;
|
|
4599
5221
|
}, [column, filterTypes]);
|
|
4600
|
-
const debouncedOnFilterValueChange =
|
|
5222
|
+
const debouncedOnFilterValueChange = React22.useMemo(() => {
|
|
4601
5223
|
const fn = (filterValue) => {
|
|
4602
5224
|
let newFilterValueForColumn;
|
|
4603
5225
|
if (column.computedFilterValue) {
|
|
@@ -4634,10 +5256,10 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4634
5256
|
]);
|
|
4635
5257
|
const filterType = column.computedFilterType;
|
|
4636
5258
|
const FilterEditor = filterEditors[filterType] || defaultFilterEditors[filterType] || StringFilterEditor;
|
|
4637
|
-
const resizeHandle =
|
|
4638
|
-
return /* @__PURE__ */
|
|
5259
|
+
const resizeHandle = useColumnResizeHandle(column);
|
|
5260
|
+
return /* @__PURE__ */ React22.createElement(ContextProvider, {
|
|
4639
5261
|
value: renderParam
|
|
4640
|
-
}, /* @__PURE__ */
|
|
5262
|
+
}, /* @__PURE__ */ React22.createElement(InfiniteTableCell, {
|
|
4641
5263
|
domRef: ref,
|
|
4642
5264
|
cellType: "header",
|
|
4643
5265
|
column,
|
|
@@ -4647,12 +5269,11 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4647
5269
|
style,
|
|
4648
5270
|
width,
|
|
4649
5271
|
onPointerDown,
|
|
4650
|
-
onPointerUp,
|
|
4651
5272
|
contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
|
|
4652
5273
|
contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
|
|
4653
5274
|
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false, rowActive: false }), CellCls),
|
|
4654
5275
|
cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
|
|
4655
|
-
afterChildren: /* @__PURE__ */
|
|
5276
|
+
afterChildren: /* @__PURE__ */ React22.createElement(React22.Fragment, null, showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ React22.createElement(InfiniteTableColumnHeaderFilter, {
|
|
4656
5277
|
filterEditor: FilterEditor,
|
|
4657
5278
|
filterTypes,
|
|
4658
5279
|
onChange: debouncedOnFilterValueChange,
|
|
@@ -4660,17 +5281,17 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4660
5281
|
columnLabel: column.field || column.name || column.id,
|
|
4661
5282
|
columnFilterValue: column.computedFilterValue,
|
|
4662
5283
|
columnHeaderHeight
|
|
4663
|
-
}) : /* @__PURE__ */
|
|
5284
|
+
}) : /* @__PURE__ */ React22.createElement(InfiniteTableColumnHeaderFilterEmpty, null) : null, resizeHandle),
|
|
4664
5285
|
renderChildren
|
|
4665
5286
|
}), draggingProxy);
|
|
4666
5287
|
}
|
|
4667
5288
|
function useInfiniteHeaderCell() {
|
|
4668
|
-
const result = (0,
|
|
5289
|
+
const result = (0, import_react24.useContext)(InfiniteTableHeaderCellContext);
|
|
4669
5290
|
return result;
|
|
4670
5291
|
}
|
|
4671
5292
|
|
|
4672
5293
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4673
|
-
var
|
|
5294
|
+
var React27 = __toModule(require("react"));
|
|
4674
5295
|
|
|
4675
5296
|
// src/components/utils/getScrollbarWidth.ts
|
|
4676
5297
|
var scrollbarWidth;
|
|
@@ -4756,7 +5377,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, c
|
|
|
4756
5377
|
let groupOffset = 0;
|
|
4757
5378
|
map2.forEach((item) => {
|
|
4758
5379
|
if (!item.ref.columnGroup) {
|
|
4759
|
-
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((
|
|
5380
|
+
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum2, col) => sum2 + col.ref.computedWidth, 0);
|
|
4760
5381
|
item.groupOffset = groupOffset;
|
|
4761
5382
|
item.computedWidth = itemWidth;
|
|
4762
5383
|
if (item.type === "group") {
|
|
@@ -4781,7 +5402,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, c
|
|
|
4781
5402
|
}
|
|
4782
5403
|
function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
4783
5404
|
items.forEach((item) => {
|
|
4784
|
-
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((
|
|
5405
|
+
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum2, col) => sum2 + col.ref.computedWidth, 0);
|
|
4785
5406
|
item.computedWidth = itemWidth;
|
|
4786
5407
|
item.groupOffset = groupOffset;
|
|
4787
5408
|
if (item.type === "group") {
|
|
@@ -4792,36 +5413,186 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
4792
5413
|
}
|
|
4793
5414
|
|
|
4794
5415
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4795
|
-
var
|
|
4796
|
-
var
|
|
5416
|
+
var React26 = __toModule(require("react"));
|
|
5417
|
+
var import_react27 = __toModule(require("react"));
|
|
5418
|
+
|
|
5419
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
5420
|
+
var React25 = __toModule(require("react"));
|
|
5421
|
+
|
|
5422
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx
|
|
5423
|
+
var React24 = __toModule(require("react"));
|
|
5424
|
+
var import_react26 = __toModule(require("react"));
|
|
5425
|
+
|
|
5426
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/GroupResizeHandle.tsx
|
|
5427
|
+
var import_react25 = __toModule(require("react"));
|
|
5428
|
+
var { rootClassName: rootClassName9 } = internalProps;
|
|
5429
|
+
var InfiniteTableHeaderCellResizeHandleCls2 = `${rootClassName9}HeaderCell_ResizeHandle`;
|
|
5430
|
+
function GroupResizeHandleFn(props) {
|
|
5431
|
+
const domRef = (0, import_react25.useRef)(null);
|
|
5432
|
+
const [constrained, setConstrained] = (0, import_react25.useState)(false);
|
|
5433
|
+
const constrainedRef = (0, import_react25.useRef)(constrained);
|
|
5434
|
+
constrainedRef.current = constrained;
|
|
5435
|
+
const onPointerDown = (e) => {
|
|
5436
|
+
e.stopPropagation();
|
|
5437
|
+
const pointerId = e.pointerId;
|
|
5438
|
+
const initialX = e.clientX;
|
|
5439
|
+
const target = e.target;
|
|
5440
|
+
target.setPointerCapture(pointerId);
|
|
5441
|
+
let initialMove = true;
|
|
5442
|
+
const resizer = getColumnGroupResizer(props.groupColumns.map((c) => c.computedVisibleIndex), {
|
|
5443
|
+
columns: props.columns,
|
|
5444
|
+
domRef
|
|
5445
|
+
});
|
|
5446
|
+
const resizeDiff = (diff) => {
|
|
5447
|
+
const { constrained: constrained2, adjustedDiffs, adjustedDiff } = props.computeResize(diff);
|
|
5448
|
+
if (constrainedRef.current !== constrained2) {
|
|
5449
|
+
setConstrained(constrained2);
|
|
5450
|
+
}
|
|
5451
|
+
resizer.resize(adjustedDiffs);
|
|
5452
|
+
return adjustedDiff;
|
|
5453
|
+
};
|
|
5454
|
+
const onPointerMove = (e2) => {
|
|
5455
|
+
if (initialMove) {
|
|
5456
|
+
const maxDiff = props.groupColumns.reduce((diff, col) => {
|
|
5457
|
+
return diff + col.computedWidth - col.computedMinWidth;
|
|
5458
|
+
}, 0);
|
|
5459
|
+
const currentSize = props.brain.getAvailableSize();
|
|
5460
|
+
const newSize = {
|
|
5461
|
+
width: currentSize.width + maxDiff,
|
|
5462
|
+
height: currentSize.height
|
|
5463
|
+
};
|
|
5464
|
+
props.brain.setAvailableSize(newSize);
|
|
5465
|
+
initialMove = false;
|
|
5466
|
+
}
|
|
5467
|
+
resizeDiff(Math.round(e2.clientX - initialX));
|
|
5468
|
+
};
|
|
5469
|
+
const onPointerUp = (e2) => {
|
|
5470
|
+
target.releasePointerCapture(pointerId);
|
|
5471
|
+
target.removeEventListener("pointermove", onPointerMove);
|
|
5472
|
+
target.removeEventListener("pointerup", onPointerUp);
|
|
5473
|
+
const diff = Math.round(e2.clientX - initialX);
|
|
5474
|
+
const adjustedDiffs = resizeDiff(diff);
|
|
5475
|
+
props.onResize(adjustedDiffs);
|
|
5476
|
+
};
|
|
5477
|
+
target.addEventListener("pointermove", onPointerMove);
|
|
5478
|
+
target.addEventListener("pointerup", onPointerUp);
|
|
5479
|
+
};
|
|
5480
|
+
return /* @__PURE__ */ import_react25.default.createElement("div", {
|
|
5481
|
+
ref: domRef,
|
|
5482
|
+
className: `${InfiniteTableHeaderCellResizeHandleCls2} ${ResizeHandleCls}`,
|
|
5483
|
+
onPointerDown
|
|
5484
|
+
}, /* @__PURE__ */ import_react25.default.createElement("div", {
|
|
5485
|
+
style: props.style,
|
|
5486
|
+
className: ResizeHandleDraggerClsRecipe({
|
|
5487
|
+
constrained
|
|
5488
|
+
})
|
|
5489
|
+
}));
|
|
5490
|
+
}
|
|
5491
|
+
var GroupResizeHandle = import_react25.default.memo(GroupResizeHandleFn);
|
|
5492
|
+
|
|
5493
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx
|
|
5494
|
+
function useColumnGroupResizeHandle(groupColumns, config) {
|
|
5495
|
+
const { bodyBrain, groupHeight, columnGroup, columnGroupsMaxDepth } = config;
|
|
5496
|
+
const {
|
|
5497
|
+
computed: { computedVisibleColumns },
|
|
5498
|
+
getState,
|
|
5499
|
+
getComputed,
|
|
5500
|
+
componentActions
|
|
5501
|
+
} = useInfiniteTable();
|
|
5502
|
+
const lastColumnInGroup = groupColumns[groupColumns.length - 1];
|
|
5503
|
+
const computeResizeForDiff = (0, import_react26.useCallback)((diff) => {
|
|
5504
|
+
const state = getState();
|
|
5505
|
+
const { columnSizing, viewportReservedWidth, bodySize } = state;
|
|
5506
|
+
const columns = getComputed().computedVisibleColumns;
|
|
5507
|
+
let atLeastOneFlex = false;
|
|
5508
|
+
const columnSizingWithFlex = columns.reduce((acc, col) => {
|
|
5509
|
+
if (col.computedFlex) {
|
|
5510
|
+
acc[col.id] = { flex: col.computedWidth };
|
|
5511
|
+
atLeastOneFlex = true;
|
|
5512
|
+
}
|
|
5513
|
+
return acc;
|
|
5514
|
+
}, {});
|
|
5515
|
+
const columnSizingForResize = atLeastOneFlex ? __spreadValues(__spreadValues({}, columnSizing), columnSizingWithFlex) : columnSizing;
|
|
5516
|
+
const result = computeGroupResize({
|
|
5517
|
+
availableSize: bodySize.width,
|
|
5518
|
+
reservedWidth: viewportReservedWidth || 0,
|
|
5519
|
+
dragHandleOffset: diff,
|
|
5520
|
+
dragHandlePositionAfter: lastColumnInGroup.computedVisibleIndex,
|
|
5521
|
+
columnSizing: columnSizingForResize,
|
|
5522
|
+
columnGroupSize: groupColumns.length,
|
|
5523
|
+
items: columns.map((c) => {
|
|
5524
|
+
return {
|
|
5525
|
+
id: c.id,
|
|
5526
|
+
resizable: c.computedResizable,
|
|
5527
|
+
computedFlex: c.computedFlex,
|
|
5528
|
+
computedWidth: c.computedWidth,
|
|
5529
|
+
computedMinWidth: c.computedMinWidth,
|
|
5530
|
+
computedMaxWidth: c.computedMaxWidth
|
|
5531
|
+
};
|
|
5532
|
+
})
|
|
5533
|
+
});
|
|
5534
|
+
return result;
|
|
5535
|
+
}, []);
|
|
5536
|
+
const onColumnResize = (0, import_react26.useCallback)((diff) => {
|
|
5537
|
+
const { columnSizing, reservedWidth } = computeResizeForDiff(diff);
|
|
5538
|
+
componentActions.viewportReservedWidth = reservedWidth;
|
|
5539
|
+
componentActions.columnSizing = columnSizing;
|
|
5540
|
+
}, []);
|
|
5541
|
+
const groupResizable = groupColumns.some((c) => c.computedResizable);
|
|
5542
|
+
const resizeHandle = groupResizable ? /* @__PURE__ */ React24.createElement(GroupResizeHandle, {
|
|
5543
|
+
brain: bodyBrain,
|
|
5544
|
+
style: {
|
|
5545
|
+
height: groupHeight * (columnGroupsMaxDepth - columnGroup.depth + 2)
|
|
5546
|
+
},
|
|
5547
|
+
columns: computedVisibleColumns,
|
|
5548
|
+
groupColumns,
|
|
5549
|
+
computeResize: computeResizeForDiff,
|
|
5550
|
+
onResize: onColumnResize
|
|
5551
|
+
}) : null;
|
|
5552
|
+
return resizeHandle;
|
|
5553
|
+
}
|
|
4797
5554
|
|
|
4798
5555
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
4799
|
-
var React21 = __toModule(require("react"));
|
|
4800
5556
|
var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
|
|
5557
|
+
var columnWidthAtIndex3 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4801
5558
|
function InfiniteTableHeaderGroup(props) {
|
|
4802
|
-
const {
|
|
5559
|
+
const {
|
|
5560
|
+
computed: { computedVisibleColumns }
|
|
5561
|
+
} = useInfiniteTable();
|
|
5562
|
+
const { columnGroup, height, columns, bodyBrain, columnGroupsMaxDepth } = props;
|
|
4803
5563
|
let { header } = columnGroup;
|
|
4804
5564
|
if (header instanceof Function) {
|
|
4805
5565
|
header = header({
|
|
4806
5566
|
columnGroup
|
|
4807
5567
|
});
|
|
4808
5568
|
}
|
|
4809
|
-
|
|
5569
|
+
const handle = useColumnGroupResizeHandle(columns, {
|
|
5570
|
+
bodyBrain,
|
|
5571
|
+
groupHeight: height,
|
|
5572
|
+
columnGroup,
|
|
5573
|
+
columnGroupsMaxDepth
|
|
5574
|
+
});
|
|
5575
|
+
const firstColumn = columns[0];
|
|
5576
|
+
const width = columns.length > 1 ? `calc( ` + columns.map((col) => `var(${columnWidthAtIndex3}-${col.computedVisibleIndex})`).join(" + ") + " )" : `var(${columnWidthAtIndex3}-${firstColumn.computedVisibleIndex})`;
|
|
5577
|
+
const zIndex2 = computedVisibleColumns.length * 10 - firstColumn.computedVisibleIndex * 10 + height * (columnGroupsMaxDepth - columnGroup.depth + 2);
|
|
5578
|
+
return /* @__PURE__ */ React25.createElement("div", {
|
|
4810
5579
|
ref: props.domRef,
|
|
4811
5580
|
"data-group-id": columnGroup.uniqueGroupId,
|
|
4812
5581
|
className: join(HeaderGroupCls, TableHeaderGroupClassName),
|
|
4813
|
-
style: { width, height }
|
|
4814
|
-
|
|
5582
|
+
style: { width, height },
|
|
5583
|
+
"data-z-index": zIndex2
|
|
5584
|
+
}, /* @__PURE__ */ React25.createElement("div", {
|
|
4815
5585
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4816
|
-
}, header));
|
|
5586
|
+
}, header), handle);
|
|
4817
5587
|
}
|
|
4818
5588
|
|
|
4819
5589
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4820
|
-
var { rootClassName:
|
|
4821
|
-
var TableHeaderClassName = `${
|
|
5590
|
+
var { rootClassName: rootClassName10 } = internalProps;
|
|
5591
|
+
var TableHeaderClassName = `${rootClassName10}Header`;
|
|
4822
5592
|
function InfiniteTableHeaderFn(props) {
|
|
4823
5593
|
const {
|
|
4824
|
-
|
|
5594
|
+
bodyBrain,
|
|
5595
|
+
headerBrain: brain,
|
|
4825
5596
|
columns,
|
|
4826
5597
|
style,
|
|
4827
5598
|
className,
|
|
@@ -4834,7 +5605,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4834
5605
|
componentState: { headerBrain, headerOptions }
|
|
4835
5606
|
} = useInfiniteTable();
|
|
4836
5607
|
const { computedVisibleColumnsMap, showColumnFilters } = computed;
|
|
4837
|
-
(0,
|
|
5608
|
+
(0, import_react27.useEffect)(() => {
|
|
4838
5609
|
const onScroll = (scrollPosition) => {
|
|
4839
5610
|
if (domRef.current) {
|
|
4840
5611
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
@@ -4843,7 +5614,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4843
5614
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4844
5615
|
return removeOnScroll;
|
|
4845
5616
|
}, [brain]);
|
|
4846
|
-
const domRef = (0,
|
|
5617
|
+
const domRef = (0, import_react27.useRef)(null);
|
|
4847
5618
|
const headerCls = HeaderClsRecipe({
|
|
4848
5619
|
overflow: false,
|
|
4849
5620
|
virtualized: true
|
|
@@ -4853,7 +5624,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4853
5624
|
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4854
5625
|
style: __spreadProps(__spreadValues({}, style), { height: columnHeaderHeight })
|
|
4855
5626
|
};
|
|
4856
|
-
const renderCell = (0,
|
|
5627
|
+
const renderCell = (0, import_react27.useCallback)((params) => {
|
|
4857
5628
|
const {
|
|
4858
5629
|
rowIndex,
|
|
4859
5630
|
colIndex,
|
|
@@ -4878,7 +5649,9 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4878
5649
|
computedWidth: colGroupItem.computedWidth,
|
|
4879
5650
|
groupOffset: colGroupItem.groupOffset
|
|
4880
5651
|
});
|
|
4881
|
-
return /* @__PURE__ */
|
|
5652
|
+
return /* @__PURE__ */ React26.createElement(InfiniteTableHeaderGroup, {
|
|
5653
|
+
bodyBrain,
|
|
5654
|
+
columnGroupsMaxDepth,
|
|
4882
5655
|
domRef: domRef2,
|
|
4883
5656
|
columns: columns2,
|
|
4884
5657
|
width: widthWithColspan,
|
|
@@ -4886,7 +5659,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4886
5659
|
columnGroup: computedColumnGroup
|
|
4887
5660
|
});
|
|
4888
5661
|
}
|
|
4889
|
-
return /* @__PURE__ */
|
|
5662
|
+
return /* @__PURE__ */ React26.createElement(InfiniteTableHeaderCell, {
|
|
4890
5663
|
domRef: domRef2,
|
|
4891
5664
|
column,
|
|
4892
5665
|
headerOptions,
|
|
@@ -4902,17 +5675,18 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4902
5675
|
columnGroupsMaxDepth,
|
|
4903
5676
|
showColumnFilters
|
|
4904
5677
|
]);
|
|
4905
|
-
return /* @__PURE__ */
|
|
5678
|
+
return /* @__PURE__ */ React26.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React26.createElement(RawTable, {
|
|
5679
|
+
name: "header",
|
|
4906
5680
|
renderCell,
|
|
4907
5681
|
brain: headerBrain,
|
|
4908
5682
|
cellHoverClassNames: []
|
|
4909
5683
|
}));
|
|
4910
5684
|
}
|
|
4911
|
-
var InfiniteTableHeader =
|
|
5685
|
+
var InfiniteTableHeader = React26.memo(InfiniteTableHeaderFn);
|
|
4912
5686
|
|
|
4913
5687
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4914
5688
|
function TableHeaderWrapper(props) {
|
|
4915
|
-
const {
|
|
5689
|
+
const { headerBrain, bodyBrain, scrollbars } = props;
|
|
4916
5690
|
const tableContextValue = useInfiniteTable();
|
|
4917
5691
|
const {
|
|
4918
5692
|
computedPinnedStartColumns,
|
|
@@ -4931,13 +5705,13 @@ function TableHeaderWrapper(props) {
|
|
|
4931
5705
|
} = tableContextValue;
|
|
4932
5706
|
const rows = !computedColumnGroups || !computedColumnGroups.size ? 1 : columnGroupsMaxDepth + 2;
|
|
4933
5707
|
const height = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
|
|
4934
|
-
const columnAndGroupTreeInfo =
|
|
5708
|
+
const columnAndGroupTreeInfo = React27.useMemo(() => {
|
|
4935
5709
|
if (!computedColumnGroups || !computedColumnGroups.size) {
|
|
4936
5710
|
return void 0;
|
|
4937
5711
|
}
|
|
4938
5712
|
return buildColumnAndGroupTree(computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth);
|
|
4939
5713
|
}, [computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap]);
|
|
4940
|
-
const cellspan =
|
|
5714
|
+
const cellspan = React27.useCallback(({ rowIndex, colIndex }) => {
|
|
4941
5715
|
const column = computedVisibleColumns[colIndex];
|
|
4942
5716
|
const rowspan2 = 1;
|
|
4943
5717
|
const colspan2 = 1;
|
|
@@ -4970,12 +5744,12 @@ function TableHeaderWrapper(props) {
|
|
|
4970
5744
|
rows,
|
|
4971
5745
|
columnGroupsDepthsMap
|
|
4972
5746
|
]);
|
|
4973
|
-
const rowspan =
|
|
4974
|
-
const colspan =
|
|
4975
|
-
const rowHeight =
|
|
5747
|
+
const rowspan = React27.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
|
|
5748
|
+
const colspan = React27.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
|
|
5749
|
+
const rowHeight = React27.useCallback((index) => {
|
|
4976
5750
|
return showColumnFilters ? index < rows - 1 ? columnHeaderHeight : 2 * columnHeaderHeight : columnHeaderHeight;
|
|
4977
5751
|
}, [rows, showColumnFilters, columnHeaderHeight]);
|
|
4978
|
-
useMatrixBrain(
|
|
5752
|
+
useMatrixBrain(headerBrain, {
|
|
4979
5753
|
colWidth: columnSize,
|
|
4980
5754
|
rowHeight,
|
|
4981
5755
|
rows,
|
|
@@ -4987,21 +5761,22 @@ function TableHeaderWrapper(props) {
|
|
|
4987
5761
|
fixedColsEnd: computedPinnedEndColumns.length,
|
|
4988
5762
|
fixedColsStart: computedPinnedStartColumns.length
|
|
4989
5763
|
});
|
|
4990
|
-
const header = /* @__PURE__ */
|
|
5764
|
+
const header = /* @__PURE__ */ React27.createElement(InfiniteTableHeader, {
|
|
4991
5765
|
columns: computedVisibleColumns,
|
|
4992
|
-
|
|
5766
|
+
headerBrain,
|
|
5767
|
+
bodyBrain,
|
|
4993
5768
|
columnHeaderHeight: height,
|
|
4994
5769
|
columnGroupsMaxDepth,
|
|
4995
5770
|
columnAndGroupTreeInfo
|
|
4996
5771
|
});
|
|
4997
|
-
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */
|
|
5772
|
+
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ React27.createElement("div", {
|
|
4998
5773
|
className: HeaderScrollbarPlaceholderCls,
|
|
4999
5774
|
style: {
|
|
5000
5775
|
zIndex: 1e3,
|
|
5001
5776
|
width: getScrollbarWidth()
|
|
5002
5777
|
}
|
|
5003
5778
|
}) : null;
|
|
5004
|
-
return /* @__PURE__ */
|
|
5779
|
+
return /* @__PURE__ */ React27.createElement("div", {
|
|
5005
5780
|
className: HeaderWrapperCls,
|
|
5006
5781
|
style: {
|
|
5007
5782
|
height
|
|
@@ -5010,8 +5785,8 @@ function TableHeaderWrapper(props) {
|
|
|
5010
5785
|
}
|
|
5011
5786
|
|
|
5012
5787
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
5013
|
-
var
|
|
5014
|
-
var
|
|
5788
|
+
var React28 = __toModule(require("react"));
|
|
5789
|
+
var import_react28 = __toModule(require("react"));
|
|
5015
5790
|
|
|
5016
5791
|
// src/components/utils/decamelize.ts
|
|
5017
5792
|
function decamelize(str, options) {
|
|
@@ -5019,17 +5794,13 @@ function decamelize(str, options) {
|
|
|
5019
5794
|
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
5795
|
}
|
|
5021
5796
|
|
|
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
5797
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5027
|
-
var
|
|
5798
|
+
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5028
5799
|
var FooterCls = "_16lm1iw1";
|
|
5029
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
5030
|
-
var InfiniteClsRecipe = (0,
|
|
5031
|
-
var InfiniteClsShiftingColumns = "
|
|
5032
|
-
var PinnedRowsContainerClsVariants = (0,
|
|
5800
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwn _16lm1iw13 _16lm1iw0";
|
|
5801
|
+
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"]] });
|
|
5802
|
+
var InfiniteClsShiftingColumns = "_16lm1iwq";
|
|
5803
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5033
5804
|
|
|
5034
5805
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
5035
5806
|
var defaultStyle = {
|
|
@@ -5058,10 +5829,10 @@ var enforceStyle = (node, style) => {
|
|
|
5058
5829
|
node.style.setProperty(decamelize(propertyName), propertyValue, "important");
|
|
5059
5830
|
}
|
|
5060
5831
|
};
|
|
5061
|
-
var InfiniteTableLicenseFooter =
|
|
5062
|
-
const { rootClassName:
|
|
5063
|
-
const domRef =
|
|
5064
|
-
const domCallback =
|
|
5832
|
+
var InfiniteTableLicenseFooter = React28.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
|
|
5833
|
+
const { rootClassName: rootClassName13 } = useInternalProps();
|
|
5834
|
+
const domRef = React28.useRef(null);
|
|
5835
|
+
const domCallback = React28.useCallback((node) => {
|
|
5065
5836
|
domRef.current = node;
|
|
5066
5837
|
if (!ref) {
|
|
5067
5838
|
return;
|
|
@@ -5072,7 +5843,7 @@ var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicens
|
|
|
5072
5843
|
ref.current = node;
|
|
5073
5844
|
}
|
|
5074
5845
|
}, []);
|
|
5075
|
-
(0,
|
|
5846
|
+
(0, import_react28.useEffect)(() => {
|
|
5076
5847
|
const forceStyle = () => {
|
|
5077
5848
|
requestAnimationFrame(() => {
|
|
5078
5849
|
var _a;
|
|
@@ -5086,12 +5857,12 @@ var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicens
|
|
|
5086
5857
|
clearInterval(intervalId);
|
|
5087
5858
|
};
|
|
5088
5859
|
}, []);
|
|
5089
|
-
return /* @__PURE__ */
|
|
5860
|
+
return /* @__PURE__ */ React28.createElement("div", __spreadProps(__spreadValues({
|
|
5090
5861
|
ref: domCallback
|
|
5091
5862
|
}, props), {
|
|
5092
|
-
className: join(`${
|
|
5863
|
+
className: join(`${rootClassName13}-Footer`, FooterCls, props.className),
|
|
5093
5864
|
style: defaultStyle
|
|
5094
|
-
}), "Powered by", " ", /* @__PURE__ */
|
|
5865
|
+
}), "Powered by", " ", /* @__PURE__ */ React28.createElement("a", {
|
|
5095
5866
|
href: "https://infinite-table.com",
|
|
5096
5867
|
rel: "noopener noreferrer",
|
|
5097
5868
|
role: "link",
|
|
@@ -5100,11 +5871,11 @@ var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicens
|
|
|
5100
5871
|
});
|
|
5101
5872
|
|
|
5102
5873
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5103
|
-
var
|
|
5104
|
-
var
|
|
5105
|
-
var { rootClassName:
|
|
5106
|
-
var InfiniteTableColumnCellContext =
|
|
5107
|
-
var InfiniteTableColumnCellClassName = `${
|
|
5874
|
+
var React29 = __toModule(require("react"));
|
|
5875
|
+
var import_react29 = __toModule(require("react"));
|
|
5876
|
+
var { rootClassName: rootClassName11 } = internalProps;
|
|
5877
|
+
var InfiniteTableColumnCellContext = React29.createContext(null);
|
|
5878
|
+
var InfiniteTableColumnCellClassName = `${rootClassName11}ColumnCell`;
|
|
5108
5879
|
function isColumnWithField(c) {
|
|
5109
5880
|
return typeof c.field === "string";
|
|
5110
5881
|
}
|
|
@@ -5118,9 +5889,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5118
5889
|
column,
|
|
5119
5890
|
onMouseLeave,
|
|
5120
5891
|
onMouseEnter,
|
|
5121
|
-
offsetProperty,
|
|
5122
5892
|
toggleGroupRow,
|
|
5123
|
-
virtualized,
|
|
5124
5893
|
rowIndex,
|
|
5125
5894
|
rowHeight,
|
|
5126
5895
|
domRef,
|
|
@@ -5128,7 +5897,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5128
5897
|
showZebraRows
|
|
5129
5898
|
} = props;
|
|
5130
5899
|
if (!column) {
|
|
5131
|
-
return /* @__PURE__ */
|
|
5900
|
+
return /* @__PURE__ */ React29.createElement("div", {
|
|
5132
5901
|
ref: domRef
|
|
5133
5902
|
}, "no column");
|
|
5134
5903
|
}
|
|
@@ -5161,7 +5930,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5161
5930
|
value
|
|
5162
5931
|
});
|
|
5163
5932
|
}
|
|
5164
|
-
const onClick = (0,
|
|
5933
|
+
const onClick = (0, import_react29.useCallback)(() => {
|
|
5165
5934
|
if (keyboardNavigation === "row") {
|
|
5166
5935
|
componentActions.activeRowIndex = rowIndex;
|
|
5167
5936
|
return;
|
|
@@ -5201,7 +5970,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5201
5970
|
isGroupRow,
|
|
5202
5971
|
rowIndex,
|
|
5203
5972
|
toggleGroupRow,
|
|
5204
|
-
toggleCurrentGroupRow: (0,
|
|
5973
|
+
toggleCurrentGroupRow: (0, import_react29.useCallback)(() => {
|
|
5205
5974
|
if (!rowInfo.isGroupRow) {
|
|
5206
5975
|
return;
|
|
5207
5976
|
}
|
|
@@ -5210,13 +5979,13 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5210
5979
|
groupBy: computedDataSource.groupBy,
|
|
5211
5980
|
pivotBy: computedDataSource.pivotBy
|
|
5212
5981
|
});
|
|
5213
|
-
const renderChildren = (0,
|
|
5982
|
+
const renderChildren = (0, import_react29.useCallback)(() => {
|
|
5214
5983
|
if (hidden) {
|
|
5215
5984
|
return null;
|
|
5216
5985
|
}
|
|
5217
5986
|
const renderFn = column.render || column.renderValue;
|
|
5218
5987
|
if (renderFn) {
|
|
5219
|
-
return /* @__PURE__ */
|
|
5988
|
+
return /* @__PURE__ */ React29.createElement(RenderHookComponent, {
|
|
5220
5989
|
render: renderFn,
|
|
5221
5990
|
renderParam
|
|
5222
5991
|
});
|
|
@@ -5233,18 +6002,15 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5233
6002
|
style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
|
|
5234
6003
|
}
|
|
5235
6004
|
style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
|
|
5236
|
-
style.width = width;
|
|
5237
6005
|
style.height = rowHeight;
|
|
5238
|
-
const memoizedStyle = (0,
|
|
6006
|
+
const memoizedStyle = (0, import_react29.useMemo)(() => style, [!style ? null : JSON.stringify(style)]);
|
|
5239
6007
|
const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
|
|
5240
6008
|
const zebra = showZebraRows ? odd ? "odd" : "even" : false;
|
|
5241
6009
|
const cellProps = {
|
|
5242
6010
|
domRef,
|
|
5243
|
-
offsetProperty,
|
|
5244
6011
|
cellType: "body",
|
|
5245
6012
|
column,
|
|
5246
6013
|
width,
|
|
5247
|
-
offset: virtualized ? 0 : column.computedPinningOffset,
|
|
5248
6014
|
style: memoizedStyle,
|
|
5249
6015
|
onMouseLeave,
|
|
5250
6016
|
onMouseEnter,
|
|
@@ -5254,44 +6020,44 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5254
6020
|
renderChildren
|
|
5255
6021
|
};
|
|
5256
6022
|
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
5257
|
-
return /* @__PURE__ */
|
|
6023
|
+
return /* @__PURE__ */ React29.createElement(ContextProvider, {
|
|
5258
6024
|
value: renderParam
|
|
5259
|
-
}, /* @__PURE__ */
|
|
6025
|
+
}, /* @__PURE__ */ React29.createElement(InfiniteTableCell, __spreadValues({}, cellProps)));
|
|
5260
6026
|
}
|
|
5261
|
-
var InfiniteTableColumnCell =
|
|
6027
|
+
var InfiniteTableColumnCell = React29.memo(InfiniteTableColumnCellFn);
|
|
5262
6028
|
function useInfiniteColumnCell() {
|
|
5263
|
-
const result = (0,
|
|
6029
|
+
const result = (0, import_react29.useContext)(InfiniteTableColumnCellContext);
|
|
5264
6030
|
return result;
|
|
5265
6031
|
}
|
|
5266
6032
|
|
|
5267
6033
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
5268
|
-
var
|
|
6034
|
+
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5269
6035
|
var GroupRowExpanderCls = "_7pupv0b";
|
|
5270
|
-
var RowClsRecipe = (0,
|
|
6036
|
+
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
6037
|
var RowHoverCls = "_7pupv01";
|
|
5272
6038
|
|
|
5273
6039
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
5274
|
-
var
|
|
6040
|
+
var React30 = __toModule(require("react"));
|
|
5275
6041
|
|
|
5276
6042
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
5277
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
5278
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
6043
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz" };
|
|
6044
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz";
|
|
5279
6045
|
var LoadMaskTextCls = "qy58ya4";
|
|
5280
6046
|
|
|
5281
6047
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
5282
|
-
var { rootClassName:
|
|
5283
|
-
var baseCls3 = `${
|
|
6048
|
+
var { rootClassName: rootClassName12 } = internalProps;
|
|
6049
|
+
var baseCls3 = `${rootClassName12}-LoadMask`;
|
|
5284
6050
|
function LoadMaskFn(props) {
|
|
5285
6051
|
const { visible, children = "Loading" } = props;
|
|
5286
|
-
return /* @__PURE__ */
|
|
6052
|
+
return /* @__PURE__ */ React30.createElement("div", {
|
|
5287
6053
|
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls3}`
|
|
5288
|
-
}, /* @__PURE__ */
|
|
6054
|
+
}, /* @__PURE__ */ React30.createElement("div", {
|
|
5289
6055
|
className: `${LoadMaskOverlayCls} ${baseCls3}-Overlay`
|
|
5290
|
-
}), /* @__PURE__ */
|
|
6056
|
+
}), /* @__PURE__ */ React30.createElement("div", {
|
|
5291
6057
|
className: `${LoadMaskTextCls} ${baseCls3}-Text`
|
|
5292
6058
|
}, children));
|
|
5293
6059
|
}
|
|
5294
|
-
var LoadMask =
|
|
6060
|
+
var LoadMask = React30.memo(LoadMaskFn);
|
|
5295
6061
|
|
|
5296
6062
|
// src/components/InfiniteTable/getImperativeApi.ts
|
|
5297
6063
|
function getImperativeApi(getState, getComputed, getDataSourceState, componentActions) {
|
|
@@ -5356,7 +6122,7 @@ function getImperativeApi(getState, getComputed, getDataSourceState, componentAc
|
|
|
5356
6122
|
}
|
|
5357
6123
|
|
|
5358
6124
|
// src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
|
|
5359
|
-
var
|
|
6125
|
+
var import_react30 = __toModule(require("react"));
|
|
5360
6126
|
var OFFSET = 10;
|
|
5361
6127
|
function getColumnContentMaxWidths(domRef, options) {
|
|
5362
6128
|
var _a;
|
|
@@ -5392,9 +6158,15 @@ function getColumnContentMaxWidths(domRef, options) {
|
|
|
5392
6158
|
cell.childNodes.forEach((child) => {
|
|
5393
6159
|
if (child !== content) {
|
|
5394
6160
|
const el = child;
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
6161
|
+
let elWidth = Math.max(el.offsetWidth, parseInt(el.style.width, 10));
|
|
6162
|
+
if (isNaN(elWidth)) {
|
|
6163
|
+
elWidth = 0;
|
|
6164
|
+
}
|
|
6165
|
+
otherElementsLength += elWidth;
|
|
6166
|
+
if (elWidth > 0) {
|
|
6167
|
+
const style = getGlobal().getComputedStyle(el);
|
|
6168
|
+
otherElementsLength += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
|
|
6169
|
+
}
|
|
5398
6170
|
}
|
|
5399
6171
|
});
|
|
5400
6172
|
measuredWidth += otherElementsLength;
|
|
@@ -5416,11 +6188,11 @@ function useAutoSizeColumns() {
|
|
|
5416
6188
|
componentActions,
|
|
5417
6189
|
componentState: { domRef, ready, autoSizeColumnsKey, brain }
|
|
5418
6190
|
} = useComponentState();
|
|
5419
|
-
const [refreshId, setRefreshId] = (0,
|
|
6191
|
+
const [refreshId, setRefreshId] = (0, import_react30.useState)(0);
|
|
5420
6192
|
const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
|
|
5421
6193
|
const getTheKey = useLatest(theKey);
|
|
5422
|
-
const lastExecutedIdentifierRef = (0,
|
|
5423
|
-
(0,
|
|
6194
|
+
const lastExecutedIdentifierRef = (0, import_react30.useRef)(null);
|
|
6195
|
+
(0, import_react30.useEffect)(() => {
|
|
5424
6196
|
const key = getTheKey();
|
|
5425
6197
|
if (key == null) {
|
|
5426
6198
|
return;
|
|
@@ -5433,7 +6205,7 @@ function useAutoSizeColumns() {
|
|
|
5433
6205
|
};
|
|
5434
6206
|
return brain.onRenderRangeChange(onChange);
|
|
5435
6207
|
}, [brain]);
|
|
5436
|
-
(0,
|
|
6208
|
+
(0, import_react30.useEffect)(() => {
|
|
5437
6209
|
var _a;
|
|
5438
6210
|
if (theKey == null) {
|
|
5439
6211
|
return;
|
|
@@ -5478,8 +6250,8 @@ function useAutoSizeColumns() {
|
|
|
5478
6250
|
}
|
|
5479
6251
|
|
|
5480
6252
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
5481
|
-
var
|
|
5482
|
-
var
|
|
6253
|
+
var import_react31 = __toModule(require("react"));
|
|
6254
|
+
var import_react32 = __toModule(require("react"));
|
|
5483
6255
|
|
|
5484
6256
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
5485
6257
|
function useYourBrain(param) {
|
|
@@ -5549,13 +6321,13 @@ function useCellRendering(param) {
|
|
|
5549
6321
|
bodySize,
|
|
5550
6322
|
rowspan
|
|
5551
6323
|
});
|
|
5552
|
-
const scrollTopMaxRef = (0,
|
|
5553
|
-
(0,
|
|
6324
|
+
const scrollTopMaxRef = (0, import_react31.useRef)(0);
|
|
6325
|
+
(0, import_react31.useEffect)(() => {
|
|
5554
6326
|
return brain.onRenderCountChange(() => {
|
|
5555
6327
|
scrollTopMaxRef.current = brain.scrollTopMax;
|
|
5556
6328
|
});
|
|
5557
6329
|
}, [brain]);
|
|
5558
|
-
(0,
|
|
6330
|
+
(0, import_react31.useEffect)(() => {
|
|
5559
6331
|
return brain.onScrollStop((scrollPosition) => {
|
|
5560
6332
|
const { scrollTop } = scrollPosition;
|
|
5561
6333
|
if (scrollTop === 0) {
|
|
@@ -5572,7 +6344,7 @@ function useCellRendering(param) {
|
|
|
5572
6344
|
}
|
|
5573
6345
|
});
|
|
5574
6346
|
}, [brain, onScrollToTop, onScrollToBottom]);
|
|
5575
|
-
(0,
|
|
6347
|
+
(0, import_react31.useEffect)(() => {
|
|
5576
6348
|
if (!bodySize.height) {
|
|
5577
6349
|
return;
|
|
5578
6350
|
}
|
|
@@ -5583,10 +6355,10 @@ function useCellRendering(param) {
|
|
|
5583
6355
|
}
|
|
5584
6356
|
}, [!!bodySize.height]);
|
|
5585
6357
|
const [, rerender] = useRerender();
|
|
5586
|
-
(0,
|
|
6358
|
+
(0, import_react31.useEffect)(() => {
|
|
5587
6359
|
rerender();
|
|
5588
6360
|
}, [dataSourceState]);
|
|
5589
|
-
const renderCell = (0,
|
|
6361
|
+
const renderCell = (0, import_react31.useCallback)((params) => {
|
|
5590
6362
|
const {
|
|
5591
6363
|
rowIndex,
|
|
5592
6364
|
colIndex,
|
|
@@ -5621,7 +6393,7 @@ function useCellRendering(param) {
|
|
|
5621
6393
|
rowStyle,
|
|
5622
6394
|
rowClassName
|
|
5623
6395
|
};
|
|
5624
|
-
return /* @__PURE__ */
|
|
6396
|
+
return /* @__PURE__ */ import_react32.default.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
|
|
5625
6397
|
}, [
|
|
5626
6398
|
rowHeight,
|
|
5627
6399
|
getData,
|
|
@@ -5639,13 +6411,13 @@ function useCellRendering(param) {
|
|
|
5639
6411
|
}
|
|
5640
6412
|
|
|
5641
6413
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
5642
|
-
var
|
|
6414
|
+
var import_react46 = __toModule(require("react"));
|
|
5643
6415
|
|
|
5644
6416
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
5645
|
-
var
|
|
6417
|
+
var import_react34 = __toModule(require("react"));
|
|
5646
6418
|
|
|
5647
6419
|
// src/components/hooks/useInterceptedMap.ts
|
|
5648
|
-
var
|
|
6420
|
+
var import_react33 = __toModule(require("react"));
|
|
5649
6421
|
function interceptMap(map2, fns) {
|
|
5650
6422
|
const { set, delete: deleteKey, clear } = map2;
|
|
5651
6423
|
if (fns.set) {
|
|
@@ -5733,7 +6505,7 @@ function useColumnGroups() {
|
|
|
5733
6505
|
componentActions,
|
|
5734
6506
|
getComponentState
|
|
5735
6507
|
} = useComponentState();
|
|
5736
|
-
(0,
|
|
6508
|
+
(0, import_react34.useEffect)(() => {
|
|
5737
6509
|
const recompute = () => {
|
|
5738
6510
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
5739
6511
|
};
|
|
@@ -5744,7 +6516,7 @@ function useColumnGroups() {
|
|
|
5744
6516
|
set: update
|
|
5745
6517
|
});
|
|
5746
6518
|
}, [computedColumnGroups]);
|
|
5747
|
-
(0,
|
|
6519
|
+
(0, import_react34.useEffect)(() => {
|
|
5748
6520
|
return interceptMap(collapsedColumnGroups, {
|
|
5749
6521
|
set: (key, visibleCol) => {
|
|
5750
6522
|
const colIds = key.slice(1);
|
|
@@ -5779,10 +6551,10 @@ function useColumnGroups() {
|
|
|
5779
6551
|
}
|
|
5780
6552
|
|
|
5781
6553
|
// src/components/InfiniteTable/hooks/useColumnRowspan.ts
|
|
5782
|
-
var
|
|
6554
|
+
var import_react35 = __toModule(require("react"));
|
|
5783
6555
|
function useColumnRowspan(computedVisibleColumns) {
|
|
5784
6556
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
5785
|
-
const rowspan = (0,
|
|
6557
|
+
const rowspan = (0, import_react35.useMemo)(() => {
|
|
5786
6558
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
5787
6559
|
return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
|
|
5788
6560
|
const dataArray = getDataSourceState().dataArray;
|
|
@@ -5808,10 +6580,10 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
5808
6580
|
}
|
|
5809
6581
|
|
|
5810
6582
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
5811
|
-
var
|
|
6583
|
+
var import_react36 = __toModule(require("react"));
|
|
5812
6584
|
var debug4 = dbg("useColumnSizeFn");
|
|
5813
6585
|
function useColumnSizeFn(columns) {
|
|
5814
|
-
const columnSize = (0,
|
|
6586
|
+
const columnSize = (0, import_react36.useCallback)((index) => {
|
|
5815
6587
|
const column = columns[index];
|
|
5816
6588
|
if (false) {
|
|
5817
6589
|
debug4("cannot find column at index", index, columns);
|
|
@@ -5822,15 +6594,10 @@ function useColumnSizeFn(columns) {
|
|
|
5822
6594
|
}
|
|
5823
6595
|
|
|
5824
6596
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
5825
|
-
var
|
|
6597
|
+
var import_react42 = __toModule(require("react"));
|
|
5826
6598
|
|
|
5827
6599
|
// 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
|
-
}
|
|
6600
|
+
var React34 = __toModule(require("react"));
|
|
5834
6601
|
|
|
5835
6602
|
// src/components/DataSource/state/rowInfoStatus.ts
|
|
5836
6603
|
var showLoadingIcon = (rowInfo) => {
|
|
@@ -5841,19 +6608,19 @@ var showLoadingIcon = (rowInfo) => {
|
|
|
5841
6608
|
};
|
|
5842
6609
|
|
|
5843
6610
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5844
|
-
var
|
|
5845
|
-
var
|
|
6611
|
+
var React32 = __toModule(require("react"));
|
|
6612
|
+
var import_react37 = __toModule(require("react"));
|
|
5846
6613
|
|
|
5847
6614
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
5848
|
-
var
|
|
5849
|
-
var ExpanderIconCls = "_16lm1iw6
|
|
5850
|
-
var ExpanderIconClsVariants = (0,
|
|
6615
|
+
var import_createRuntimeFn6 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
6616
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwh _16lm1iwd";
|
|
6617
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn6.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5851
6618
|
|
|
5852
6619
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5853
6620
|
function ExpanderIcon(props) {
|
|
5854
6621
|
var _a;
|
|
5855
6622
|
const { size = 24 } = props;
|
|
5856
|
-
const [expanded, setExpanded] = (0,
|
|
6623
|
+
const [expanded, setExpanded] = (0, import_react37.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
5857
6624
|
const onClick = () => {
|
|
5858
6625
|
var _a2;
|
|
5859
6626
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
@@ -5861,12 +6628,12 @@ function ExpanderIcon(props) {
|
|
|
5861
6628
|
setExpanded(!expanded);
|
|
5862
6629
|
}
|
|
5863
6630
|
};
|
|
5864
|
-
|
|
6631
|
+
React32.useEffect(() => {
|
|
5865
6632
|
if (isControlled("expanded", props)) {
|
|
5866
6633
|
setExpanded(props.expanded);
|
|
5867
6634
|
}
|
|
5868
6635
|
}, [props.expanded]);
|
|
5869
|
-
return /* @__PURE__ */
|
|
6636
|
+
return /* @__PURE__ */ React32.createElement("svg", {
|
|
5870
6637
|
"data-name": "expander-icon",
|
|
5871
6638
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5872
6639
|
height: `${size}px`,
|
|
@@ -5877,20 +6644,20 @@ function ExpanderIcon(props) {
|
|
|
5877
6644
|
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
5878
6645
|
expanded
|
|
5879
6646
|
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
5880
|
-
}, /* @__PURE__ */
|
|
6647
|
+
}, /* @__PURE__ */ React32.createElement("path", {
|
|
5881
6648
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
5882
6649
|
}));
|
|
5883
6650
|
}
|
|
5884
6651
|
|
|
5885
6652
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5886
|
-
var
|
|
6653
|
+
var React33 = __toModule(require("react"));
|
|
5887
6654
|
|
|
5888
6655
|
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
5889
|
-
var LoadingIconCls = "_16lm1iw8
|
|
6656
|
+
var LoadingIconCls = "_16lm1iw8 _16lm1iwh _16lm1iwd";
|
|
5890
6657
|
|
|
5891
6658
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5892
6659
|
var LoadingIcon = (props) => {
|
|
5893
|
-
return /* @__PURE__ */
|
|
6660
|
+
return /* @__PURE__ */ React33.createElement("svg", {
|
|
5894
6661
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5895
6662
|
style: {
|
|
5896
6663
|
margin: "auto",
|
|
@@ -5902,14 +6669,14 @@ var LoadingIcon = (props) => {
|
|
|
5902
6669
|
viewBox: "0 0 100 100",
|
|
5903
6670
|
preserveAspectRatio: "xMidYMid",
|
|
5904
6671
|
className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
|
|
5905
|
-
}, /* @__PURE__ */
|
|
6672
|
+
}, /* @__PURE__ */ React33.createElement("circle", {
|
|
5906
6673
|
cx: "50",
|
|
5907
6674
|
cy: "50",
|
|
5908
6675
|
fill: "none",
|
|
5909
6676
|
strokeWidth: "10",
|
|
5910
6677
|
r: "35",
|
|
5911
6678
|
strokeDasharray: "164.93361431346415 56.97787143782138"
|
|
5912
|
-
}, /* @__PURE__ */
|
|
6679
|
+
}, /* @__PURE__ */ React33.createElement("animateTransform", {
|
|
5913
6680
|
attributeName: "transform",
|
|
5914
6681
|
type: "rotate",
|
|
5915
6682
|
repeatCount: "indefinite",
|
|
@@ -5929,7 +6696,7 @@ function getGroupColumnRender({
|
|
|
5929
6696
|
var _a, _b, _c;
|
|
5930
6697
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5931
6698
|
if (column.renderValue) {
|
|
5932
|
-
value = /* @__PURE__ */
|
|
6699
|
+
value = /* @__PURE__ */ React34.createElement(RenderHookComponent, {
|
|
5933
6700
|
render: column.renderValue,
|
|
5934
6701
|
renderParam: renderOptions
|
|
5935
6702
|
});
|
|
@@ -5959,22 +6726,22 @@ function getGroupColumnRender({
|
|
|
5959
6726
|
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
6727
|
const isLoading = showLoadingIcon(groupRowInfo);
|
|
5961
6728
|
if (isLoading) {
|
|
5962
|
-
icon = /* @__PURE__ */
|
|
6729
|
+
icon = /* @__PURE__ */ React34.createElement(LoadingIcon, null);
|
|
5963
6730
|
} else if (showExpanderIcon) {
|
|
5964
|
-
const defaultIcon = /* @__PURE__ */
|
|
6731
|
+
const defaultIcon = /* @__PURE__ */ React34.createElement(ExpanderIcon, {
|
|
5965
6732
|
expanded: !collapsed,
|
|
5966
6733
|
onChange: () => {
|
|
5967
6734
|
toggleGroupRow(groupKeys);
|
|
5968
6735
|
}
|
|
5969
6736
|
});
|
|
5970
|
-
icon = column.renderGroupIcon ? /* @__PURE__ */
|
|
6737
|
+
icon = column.renderGroupIcon ? /* @__PURE__ */ React34.createElement(RenderHookComponent, {
|
|
5971
6738
|
render: column.renderGroupIcon,
|
|
5972
6739
|
renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
|
|
5973
6740
|
}) : defaultIcon;
|
|
5974
6741
|
}
|
|
5975
|
-
return /* @__PURE__ */
|
|
6742
|
+
return /* @__PURE__ */ React34.createElement("div", {
|
|
5976
6743
|
className: join(display.flex, alignItems.center)
|
|
5977
|
-
}, icon, /* @__PURE__ */
|
|
6744
|
+
}, icon, /* @__PURE__ */ React34.createElement("div", {
|
|
5978
6745
|
className: cssEllipsisClassName
|
|
5979
6746
|
}, value != null ? value : null));
|
|
5980
6747
|
};
|
|
@@ -6019,9 +6786,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
6019
6786
|
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
6787
|
const isLoading = showLoadingIcon(rowInfo);
|
|
6021
6788
|
if (isLoading) {
|
|
6022
|
-
icon = /* @__PURE__ */
|
|
6789
|
+
icon = /* @__PURE__ */ React34.createElement(LoadingIcon, null);
|
|
6023
6790
|
} else if (showExpanderIcon) {
|
|
6024
|
-
const defaultIcon = /* @__PURE__ */
|
|
6791
|
+
const defaultIcon = /* @__PURE__ */ React34.createElement(ExpanderIcon, {
|
|
6025
6792
|
expanded: !collapsed,
|
|
6026
6793
|
onChange: () => {
|
|
6027
6794
|
if (!rowInfo.isGroupRow) {
|
|
@@ -6036,9 +6803,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
6036
6803
|
icon = column.renderGroupIcon(renderParam);
|
|
6037
6804
|
}
|
|
6038
6805
|
}
|
|
6039
|
-
return /* @__PURE__ */
|
|
6806
|
+
return /* @__PURE__ */ React34.createElement("div", {
|
|
6040
6807
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
6041
|
-
}, icon, /* @__PURE__ */
|
|
6808
|
+
}, icon, /* @__PURE__ */ React34.createElement("div", {
|
|
6042
6809
|
className: cssEllipsisClassName
|
|
6043
6810
|
}, value != null ? value : null));
|
|
6044
6811
|
}
|
|
@@ -6054,11 +6821,11 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
6054
6821
|
}
|
|
6055
6822
|
|
|
6056
6823
|
// src/components/InfiniteTable/hooks/useEffectWithRaf.ts
|
|
6057
|
-
var
|
|
6824
|
+
var import_react38 = __toModule(require("react"));
|
|
6058
6825
|
function useEffectWithRaf(fn, deps) {
|
|
6059
|
-
const rafId = (0,
|
|
6060
|
-
const removeFnRaf = (0,
|
|
6061
|
-
(0,
|
|
6826
|
+
const rafId = (0, import_react38.useRef)(0);
|
|
6827
|
+
const removeFnRaf = (0, import_react38.useRef)();
|
|
6828
|
+
(0, import_react38.useEffect)(() => {
|
|
6062
6829
|
rafId.current = requestAnimationFrame(() => {
|
|
6063
6830
|
removeFnRaf.current = fn();
|
|
6064
6831
|
});
|
|
@@ -6075,7 +6842,7 @@ function useEffectWithRaf(fn, deps) {
|
|
|
6075
6842
|
}
|
|
6076
6843
|
|
|
6077
6844
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
6078
|
-
var
|
|
6845
|
+
var import_react41 = __toModule(require("react"));
|
|
6079
6846
|
|
|
6080
6847
|
// src/utils/groupAndPivot/index.ts
|
|
6081
6848
|
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
@@ -6528,7 +7295,7 @@ function enhancedFlatten(param) {
|
|
|
6528
7295
|
}
|
|
6529
7296
|
|
|
6530
7297
|
// src/components/DataSource/index.tsx
|
|
6531
|
-
var
|
|
7298
|
+
var React35 = __toModule(require("react"));
|
|
6532
7299
|
|
|
6533
7300
|
// src/utils/multisort/sortTypes.ts
|
|
6534
7301
|
var numberComparator = function(first, second) {
|
|
@@ -6716,15 +7483,15 @@ var GroupRowsState = class {
|
|
|
6716
7483
|
};
|
|
6717
7484
|
|
|
6718
7485
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
6719
|
-
var
|
|
7486
|
+
var import_react40 = __toModule(require("react"));
|
|
6720
7487
|
|
|
6721
7488
|
// src/components/hooks/useEffectWithChanges.ts
|
|
6722
|
-
var
|
|
7489
|
+
var import_react39 = __toModule(require("react"));
|
|
6723
7490
|
function useEffectWithChanges(fn, deps) {
|
|
6724
|
-
const prevRef = (0,
|
|
6725
|
-
const oldValuesRef = (0,
|
|
7491
|
+
const prevRef = (0, import_react39.useRef)({});
|
|
7492
|
+
const oldValuesRef = (0, import_react39.useRef)({});
|
|
6726
7493
|
const oldValues = oldValuesRef.current;
|
|
6727
|
-
const changesRef = (0,
|
|
7494
|
+
const changesRef = (0, import_react39.useRef)({});
|
|
6728
7495
|
const changes = changesRef.current;
|
|
6729
7496
|
const useEffectDeps = [];
|
|
6730
7497
|
for (const k in deps) {
|
|
@@ -6737,7 +7504,7 @@ function useEffectWithChanges(fn, deps) {
|
|
|
6737
7504
|
}
|
|
6738
7505
|
}
|
|
6739
7506
|
prevRef.current = deps;
|
|
6740
|
-
(0,
|
|
7507
|
+
(0, import_react39.useEffect)(() => {
|
|
6741
7508
|
const changes2 = changesRef.current;
|
|
6742
7509
|
const result = fn(changes2, oldValues);
|
|
6743
7510
|
changesRef.current = {};
|
|
@@ -7005,12 +7772,12 @@ function useLoadData() {
|
|
|
7005
7772
|
livePaginationCursor,
|
|
7006
7773
|
cursorId: stateCursorId
|
|
7007
7774
|
} = componentState;
|
|
7008
|
-
const [scrollbars, setScrollbars] = (0,
|
|
7775
|
+
const [scrollbars, setScrollbars] = (0, import_react40.useState)({
|
|
7009
7776
|
vertical: false,
|
|
7010
7777
|
horizontal: false
|
|
7011
7778
|
});
|
|
7012
|
-
const scrollbarsRef = (0,
|
|
7013
|
-
(0,
|
|
7779
|
+
const scrollbarsRef = (0, import_react40.useRef)(scrollbars);
|
|
7780
|
+
(0, import_react40.useEffect)(() => {
|
|
7014
7781
|
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
7015
7782
|
if (!scrollbars2) {
|
|
7016
7783
|
return;
|
|
@@ -7020,7 +7787,7 @@ function useLoadData() {
|
|
|
7020
7787
|
});
|
|
7021
7788
|
return () => notifyScrollbarsChange.destroy();
|
|
7022
7789
|
}, [notifyScrollbarsChange]);
|
|
7023
|
-
(0,
|
|
7790
|
+
(0, import_react40.useEffect)(() => {
|
|
7024
7791
|
if (!livePagination) {
|
|
7025
7792
|
return;
|
|
7026
7793
|
}
|
|
@@ -7034,7 +7801,7 @@ function useLoadData() {
|
|
|
7034
7801
|
});
|
|
7035
7802
|
return () => cancelAnimationFrame(frameId);
|
|
7036
7803
|
}, [livePaginationCursor]);
|
|
7037
|
-
(0,
|
|
7804
|
+
(0, import_react40.useEffect)(() => {
|
|
7038
7805
|
if (!livePagination || livePaginationCursor !== void 0) {
|
|
7039
7806
|
return;
|
|
7040
7807
|
}
|
|
@@ -7048,7 +7815,7 @@ function useLoadData() {
|
|
|
7048
7815
|
});
|
|
7049
7816
|
return () => cancelAnimationFrame(frameId);
|
|
7050
7817
|
}, [dataArray.length, livePaginationCursor]);
|
|
7051
|
-
(0,
|
|
7818
|
+
(0, import_react40.useEffect)(() => {
|
|
7052
7819
|
const state = getComponentState();
|
|
7053
7820
|
const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2, dataArray: dataArray2 } = state;
|
|
7054
7821
|
if (!scrollbars.vertical && livePagination2) {
|
|
@@ -7066,7 +7833,7 @@ function useLoadData() {
|
|
|
7066
7833
|
filterValue,
|
|
7067
7834
|
cursorId: livePagination ? stateCursorId : null
|
|
7068
7835
|
};
|
|
7069
|
-
const initialRef = (0,
|
|
7836
|
+
const initialRef = (0, import_react40.useRef)(true);
|
|
7070
7837
|
useLazyLoadRange();
|
|
7071
7838
|
useEffectWithChanges(() => {
|
|
7072
7839
|
const componentState2 = getComponentState();
|
|
@@ -7098,7 +7865,7 @@ function useLazyLoadRange() {
|
|
|
7098
7865
|
componentActions: actions,
|
|
7099
7866
|
componentState
|
|
7100
7867
|
} = useComponentState();
|
|
7101
|
-
(0,
|
|
7868
|
+
(0, import_react40.useEffect)(() => {
|
|
7102
7869
|
actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
|
|
7103
7870
|
}, [componentState.data, componentState.dataParams]);
|
|
7104
7871
|
const {
|
|
@@ -7107,7 +7874,7 @@ function useLazyLoadRange() {
|
|
|
7107
7874
|
dataArray,
|
|
7108
7875
|
scrollStopDelayUpdatedByTable
|
|
7109
7876
|
} = componentState;
|
|
7110
|
-
const latestRenderRangeRef = (0,
|
|
7877
|
+
const latestRenderRangeRef = (0, import_react40.useRef)(null);
|
|
7111
7878
|
const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
|
|
7112
7879
|
const componentState2 = getComponentState();
|
|
7113
7880
|
renderRange = renderRange || latestRenderRangeRef.current;
|
|
@@ -7126,8 +7893,8 @@ function useLazyLoadRange() {
|
|
|
7126
7893
|
componentActions: actions
|
|
7127
7894
|
}, cache);
|
|
7128
7895
|
};
|
|
7129
|
-
const debouncedLoadRange = (0,
|
|
7130
|
-
(0,
|
|
7896
|
+
const debouncedLoadRange = (0, import_react40.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
7897
|
+
(0, import_react40.useEffect)(() => {
|
|
7131
7898
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
7132
7899
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
7133
7900
|
latestRenderRangeRef.current = renderRange;
|
|
@@ -7136,7 +7903,7 @@ function useLazyLoadRange() {
|
|
|
7136
7903
|
}
|
|
7137
7904
|
return;
|
|
7138
7905
|
}, [lazyLoadBatchSize]);
|
|
7139
|
-
(0,
|
|
7906
|
+
(0, import_react40.useEffect)(() => {
|
|
7140
7907
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
7141
7908
|
debouncedLoadRange();
|
|
7142
7909
|
}
|
|
@@ -7939,7 +8706,7 @@ function DataSourceWithContext(props) {
|
|
|
7939
8706
|
if (typeof children === "function") {
|
|
7940
8707
|
children = children(computedValues);
|
|
7941
8708
|
}
|
|
7942
|
-
return /* @__PURE__ */
|
|
8709
|
+
return /* @__PURE__ */ React35.createElement(React35.Fragment, null, children);
|
|
7943
8710
|
}
|
|
7944
8711
|
var DataSourceRoot = getComponentStateRoot({
|
|
7945
8712
|
initSetupState,
|
|
@@ -7962,14 +8729,14 @@ function DataSourceCmp({ children }) {
|
|
|
7962
8729
|
globalThis.getDataSourceState = getState;
|
|
7963
8730
|
}
|
|
7964
8731
|
useLoadData();
|
|
7965
|
-
return /* @__PURE__ */
|
|
8732
|
+
return /* @__PURE__ */ React35.createElement(DataSourceContext.Provider, {
|
|
7966
8733
|
value: contextValue
|
|
7967
|
-
}, /* @__PURE__ */
|
|
8734
|
+
}, /* @__PURE__ */ React35.createElement(DataSourceWithContext, {
|
|
7968
8735
|
children
|
|
7969
8736
|
}));
|
|
7970
8737
|
}
|
|
7971
8738
|
function DataSource(props) {
|
|
7972
|
-
return /* @__PURE__ */
|
|
8739
|
+
return /* @__PURE__ */ React35.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React35.createElement(DataSourceCmp, {
|
|
7973
8740
|
children: props.children
|
|
7974
8741
|
}));
|
|
7975
8742
|
}
|
|
@@ -7977,7 +8744,7 @@ function DataSource(props) {
|
|
|
7977
8744
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
7978
8745
|
function useToggleGroupRow() {
|
|
7979
8746
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
7980
|
-
const toggleGroupRow = (0,
|
|
8747
|
+
const toggleGroupRow = (0, import_react41.useCallback)((groupKeys) => {
|
|
7981
8748
|
const state = getDataSourceState();
|
|
7982
8749
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
7983
8750
|
newState.toggleGroupRow(groupKeys);
|
|
@@ -8009,7 +8776,7 @@ function useToggleGroupRow() {
|
|
|
8009
8776
|
|
|
8010
8777
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
8011
8778
|
function useGroupByMap(groupBy) {
|
|
8012
|
-
const groupByMap = (0,
|
|
8779
|
+
const groupByMap = (0, import_react42.useMemo)(() => {
|
|
8013
8780
|
return groupBy.reduce((acc, groupBy2, index) => {
|
|
8014
8781
|
acc.set(groupBy2.field, {
|
|
8015
8782
|
groupBy: groupBy2,
|
|
@@ -8033,13 +8800,13 @@ function useColumnsWhen() {
|
|
|
8033
8800
|
}
|
|
8034
8801
|
} = useComponentState();
|
|
8035
8802
|
const groupByMap = useGroupByMap(groupBy);
|
|
8036
|
-
(0,
|
|
8803
|
+
(0, import_react42.useEffect)(() => {
|
|
8037
8804
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
8038
8805
|
}, [groupRenderStrategy]);
|
|
8039
|
-
(0,
|
|
8806
|
+
(0, import_react42.useEffect)(() => {
|
|
8040
8807
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
8041
8808
|
}, [pivotTotalColumnPosition]);
|
|
8042
|
-
(0,
|
|
8809
|
+
(0, import_react42.useEffect)(() => {
|
|
8043
8810
|
if (pivotGrandTotalColumnPosition != void 0) {
|
|
8044
8811
|
dataSourceActions.pivotGrandTotalColumnPosition = pivotGrandTotalColumnPosition;
|
|
8045
8812
|
}
|
|
@@ -8113,7 +8880,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
8113
8880
|
});
|
|
8114
8881
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
8115
8882
|
}
|
|
8116
|
-
(0,
|
|
8883
|
+
(0, import_react42.useEffect)(() => {
|
|
8117
8884
|
const update = () => {
|
|
8118
8885
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
8119
8886
|
};
|
|
@@ -8142,7 +8909,7 @@ function useColumnsWhenGrouping() {
|
|
|
8142
8909
|
}
|
|
8143
8910
|
} = useComponentState();
|
|
8144
8911
|
const toggleGroupRow = useToggleGroupRow();
|
|
8145
|
-
(0,
|
|
8912
|
+
(0, import_react42.useEffect)(() => {
|
|
8146
8913
|
const update = () => {
|
|
8147
8914
|
const columnsWhenGrouping = getColumnsWhenGrouping({
|
|
8148
8915
|
columns,
|
|
@@ -8278,7 +9045,7 @@ function useHideColumns(groupByMap) {
|
|
|
8278
9045
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
8279
9046
|
hideEmptyGroupColumns
|
|
8280
9047
|
]);
|
|
8281
|
-
(0,
|
|
9048
|
+
(0, import_react42.useEffect)(() => {
|
|
8282
9049
|
const isGrouped = groupBy.length > 0;
|
|
8283
9050
|
const currentState = getComponentState();
|
|
8284
9051
|
const { controlledColumnVisibility, columnVisibility } = currentState;
|
|
@@ -8393,145 +9160,7 @@ function getColumnsWhenGrouping(params) {
|
|
|
8393
9160
|
}
|
|
8394
9161
|
|
|
8395
9162
|
// 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
|
-
};
|
|
9163
|
+
var import_react44 = __toModule(require("react"));
|
|
8535
9164
|
|
|
8536
9165
|
// src/components/InfiniteTable/utils/adjustColumnOrderForPinning.ts
|
|
8537
9166
|
var order = ["start", void 0, "end"];
|
|
@@ -8725,8 +9354,8 @@ var getComputedVisibleColumns = ({
|
|
|
8725
9354
|
const computedSortIndex = (_c = sortingInfo == null ? void 0 : sortingInfo.index) != null ? _c : -1;
|
|
8726
9355
|
const computedWidth = computedSizes[i];
|
|
8727
9356
|
const computedFlex = flexSizes[i] || null;
|
|
8728
|
-
const computedMinWidth = minSizes[i] ||
|
|
8729
|
-
const computedMaxWidth = maxSizes[i] ||
|
|
9357
|
+
const computedMinWidth = minSizes[i] || 0;
|
|
9358
|
+
const computedMaxWidth = maxSizes[i] || 1e4;
|
|
8730
9359
|
const computedPinned = getComputedPinned(id, columnPinning);
|
|
8731
9360
|
const computedLast = i === visibleColumnOrder.length - 1;
|
|
8732
9361
|
const computedPinningOffset = computedPinned === "start" ? computedPinnedStartColumnsWidth : computedPinned === "end" ? computedPinnedEndColumnsWidth : computedOffset - computedPinnedStartColumnsWidth;
|
|
@@ -8879,10 +9508,10 @@ var getComputedVisibleColumns = ({
|
|
|
8879
9508
|
};
|
|
8880
9509
|
|
|
8881
9510
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
8882
|
-
var
|
|
9511
|
+
var import_react43 = __toModule(require("react"));
|
|
8883
9512
|
var useRerenderOnKeyChange = (map2) => {
|
|
8884
9513
|
const [renderId, rerender] = useRerender();
|
|
8885
|
-
(0,
|
|
9514
|
+
(0, import_react43.useEffect)(() => {
|
|
8886
9515
|
const update = rafFn(rerender);
|
|
8887
9516
|
return interceptMap(map2, {
|
|
8888
9517
|
set: update,
|
|
@@ -8936,7 +9565,7 @@ var useComputedVisibleColumns = ({
|
|
|
8936
9565
|
computedPinnedEndOffset,
|
|
8937
9566
|
computedPinnedEndWidth,
|
|
8938
9567
|
computedPinnedStartWidth
|
|
8939
|
-
} = (0,
|
|
9568
|
+
} = (0, import_react44.useMemo)(() => {
|
|
8940
9569
|
return getComputedVisibleColumns({
|
|
8941
9570
|
columns,
|
|
8942
9571
|
bodySize,
|
|
@@ -8968,6 +9597,7 @@ var useComputedVisibleColumns = ({
|
|
|
8968
9597
|
columnMinWidth,
|
|
8969
9598
|
columnMaxWidth,
|
|
8970
9599
|
columnDefaultWidth,
|
|
9600
|
+
viewportReservedWidth,
|
|
8971
9601
|
sortable,
|
|
8972
9602
|
sortInfo,
|
|
8973
9603
|
setSortInfo,
|
|
@@ -9005,7 +9635,7 @@ var useComputedVisibleColumns = ({
|
|
|
9005
9635
|
};
|
|
9006
9636
|
|
|
9007
9637
|
// src/components/InfiniteTable/hooks/useScrollbars.ts
|
|
9008
|
-
var
|
|
9638
|
+
var import_react45 = __toModule(require("react"));
|
|
9009
9639
|
var INITIAL_SCROLLBARS = {
|
|
9010
9640
|
vertical: false,
|
|
9011
9641
|
horizontal: false
|
|
@@ -9013,8 +9643,8 @@ var INITIAL_SCROLLBARS = {
|
|
|
9013
9643
|
function useScrollbars(brain) {
|
|
9014
9644
|
const { getComponentState: getInfiniteTableState } = useComponentState();
|
|
9015
9645
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
9016
|
-
const [scrollbars, setScrollbars] = (0,
|
|
9017
|
-
(0,
|
|
9646
|
+
const [scrollbars, setScrollbars] = (0, import_react45.useState)(INITIAL_SCROLLBARS);
|
|
9647
|
+
(0, import_react45.useEffect)(() => {
|
|
9018
9648
|
return brain.onRenderCountChange(() => {
|
|
9019
9649
|
const { scrollTopMax, scrollLeftMax } = brain;
|
|
9020
9650
|
setScrollbars({
|
|
@@ -9023,7 +9653,7 @@ function useScrollbars(brain) {
|
|
|
9023
9653
|
});
|
|
9024
9654
|
});
|
|
9025
9655
|
}, [brain]);
|
|
9026
|
-
(0,
|
|
9656
|
+
(0, import_react45.useLayoutEffect)(() => {
|
|
9027
9657
|
const dataSourceState = getDataSourceState();
|
|
9028
9658
|
const { onScrollbarsChange } = getInfiniteTableState();
|
|
9029
9659
|
const { notifyScrollbarsChange } = dataSourceState;
|
|
@@ -9054,7 +9684,7 @@ function useComputed() {
|
|
|
9054
9684
|
bodySize,
|
|
9055
9685
|
showSeparatePivotColumnForSingleAggregation
|
|
9056
9686
|
} = componentState;
|
|
9057
|
-
(0,
|
|
9687
|
+
(0, import_react46.useState)(() => {
|
|
9058
9688
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
9059
9689
|
if (rowHeight) {
|
|
9060
9690
|
componentActions.rowHeight = rowHeight;
|
|
@@ -9066,13 +9696,13 @@ function useComputed() {
|
|
|
9066
9696
|
}
|
|
9067
9697
|
});
|
|
9068
9698
|
});
|
|
9069
|
-
(0,
|
|
9699
|
+
(0, import_react46.useEffect)(() => {
|
|
9070
9700
|
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
9071
9701
|
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
9072
9702
|
const { multiSort, filterValue } = dataSourceState;
|
|
9073
9703
|
useColumnGroups();
|
|
9074
9704
|
const { toggleGroupRow } = useColumnsWhen();
|
|
9075
|
-
const setSortInfo = (0,
|
|
9705
|
+
const setSortInfo = (0, import_react46.useCallback)((sortInfo) => {
|
|
9076
9706
|
var _a2;
|
|
9077
9707
|
const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
9078
9708
|
dataSourceActions.sortInfo = newSortInfo;
|
|
@@ -9150,6 +9780,10 @@ function useComputed() {
|
|
|
9150
9780
|
}
|
|
9151
9781
|
|
|
9152
9782
|
// src/components/InfiniteTable/hooks/useDOMProps.ts
|
|
9783
|
+
var columnWidthAtIndex4 = stripVar(InternalVars.columnWidthAtIndex);
|
|
9784
|
+
var columnOffsetAtIndex2 = stripVar(InternalVars.columnOffsetAtIndex);
|
|
9785
|
+
var activeCellColWidth = stripVar(InternalVars.activeCellColWidth);
|
|
9786
|
+
var activeCellColOffset = stripVar(InternalVars.activeCellColOffset);
|
|
9153
9787
|
function useDOMProps(initialDOMProps) {
|
|
9154
9788
|
const { computed, componentState, componentActions } = useInfiniteTable();
|
|
9155
9789
|
const {
|
|
@@ -9160,9 +9794,24 @@ function useDOMProps(initialDOMProps) {
|
|
|
9160
9794
|
onBlurWithin,
|
|
9161
9795
|
onFocusWithin,
|
|
9162
9796
|
onSelfFocus,
|
|
9163
|
-
onSelfBlur
|
|
9797
|
+
onSelfBlur,
|
|
9798
|
+
activeCellIndex
|
|
9164
9799
|
} = componentState;
|
|
9165
|
-
const {
|
|
9800
|
+
const {
|
|
9801
|
+
computedPinnedStartColumnsWidth,
|
|
9802
|
+
computedPinnedEndColumnsWidth,
|
|
9803
|
+
computedVisibleColumns
|
|
9804
|
+
} = computed;
|
|
9805
|
+
const cssVars = computedVisibleColumns.reduce((vars, col) => {
|
|
9806
|
+
const index = col.computedVisibleIndex;
|
|
9807
|
+
vars[`${columnWidthAtIndex4}-${index}`] = col.computedWidth + "px";
|
|
9808
|
+
vars[`${columnOffsetAtIndex2}-${index}`] = col.computedOffset + "px";
|
|
9809
|
+
return vars;
|
|
9810
|
+
}, {});
|
|
9811
|
+
if (activeCellIndex != null) {
|
|
9812
|
+
cssVars[activeCellColWidth] = `var(${getCSSVarNameForColWidth(activeCellIndex[1])})`;
|
|
9813
|
+
cssVars[activeCellColOffset] = `var(${getCSSVarNameForColOffset(activeCellIndex[1])})`;
|
|
9814
|
+
}
|
|
9166
9815
|
const setFocused = rafFn((focused2) => {
|
|
9167
9816
|
componentActions.focused = focused2;
|
|
9168
9817
|
});
|
|
@@ -9217,7 +9866,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
9217
9866
|
focusedWithin
|
|
9218
9867
|
}));
|
|
9219
9868
|
domProps.className = className;
|
|
9220
|
-
domProps.style = __spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style);
|
|
9869
|
+
domProps.style = __spreadValues(__spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style), cssVars);
|
|
9221
9870
|
if (focused) {
|
|
9222
9871
|
if (componentState.focusedStyle) {
|
|
9223
9872
|
Object.assign(domProps.style, componentState.focusedStyle);
|
|
@@ -9232,7 +9881,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
9232
9881
|
}
|
|
9233
9882
|
|
|
9234
9883
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
9235
|
-
var
|
|
9884
|
+
var import_react47 = __toModule(require("react"));
|
|
9236
9885
|
|
|
9237
9886
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
9238
9887
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -9390,10 +10039,10 @@ var isInsideSandbox = () => {
|
|
|
9390
10039
|
};
|
|
9391
10040
|
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
9392
10041
|
var useLicense = (licenseKey = "") => {
|
|
9393
|
-
const valid = (0,
|
|
10042
|
+
const valid = (0, import_react47.useMemo)(() => {
|
|
9394
10043
|
let valid2 = isValidLicense(licenseKey, {
|
|
9395
10044
|
publishedAt: 1624970570587,
|
|
9396
|
-
version: "0.3.
|
|
10045
|
+
version: "0.3.13"
|
|
9397
10046
|
});
|
|
9398
10047
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
9399
10048
|
return true;
|
|
@@ -9524,10 +10173,23 @@ function handleCellNavigation(options) {
|
|
|
9524
10173
|
actions.activeCellIndex = [rowIndex, colIndex];
|
|
9525
10174
|
return true;
|
|
9526
10175
|
}
|
|
10176
|
+
var validKeys = {
|
|
10177
|
+
ArrowUp: true,
|
|
10178
|
+
ArrowDown: true,
|
|
10179
|
+
ArrowLeft: true,
|
|
10180
|
+
ArrowRight: true,
|
|
10181
|
+
PageUp: true,
|
|
10182
|
+
PageDown: true,
|
|
10183
|
+
Home: true,
|
|
10184
|
+
End: true
|
|
10185
|
+
};
|
|
9527
10186
|
function handleKeyboardNavigation(options) {
|
|
9528
10187
|
const { getState } = options;
|
|
9529
10188
|
const state = getState();
|
|
9530
10189
|
const { activeRowIndex, activeCellIndex, keyboardNavigation } = state;
|
|
10190
|
+
if (!validKeys[options.key]) {
|
|
10191
|
+
return false;
|
|
10192
|
+
}
|
|
9531
10193
|
if (activeRowIndex != null && keyboardNavigation === "row") {
|
|
9532
10194
|
return handleRowNavigation(options);
|
|
9533
10195
|
}
|
|
@@ -9538,7 +10200,7 @@ function handleKeyboardNavigation(options) {
|
|
|
9538
10200
|
}
|
|
9539
10201
|
|
|
9540
10202
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
9541
|
-
var
|
|
10203
|
+
var import_react48 = __toModule(require("react"));
|
|
9542
10204
|
|
|
9543
10205
|
// src/components/VirtualBrain/ScrollListener.ts
|
|
9544
10206
|
var initialScrollPosition = {
|
|
@@ -9618,6 +10280,7 @@ function initSetupState2() {
|
|
|
9618
10280
|
});
|
|
9619
10281
|
if (false) {
|
|
9620
10282
|
globalThis.brain = brain;
|
|
10283
|
+
globalThis.headerBrain = headerBrain;
|
|
9621
10284
|
}
|
|
9622
10285
|
const { renderer, onRenderUpdater } = createRenderer2(brain);
|
|
9623
10286
|
brain.onAvailableSizeChange((size) => {
|
|
@@ -9633,9 +10296,10 @@ function initSetupState2() {
|
|
|
9633
10296
|
brain,
|
|
9634
10297
|
headerBrain,
|
|
9635
10298
|
columnShifts: null,
|
|
9636
|
-
domRef: (0,
|
|
9637
|
-
scrollerDOMRef: (0,
|
|
9638
|
-
portalDOMRef: (0,
|
|
10299
|
+
domRef: (0, import_react48.createRef)(),
|
|
10300
|
+
scrollerDOMRef: (0, import_react48.createRef)(),
|
|
10301
|
+
portalDOMRef: (0, import_react48.createRef)(),
|
|
10302
|
+
activeCellIndicatorDOMRef: (0, import_react48.createRef)(),
|
|
9639
10303
|
onRowHeightCSSVarChange: buildSubscriptionCallback(),
|
|
9640
10304
|
onColumnHeaderHeightCSSVarChange: buildSubscriptionCallback(),
|
|
9641
10305
|
bodySize: {
|
|
@@ -9691,7 +10355,7 @@ var forwardProps3 = (setupState) => {
|
|
|
9691
10355
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
9692
10356
|
resizableColumns: (resizableColumns) => resizableColumns != null ? resizableColumns : true,
|
|
9693
10357
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
9694
|
-
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth :
|
|
10358
|
+
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 5e3,
|
|
9695
10359
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
9696
10360
|
columnCssEllipsis: (columnCssEllipsis) => columnCssEllipsis != null ? columnCssEllipsis : true,
|
|
9697
10361
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
@@ -9794,7 +10458,7 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
9794
10458
|
getParentState: () => useDataSource(),
|
|
9795
10459
|
debugName: "InfiniteTable"
|
|
9796
10460
|
});
|
|
9797
|
-
var InfiniteTableComponent =
|
|
10461
|
+
var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
9798
10462
|
var _a;
|
|
9799
10463
|
const {
|
|
9800
10464
|
componentState,
|
|
@@ -9808,7 +10472,7 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9808
10472
|
getState: getDataSourceState,
|
|
9809
10473
|
componentActions: dataSourceActions
|
|
9810
10474
|
} = useDataSourceContextValue();
|
|
9811
|
-
const [imperativeApi] = (0,
|
|
10475
|
+
const [imperativeApi] = (0, import_react49.useState)(() => {
|
|
9812
10476
|
return getImperativeApi(getState, getComputed, getDataSourceState, actions);
|
|
9813
10477
|
});
|
|
9814
10478
|
const {
|
|
@@ -9832,14 +10496,14 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9832
10496
|
activeCellIndex,
|
|
9833
10497
|
onRenderUpdater
|
|
9834
10498
|
} = componentState;
|
|
9835
|
-
(0,
|
|
10499
|
+
(0, import_react49.useEffect)(() => {
|
|
9836
10500
|
if (activeRowIndex != null) {
|
|
9837
10501
|
imperativeApi.scrollRowIntoView(activeRowIndex, {
|
|
9838
10502
|
offset: 30
|
|
9839
10503
|
});
|
|
9840
10504
|
}
|
|
9841
10505
|
}, [activeRowIndex]);
|
|
9842
|
-
(0,
|
|
10506
|
+
(0, import_react49.useEffect)(() => {
|
|
9843
10507
|
if (activeCellIndex != null) {
|
|
9844
10508
|
imperativeApi.scrollCellIntoView(activeCellIndex[0], activeCellIndex[1], {
|
|
9845
10509
|
offset: 30
|
|
@@ -9856,7 +10520,7 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9856
10520
|
bodySize,
|
|
9857
10521
|
computed
|
|
9858
10522
|
});
|
|
9859
|
-
|
|
10523
|
+
React36.useEffect(() => {
|
|
9860
10524
|
const dataSourceState = getDataSourceState();
|
|
9861
10525
|
const onChange = debounce((renderRange) => {
|
|
9862
10526
|
dataSourceState.notifyRenderRangeChange({
|
|
@@ -9869,12 +10533,12 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9869
10533
|
const licenseValid = useLicense(licenseKey);
|
|
9870
10534
|
const domProps = useDOMProps(componentState.domProps);
|
|
9871
10535
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
9872
|
-
|
|
10536
|
+
React36.useEffect(() => {
|
|
9873
10537
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
9874
10538
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
9875
10539
|
}, [scrollStopDelay]);
|
|
9876
10540
|
useAutoSizeColumns();
|
|
9877
|
-
const onKeyDown = (0,
|
|
10541
|
+
const onKeyDown = (0, import_react49.useCallback)((event) => {
|
|
9878
10542
|
if (handleKeyboardNavigation({
|
|
9879
10543
|
getState,
|
|
9880
10544
|
actions,
|
|
@@ -9886,13 +10550,14 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9886
10550
|
event.preventDefault();
|
|
9887
10551
|
}
|
|
9888
10552
|
}, []);
|
|
9889
|
-
return /* @__PURE__ */
|
|
10553
|
+
return /* @__PURE__ */ React36.createElement("div", __spreadValues({
|
|
9890
10554
|
onKeyDown,
|
|
9891
10555
|
ref: domRef
|
|
9892
|
-
}, domProps), header ? /* @__PURE__ */
|
|
9893
|
-
|
|
10556
|
+
}, domProps), header ? /* @__PURE__ */ React36.createElement(TableHeaderWrapper, {
|
|
10557
|
+
bodyBrain: brain,
|
|
10558
|
+
headerBrain,
|
|
9894
10559
|
scrollbars
|
|
9895
|
-
}) : null, /* @__PURE__ */
|
|
10560
|
+
}) : null, /* @__PURE__ */ React36.createElement(InfiniteTableBody, null, /* @__PURE__ */ React36.createElement(HeadlessTable, {
|
|
9896
10561
|
tabIndex: 0,
|
|
9897
10562
|
activeRowIndex: componentState.ready && keyboardNavigation === "row" ? activeRowIndex : null,
|
|
9898
10563
|
activeCellIndex: componentState.ready && keyboardNavigation === "cell" ? activeCellIndex : null,
|
|
@@ -9903,18 +10568,18 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9903
10568
|
renderCell,
|
|
9904
10569
|
cellHoverClassNames: HOVERED_CLASS_NAMES,
|
|
9905
10570
|
scrollerDOMRef
|
|
9906
|
-
}), /* @__PURE__ */
|
|
10571
|
+
}), /* @__PURE__ */ React36.createElement(LoadMaskCmp, {
|
|
9907
10572
|
visible: loading
|
|
9908
|
-
}, loadingText)), /* @__PURE__ */
|
|
10573
|
+
}, loadingText)), /* @__PURE__ */ React36.createElement("div", {
|
|
9909
10574
|
ref: portalDOMRef,
|
|
9910
10575
|
className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
9911
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
10576
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ React36.createElement(CSSVariableWatch, {
|
|
9912
10577
|
varName: rowHeightCSSVar,
|
|
9913
10578
|
onChange: onRowHeightCSSVarChange
|
|
9914
|
-
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */
|
|
10579
|
+
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ React36.createElement(CSSVariableWatch, {
|
|
9915
10580
|
varName: columnHeaderHeightCSSVar,
|
|
9916
10581
|
onChange: onColumnHeaderHeightCSSVarChange
|
|
9917
|
-
}) : null, /* @__PURE__ */
|
|
10582
|
+
}) : null, /* @__PURE__ */ React36.createElement(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ React36.createElement(InfiniteTableLicenseFooter, null));
|
|
9918
10583
|
});
|
|
9919
10584
|
function InfiniteTableContextProvider() {
|
|
9920
10585
|
const { componentActions, componentState } = useComponentState();
|
|
@@ -9934,33 +10599,34 @@ function InfiniteTableContextProvider() {
|
|
|
9934
10599
|
getState
|
|
9935
10600
|
};
|
|
9936
10601
|
useResizeObserver(scrollerDOMRef, (size) => {
|
|
9937
|
-
var _a, _b;
|
|
9938
10602
|
const bodySize = {
|
|
9939
10603
|
width: size.width,
|
|
9940
10604
|
height: size.height
|
|
9941
10605
|
};
|
|
9942
|
-
bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
|
|
9943
10606
|
componentActions.bodySize = bodySize;
|
|
9944
|
-
}, { earlyAttach: true });
|
|
9945
|
-
|
|
10607
|
+
}, { earlyAttach: true, debounce: 50 });
|
|
10608
|
+
React36.useEffect(() => {
|
|
9946
10609
|
return () => {
|
|
9947
10610
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
9948
10611
|
componentState.onColumnHeaderHeightCSSVarChange.destroy();
|
|
9949
10612
|
};
|
|
9950
10613
|
}, []);
|
|
9951
|
-
|
|
10614
|
+
React36.useEffect(() => {
|
|
9952
10615
|
if (scrollerDOMRef.current) {
|
|
9953
10616
|
scrollerDOMRef.current.scrollTop = 0;
|
|
9954
10617
|
}
|
|
9955
10618
|
}, [scrollTopKey, scrollerDOMRef]);
|
|
9956
10619
|
const TableContext2 = getInfiniteTableContext();
|
|
9957
|
-
return /* @__PURE__ */
|
|
10620
|
+
return /* @__PURE__ */ React36.createElement(TableContext2.Provider, {
|
|
9958
10621
|
value: contextValue
|
|
9959
|
-
}, /* @__PURE__ */
|
|
10622
|
+
}, /* @__PURE__ */ React36.createElement(InfiniteTableComponent, null));
|
|
9960
10623
|
}
|
|
9961
10624
|
function InfiniteTable(props) {
|
|
9962
|
-
const table = /* @__PURE__ */
|
|
9963
|
-
|
|
10625
|
+
const table = /* @__PURE__ */ React36.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React36.createElement(InfiniteTableContextProvider, null));
|
|
10626
|
+
if (false) {
|
|
10627
|
+
return /* @__PURE__ */ React36.createElement(React36.StrictMode, null, table);
|
|
10628
|
+
}
|
|
10629
|
+
return table;
|
|
9964
10630
|
}
|
|
9965
10631
|
InfiniteTable.defaultProps = {
|
|
9966
10632
|
rowHeight: 40,
|