@infinite-table/infinite-react 0.3.11 → 0.3.14
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 +8 -4
- package/index.esm.css +91 -51
- package/index.esm.js +1241 -544
- package/index.js +1285 -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++) {
|
|
@@ -3180,6 +3280,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3180
3280
|
}
|
|
3181
3281
|
};
|
|
3182
3282
|
this.destroy = () => {
|
|
3283
|
+
if (this.destroyed) {
|
|
3284
|
+
return;
|
|
3285
|
+
}
|
|
3183
3286
|
this.destroyed = true;
|
|
3184
3287
|
this.reset();
|
|
3185
3288
|
this.onDestroy();
|
|
@@ -3347,14 +3450,12 @@ var useRerender = () => {
|
|
|
3347
3450
|
];
|
|
3348
3451
|
};
|
|
3349
3452
|
|
|
3350
|
-
// src/components/InfiniteTable/
|
|
3351
|
-
var
|
|
3352
|
-
var
|
|
3353
|
-
rootClassName: rootClassName2
|
|
3354
|
-
};
|
|
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";
|
|
3355
3456
|
|
|
3356
3457
|
// src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
|
|
3357
|
-
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0
|
|
3458
|
+
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwf _16lm1iw3 _16lm1iwu _16lm1iwv _16lm1iwx", hidden: "j26lrx2 j26lrx0 _16lm1iwf _16lm1iw3 _16lm1iwu _16lm1iwv _16lm1iwx" };
|
|
3358
3459
|
|
|
3359
3460
|
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
3360
3461
|
var { rootClassName: rootClassName3 } = internalProps;
|
|
@@ -3391,6 +3492,9 @@ var ActiveRowIndicatorFn = (props) => {
|
|
|
3391
3492
|
};
|
|
3392
3493
|
}, [brain]);
|
|
3393
3494
|
return /* @__PURE__ */ React10.createElement("div", {
|
|
3495
|
+
className: ActiveIndicatorWrapperCls,
|
|
3496
|
+
"data-name": "active-row"
|
|
3497
|
+
}, /* @__PURE__ */ React10.createElement("div", {
|
|
3394
3498
|
ref: domRef,
|
|
3395
3499
|
"data-name": "active-row-indicator",
|
|
3396
3500
|
className: `${baseCls} ${active ? ActiveRowIndicatorCls.visible : ActiveRowIndicatorCls.hidden}`,
|
|
@@ -3398,74 +3502,62 @@ var ActiveRowIndicatorFn = (props) => {
|
|
|
3398
3502
|
transform: `translate3d(0px, ${-brain.getScrollPosition().scrollTop + state.top}px,0)`,
|
|
3399
3503
|
height: state.rowHeight
|
|
3400
3504
|
} : void 0
|
|
3401
|
-
});
|
|
3505
|
+
}));
|
|
3402
3506
|
};
|
|
3403
3507
|
var ActiveRowIndicator = React10.memo(ActiveRowIndicatorFn);
|
|
3404
3508
|
|
|
3405
3509
|
// src/components/InfiniteTable/components/ActiveCellIndicator.tsx
|
|
3406
3510
|
var React11 = __toModule(require("react"));
|
|
3407
3511
|
var import_react10 = __toModule(require("react"));
|
|
3408
|
-
|
|
3409
|
-
// src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
|
|
3410
|
-
var ActiveCellIndicatorCls = { visible: "nxbq1c1 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu", hidden: "nxbq1c2 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu" };
|
|
3411
|
-
|
|
3412
|
-
// src/components/InfiniteTable/components/ActiveCellIndicator.tsx
|
|
3413
3512
|
var { rootClassName: rootClassName4 } = internalProps;
|
|
3414
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
|
+
};
|
|
3415
3521
|
var ActiveCellIndicatorFn = (props) => {
|
|
3416
3522
|
const { brain } = props;
|
|
3417
|
-
const [rerenderId, rerender] = useRerender();
|
|
3418
|
-
const [state, setState] = (0, import_react10.useState)({
|
|
3419
|
-
top: 0,
|
|
3420
|
-
rowHeight: 0,
|
|
3421
|
-
colWidth: 0,
|
|
3422
|
-
left: 0
|
|
3423
|
-
});
|
|
3424
3523
|
const domRef = (0, import_react10.useRef)(null);
|
|
3425
|
-
const stateRef = (0, import_react10.useRef)(state);
|
|
3426
3524
|
const active = props.activeCellIndex != null && brain.getRowCount() > props.activeCellIndex[0];
|
|
3427
3525
|
(0, import_react10.useLayoutEffect)(() => {
|
|
3428
3526
|
if (props.activeCellIndex == null) {
|
|
3429
3527
|
return;
|
|
3430
3528
|
}
|
|
3431
3529
|
const rowIndex = props.activeCellIndex[0];
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
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]);
|
|
3439
3541
|
(0, import_react10.useEffect)(() => {
|
|
3440
|
-
const removeOnSCroll = brain.onScroll((
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
});
|
|
3446
|
-
const removeOnRenderCountChange = brain.onRenderCountChange(() => {
|
|
3447
|
-
rerender();
|
|
3448
|
-
});
|
|
3449
|
-
const removeOnAvailableSizeChange = brain.onAvailableSizeChange(() => {
|
|
3450
|
-
rerender();
|
|
3542
|
+
const removeOnSCroll = brain.onScroll((scrollPosition) => {
|
|
3543
|
+
setInfiniteVarsOnNode({
|
|
3544
|
+
scrollTopForActiveCell: `${-scrollPosition.scrollTop}px`,
|
|
3545
|
+
scrollLeftForActiveCell: `${-scrollPosition.scrollLeft}px`
|
|
3546
|
+
}, domRef.current);
|
|
3451
3547
|
});
|
|
3452
3548
|
return () => {
|
|
3453
|
-
removeOnAvailableSizeChange();
|
|
3454
|
-
removeOnRenderCountChange();
|
|
3455
3549
|
removeOnSCroll();
|
|
3456
3550
|
};
|
|
3457
3551
|
}, [brain]);
|
|
3458
|
-
const scrollPosition = brain.getScrollPosition();
|
|
3459
3552
|
return /* @__PURE__ */ React11.createElement("div", {
|
|
3553
|
+
className: ActiveIndicatorWrapperCls,
|
|
3554
|
+
"data-name": "active-cell"
|
|
3555
|
+
}, /* @__PURE__ */ React11.createElement("div", {
|
|
3460
3556
|
ref: domRef,
|
|
3461
3557
|
"data-name": "active-cell-indicator",
|
|
3462
3558
|
className: `${baseCls2} ${active ? ActiveCellIndicatorCls.visible : ActiveCellIndicatorCls.hidden}`,
|
|
3463
|
-
style: active ?
|
|
3464
|
-
|
|
3465
|
-
width: state.colWidth,
|
|
3466
|
-
height: state.rowHeight
|
|
3467
|
-
} : void 0
|
|
3468
|
-
});
|
|
3559
|
+
style: active ? ActiveStyle : void 0
|
|
3560
|
+
}));
|
|
3469
3561
|
};
|
|
3470
3562
|
var ActiveCellIndicator = React11.memo(ActiveCellIndicatorFn);
|
|
3471
3563
|
|
|
@@ -3535,7 +3627,7 @@ function HeadlessTable(props) {
|
|
|
3535
3627
|
};
|
|
3536
3628
|
brain.update(size);
|
|
3537
3629
|
};
|
|
3538
|
-
const remove = setupResizeObserver(node, onResize);
|
|
3630
|
+
const remove = setupResizeObserver(node, onResize, { debounce: 50 });
|
|
3539
3631
|
return remove;
|
|
3540
3632
|
}, []);
|
|
3541
3633
|
const onContainerScroll = (0, import_react11.useCallback)((scrollPos) => {
|
|
@@ -3862,6 +3954,12 @@ function getComponentStateRoot(config) {
|
|
|
3862
3954
|
}
|
|
3863
3955
|
}
|
|
3864
3956
|
});
|
|
3957
|
+
(0, import_react14.useEffect)(() => {
|
|
3958
|
+
return () => {
|
|
3959
|
+
var _a2;
|
|
3960
|
+
(_a2 = config.cleanup) == null ? void 0 : _a2.call(config, getComponentState());
|
|
3961
|
+
};
|
|
3962
|
+
}, []);
|
|
3865
3963
|
return /* @__PURE__ */ React13.createElement(Context.Provider, {
|
|
3866
3964
|
value: contextValue
|
|
3867
3965
|
}, props.children);
|
|
@@ -3881,45 +3979,45 @@ var useInternalProps = () => {
|
|
|
3881
3979
|
};
|
|
3882
3980
|
|
|
3883
3981
|
// src/components/InfiniteTable/utilities.css.ts
|
|
3884
|
-
var alignItems = { center: "
|
|
3885
|
-
var cssEllipsisClassName = "
|
|
3886
|
-
var cursor = { pointer: "_16lm1iwd" };
|
|
3887
|
-
var display = { flex: "
|
|
3888
|
-
var flex = { "1": "
|
|
3889
|
-
var flexFlow = { column: "
|
|
3890
|
-
var justifyContent = { center: "
|
|
3891
|
-
var left = { "0": "
|
|
3892
|
-
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" };
|
|
3893
3991
|
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
3894
|
-
var top = { "0": "
|
|
3992
|
+
var top = { "0": "_16lm1iwv", "100%": "_16lm1iww" };
|
|
3895
3993
|
var transformTranslateZero = "_16lm1iwa";
|
|
3896
|
-
var userSelect = { none: "
|
|
3897
|
-
var zIndex = { "1": "
|
|
3994
|
+
var userSelect = { none: "_16lm1iwq" };
|
|
3995
|
+
var zIndex = { "1": "_16lm1iwi", "10": "_16lm1iwj", "1000": "_16lm1iwk", "10000": "_16lm1iwl", "100000": "_16lm1iwm" };
|
|
3898
3996
|
|
|
3899
3997
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3900
3998
|
var InfiniteTableBody = React14.forwardRef(function InfiniteTableBody2(props, ref) {
|
|
3901
|
-
const { rootClassName:
|
|
3999
|
+
const { rootClassName: rootClassName13 } = useInternalProps();
|
|
3902
4000
|
return /* @__PURE__ */ React14.createElement("div", __spreadProps(__spreadValues({
|
|
3903
4001
|
ref
|
|
3904
4002
|
}, props), {
|
|
3905
|
-
className: join(`${
|
|
4003
|
+
className: join(`${rootClassName13}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
|
|
3906
4004
|
}));
|
|
3907
4005
|
});
|
|
3908
4006
|
|
|
3909
4007
|
// src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx
|
|
3910
4008
|
var React15 = __toModule(require("react"));
|
|
3911
4009
|
var InfiniteTableFooter = React15.forwardRef(function InfiniteTableFooter2(props, ref) {
|
|
3912
|
-
const { rootClassName:
|
|
4010
|
+
const { rootClassName: rootClassName13 } = useInternalProps();
|
|
3913
4011
|
return /* @__PURE__ */ React15.createElement("div", __spreadProps(__spreadValues({
|
|
3914
4012
|
ref
|
|
3915
4013
|
}, props), {
|
|
3916
|
-
className: join(`${
|
|
4014
|
+
className: join(`${rootClassName13}Footer`, position.relative, display.flex, flexFlow.row, props.className)
|
|
3917
4015
|
}));
|
|
3918
4016
|
});
|
|
3919
4017
|
|
|
3920
4018
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3921
|
-
var
|
|
3922
|
-
var
|
|
4019
|
+
var React22 = __toModule(require("react"));
|
|
4020
|
+
var import_react24 = __toModule(require("react"));
|
|
3923
4021
|
var import_react_dom = __toModule(require("react-dom"));
|
|
3924
4022
|
|
|
3925
4023
|
// src/components/DataSource/defaultFilterTypes.ts
|
|
@@ -4079,7 +4177,6 @@ var useColumnPointerEvents = ({
|
|
|
4079
4177
|
const [draggingDiff, setDraggingDiff] = (0, import_react17.useState)(null);
|
|
4080
4178
|
const [proxyOffset, setProxyOffset] = (0, import_react17.useState)(null);
|
|
4081
4179
|
const breakpointsRef = (0, import_react17.useRef)([]);
|
|
4082
|
-
const pointerMoveRef = (0, import_react17.useRef)(null);
|
|
4083
4180
|
const didDragRef = (0, import_react17.useRef)(false);
|
|
4084
4181
|
const initialClientPos = (0, import_react17.useRef)(null);
|
|
4085
4182
|
const currentDropIndexRef = (0, import_react17.useRef)(null);
|
|
@@ -4155,35 +4252,40 @@ var useColumnPointerEvents = ({
|
|
|
4155
4252
|
}
|
|
4156
4253
|
setDraggingDiff({ left: diffX, top: diffY });
|
|
4157
4254
|
};
|
|
4158
|
-
|
|
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
|
+
};
|
|
4159
4277
|
target.addEventListener("pointermove", onPointerMove);
|
|
4278
|
+
target.addEventListener("pointerup", onPointerUp);
|
|
4160
4279
|
target.setPointerCapture(e.pointerId);
|
|
4161
|
-
}, [
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
componentActions.draggingColumnId = null;
|
|
4170
|
-
if (!didDragRef.current && column.computedSortable) {
|
|
4171
|
-
column.toggleSort();
|
|
4172
|
-
}
|
|
4173
|
-
const dropIndex = currentDropIndexRef.current;
|
|
4174
|
-
if (dropIndex != null && dropIndex !== columnIndex) {
|
|
4175
|
-
const newOrder = moveXatY(computedColumnOrder, columnIndex, dropIndex > columnIndex ? dropIndex - 1 : dropIndex);
|
|
4176
|
-
componentActions.columnOrder = newOrder;
|
|
4177
|
-
}
|
|
4178
|
-
breakpointsRef.current = [];
|
|
4179
|
-
pointerMoveRef.current = null;
|
|
4180
|
-
didDragRef.current = false;
|
|
4181
|
-
initialClientPos.current = null;
|
|
4182
|
-
currentDropIndexRef.current = null;
|
|
4183
|
-
}, [column, columnIndex, componentActions, computedColumnOrder]);
|
|
4280
|
+
}, [
|
|
4281
|
+
columns,
|
|
4282
|
+
column,
|
|
4283
|
+
columnIndex,
|
|
4284
|
+
columnsArray,
|
|
4285
|
+
computedRemainingSpace,
|
|
4286
|
+
computedColumnOrder
|
|
4287
|
+
]);
|
|
4184
4288
|
return {
|
|
4185
|
-
onPointerUp: column.computedDraggable ? onPointerUp : () => {
|
|
4186
|
-
},
|
|
4187
4289
|
onPointerDown: column.computedDraggable ? onPointerDown : () => {
|
|
4188
4290
|
},
|
|
4189
4291
|
dragging,
|
|
@@ -4240,19 +4342,19 @@ var import_react19 = __toModule(require("react"));
|
|
|
4240
4342
|
|
|
4241
4343
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
4242
4344
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4243
|
-
var CellCls = "_1eexc2a5
|
|
4244
|
-
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: [] });
|
|
4245
4347
|
var HeaderCellProxy = "_12zfob10";
|
|
4246
|
-
var HeaderCellRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob1h
|
|
4247
|
-
var HeaderClsRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob17
|
|
4248
|
-
var HeaderFilterCls = "_12zfob11c
|
|
4249
|
-
var HeaderFilterEditorCls = "
|
|
4250
|
-
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";
|
|
4251
4353
|
var HeaderScrollbarPlaceholderCls = "_12zfob16 _16lm1iw2";
|
|
4252
4354
|
var HeaderSortIconCls = "_16lm1iw1";
|
|
4253
4355
|
var HeaderSortIconIndexCls = "_12zfob15";
|
|
4254
4356
|
var HeaderSortIconRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob12", center: "_12zfob13", end: "_12zfob14" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4255
|
-
var HeaderWrapperCls = "_12zfob11a
|
|
4357
|
+
var HeaderWrapperCls = "_12zfob11a _16lm1iw1a _16lm1iw1 _16lm1iwn _16lm1iw14";
|
|
4256
4358
|
|
|
4257
4359
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
4258
4360
|
var defaultLineStyle = {
|
|
@@ -4339,20 +4441,20 @@ var useInfiniteTableState = () => {
|
|
|
4339
4441
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
4340
4442
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4341
4443
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
4342
|
-
var ColumnCellCls = "_1eexc2a5
|
|
4444
|
+
var ColumnCellCls = "_1eexc2a5 _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw2 _16lm1iw1d _16lm1iw1e";
|
|
4343
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"]] });
|
|
4344
4446
|
|
|
4345
4447
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4346
4448
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
4347
4449
|
var InfiniteTableCellClassName = `${rootClassName5}Cell`;
|
|
4348
4450
|
var InfiniteTableCellContentClassName = `${rootClassName5}Cell_content`;
|
|
4451
|
+
var columnWidthAtIndex2 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4349
4452
|
function InfiniteTableCellFn(props) {
|
|
4350
4453
|
var _b, _c, _d;
|
|
4351
4454
|
const _a = props, {
|
|
4352
4455
|
cssEllipsis = true,
|
|
4353
4456
|
virtualized = true,
|
|
4354
4457
|
skipColumnShifting = false,
|
|
4355
|
-
offsetProperty = "left",
|
|
4356
4458
|
contentStyle,
|
|
4357
4459
|
column,
|
|
4358
4460
|
domRef,
|
|
@@ -4360,7 +4462,6 @@ function InfiniteTableCellFn(props) {
|
|
|
4360
4462
|
contentClassName,
|
|
4361
4463
|
afterChildren,
|
|
4362
4464
|
beforeChildren,
|
|
4363
|
-
offset,
|
|
4364
4465
|
cellType,
|
|
4365
4466
|
cssPosition: _cssPosition,
|
|
4366
4467
|
renderChildren
|
|
@@ -4368,7 +4469,6 @@ function InfiniteTableCellFn(props) {
|
|
|
4368
4469
|
"cssEllipsis",
|
|
4369
4470
|
"virtualized",
|
|
4370
4471
|
"skipColumnShifting",
|
|
4371
|
-
"offsetProperty",
|
|
4372
4472
|
"contentStyle",
|
|
4373
4473
|
"column",
|
|
4374
4474
|
"domRef",
|
|
@@ -4376,7 +4476,6 @@ function InfiniteTableCellFn(props) {
|
|
|
4376
4476
|
"contentClassName",
|
|
4377
4477
|
"afterChildren",
|
|
4378
4478
|
"beforeChildren",
|
|
4379
|
-
"offset",
|
|
4380
4479
|
"cellType",
|
|
4381
4480
|
"cssPosition",
|
|
4382
4481
|
"renderChildren"
|
|
@@ -4385,10 +4484,10 @@ function InfiniteTableCellFn(props) {
|
|
|
4385
4484
|
const { columnShifts } = useInfiniteTableState();
|
|
4386
4485
|
const shifting = !!columnShifts;
|
|
4387
4486
|
const style = __spreadValues({
|
|
4388
|
-
width
|
|
4487
|
+
width: `var(${columnWidthAtIndex2}-${column.computedVisibleIndex})`
|
|
4389
4488
|
}, domProps.style);
|
|
4390
4489
|
if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
|
|
4391
|
-
const shiftLeft = columnShifts[column.computedVisibleIndex]
|
|
4490
|
+
const shiftLeft = columnShifts[column.computedVisibleIndex];
|
|
4392
4491
|
if (virtualized) {
|
|
4393
4492
|
style.left = shiftLeft;
|
|
4394
4493
|
} else {
|
|
@@ -4470,10 +4569,545 @@ function InfiniteTableColumnHeaderFilterEmpty() {
|
|
|
4470
4569
|
});
|
|
4471
4570
|
}
|
|
4472
4571
|
|
|
4473
|
-
// src/components/InfiniteTable/components/InfiniteTableHeader/
|
|
4474
|
-
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 = params.computeSpecialSpaceDistribution ? Math.max(availableSize, 0) : 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
|
+
maxSize: item.computedMaxWidth,
|
|
4853
|
+
minSize: item.computedMinWidth,
|
|
4854
|
+
flex: item.resizable ? item.computedWidth : null,
|
|
4855
|
+
size: 0
|
|
4856
|
+
};
|
|
4857
|
+
}),
|
|
4858
|
+
computeSpecialSpaceDistribution: true,
|
|
4859
|
+
availableSize: Math.max(beforeSizes.reduce(sum, 0) + dragHandleOffset - unresizableWidth, 0)
|
|
4860
|
+
});
|
|
4861
|
+
const diffsForEachItem = beforeItems.map((item, index) => {
|
|
4862
|
+
return computedSizes[index] - item.computedWidth;
|
|
4863
|
+
});
|
|
4864
|
+
let groupMinReached = true;
|
|
4865
|
+
let groupMaxReached = true;
|
|
4866
|
+
let groupConstrained = true;
|
|
4867
|
+
const adjustedDiffs = [];
|
|
4868
|
+
diffsForEachItem.forEach((diff, i) => {
|
|
4869
|
+
const item = beforeItems[i];
|
|
4870
|
+
if (!item.resizable) {
|
|
4871
|
+
adjustedDiffs.push(0);
|
|
4872
|
+
return;
|
|
4873
|
+
}
|
|
4874
|
+
const propertyToAdjust = beforePropertiesToAdjust[i];
|
|
4875
|
+
const itemSize = beforeSizes[i];
|
|
4876
|
+
const currentColumnSizing = cloneColumnSizing(columnSizing);
|
|
4877
|
+
const { maxReached, minReached, constrained, adjustedDiff: adjustedDiff2 } = computeResize({
|
|
4878
|
+
availableSize: params.availableSize,
|
|
4879
|
+
reservedWidth: params.reservedWidth,
|
|
4880
|
+
dragHandleOffset: diff,
|
|
4881
|
+
dragHandlePositionAfter: beforeIndexes[i],
|
|
4882
|
+
shareSpaceOnResize: false,
|
|
4883
|
+
items: params.items,
|
|
4884
|
+
columnSizing: currentColumnSizing
|
|
4885
|
+
});
|
|
4886
|
+
columnSizing[item.id] = __spreadProps(__spreadValues({}, currentColumnSizing[item.id]), {
|
|
4887
|
+
[propertyToAdjust]: itemSize + adjustedDiff2
|
|
4888
|
+
});
|
|
4889
|
+
adjustedDiffs.push(adjustedDiff2);
|
|
4890
|
+
if (!maxReached) {
|
|
4891
|
+
groupMaxReached = false;
|
|
4892
|
+
}
|
|
4893
|
+
if (!minReached) {
|
|
4894
|
+
groupMinReached = false;
|
|
4895
|
+
}
|
|
4896
|
+
if (!constrained) {
|
|
4897
|
+
groupConstrained = false;
|
|
4898
|
+
}
|
|
4899
|
+
});
|
|
4900
|
+
const adjustedDiff = adjustedDiffs.reduce(sum, 0);
|
|
4901
|
+
return {
|
|
4902
|
+
minReached: groupMinReached,
|
|
4903
|
+
maxReached: groupMaxReached,
|
|
4904
|
+
constrained: groupConstrained,
|
|
4905
|
+
adjustedDiffs,
|
|
4906
|
+
adjustedDiff,
|
|
4907
|
+
columnSizing,
|
|
4908
|
+
reservedWidth: reservedWidth - adjustedDiff
|
|
4909
|
+
};
|
|
4910
|
+
};
|
|
4911
|
+
|
|
4912
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
|
|
4913
|
+
var import_react22 = __toModule(require("react"));
|
|
4914
|
+
|
|
4915
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/columnResizer.ts
|
|
4916
|
+
function getColumnResizer(colIndex, {
|
|
4917
|
+
columns,
|
|
4918
|
+
shareSpaceOnResize,
|
|
4919
|
+
domRef
|
|
4920
|
+
}) {
|
|
4921
|
+
const column = columns[colIndex];
|
|
4922
|
+
return {
|
|
4923
|
+
resize(diff) {
|
|
4924
|
+
setInfiniteColumnWidth(colIndex, column.computedWidth + diff, domRef.current);
|
|
4925
|
+
const nextColIndex = colIndex + 1;
|
|
4926
|
+
if (shareSpaceOnResize) {
|
|
4927
|
+
const nextColumn = columns[nextColIndex];
|
|
4928
|
+
if (!nextColumn) {
|
|
4929
|
+
return;
|
|
4930
|
+
}
|
|
4931
|
+
setInfiniteColumnWidth(nextColIndex, nextColumn.computedWidth - diff, domRef.current);
|
|
4932
|
+
setInfiniteColumnOffset(nextColIndex, nextColumn.computedOffset + diff, domRef.current);
|
|
4933
|
+
return;
|
|
4934
|
+
}
|
|
4935
|
+
for (let i = nextColIndex, len = columns.length; i < len; i++) {
|
|
4936
|
+
setInfiniteColumnOffset(i, columns[i].computedOffset + diff, domRef.current);
|
|
4937
|
+
}
|
|
4938
|
+
}
|
|
4939
|
+
};
|
|
4940
|
+
}
|
|
4941
|
+
function getColumnGroupResizer(colIndexes, config) {
|
|
4942
|
+
const lastColIndex = colIndexes[colIndexes.length - 1];
|
|
4943
|
+
return {
|
|
4944
|
+
resize(diffs) {
|
|
4945
|
+
const { columns, domRef } = config;
|
|
4946
|
+
let offset = columns[colIndexes[0]].computedOffset;
|
|
4947
|
+
let diffSum = 0;
|
|
4948
|
+
const node = domRef.current;
|
|
4949
|
+
diffs.forEach((diff, i) => {
|
|
4950
|
+
diffSum += diff;
|
|
4951
|
+
const colIndex = colIndexes[i];
|
|
4952
|
+
const column = columns[colIndex];
|
|
4953
|
+
const newWidth = column.computedWidth + diff;
|
|
4954
|
+
setInfiniteColumnWidth(colIndex, newWidth, node);
|
|
4955
|
+
if (offset) {
|
|
4956
|
+
setInfiniteColumnOffset(colIndex, offset, node);
|
|
4957
|
+
}
|
|
4958
|
+
offset += newWidth;
|
|
4959
|
+
});
|
|
4960
|
+
for (let i = lastColIndex + 1; i < columns.length; i++) {
|
|
4961
|
+
setInfiniteColumnOffset(i, columns[i].computedOffset + diffSum, node);
|
|
4962
|
+
}
|
|
4963
|
+
}
|
|
4964
|
+
};
|
|
4965
|
+
}
|
|
4966
|
+
|
|
4967
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts
|
|
4968
|
+
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4969
|
+
var ResizeHandleCls = "zneyzh0 _16lm1iw2 _16lm1iwv _16lm1iw11 _16lm1iwz _16lm1iwe";
|
|
4970
|
+
var ResizeHandleDraggerClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "zneyzh1 _16lm1iw2 _16lm1iwv _16lm1iwz", variantClassNames: { constrained: { false: "zneyzh2", true: "zneyzh3" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4971
|
+
|
|
4972
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
|
|
4475
4973
|
var { rootClassName: rootClassName7 } = internalProps;
|
|
4476
|
-
var
|
|
4974
|
+
var InfiniteTableHeaderCellResizeHandleCls = `${rootClassName7}HeaderCell_ResizeHandle`;
|
|
4975
|
+
function ResizeHandleFn(props) {
|
|
4976
|
+
const domRef = (0, import_react22.useRef)(null);
|
|
4977
|
+
const [constrained, setConstrained] = (0, import_react22.useState)(false);
|
|
4978
|
+
const constrainedRef = (0, import_react22.useRef)(constrained);
|
|
4979
|
+
constrainedRef.current = constrained;
|
|
4980
|
+
const onPointerDown = (e) => {
|
|
4981
|
+
e.stopPropagation();
|
|
4982
|
+
const shareSpaceOnResize = !!e.shiftKey;
|
|
4983
|
+
const pointerId = e.pointerId;
|
|
4984
|
+
const initialX = e.clientX;
|
|
4985
|
+
const target = e.target;
|
|
4986
|
+
target.setPointerCapture(pointerId);
|
|
4987
|
+
const resizer = getColumnResizer(props.columnIndex, {
|
|
4988
|
+
columns: props.columns,
|
|
4989
|
+
shareSpaceOnResize,
|
|
4990
|
+
domRef
|
|
4991
|
+
});
|
|
4992
|
+
const resizeDiff = (diff) => {
|
|
4993
|
+
const { adjustedDiff, constrained: constrained2 } = props.computeResize({
|
|
4994
|
+
diff,
|
|
4995
|
+
shareSpaceOnResize
|
|
4996
|
+
});
|
|
4997
|
+
if (constrainedRef.current !== constrained2) {
|
|
4998
|
+
setConstrained(constrained2);
|
|
4999
|
+
}
|
|
5000
|
+
resizer.resize(adjustedDiff);
|
|
5001
|
+
return adjustedDiff;
|
|
5002
|
+
};
|
|
5003
|
+
const onPointerMove = (e2) => {
|
|
5004
|
+
resizeDiff(Math.round(e2.clientX - initialX));
|
|
5005
|
+
};
|
|
5006
|
+
const onPointerUp = (e2) => {
|
|
5007
|
+
target.releasePointerCapture(pointerId);
|
|
5008
|
+
target.removeEventListener("pointermove", onPointerMove);
|
|
5009
|
+
target.removeEventListener("pointerup", onPointerUp);
|
|
5010
|
+
const diff = Math.round(e2.clientX - initialX);
|
|
5011
|
+
const adjustedDiff = resizeDiff(diff);
|
|
5012
|
+
props.onResize({ diff: adjustedDiff, shareSpaceOnResize });
|
|
5013
|
+
};
|
|
5014
|
+
target.addEventListener("pointermove", onPointerMove);
|
|
5015
|
+
target.addEventListener("pointerup", onPointerUp);
|
|
5016
|
+
};
|
|
5017
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", {
|
|
5018
|
+
ref: domRef,
|
|
5019
|
+
className: `${InfiniteTableHeaderCellResizeHandleCls} ${ResizeHandleCls}`,
|
|
5020
|
+
onPointerDown
|
|
5021
|
+
}, /* @__PURE__ */ import_react22.default.createElement("div", {
|
|
5022
|
+
className: ResizeHandleDraggerClsRecipe({
|
|
5023
|
+
constrained
|
|
5024
|
+
})
|
|
5025
|
+
}));
|
|
5026
|
+
}
|
|
5027
|
+
var ResizeHandle = import_react22.default.memo(ResizeHandleFn);
|
|
5028
|
+
|
|
5029
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx
|
|
5030
|
+
function useColumnResizeHandle(column) {
|
|
5031
|
+
const {
|
|
5032
|
+
computed: { computedVisibleColumns },
|
|
5033
|
+
componentState: { domRef },
|
|
5034
|
+
getState,
|
|
5035
|
+
getComputed,
|
|
5036
|
+
componentActions
|
|
5037
|
+
} = useInfiniteTable();
|
|
5038
|
+
const computeResizeForDiff = (0, import_react23.useCallback)(({
|
|
5039
|
+
diff,
|
|
5040
|
+
shareSpaceOnResize
|
|
5041
|
+
}) => {
|
|
5042
|
+
const state = getState();
|
|
5043
|
+
const { columnSizing, viewportReservedWidth, bodySize, activeCellIndex } = state;
|
|
5044
|
+
const columns = getComputed().computedVisibleColumns;
|
|
5045
|
+
let atLeastOneFlex = false;
|
|
5046
|
+
const columnSizingWithFlex = columns.reduce((acc, col) => {
|
|
5047
|
+
if (col.computedFlex) {
|
|
5048
|
+
acc[col.id] = __spreadProps(__spreadValues({}, columnSizing[col.id]), { flex: col.computedWidth });
|
|
5049
|
+
atLeastOneFlex = true;
|
|
5050
|
+
}
|
|
5051
|
+
return acc;
|
|
5052
|
+
}, {});
|
|
5053
|
+
const columnSizingForResize = atLeastOneFlex ? __spreadValues(__spreadValues({}, columnSizing), columnSizingWithFlex) : columnSizing;
|
|
5054
|
+
const result = computeResize({
|
|
5055
|
+
shareSpaceOnResize,
|
|
5056
|
+
availableSize: bodySize.width,
|
|
5057
|
+
reservedWidth: viewportReservedWidth || 0,
|
|
5058
|
+
dragHandleOffset: diff,
|
|
5059
|
+
dragHandlePositionAfter: column.computedVisibleIndex,
|
|
5060
|
+
columnSizing: columnSizingForResize,
|
|
5061
|
+
items: columns.map((c) => {
|
|
5062
|
+
return {
|
|
5063
|
+
id: c.id,
|
|
5064
|
+
computedFlex: c.computedFlex,
|
|
5065
|
+
computedWidth: c.computedWidth,
|
|
5066
|
+
computedMinWidth: c.computedMinWidth,
|
|
5067
|
+
computedMaxWidth: c.computedMaxWidth
|
|
5068
|
+
};
|
|
5069
|
+
})
|
|
5070
|
+
});
|
|
5071
|
+
if (activeCellIndex && activeCellIndex[1] >= column.computedVisibleIndex) {
|
|
5072
|
+
const activeColumn = columns[activeCellIndex[1]];
|
|
5073
|
+
const currentColumn = columns[column.computedVisibleIndex];
|
|
5074
|
+
if (activeCellIndex[1] === currentColumn.computedVisibleIndex) {
|
|
5075
|
+
setInfiniteColumnWidth(currentColumn.computedVisibleIndex, currentColumn.computedWidth + result.adjustedDiff, domRef.current);
|
|
5076
|
+
} else if (activeColumn) {
|
|
5077
|
+
setInfiniteColumnOffset(activeColumn.computedVisibleIndex, activeColumn.computedOffset + result.adjustedDiff, domRef.current);
|
|
5078
|
+
}
|
|
5079
|
+
if (shareSpaceOnResize && activeCellIndex[1] === currentColumn.computedVisibleIndex + 1 && activeColumn) {
|
|
5080
|
+
setInfiniteColumnWidth(activeColumn.computedVisibleIndex, activeColumn.computedWidth - result.adjustedDiff, domRef.current);
|
|
5081
|
+
}
|
|
5082
|
+
}
|
|
5083
|
+
return result;
|
|
5084
|
+
}, []);
|
|
5085
|
+
const onColumnResize = (0, import_react23.useCallback)(({
|
|
5086
|
+
diff,
|
|
5087
|
+
shareSpaceOnResize
|
|
5088
|
+
}) => {
|
|
5089
|
+
const { columnSizing, reservedWidth } = computeResizeForDiff({
|
|
5090
|
+
diff,
|
|
5091
|
+
shareSpaceOnResize
|
|
5092
|
+
});
|
|
5093
|
+
if (!shareSpaceOnResize) {
|
|
5094
|
+
componentActions.viewportReservedWidth = reservedWidth;
|
|
5095
|
+
}
|
|
5096
|
+
componentActions.columnSizing = columnSizing;
|
|
5097
|
+
}, []);
|
|
5098
|
+
const resizeHandle = column.computedResizable ? /* @__PURE__ */ React21.createElement(ResizeHandle, {
|
|
5099
|
+
columns: computedVisibleColumns,
|
|
5100
|
+
columnIndex: column.computedVisibleIndex,
|
|
5101
|
+
computeResize: computeResizeForDiff,
|
|
5102
|
+
onResize: onColumnResize
|
|
5103
|
+
}) : null;
|
|
5104
|
+
return resizeHandle;
|
|
5105
|
+
}
|
|
5106
|
+
|
|
5107
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
5108
|
+
var InfiniteTableHeaderCellContext = React22.createContext(null);
|
|
5109
|
+
var { rootClassName: rootClassName8 } = internalProps;
|
|
5110
|
+
var InfiniteTableHeaderCellClassName = `${rootClassName8}HeaderCell`;
|
|
4477
5111
|
function InfiniteTableHeaderCell(props) {
|
|
4478
5112
|
var _a, _b, _c, _d, _e;
|
|
4479
5113
|
const column = props.column;
|
|
@@ -4481,13 +5115,13 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4481
5115
|
const { onResize, height, width, headerOptions } = props;
|
|
4482
5116
|
const sortInfo = column.computedSortInfo;
|
|
4483
5117
|
let header = column.header;
|
|
4484
|
-
const ref = (0,
|
|
5118
|
+
const ref = (0, import_react24.useCallback)((node) => {
|
|
4485
5119
|
var _a2;
|
|
4486
5120
|
domRef.current = node;
|
|
4487
5121
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
4488
5122
|
}, [props.domRef]);
|
|
4489
5123
|
const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
|
|
4490
|
-
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */
|
|
5124
|
+
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ React22.createElement(SortIcon, {
|
|
4491
5125
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
4492
5126
|
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
|
|
4493
5127
|
align: column.align || "start"
|
|
@@ -4504,15 +5138,15 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4504
5138
|
const align = column.align || "start";
|
|
4505
5139
|
const renderChildren = () => {
|
|
4506
5140
|
if (header instanceof Function) {
|
|
4507
|
-
header = /* @__PURE__ */
|
|
5141
|
+
header = /* @__PURE__ */ React22.createElement(RenderHookComponent, {
|
|
4508
5142
|
render: header,
|
|
4509
5143
|
renderParam
|
|
4510
5144
|
});
|
|
4511
5145
|
}
|
|
4512
5146
|
header = header != null ? header : column.name;
|
|
4513
|
-
return /* @__PURE__ */
|
|
5147
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
|
|
4514
5148
|
};
|
|
4515
|
-
const domRef = (0,
|
|
5149
|
+
const domRef = (0, import_react24.useRef)(null);
|
|
4516
5150
|
const {
|
|
4517
5151
|
computed: {
|
|
4518
5152
|
computedRemainingSpace,
|
|
@@ -4526,7 +5160,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4526
5160
|
getState: getDataSourceState,
|
|
4527
5161
|
componentState: { filterDelay, filterTypes }
|
|
4528
5162
|
} = useDataSourceContextValue();
|
|
4529
|
-
(0,
|
|
5163
|
+
(0, import_react24.useEffect)(() => {
|
|
4530
5164
|
let clearOnResize = null;
|
|
4531
5165
|
const node = domRef.current;
|
|
4532
5166
|
if (onResize && node) {
|
|
@@ -4539,7 +5173,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4539
5173
|
const style = {
|
|
4540
5174
|
height
|
|
4541
5175
|
};
|
|
4542
|
-
const { onPointerDown,
|
|
5176
|
+
const { onPointerDown, dragging, draggingDiff, proxyOffset } = useColumnPointerEvents({
|
|
4543
5177
|
computedRemainingSpace,
|
|
4544
5178
|
columnId: column.id,
|
|
4545
5179
|
domRef,
|
|
@@ -4547,7 +5181,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4547
5181
|
});
|
|
4548
5182
|
let draggingProxy = null;
|
|
4549
5183
|
if (dragging) {
|
|
4550
|
-
draggingProxy = /* @__PURE__ */
|
|
5184
|
+
draggingProxy = /* @__PURE__ */ React22.createElement("div", {
|
|
4551
5185
|
className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
|
|
4552
5186
|
style: {
|
|
4553
5187
|
position: "absolute",
|
|
@@ -4564,7 +5198,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4564
5198
|
const contentRecipeVariants = {
|
|
4565
5199
|
filtered: column.computedFiltered
|
|
4566
5200
|
};
|
|
4567
|
-
const setFilterValue = (0,
|
|
5201
|
+
const setFilterValue = (0, import_react24.useCallback)((filterValue) => {
|
|
4568
5202
|
var _a2;
|
|
4569
5203
|
const state = getDataSourceState();
|
|
4570
5204
|
let newFilterValue = (_a2 = state.filterValue) != null ? _a2 : [];
|
|
@@ -4588,7 +5222,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4588
5222
|
});
|
|
4589
5223
|
dataSourceActions.filterValue = newFilterValue;
|
|
4590
5224
|
}, [column, filterTypes]);
|
|
4591
|
-
const debouncedOnFilterValueChange =
|
|
5225
|
+
const debouncedOnFilterValueChange = React22.useMemo(() => {
|
|
4592
5226
|
const fn = (filterValue) => {
|
|
4593
5227
|
let newFilterValueForColumn;
|
|
4594
5228
|
if (column.computedFilterValue) {
|
|
@@ -4625,10 +5259,10 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4625
5259
|
]);
|
|
4626
5260
|
const filterType = column.computedFilterType;
|
|
4627
5261
|
const FilterEditor = filterEditors[filterType] || defaultFilterEditors[filterType] || StringFilterEditor;
|
|
4628
|
-
const resizeHandle =
|
|
4629
|
-
return /* @__PURE__ */
|
|
5262
|
+
const resizeHandle = useColumnResizeHandle(column);
|
|
5263
|
+
return /* @__PURE__ */ React22.createElement(ContextProvider, {
|
|
4630
5264
|
value: renderParam
|
|
4631
|
-
}, /* @__PURE__ */
|
|
5265
|
+
}, /* @__PURE__ */ React22.createElement(InfiniteTableCell, {
|
|
4632
5266
|
domRef: ref,
|
|
4633
5267
|
cellType: "header",
|
|
4634
5268
|
column,
|
|
@@ -4638,12 +5272,11 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4638
5272
|
style,
|
|
4639
5273
|
width,
|
|
4640
5274
|
onPointerDown,
|
|
4641
|
-
onPointerUp,
|
|
4642
5275
|
contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
|
|
4643
5276
|
contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
|
|
4644
5277
|
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false, rowActive: false }), CellCls),
|
|
4645
5278
|
cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
|
|
4646
|
-
afterChildren: /* @__PURE__ */
|
|
5279
|
+
afterChildren: /* @__PURE__ */ React22.createElement(React22.Fragment, null, showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ React22.createElement(InfiniteTableColumnHeaderFilter, {
|
|
4647
5280
|
filterEditor: FilterEditor,
|
|
4648
5281
|
filterTypes,
|
|
4649
5282
|
onChange: debouncedOnFilterValueChange,
|
|
@@ -4651,17 +5284,17 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4651
5284
|
columnLabel: column.field || column.name || column.id,
|
|
4652
5285
|
columnFilterValue: column.computedFilterValue,
|
|
4653
5286
|
columnHeaderHeight
|
|
4654
|
-
}) : /* @__PURE__ */
|
|
5287
|
+
}) : /* @__PURE__ */ React22.createElement(InfiniteTableColumnHeaderFilterEmpty, null) : null, resizeHandle),
|
|
4655
5288
|
renderChildren
|
|
4656
5289
|
}), draggingProxy);
|
|
4657
5290
|
}
|
|
4658
5291
|
function useInfiniteHeaderCell() {
|
|
4659
|
-
const result = (0,
|
|
5292
|
+
const result = (0, import_react24.useContext)(InfiniteTableHeaderCellContext);
|
|
4660
5293
|
return result;
|
|
4661
5294
|
}
|
|
4662
5295
|
|
|
4663
5296
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4664
|
-
var
|
|
5297
|
+
var React27 = __toModule(require("react"));
|
|
4665
5298
|
|
|
4666
5299
|
// src/components/utils/getScrollbarWidth.ts
|
|
4667
5300
|
var scrollbarWidth;
|
|
@@ -4747,7 +5380,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, c
|
|
|
4747
5380
|
let groupOffset = 0;
|
|
4748
5381
|
map2.forEach((item) => {
|
|
4749
5382
|
if (!item.ref.columnGroup) {
|
|
4750
|
-
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((
|
|
5383
|
+
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum2, col) => sum2 + col.ref.computedWidth, 0);
|
|
4751
5384
|
item.groupOffset = groupOffset;
|
|
4752
5385
|
item.computedWidth = itemWidth;
|
|
4753
5386
|
if (item.type === "group") {
|
|
@@ -4772,7 +5405,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, c
|
|
|
4772
5405
|
}
|
|
4773
5406
|
function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
4774
5407
|
items.forEach((item) => {
|
|
4775
|
-
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((
|
|
5408
|
+
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum2, col) => sum2 + col.ref.computedWidth, 0);
|
|
4776
5409
|
item.computedWidth = itemWidth;
|
|
4777
5410
|
item.groupOffset = groupOffset;
|
|
4778
5411
|
if (item.type === "group") {
|
|
@@ -4783,36 +5416,186 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
4783
5416
|
}
|
|
4784
5417
|
|
|
4785
5418
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4786
|
-
var
|
|
4787
|
-
var
|
|
5419
|
+
var React26 = __toModule(require("react"));
|
|
5420
|
+
var import_react27 = __toModule(require("react"));
|
|
5421
|
+
|
|
5422
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
5423
|
+
var React25 = __toModule(require("react"));
|
|
5424
|
+
|
|
5425
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx
|
|
5426
|
+
var React24 = __toModule(require("react"));
|
|
5427
|
+
var import_react26 = __toModule(require("react"));
|
|
5428
|
+
|
|
5429
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/GroupResizeHandle.tsx
|
|
5430
|
+
var import_react25 = __toModule(require("react"));
|
|
5431
|
+
var { rootClassName: rootClassName9 } = internalProps;
|
|
5432
|
+
var InfiniteTableHeaderCellResizeHandleCls2 = `${rootClassName9}HeaderCell_ResizeHandle`;
|
|
5433
|
+
function GroupResizeHandleFn(props) {
|
|
5434
|
+
const domRef = (0, import_react25.useRef)(null);
|
|
5435
|
+
const [constrained, setConstrained] = (0, import_react25.useState)(false);
|
|
5436
|
+
const constrainedRef = (0, import_react25.useRef)(constrained);
|
|
5437
|
+
constrainedRef.current = constrained;
|
|
5438
|
+
const onPointerDown = (e) => {
|
|
5439
|
+
e.stopPropagation();
|
|
5440
|
+
const pointerId = e.pointerId;
|
|
5441
|
+
const initialX = e.clientX;
|
|
5442
|
+
const target = e.target;
|
|
5443
|
+
target.setPointerCapture(pointerId);
|
|
5444
|
+
let initialMove = true;
|
|
5445
|
+
const resizer = getColumnGroupResizer(props.groupColumns.map((c) => c.computedVisibleIndex), {
|
|
5446
|
+
columns: props.columns,
|
|
5447
|
+
domRef
|
|
5448
|
+
});
|
|
5449
|
+
const resizeDiff = (diff) => {
|
|
5450
|
+
const { constrained: constrained2, adjustedDiffs, adjustedDiff } = props.computeResize(diff);
|
|
5451
|
+
if (constrainedRef.current !== constrained2) {
|
|
5452
|
+
setConstrained(constrained2);
|
|
5453
|
+
}
|
|
5454
|
+
resizer.resize(adjustedDiffs);
|
|
5455
|
+
return adjustedDiff;
|
|
5456
|
+
};
|
|
5457
|
+
const onPointerMove = (e2) => {
|
|
5458
|
+
if (initialMove) {
|
|
5459
|
+
const maxDiff = props.groupColumns.reduce((diff, col) => {
|
|
5460
|
+
return diff + col.computedWidth - col.computedMinWidth;
|
|
5461
|
+
}, 0);
|
|
5462
|
+
const currentSize = props.brain.getAvailableSize();
|
|
5463
|
+
const newSize = {
|
|
5464
|
+
width: currentSize.width + maxDiff,
|
|
5465
|
+
height: currentSize.height
|
|
5466
|
+
};
|
|
5467
|
+
props.brain.setAvailableSize(newSize);
|
|
5468
|
+
initialMove = false;
|
|
5469
|
+
}
|
|
5470
|
+
resizeDiff(Math.round(e2.clientX - initialX));
|
|
5471
|
+
};
|
|
5472
|
+
const onPointerUp = (e2) => {
|
|
5473
|
+
target.releasePointerCapture(pointerId);
|
|
5474
|
+
target.removeEventListener("pointermove", onPointerMove);
|
|
5475
|
+
target.removeEventListener("pointerup", onPointerUp);
|
|
5476
|
+
const diff = Math.round(e2.clientX - initialX);
|
|
5477
|
+
const adjustedDiffs = resizeDiff(diff);
|
|
5478
|
+
props.onResize(adjustedDiffs);
|
|
5479
|
+
};
|
|
5480
|
+
target.addEventListener("pointermove", onPointerMove);
|
|
5481
|
+
target.addEventListener("pointerup", onPointerUp);
|
|
5482
|
+
};
|
|
5483
|
+
return /* @__PURE__ */ import_react25.default.createElement("div", {
|
|
5484
|
+
ref: domRef,
|
|
5485
|
+
className: `${InfiniteTableHeaderCellResizeHandleCls2} ${ResizeHandleCls}`,
|
|
5486
|
+
onPointerDown
|
|
5487
|
+
}, /* @__PURE__ */ import_react25.default.createElement("div", {
|
|
5488
|
+
style: props.style,
|
|
5489
|
+
className: ResizeHandleDraggerClsRecipe({
|
|
5490
|
+
constrained
|
|
5491
|
+
})
|
|
5492
|
+
}));
|
|
5493
|
+
}
|
|
5494
|
+
var GroupResizeHandle = import_react25.default.memo(GroupResizeHandleFn);
|
|
5495
|
+
|
|
5496
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx
|
|
5497
|
+
function useColumnGroupResizeHandle(groupColumns, config) {
|
|
5498
|
+
const { bodyBrain, groupHeight, columnGroup, columnGroupsMaxDepth } = config;
|
|
5499
|
+
const {
|
|
5500
|
+
computed: { computedVisibleColumns },
|
|
5501
|
+
getState,
|
|
5502
|
+
getComputed,
|
|
5503
|
+
componentActions
|
|
5504
|
+
} = useInfiniteTable();
|
|
5505
|
+
const lastColumnInGroup = groupColumns[groupColumns.length - 1];
|
|
5506
|
+
const computeResizeForDiff = (0, import_react26.useCallback)((diff) => {
|
|
5507
|
+
const state = getState();
|
|
5508
|
+
const { columnSizing, viewportReservedWidth, bodySize } = state;
|
|
5509
|
+
const columns = getComputed().computedVisibleColumns;
|
|
5510
|
+
let atLeastOneFlex = false;
|
|
5511
|
+
const columnSizingWithFlex = columns.reduce((acc, col) => {
|
|
5512
|
+
if (col.computedFlex) {
|
|
5513
|
+
acc[col.id] = __spreadProps(__spreadValues({}, columnSizing[col.id]), { flex: col.computedWidth });
|
|
5514
|
+
atLeastOneFlex = true;
|
|
5515
|
+
}
|
|
5516
|
+
return acc;
|
|
5517
|
+
}, {});
|
|
5518
|
+
const columnSizingForResize = atLeastOneFlex ? __spreadValues(__spreadValues({}, columnSizing), columnSizingWithFlex) : columnSizing;
|
|
5519
|
+
const result = computeGroupResize({
|
|
5520
|
+
availableSize: bodySize.width,
|
|
5521
|
+
reservedWidth: viewportReservedWidth || 0,
|
|
5522
|
+
dragHandleOffset: diff,
|
|
5523
|
+
dragHandlePositionAfter: lastColumnInGroup.computedVisibleIndex,
|
|
5524
|
+
columnSizing: columnSizingForResize,
|
|
5525
|
+
columnGroupSize: groupColumns.length,
|
|
5526
|
+
items: columns.map((c) => {
|
|
5527
|
+
return {
|
|
5528
|
+
id: c.id,
|
|
5529
|
+
resizable: c.computedResizable,
|
|
5530
|
+
computedFlex: c.computedFlex,
|
|
5531
|
+
computedWidth: c.computedWidth,
|
|
5532
|
+
computedMinWidth: c.computedMinWidth,
|
|
5533
|
+
computedMaxWidth: c.computedMaxWidth
|
|
5534
|
+
};
|
|
5535
|
+
})
|
|
5536
|
+
});
|
|
5537
|
+
return result;
|
|
5538
|
+
}, []);
|
|
5539
|
+
const onColumnResize = (0, import_react26.useCallback)((diff) => {
|
|
5540
|
+
const { columnSizing, reservedWidth } = computeResizeForDiff(diff);
|
|
5541
|
+
componentActions.viewportReservedWidth = reservedWidth;
|
|
5542
|
+
componentActions.columnSizing = columnSizing;
|
|
5543
|
+
}, []);
|
|
5544
|
+
const groupResizable = groupColumns.some((c) => c.computedResizable);
|
|
5545
|
+
const resizeHandle = groupResizable ? /* @__PURE__ */ React24.createElement(GroupResizeHandle, {
|
|
5546
|
+
brain: bodyBrain,
|
|
5547
|
+
style: {
|
|
5548
|
+
height: groupHeight * (columnGroupsMaxDepth - columnGroup.depth + 2)
|
|
5549
|
+
},
|
|
5550
|
+
columns: computedVisibleColumns,
|
|
5551
|
+
groupColumns,
|
|
5552
|
+
computeResize: computeResizeForDiff,
|
|
5553
|
+
onResize: onColumnResize
|
|
5554
|
+
}) : null;
|
|
5555
|
+
return resizeHandle;
|
|
5556
|
+
}
|
|
4788
5557
|
|
|
4789
5558
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
4790
|
-
var React21 = __toModule(require("react"));
|
|
4791
5559
|
var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
|
|
5560
|
+
var columnWidthAtIndex3 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4792
5561
|
function InfiniteTableHeaderGroup(props) {
|
|
4793
|
-
const {
|
|
5562
|
+
const {
|
|
5563
|
+
computed: { computedVisibleColumns }
|
|
5564
|
+
} = useInfiniteTable();
|
|
5565
|
+
const { columnGroup, height, columns, bodyBrain, columnGroupsMaxDepth } = props;
|
|
4794
5566
|
let { header } = columnGroup;
|
|
4795
5567
|
if (header instanceof Function) {
|
|
4796
5568
|
header = header({
|
|
4797
5569
|
columnGroup
|
|
4798
5570
|
});
|
|
4799
5571
|
}
|
|
4800
|
-
|
|
5572
|
+
const handle = useColumnGroupResizeHandle(columns, {
|
|
5573
|
+
bodyBrain,
|
|
5574
|
+
groupHeight: height,
|
|
5575
|
+
columnGroup,
|
|
5576
|
+
columnGroupsMaxDepth
|
|
5577
|
+
});
|
|
5578
|
+
const firstColumn = columns[0];
|
|
5579
|
+
const width = columns.length > 1 ? `calc( ` + columns.map((col) => `var(${columnWidthAtIndex3}-${col.computedVisibleIndex})`).join(" + ") + " )" : `var(${columnWidthAtIndex3}-${firstColumn.computedVisibleIndex})`;
|
|
5580
|
+
const zIndex2 = computedVisibleColumns.length * 10 - firstColumn.computedVisibleIndex * 10 + height * (columnGroupsMaxDepth - columnGroup.depth + 2);
|
|
5581
|
+
return /* @__PURE__ */ React25.createElement("div", {
|
|
4801
5582
|
ref: props.domRef,
|
|
4802
5583
|
"data-group-id": columnGroup.uniqueGroupId,
|
|
4803
5584
|
className: join(HeaderGroupCls, TableHeaderGroupClassName),
|
|
4804
|
-
style: { width, height }
|
|
4805
|
-
|
|
5585
|
+
style: { width, height },
|
|
5586
|
+
"data-z-index": zIndex2
|
|
5587
|
+
}, /* @__PURE__ */ React25.createElement("div", {
|
|
4806
5588
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4807
|
-
}, header));
|
|
5589
|
+
}, header), handle);
|
|
4808
5590
|
}
|
|
4809
5591
|
|
|
4810
5592
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4811
|
-
var { rootClassName:
|
|
4812
|
-
var TableHeaderClassName = `${
|
|
5593
|
+
var { rootClassName: rootClassName10 } = internalProps;
|
|
5594
|
+
var TableHeaderClassName = `${rootClassName10}Header`;
|
|
4813
5595
|
function InfiniteTableHeaderFn(props) {
|
|
4814
5596
|
const {
|
|
4815
|
-
|
|
5597
|
+
bodyBrain,
|
|
5598
|
+
headerBrain: brain,
|
|
4816
5599
|
columns,
|
|
4817
5600
|
style,
|
|
4818
5601
|
className,
|
|
@@ -4825,7 +5608,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4825
5608
|
componentState: { headerBrain, headerOptions }
|
|
4826
5609
|
} = useInfiniteTable();
|
|
4827
5610
|
const { computedVisibleColumnsMap, showColumnFilters } = computed;
|
|
4828
|
-
(0,
|
|
5611
|
+
(0, import_react27.useEffect)(() => {
|
|
4829
5612
|
const onScroll = (scrollPosition) => {
|
|
4830
5613
|
if (domRef.current) {
|
|
4831
5614
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
@@ -4834,7 +5617,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4834
5617
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4835
5618
|
return removeOnScroll;
|
|
4836
5619
|
}, [brain]);
|
|
4837
|
-
const domRef = (0,
|
|
5620
|
+
const domRef = (0, import_react27.useRef)(null);
|
|
4838
5621
|
const headerCls = HeaderClsRecipe({
|
|
4839
5622
|
overflow: false,
|
|
4840
5623
|
virtualized: true
|
|
@@ -4844,7 +5627,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4844
5627
|
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4845
5628
|
style: __spreadProps(__spreadValues({}, style), { height: columnHeaderHeight })
|
|
4846
5629
|
};
|
|
4847
|
-
const renderCell = (0,
|
|
5630
|
+
const renderCell = (0, import_react27.useCallback)((params) => {
|
|
4848
5631
|
const {
|
|
4849
5632
|
rowIndex,
|
|
4850
5633
|
colIndex,
|
|
@@ -4869,7 +5652,9 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4869
5652
|
computedWidth: colGroupItem.computedWidth,
|
|
4870
5653
|
groupOffset: colGroupItem.groupOffset
|
|
4871
5654
|
});
|
|
4872
|
-
return /* @__PURE__ */
|
|
5655
|
+
return /* @__PURE__ */ React26.createElement(InfiniteTableHeaderGroup, {
|
|
5656
|
+
bodyBrain,
|
|
5657
|
+
columnGroupsMaxDepth,
|
|
4873
5658
|
domRef: domRef2,
|
|
4874
5659
|
columns: columns2,
|
|
4875
5660
|
width: widthWithColspan,
|
|
@@ -4877,7 +5662,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4877
5662
|
columnGroup: computedColumnGroup
|
|
4878
5663
|
});
|
|
4879
5664
|
}
|
|
4880
|
-
return /* @__PURE__ */
|
|
5665
|
+
return /* @__PURE__ */ React26.createElement(InfiniteTableHeaderCell, {
|
|
4881
5666
|
domRef: domRef2,
|
|
4882
5667
|
column,
|
|
4883
5668
|
headerOptions,
|
|
@@ -4893,17 +5678,18 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4893
5678
|
columnGroupsMaxDepth,
|
|
4894
5679
|
showColumnFilters
|
|
4895
5680
|
]);
|
|
4896
|
-
return /* @__PURE__ */
|
|
5681
|
+
return /* @__PURE__ */ React26.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React26.createElement(RawTable, {
|
|
5682
|
+
name: "header",
|
|
4897
5683
|
renderCell,
|
|
4898
5684
|
brain: headerBrain,
|
|
4899
5685
|
cellHoverClassNames: []
|
|
4900
5686
|
}));
|
|
4901
5687
|
}
|
|
4902
|
-
var InfiniteTableHeader =
|
|
5688
|
+
var InfiniteTableHeader = React26.memo(InfiniteTableHeaderFn);
|
|
4903
5689
|
|
|
4904
5690
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4905
5691
|
function TableHeaderWrapper(props) {
|
|
4906
|
-
const {
|
|
5692
|
+
const { headerBrain, bodyBrain, scrollbars } = props;
|
|
4907
5693
|
const tableContextValue = useInfiniteTable();
|
|
4908
5694
|
const {
|
|
4909
5695
|
computedPinnedStartColumns,
|
|
@@ -4922,13 +5708,13 @@ function TableHeaderWrapper(props) {
|
|
|
4922
5708
|
} = tableContextValue;
|
|
4923
5709
|
const rows = !computedColumnGroups || !computedColumnGroups.size ? 1 : columnGroupsMaxDepth + 2;
|
|
4924
5710
|
const height = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
|
|
4925
|
-
const columnAndGroupTreeInfo =
|
|
5711
|
+
const columnAndGroupTreeInfo = React27.useMemo(() => {
|
|
4926
5712
|
if (!computedColumnGroups || !computedColumnGroups.size) {
|
|
4927
5713
|
return void 0;
|
|
4928
5714
|
}
|
|
4929
5715
|
return buildColumnAndGroupTree(computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth);
|
|
4930
5716
|
}, [computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap]);
|
|
4931
|
-
const cellspan =
|
|
5717
|
+
const cellspan = React27.useCallback(({ rowIndex, colIndex }) => {
|
|
4932
5718
|
const column = computedVisibleColumns[colIndex];
|
|
4933
5719
|
const rowspan2 = 1;
|
|
4934
5720
|
const colspan2 = 1;
|
|
@@ -4961,12 +5747,12 @@ function TableHeaderWrapper(props) {
|
|
|
4961
5747
|
rows,
|
|
4962
5748
|
columnGroupsDepthsMap
|
|
4963
5749
|
]);
|
|
4964
|
-
const rowspan =
|
|
4965
|
-
const colspan =
|
|
4966
|
-
const rowHeight =
|
|
5750
|
+
const rowspan = React27.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
|
|
5751
|
+
const colspan = React27.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
|
|
5752
|
+
const rowHeight = React27.useCallback((index) => {
|
|
4967
5753
|
return showColumnFilters ? index < rows - 1 ? columnHeaderHeight : 2 * columnHeaderHeight : columnHeaderHeight;
|
|
4968
5754
|
}, [rows, showColumnFilters, columnHeaderHeight]);
|
|
4969
|
-
useMatrixBrain(
|
|
5755
|
+
useMatrixBrain(headerBrain, {
|
|
4970
5756
|
colWidth: columnSize,
|
|
4971
5757
|
rowHeight,
|
|
4972
5758
|
rows,
|
|
@@ -4978,21 +5764,22 @@ function TableHeaderWrapper(props) {
|
|
|
4978
5764
|
fixedColsEnd: computedPinnedEndColumns.length,
|
|
4979
5765
|
fixedColsStart: computedPinnedStartColumns.length
|
|
4980
5766
|
});
|
|
4981
|
-
const header = /* @__PURE__ */
|
|
5767
|
+
const header = /* @__PURE__ */ React27.createElement(InfiniteTableHeader, {
|
|
4982
5768
|
columns: computedVisibleColumns,
|
|
4983
|
-
|
|
5769
|
+
headerBrain,
|
|
5770
|
+
bodyBrain,
|
|
4984
5771
|
columnHeaderHeight: height,
|
|
4985
5772
|
columnGroupsMaxDepth,
|
|
4986
5773
|
columnAndGroupTreeInfo
|
|
4987
5774
|
});
|
|
4988
|
-
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */
|
|
5775
|
+
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ React27.createElement("div", {
|
|
4989
5776
|
className: HeaderScrollbarPlaceholderCls,
|
|
4990
5777
|
style: {
|
|
4991
5778
|
zIndex: 1e3,
|
|
4992
5779
|
width: getScrollbarWidth()
|
|
4993
5780
|
}
|
|
4994
5781
|
}) : null;
|
|
4995
|
-
return /* @__PURE__ */
|
|
5782
|
+
return /* @__PURE__ */ React27.createElement("div", {
|
|
4996
5783
|
className: HeaderWrapperCls,
|
|
4997
5784
|
style: {
|
|
4998
5785
|
height
|
|
@@ -5001,8 +5788,8 @@ function TableHeaderWrapper(props) {
|
|
|
5001
5788
|
}
|
|
5002
5789
|
|
|
5003
5790
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
5004
|
-
var
|
|
5005
|
-
var
|
|
5791
|
+
var React28 = __toModule(require("react"));
|
|
5792
|
+
var import_react28 = __toModule(require("react"));
|
|
5006
5793
|
|
|
5007
5794
|
// src/components/utils/decamelize.ts
|
|
5008
5795
|
function decamelize(str, options) {
|
|
@@ -5010,17 +5797,13 @@ function decamelize(str, options) {
|
|
|
5010
5797
|
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();
|
|
5011
5798
|
}
|
|
5012
5799
|
|
|
5013
|
-
// src/components/InfiniteTable/theme.css.ts
|
|
5014
|
-
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)" } } };
|
|
5015
|
-
var columnHeaderHeightName = "column-header-height";
|
|
5016
|
-
|
|
5017
5800
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5018
|
-
var
|
|
5801
|
+
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5019
5802
|
var FooterCls = "_16lm1iw1";
|
|
5020
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
5021
|
-
var InfiniteClsRecipe = (0,
|
|
5022
|
-
var InfiniteClsShiftingColumns = "
|
|
5023
|
-
var PinnedRowsContainerClsVariants = (0,
|
|
5803
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwn _16lm1iw13 _16lm1iw0";
|
|
5804
|
+
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"]] });
|
|
5805
|
+
var InfiniteClsShiftingColumns = "_16lm1iwq";
|
|
5806
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5024
5807
|
|
|
5025
5808
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
5026
5809
|
var defaultStyle = {
|
|
@@ -5049,10 +5832,10 @@ var enforceStyle = (node, style) => {
|
|
|
5049
5832
|
node.style.setProperty(decamelize(propertyName), propertyValue, "important");
|
|
5050
5833
|
}
|
|
5051
5834
|
};
|
|
5052
|
-
var InfiniteTableLicenseFooter =
|
|
5053
|
-
const { rootClassName:
|
|
5054
|
-
const domRef =
|
|
5055
|
-
const domCallback =
|
|
5835
|
+
var InfiniteTableLicenseFooter = React28.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
|
|
5836
|
+
const { rootClassName: rootClassName13 } = useInternalProps();
|
|
5837
|
+
const domRef = React28.useRef(null);
|
|
5838
|
+
const domCallback = React28.useCallback((node) => {
|
|
5056
5839
|
domRef.current = node;
|
|
5057
5840
|
if (!ref) {
|
|
5058
5841
|
return;
|
|
@@ -5063,7 +5846,7 @@ var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicens
|
|
|
5063
5846
|
ref.current = node;
|
|
5064
5847
|
}
|
|
5065
5848
|
}, []);
|
|
5066
|
-
(0,
|
|
5849
|
+
(0, import_react28.useEffect)(() => {
|
|
5067
5850
|
const forceStyle = () => {
|
|
5068
5851
|
requestAnimationFrame(() => {
|
|
5069
5852
|
var _a;
|
|
@@ -5077,12 +5860,12 @@ var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicens
|
|
|
5077
5860
|
clearInterval(intervalId);
|
|
5078
5861
|
};
|
|
5079
5862
|
}, []);
|
|
5080
|
-
return /* @__PURE__ */
|
|
5863
|
+
return /* @__PURE__ */ React28.createElement("div", __spreadProps(__spreadValues({
|
|
5081
5864
|
ref: domCallback
|
|
5082
5865
|
}, props), {
|
|
5083
|
-
className: join(`${
|
|
5866
|
+
className: join(`${rootClassName13}-Footer`, FooterCls, props.className),
|
|
5084
5867
|
style: defaultStyle
|
|
5085
|
-
}), "Powered by", " ", /* @__PURE__ */
|
|
5868
|
+
}), "Powered by", " ", /* @__PURE__ */ React28.createElement("a", {
|
|
5086
5869
|
href: "https://infinite-table.com",
|
|
5087
5870
|
rel: "noopener noreferrer",
|
|
5088
5871
|
role: "link",
|
|
@@ -5091,11 +5874,11 @@ var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicens
|
|
|
5091
5874
|
});
|
|
5092
5875
|
|
|
5093
5876
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5094
|
-
var
|
|
5095
|
-
var
|
|
5096
|
-
var { rootClassName:
|
|
5097
|
-
var InfiniteTableColumnCellContext =
|
|
5098
|
-
var InfiniteTableColumnCellClassName = `${
|
|
5877
|
+
var React29 = __toModule(require("react"));
|
|
5878
|
+
var import_react29 = __toModule(require("react"));
|
|
5879
|
+
var { rootClassName: rootClassName11 } = internalProps;
|
|
5880
|
+
var InfiniteTableColumnCellContext = React29.createContext(null);
|
|
5881
|
+
var InfiniteTableColumnCellClassName = `${rootClassName11}ColumnCell`;
|
|
5099
5882
|
function isColumnWithField(c) {
|
|
5100
5883
|
return typeof c.field === "string";
|
|
5101
5884
|
}
|
|
@@ -5109,9 +5892,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5109
5892
|
column,
|
|
5110
5893
|
onMouseLeave,
|
|
5111
5894
|
onMouseEnter,
|
|
5112
|
-
offsetProperty,
|
|
5113
5895
|
toggleGroupRow,
|
|
5114
|
-
virtualized,
|
|
5115
5896
|
rowIndex,
|
|
5116
5897
|
rowHeight,
|
|
5117
5898
|
domRef,
|
|
@@ -5119,7 +5900,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5119
5900
|
showZebraRows
|
|
5120
5901
|
} = props;
|
|
5121
5902
|
if (!column) {
|
|
5122
|
-
return /* @__PURE__ */
|
|
5903
|
+
return /* @__PURE__ */ React29.createElement("div", {
|
|
5123
5904
|
ref: domRef
|
|
5124
5905
|
}, "no column");
|
|
5125
5906
|
}
|
|
@@ -5152,7 +5933,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5152
5933
|
value
|
|
5153
5934
|
});
|
|
5154
5935
|
}
|
|
5155
|
-
const onClick = (0,
|
|
5936
|
+
const onClick = (0, import_react29.useCallback)(() => {
|
|
5156
5937
|
if (keyboardNavigation === "row") {
|
|
5157
5938
|
componentActions.activeRowIndex = rowIndex;
|
|
5158
5939
|
return;
|
|
@@ -5192,7 +5973,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5192
5973
|
isGroupRow,
|
|
5193
5974
|
rowIndex,
|
|
5194
5975
|
toggleGroupRow,
|
|
5195
|
-
toggleCurrentGroupRow: (0,
|
|
5976
|
+
toggleCurrentGroupRow: (0, import_react29.useCallback)(() => {
|
|
5196
5977
|
if (!rowInfo.isGroupRow) {
|
|
5197
5978
|
return;
|
|
5198
5979
|
}
|
|
@@ -5201,13 +5982,13 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5201
5982
|
groupBy: computedDataSource.groupBy,
|
|
5202
5983
|
pivotBy: computedDataSource.pivotBy
|
|
5203
5984
|
});
|
|
5204
|
-
const renderChildren = (0,
|
|
5985
|
+
const renderChildren = (0, import_react29.useCallback)(() => {
|
|
5205
5986
|
if (hidden) {
|
|
5206
5987
|
return null;
|
|
5207
5988
|
}
|
|
5208
5989
|
const renderFn = column.render || column.renderValue;
|
|
5209
5990
|
if (renderFn) {
|
|
5210
|
-
return /* @__PURE__ */
|
|
5991
|
+
return /* @__PURE__ */ React29.createElement(RenderHookComponent, {
|
|
5211
5992
|
render: renderFn,
|
|
5212
5993
|
renderParam
|
|
5213
5994
|
});
|
|
@@ -5224,18 +6005,15 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5224
6005
|
style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
|
|
5225
6006
|
}
|
|
5226
6007
|
style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
|
|
5227
|
-
style.width = width;
|
|
5228
6008
|
style.height = rowHeight;
|
|
5229
|
-
const memoizedStyle = (0,
|
|
6009
|
+
const memoizedStyle = (0, import_react29.useMemo)(() => style, [!style ? null : JSON.stringify(style)]);
|
|
5230
6010
|
const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
|
|
5231
6011
|
const zebra = showZebraRows ? odd ? "odd" : "even" : false;
|
|
5232
6012
|
const cellProps = {
|
|
5233
6013
|
domRef,
|
|
5234
|
-
offsetProperty,
|
|
5235
6014
|
cellType: "body",
|
|
5236
6015
|
column,
|
|
5237
6016
|
width,
|
|
5238
|
-
offset: virtualized ? 0 : column.computedPinningOffset,
|
|
5239
6017
|
style: memoizedStyle,
|
|
5240
6018
|
onMouseLeave,
|
|
5241
6019
|
onMouseEnter,
|
|
@@ -5245,44 +6023,44 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5245
6023
|
renderChildren
|
|
5246
6024
|
};
|
|
5247
6025
|
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
5248
|
-
return /* @__PURE__ */
|
|
6026
|
+
return /* @__PURE__ */ React29.createElement(ContextProvider, {
|
|
5249
6027
|
value: renderParam
|
|
5250
|
-
}, /* @__PURE__ */
|
|
6028
|
+
}, /* @__PURE__ */ React29.createElement(InfiniteTableCell, __spreadValues({}, cellProps)));
|
|
5251
6029
|
}
|
|
5252
|
-
var InfiniteTableColumnCell =
|
|
6030
|
+
var InfiniteTableColumnCell = React29.memo(InfiniteTableColumnCellFn);
|
|
5253
6031
|
function useInfiniteColumnCell() {
|
|
5254
|
-
const result = (0,
|
|
6032
|
+
const result = (0, import_react29.useContext)(InfiniteTableColumnCellContext);
|
|
5255
6033
|
return result;
|
|
5256
6034
|
}
|
|
5257
6035
|
|
|
5258
6036
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
5259
|
-
var
|
|
6037
|
+
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5260
6038
|
var GroupRowExpanderCls = "_7pupv0b";
|
|
5261
|
-
var RowClsRecipe = (0,
|
|
6039
|
+
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: [] });
|
|
5262
6040
|
var RowHoverCls = "_7pupv01";
|
|
5263
6041
|
|
|
5264
6042
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
5265
|
-
var
|
|
6043
|
+
var React30 = __toModule(require("react"));
|
|
5266
6044
|
|
|
5267
6045
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
5268
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
5269
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
6046
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz" };
|
|
6047
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz";
|
|
5270
6048
|
var LoadMaskTextCls = "qy58ya4";
|
|
5271
6049
|
|
|
5272
6050
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
5273
|
-
var { rootClassName:
|
|
5274
|
-
var baseCls3 = `${
|
|
6051
|
+
var { rootClassName: rootClassName12 } = internalProps;
|
|
6052
|
+
var baseCls3 = `${rootClassName12}-LoadMask`;
|
|
5275
6053
|
function LoadMaskFn(props) {
|
|
5276
6054
|
const { visible, children = "Loading" } = props;
|
|
5277
|
-
return /* @__PURE__ */
|
|
6055
|
+
return /* @__PURE__ */ React30.createElement("div", {
|
|
5278
6056
|
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls3}`
|
|
5279
|
-
}, /* @__PURE__ */
|
|
6057
|
+
}, /* @__PURE__ */ React30.createElement("div", {
|
|
5280
6058
|
className: `${LoadMaskOverlayCls} ${baseCls3}-Overlay`
|
|
5281
|
-
}), /* @__PURE__ */
|
|
6059
|
+
}), /* @__PURE__ */ React30.createElement("div", {
|
|
5282
6060
|
className: `${LoadMaskTextCls} ${baseCls3}-Text`
|
|
5283
6061
|
}, children));
|
|
5284
6062
|
}
|
|
5285
|
-
var LoadMask =
|
|
6063
|
+
var LoadMask = React30.memo(LoadMaskFn);
|
|
5286
6064
|
|
|
5287
6065
|
// src/components/InfiniteTable/getImperativeApi.ts
|
|
5288
6066
|
function getImperativeApi(getState, getComputed, getDataSourceState, componentActions) {
|
|
@@ -5347,7 +6125,7 @@ function getImperativeApi(getState, getComputed, getDataSourceState, componentAc
|
|
|
5347
6125
|
}
|
|
5348
6126
|
|
|
5349
6127
|
// src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
|
|
5350
|
-
var
|
|
6128
|
+
var import_react30 = __toModule(require("react"));
|
|
5351
6129
|
var OFFSET = 10;
|
|
5352
6130
|
function getColumnContentMaxWidths(domRef, options) {
|
|
5353
6131
|
var _a;
|
|
@@ -5383,9 +6161,15 @@ function getColumnContentMaxWidths(domRef, options) {
|
|
|
5383
6161
|
cell.childNodes.forEach((child) => {
|
|
5384
6162
|
if (child !== content) {
|
|
5385
6163
|
const el = child;
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
6164
|
+
let elWidth = Math.max(el.offsetWidth, parseInt(el.style.width, 10));
|
|
6165
|
+
if (isNaN(elWidth)) {
|
|
6166
|
+
elWidth = 0;
|
|
6167
|
+
}
|
|
6168
|
+
otherElementsLength += elWidth;
|
|
6169
|
+
if (elWidth > 0) {
|
|
6170
|
+
const style = getGlobal().getComputedStyle(el);
|
|
6171
|
+
otherElementsLength += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
|
|
6172
|
+
}
|
|
5389
6173
|
}
|
|
5390
6174
|
});
|
|
5391
6175
|
measuredWidth += otherElementsLength;
|
|
@@ -5407,11 +6191,11 @@ function useAutoSizeColumns() {
|
|
|
5407
6191
|
componentActions,
|
|
5408
6192
|
componentState: { domRef, ready, autoSizeColumnsKey, brain }
|
|
5409
6193
|
} = useComponentState();
|
|
5410
|
-
const [refreshId, setRefreshId] = (0,
|
|
6194
|
+
const [refreshId, setRefreshId] = (0, import_react30.useState)(0);
|
|
5411
6195
|
const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
|
|
5412
6196
|
const getTheKey = useLatest(theKey);
|
|
5413
|
-
const lastExecutedIdentifierRef = (0,
|
|
5414
|
-
(0,
|
|
6197
|
+
const lastExecutedIdentifierRef = (0, import_react30.useRef)(null);
|
|
6198
|
+
(0, import_react30.useEffect)(() => {
|
|
5415
6199
|
const key = getTheKey();
|
|
5416
6200
|
if (key == null) {
|
|
5417
6201
|
return;
|
|
@@ -5424,7 +6208,7 @@ function useAutoSizeColumns() {
|
|
|
5424
6208
|
};
|
|
5425
6209
|
return brain.onRenderRangeChange(onChange);
|
|
5426
6210
|
}, [brain]);
|
|
5427
|
-
(0,
|
|
6211
|
+
(0, import_react30.useEffect)(() => {
|
|
5428
6212
|
var _a;
|
|
5429
6213
|
if (theKey == null) {
|
|
5430
6214
|
return;
|
|
@@ -5469,8 +6253,8 @@ function useAutoSizeColumns() {
|
|
|
5469
6253
|
}
|
|
5470
6254
|
|
|
5471
6255
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
5472
|
-
var
|
|
5473
|
-
var
|
|
6256
|
+
var import_react31 = __toModule(require("react"));
|
|
6257
|
+
var import_react32 = __toModule(require("react"));
|
|
5474
6258
|
|
|
5475
6259
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
5476
6260
|
function useYourBrain(param) {
|
|
@@ -5540,13 +6324,13 @@ function useCellRendering(param) {
|
|
|
5540
6324
|
bodySize,
|
|
5541
6325
|
rowspan
|
|
5542
6326
|
});
|
|
5543
|
-
const scrollTopMaxRef = (0,
|
|
5544
|
-
(0,
|
|
6327
|
+
const scrollTopMaxRef = (0, import_react31.useRef)(0);
|
|
6328
|
+
(0, import_react31.useEffect)(() => {
|
|
5545
6329
|
return brain.onRenderCountChange(() => {
|
|
5546
6330
|
scrollTopMaxRef.current = brain.scrollTopMax;
|
|
5547
6331
|
});
|
|
5548
6332
|
}, [brain]);
|
|
5549
|
-
(0,
|
|
6333
|
+
(0, import_react31.useEffect)(() => {
|
|
5550
6334
|
return brain.onScrollStop((scrollPosition) => {
|
|
5551
6335
|
const { scrollTop } = scrollPosition;
|
|
5552
6336
|
if (scrollTop === 0) {
|
|
@@ -5563,7 +6347,7 @@ function useCellRendering(param) {
|
|
|
5563
6347
|
}
|
|
5564
6348
|
});
|
|
5565
6349
|
}, [brain, onScrollToTop, onScrollToBottom]);
|
|
5566
|
-
(0,
|
|
6350
|
+
(0, import_react31.useEffect)(() => {
|
|
5567
6351
|
if (!bodySize.height) {
|
|
5568
6352
|
return;
|
|
5569
6353
|
}
|
|
@@ -5574,10 +6358,10 @@ function useCellRendering(param) {
|
|
|
5574
6358
|
}
|
|
5575
6359
|
}, [!!bodySize.height]);
|
|
5576
6360
|
const [, rerender] = useRerender();
|
|
5577
|
-
(0,
|
|
6361
|
+
(0, import_react31.useEffect)(() => {
|
|
5578
6362
|
rerender();
|
|
5579
6363
|
}, [dataSourceState]);
|
|
5580
|
-
const renderCell = (0,
|
|
6364
|
+
const renderCell = (0, import_react31.useCallback)((params) => {
|
|
5581
6365
|
const {
|
|
5582
6366
|
rowIndex,
|
|
5583
6367
|
colIndex,
|
|
@@ -5612,7 +6396,7 @@ function useCellRendering(param) {
|
|
|
5612
6396
|
rowStyle,
|
|
5613
6397
|
rowClassName
|
|
5614
6398
|
};
|
|
5615
|
-
return /* @__PURE__ */
|
|
6399
|
+
return /* @__PURE__ */ import_react32.default.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
|
|
5616
6400
|
}, [
|
|
5617
6401
|
rowHeight,
|
|
5618
6402
|
getData,
|
|
@@ -5630,13 +6414,13 @@ function useCellRendering(param) {
|
|
|
5630
6414
|
}
|
|
5631
6415
|
|
|
5632
6416
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
5633
|
-
var
|
|
6417
|
+
var import_react46 = __toModule(require("react"));
|
|
5634
6418
|
|
|
5635
6419
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
5636
|
-
var
|
|
6420
|
+
var import_react34 = __toModule(require("react"));
|
|
5637
6421
|
|
|
5638
6422
|
// src/components/hooks/useInterceptedMap.ts
|
|
5639
|
-
var
|
|
6423
|
+
var import_react33 = __toModule(require("react"));
|
|
5640
6424
|
function interceptMap(map2, fns) {
|
|
5641
6425
|
const { set, delete: deleteKey, clear } = map2;
|
|
5642
6426
|
if (fns.set) {
|
|
@@ -5724,7 +6508,7 @@ function useColumnGroups() {
|
|
|
5724
6508
|
componentActions,
|
|
5725
6509
|
getComponentState
|
|
5726
6510
|
} = useComponentState();
|
|
5727
|
-
(0,
|
|
6511
|
+
(0, import_react34.useEffect)(() => {
|
|
5728
6512
|
const recompute = () => {
|
|
5729
6513
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
5730
6514
|
};
|
|
@@ -5735,7 +6519,7 @@ function useColumnGroups() {
|
|
|
5735
6519
|
set: update
|
|
5736
6520
|
});
|
|
5737
6521
|
}, [computedColumnGroups]);
|
|
5738
|
-
(0,
|
|
6522
|
+
(0, import_react34.useEffect)(() => {
|
|
5739
6523
|
return interceptMap(collapsedColumnGroups, {
|
|
5740
6524
|
set: (key, visibleCol) => {
|
|
5741
6525
|
const colIds = key.slice(1);
|
|
@@ -5770,10 +6554,10 @@ function useColumnGroups() {
|
|
|
5770
6554
|
}
|
|
5771
6555
|
|
|
5772
6556
|
// src/components/InfiniteTable/hooks/useColumnRowspan.ts
|
|
5773
|
-
var
|
|
6557
|
+
var import_react35 = __toModule(require("react"));
|
|
5774
6558
|
function useColumnRowspan(computedVisibleColumns) {
|
|
5775
6559
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
5776
|
-
const rowspan = (0,
|
|
6560
|
+
const rowspan = (0, import_react35.useMemo)(() => {
|
|
5777
6561
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
5778
6562
|
return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
|
|
5779
6563
|
const dataArray = getDataSourceState().dataArray;
|
|
@@ -5799,10 +6583,10 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
5799
6583
|
}
|
|
5800
6584
|
|
|
5801
6585
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
5802
|
-
var
|
|
6586
|
+
var import_react36 = __toModule(require("react"));
|
|
5803
6587
|
var debug4 = dbg("useColumnSizeFn");
|
|
5804
6588
|
function useColumnSizeFn(columns) {
|
|
5805
|
-
const columnSize = (0,
|
|
6589
|
+
const columnSize = (0, import_react36.useCallback)((index) => {
|
|
5806
6590
|
const column = columns[index];
|
|
5807
6591
|
if (false) {
|
|
5808
6592
|
debug4("cannot find column at index", index, columns);
|
|
@@ -5813,15 +6597,10 @@ function useColumnSizeFn(columns) {
|
|
|
5813
6597
|
}
|
|
5814
6598
|
|
|
5815
6599
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
5816
|
-
var
|
|
6600
|
+
var import_react42 = __toModule(require("react"));
|
|
5817
6601
|
|
|
5818
6602
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
5819
|
-
var
|
|
5820
|
-
|
|
5821
|
-
// src/utils/stripVar.ts
|
|
5822
|
-
function stripVar(cssVariableWithVarString) {
|
|
5823
|
-
return cssVariableWithVarString.slice(4, -1);
|
|
5824
|
-
}
|
|
6603
|
+
var React34 = __toModule(require("react"));
|
|
5825
6604
|
|
|
5826
6605
|
// src/components/DataSource/state/rowInfoStatus.ts
|
|
5827
6606
|
var showLoadingIcon = (rowInfo) => {
|
|
@@ -5832,19 +6611,19 @@ var showLoadingIcon = (rowInfo) => {
|
|
|
5832
6611
|
};
|
|
5833
6612
|
|
|
5834
6613
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5835
|
-
var
|
|
5836
|
-
var
|
|
6614
|
+
var React32 = __toModule(require("react"));
|
|
6615
|
+
var import_react37 = __toModule(require("react"));
|
|
5837
6616
|
|
|
5838
6617
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
5839
|
-
var
|
|
5840
|
-
var ExpanderIconCls = "_16lm1iw6
|
|
5841
|
-
var ExpanderIconClsVariants = (0,
|
|
6618
|
+
var import_createRuntimeFn6 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
6619
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwh _16lm1iwd";
|
|
6620
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn6.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5842
6621
|
|
|
5843
6622
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5844
6623
|
function ExpanderIcon(props) {
|
|
5845
6624
|
var _a;
|
|
5846
6625
|
const { size = 24 } = props;
|
|
5847
|
-
const [expanded, setExpanded] = (0,
|
|
6626
|
+
const [expanded, setExpanded] = (0, import_react37.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
5848
6627
|
const onClick = () => {
|
|
5849
6628
|
var _a2;
|
|
5850
6629
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
@@ -5852,12 +6631,12 @@ function ExpanderIcon(props) {
|
|
|
5852
6631
|
setExpanded(!expanded);
|
|
5853
6632
|
}
|
|
5854
6633
|
};
|
|
5855
|
-
|
|
6634
|
+
React32.useEffect(() => {
|
|
5856
6635
|
if (isControlled("expanded", props)) {
|
|
5857
6636
|
setExpanded(props.expanded);
|
|
5858
6637
|
}
|
|
5859
6638
|
}, [props.expanded]);
|
|
5860
|
-
return /* @__PURE__ */
|
|
6639
|
+
return /* @__PURE__ */ React32.createElement("svg", {
|
|
5861
6640
|
"data-name": "expander-icon",
|
|
5862
6641
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5863
6642
|
height: `${size}px`,
|
|
@@ -5868,20 +6647,20 @@ function ExpanderIcon(props) {
|
|
|
5868
6647
|
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
5869
6648
|
expanded
|
|
5870
6649
|
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
5871
|
-
}, /* @__PURE__ */
|
|
6650
|
+
}, /* @__PURE__ */ React32.createElement("path", {
|
|
5872
6651
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
5873
6652
|
}));
|
|
5874
6653
|
}
|
|
5875
6654
|
|
|
5876
6655
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5877
|
-
var
|
|
6656
|
+
var React33 = __toModule(require("react"));
|
|
5878
6657
|
|
|
5879
6658
|
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
5880
|
-
var LoadingIconCls = "_16lm1iw8
|
|
6659
|
+
var LoadingIconCls = "_16lm1iw8 _16lm1iwh _16lm1iwd";
|
|
5881
6660
|
|
|
5882
6661
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5883
6662
|
var LoadingIcon = (props) => {
|
|
5884
|
-
return /* @__PURE__ */
|
|
6663
|
+
return /* @__PURE__ */ React33.createElement("svg", {
|
|
5885
6664
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5886
6665
|
style: {
|
|
5887
6666
|
margin: "auto",
|
|
@@ -5893,14 +6672,14 @@ var LoadingIcon = (props) => {
|
|
|
5893
6672
|
viewBox: "0 0 100 100",
|
|
5894
6673
|
preserveAspectRatio: "xMidYMid",
|
|
5895
6674
|
className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
|
|
5896
|
-
}, /* @__PURE__ */
|
|
6675
|
+
}, /* @__PURE__ */ React33.createElement("circle", {
|
|
5897
6676
|
cx: "50",
|
|
5898
6677
|
cy: "50",
|
|
5899
6678
|
fill: "none",
|
|
5900
6679
|
strokeWidth: "10",
|
|
5901
6680
|
r: "35",
|
|
5902
6681
|
strokeDasharray: "164.93361431346415 56.97787143782138"
|
|
5903
|
-
}, /* @__PURE__ */
|
|
6682
|
+
}, /* @__PURE__ */ React33.createElement("animateTransform", {
|
|
5904
6683
|
attributeName: "transform",
|
|
5905
6684
|
type: "rotate",
|
|
5906
6685
|
repeatCount: "indefinite",
|
|
@@ -5920,7 +6699,7 @@ function getGroupColumnRender({
|
|
|
5920
6699
|
var _a, _b, _c;
|
|
5921
6700
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5922
6701
|
if (column.renderValue) {
|
|
5923
|
-
value = /* @__PURE__ */
|
|
6702
|
+
value = /* @__PURE__ */ React34.createElement(RenderHookComponent, {
|
|
5924
6703
|
render: column.renderValue,
|
|
5925
6704
|
renderParam: renderOptions
|
|
5926
6705
|
});
|
|
@@ -5950,22 +6729,22 @@ function getGroupColumnRender({
|
|
|
5950
6729
|
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);
|
|
5951
6730
|
const isLoading = showLoadingIcon(groupRowInfo);
|
|
5952
6731
|
if (isLoading) {
|
|
5953
|
-
icon = /* @__PURE__ */
|
|
6732
|
+
icon = /* @__PURE__ */ React34.createElement(LoadingIcon, null);
|
|
5954
6733
|
} else if (showExpanderIcon) {
|
|
5955
|
-
const defaultIcon = /* @__PURE__ */
|
|
6734
|
+
const defaultIcon = /* @__PURE__ */ React34.createElement(ExpanderIcon, {
|
|
5956
6735
|
expanded: !collapsed,
|
|
5957
6736
|
onChange: () => {
|
|
5958
6737
|
toggleGroupRow(groupKeys);
|
|
5959
6738
|
}
|
|
5960
6739
|
});
|
|
5961
|
-
icon = column.renderGroupIcon ? /* @__PURE__ */
|
|
6740
|
+
icon = column.renderGroupIcon ? /* @__PURE__ */ React34.createElement(RenderHookComponent, {
|
|
5962
6741
|
render: column.renderGroupIcon,
|
|
5963
6742
|
renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
|
|
5964
6743
|
}) : defaultIcon;
|
|
5965
6744
|
}
|
|
5966
|
-
return /* @__PURE__ */
|
|
6745
|
+
return /* @__PURE__ */ React34.createElement("div", {
|
|
5967
6746
|
className: join(display.flex, alignItems.center)
|
|
5968
|
-
}, icon, /* @__PURE__ */
|
|
6747
|
+
}, icon, /* @__PURE__ */ React34.createElement("div", {
|
|
5969
6748
|
className: cssEllipsisClassName
|
|
5970
6749
|
}, value != null ? value : null));
|
|
5971
6750
|
};
|
|
@@ -6010,9 +6789,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
6010
6789
|
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;
|
|
6011
6790
|
const isLoading = showLoadingIcon(rowInfo);
|
|
6012
6791
|
if (isLoading) {
|
|
6013
|
-
icon = /* @__PURE__ */
|
|
6792
|
+
icon = /* @__PURE__ */ React34.createElement(LoadingIcon, null);
|
|
6014
6793
|
} else if (showExpanderIcon) {
|
|
6015
|
-
const defaultIcon = /* @__PURE__ */
|
|
6794
|
+
const defaultIcon = /* @__PURE__ */ React34.createElement(ExpanderIcon, {
|
|
6016
6795
|
expanded: !collapsed,
|
|
6017
6796
|
onChange: () => {
|
|
6018
6797
|
if (!rowInfo.isGroupRow) {
|
|
@@ -6027,9 +6806,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
6027
6806
|
icon = column.renderGroupIcon(renderParam);
|
|
6028
6807
|
}
|
|
6029
6808
|
}
|
|
6030
|
-
return /* @__PURE__ */
|
|
6809
|
+
return /* @__PURE__ */ React34.createElement("div", {
|
|
6031
6810
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
6032
|
-
}, icon, /* @__PURE__ */
|
|
6811
|
+
}, icon, /* @__PURE__ */ React34.createElement("div", {
|
|
6033
6812
|
className: cssEllipsisClassName
|
|
6034
6813
|
}, value != null ? value : null));
|
|
6035
6814
|
}
|
|
@@ -6045,11 +6824,11 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
6045
6824
|
}
|
|
6046
6825
|
|
|
6047
6826
|
// src/components/InfiniteTable/hooks/useEffectWithRaf.ts
|
|
6048
|
-
var
|
|
6827
|
+
var import_react38 = __toModule(require("react"));
|
|
6049
6828
|
function useEffectWithRaf(fn, deps) {
|
|
6050
|
-
const rafId = (0,
|
|
6051
|
-
const removeFnRaf = (0,
|
|
6052
|
-
(0,
|
|
6829
|
+
const rafId = (0, import_react38.useRef)(0);
|
|
6830
|
+
const removeFnRaf = (0, import_react38.useRef)();
|
|
6831
|
+
(0, import_react38.useEffect)(() => {
|
|
6053
6832
|
rafId.current = requestAnimationFrame(() => {
|
|
6054
6833
|
removeFnRaf.current = fn();
|
|
6055
6834
|
});
|
|
@@ -6066,7 +6845,7 @@ function useEffectWithRaf(fn, deps) {
|
|
|
6066
6845
|
}
|
|
6067
6846
|
|
|
6068
6847
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
6069
|
-
var
|
|
6848
|
+
var import_react41 = __toModule(require("react"));
|
|
6070
6849
|
|
|
6071
6850
|
// src/utils/groupAndPivot/index.ts
|
|
6072
6851
|
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
@@ -6519,7 +7298,7 @@ function enhancedFlatten(param) {
|
|
|
6519
7298
|
}
|
|
6520
7299
|
|
|
6521
7300
|
// src/components/DataSource/index.tsx
|
|
6522
|
-
var
|
|
7301
|
+
var React35 = __toModule(require("react"));
|
|
6523
7302
|
|
|
6524
7303
|
// src/utils/multisort/sortTypes.ts
|
|
6525
7304
|
var numberComparator = function(first, second) {
|
|
@@ -6707,15 +7486,15 @@ var GroupRowsState = class {
|
|
|
6707
7486
|
};
|
|
6708
7487
|
|
|
6709
7488
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
6710
|
-
var
|
|
7489
|
+
var import_react40 = __toModule(require("react"));
|
|
6711
7490
|
|
|
6712
7491
|
// src/components/hooks/useEffectWithChanges.ts
|
|
6713
|
-
var
|
|
7492
|
+
var import_react39 = __toModule(require("react"));
|
|
6714
7493
|
function useEffectWithChanges(fn, deps) {
|
|
6715
|
-
const prevRef = (0,
|
|
6716
|
-
const oldValuesRef = (0,
|
|
7494
|
+
const prevRef = (0, import_react39.useRef)({});
|
|
7495
|
+
const oldValuesRef = (0, import_react39.useRef)({});
|
|
6717
7496
|
const oldValues = oldValuesRef.current;
|
|
6718
|
-
const changesRef = (0,
|
|
7497
|
+
const changesRef = (0, import_react39.useRef)({});
|
|
6719
7498
|
const changes = changesRef.current;
|
|
6720
7499
|
const useEffectDeps = [];
|
|
6721
7500
|
for (const k in deps) {
|
|
@@ -6728,7 +7507,7 @@ function useEffectWithChanges(fn, deps) {
|
|
|
6728
7507
|
}
|
|
6729
7508
|
}
|
|
6730
7509
|
prevRef.current = deps;
|
|
6731
|
-
(0,
|
|
7510
|
+
(0, import_react39.useEffect)(() => {
|
|
6732
7511
|
const changes2 = changesRef.current;
|
|
6733
7512
|
const result = fn(changes2, oldValues);
|
|
6734
7513
|
changesRef.current = {};
|
|
@@ -6996,12 +7775,12 @@ function useLoadData() {
|
|
|
6996
7775
|
livePaginationCursor,
|
|
6997
7776
|
cursorId: stateCursorId
|
|
6998
7777
|
} = componentState;
|
|
6999
|
-
const [scrollbars, setScrollbars] = (0,
|
|
7778
|
+
const [scrollbars, setScrollbars] = (0, import_react40.useState)({
|
|
7000
7779
|
vertical: false,
|
|
7001
7780
|
horizontal: false
|
|
7002
7781
|
});
|
|
7003
|
-
const scrollbarsRef = (0,
|
|
7004
|
-
(0,
|
|
7782
|
+
const scrollbarsRef = (0, import_react40.useRef)(scrollbars);
|
|
7783
|
+
(0, import_react40.useEffect)(() => {
|
|
7005
7784
|
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
7006
7785
|
if (!scrollbars2) {
|
|
7007
7786
|
return;
|
|
@@ -7011,7 +7790,7 @@ function useLoadData() {
|
|
|
7011
7790
|
});
|
|
7012
7791
|
return () => notifyScrollbarsChange.destroy();
|
|
7013
7792
|
}, [notifyScrollbarsChange]);
|
|
7014
|
-
(0,
|
|
7793
|
+
(0, import_react40.useEffect)(() => {
|
|
7015
7794
|
if (!livePagination) {
|
|
7016
7795
|
return;
|
|
7017
7796
|
}
|
|
@@ -7025,7 +7804,7 @@ function useLoadData() {
|
|
|
7025
7804
|
});
|
|
7026
7805
|
return () => cancelAnimationFrame(frameId);
|
|
7027
7806
|
}, [livePaginationCursor]);
|
|
7028
|
-
(0,
|
|
7807
|
+
(0, import_react40.useEffect)(() => {
|
|
7029
7808
|
if (!livePagination || livePaginationCursor !== void 0) {
|
|
7030
7809
|
return;
|
|
7031
7810
|
}
|
|
@@ -7039,7 +7818,7 @@ function useLoadData() {
|
|
|
7039
7818
|
});
|
|
7040
7819
|
return () => cancelAnimationFrame(frameId);
|
|
7041
7820
|
}, [dataArray.length, livePaginationCursor]);
|
|
7042
|
-
(0,
|
|
7821
|
+
(0, import_react40.useEffect)(() => {
|
|
7043
7822
|
const state = getComponentState();
|
|
7044
7823
|
const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2, dataArray: dataArray2 } = state;
|
|
7045
7824
|
if (!scrollbars.vertical && livePagination2) {
|
|
@@ -7057,7 +7836,7 @@ function useLoadData() {
|
|
|
7057
7836
|
filterValue,
|
|
7058
7837
|
cursorId: livePagination ? stateCursorId : null
|
|
7059
7838
|
};
|
|
7060
|
-
const initialRef = (0,
|
|
7839
|
+
const initialRef = (0, import_react40.useRef)(true);
|
|
7061
7840
|
useLazyLoadRange();
|
|
7062
7841
|
useEffectWithChanges(() => {
|
|
7063
7842
|
const componentState2 = getComponentState();
|
|
@@ -7089,7 +7868,7 @@ function useLazyLoadRange() {
|
|
|
7089
7868
|
componentActions: actions,
|
|
7090
7869
|
componentState
|
|
7091
7870
|
} = useComponentState();
|
|
7092
|
-
(0,
|
|
7871
|
+
(0, import_react40.useEffect)(() => {
|
|
7093
7872
|
actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
|
|
7094
7873
|
}, [componentState.data, componentState.dataParams]);
|
|
7095
7874
|
const {
|
|
@@ -7098,7 +7877,7 @@ function useLazyLoadRange() {
|
|
|
7098
7877
|
dataArray,
|
|
7099
7878
|
scrollStopDelayUpdatedByTable
|
|
7100
7879
|
} = componentState;
|
|
7101
|
-
const latestRenderRangeRef = (0,
|
|
7880
|
+
const latestRenderRangeRef = (0, import_react40.useRef)(null);
|
|
7102
7881
|
const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
|
|
7103
7882
|
const componentState2 = getComponentState();
|
|
7104
7883
|
renderRange = renderRange || latestRenderRangeRef.current;
|
|
@@ -7117,8 +7896,8 @@ function useLazyLoadRange() {
|
|
|
7117
7896
|
componentActions: actions
|
|
7118
7897
|
}, cache);
|
|
7119
7898
|
};
|
|
7120
|
-
const debouncedLoadRange = (0,
|
|
7121
|
-
(0,
|
|
7899
|
+
const debouncedLoadRange = (0, import_react40.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
7900
|
+
(0, import_react40.useEffect)(() => {
|
|
7122
7901
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
7123
7902
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
7124
7903
|
latestRenderRangeRef.current = renderRange;
|
|
@@ -7127,7 +7906,7 @@ function useLazyLoadRange() {
|
|
|
7127
7906
|
}
|
|
7128
7907
|
return;
|
|
7129
7908
|
}, [lazyLoadBatchSize]);
|
|
7130
|
-
(0,
|
|
7909
|
+
(0, import_react40.useEffect)(() => {
|
|
7131
7910
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
7132
7911
|
debouncedLoadRange();
|
|
7133
7912
|
}
|
|
@@ -7930,7 +8709,7 @@ function DataSourceWithContext(props) {
|
|
|
7930
8709
|
if (typeof children === "function") {
|
|
7931
8710
|
children = children(computedValues);
|
|
7932
8711
|
}
|
|
7933
|
-
return /* @__PURE__ */
|
|
8712
|
+
return /* @__PURE__ */ React35.createElement(React35.Fragment, null, children);
|
|
7934
8713
|
}
|
|
7935
8714
|
var DataSourceRoot = getComponentStateRoot({
|
|
7936
8715
|
initSetupState,
|
|
@@ -7953,14 +8732,14 @@ function DataSourceCmp({ children }) {
|
|
|
7953
8732
|
globalThis.getDataSourceState = getState;
|
|
7954
8733
|
}
|
|
7955
8734
|
useLoadData();
|
|
7956
|
-
return /* @__PURE__ */
|
|
8735
|
+
return /* @__PURE__ */ React35.createElement(DataSourceContext.Provider, {
|
|
7957
8736
|
value: contextValue
|
|
7958
|
-
}, /* @__PURE__ */
|
|
8737
|
+
}, /* @__PURE__ */ React35.createElement(DataSourceWithContext, {
|
|
7959
8738
|
children
|
|
7960
8739
|
}));
|
|
7961
8740
|
}
|
|
7962
8741
|
function DataSource(props) {
|
|
7963
|
-
return /* @__PURE__ */
|
|
8742
|
+
return /* @__PURE__ */ React35.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React35.createElement(DataSourceCmp, {
|
|
7964
8743
|
children: props.children
|
|
7965
8744
|
}));
|
|
7966
8745
|
}
|
|
@@ -7968,7 +8747,7 @@ function DataSource(props) {
|
|
|
7968
8747
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
7969
8748
|
function useToggleGroupRow() {
|
|
7970
8749
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
7971
|
-
const toggleGroupRow = (0,
|
|
8750
|
+
const toggleGroupRow = (0, import_react41.useCallback)((groupKeys) => {
|
|
7972
8751
|
const state = getDataSourceState();
|
|
7973
8752
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
7974
8753
|
newState.toggleGroupRow(groupKeys);
|
|
@@ -8000,7 +8779,7 @@ function useToggleGroupRow() {
|
|
|
8000
8779
|
|
|
8001
8780
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
8002
8781
|
function useGroupByMap(groupBy) {
|
|
8003
|
-
const groupByMap = (0,
|
|
8782
|
+
const groupByMap = (0, import_react42.useMemo)(() => {
|
|
8004
8783
|
return groupBy.reduce((acc, groupBy2, index) => {
|
|
8005
8784
|
acc.set(groupBy2.field, {
|
|
8006
8785
|
groupBy: groupBy2,
|
|
@@ -8024,13 +8803,13 @@ function useColumnsWhen() {
|
|
|
8024
8803
|
}
|
|
8025
8804
|
} = useComponentState();
|
|
8026
8805
|
const groupByMap = useGroupByMap(groupBy);
|
|
8027
|
-
(0,
|
|
8806
|
+
(0, import_react42.useEffect)(() => {
|
|
8028
8807
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
8029
8808
|
}, [groupRenderStrategy]);
|
|
8030
|
-
(0,
|
|
8809
|
+
(0, import_react42.useEffect)(() => {
|
|
8031
8810
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
8032
8811
|
}, [pivotTotalColumnPosition]);
|
|
8033
|
-
(0,
|
|
8812
|
+
(0, import_react42.useEffect)(() => {
|
|
8034
8813
|
if (pivotGrandTotalColumnPosition != void 0) {
|
|
8035
8814
|
dataSourceActions.pivotGrandTotalColumnPosition = pivotGrandTotalColumnPosition;
|
|
8036
8815
|
}
|
|
@@ -8104,7 +8883,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
8104
8883
|
});
|
|
8105
8884
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
8106
8885
|
}
|
|
8107
|
-
(0,
|
|
8886
|
+
(0, import_react42.useEffect)(() => {
|
|
8108
8887
|
const update = () => {
|
|
8109
8888
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
8110
8889
|
};
|
|
@@ -8133,7 +8912,7 @@ function useColumnsWhenGrouping() {
|
|
|
8133
8912
|
}
|
|
8134
8913
|
} = useComponentState();
|
|
8135
8914
|
const toggleGroupRow = useToggleGroupRow();
|
|
8136
|
-
(0,
|
|
8915
|
+
(0, import_react42.useEffect)(() => {
|
|
8137
8916
|
const update = () => {
|
|
8138
8917
|
const columnsWhenGrouping = getColumnsWhenGrouping({
|
|
8139
8918
|
columns,
|
|
@@ -8269,7 +9048,7 @@ function useHideColumns(groupByMap) {
|
|
|
8269
9048
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
8270
9049
|
hideEmptyGroupColumns
|
|
8271
9050
|
]);
|
|
8272
|
-
(0,
|
|
9051
|
+
(0, import_react42.useEffect)(() => {
|
|
8273
9052
|
const isGrouped = groupBy.length > 0;
|
|
8274
9053
|
const currentState = getComponentState();
|
|
8275
9054
|
const { controlledColumnVisibility, columnVisibility } = currentState;
|
|
@@ -8384,145 +9163,7 @@ function getColumnsWhenGrouping(params) {
|
|
|
8384
9163
|
}
|
|
8385
9164
|
|
|
8386
9165
|
// src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
|
|
8387
|
-
var
|
|
8388
|
-
|
|
8389
|
-
// src/components/flexbox/index.ts
|
|
8390
|
-
var computeFlex = (params) => {
|
|
8391
|
-
const {
|
|
8392
|
-
availableSize,
|
|
8393
|
-
items,
|
|
8394
|
-
minSize: defaultMinSize,
|
|
8395
|
-
maxSize: defaultMaxSize
|
|
8396
|
-
} = params;
|
|
8397
|
-
if (availableSize < 0) {
|
|
8398
|
-
throw "The provided availableSize cannot be negative!";
|
|
8399
|
-
}
|
|
8400
|
-
let totalFixedSize = 0;
|
|
8401
|
-
let totalFlex = 0;
|
|
8402
|
-
let totalFlexCount = 0;
|
|
8403
|
-
const minSizes = [];
|
|
8404
|
-
const maxSizes = [];
|
|
8405
|
-
items.forEach((item, i) => {
|
|
8406
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8407
|
-
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
8408
|
-
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
8409
|
-
minSizes.push(minSize);
|
|
8410
|
-
maxSizes.push(maxSize);
|
|
8411
|
-
if (item.size != null) {
|
|
8412
|
-
if (maxSize != null && item.size > maxSize) {
|
|
8413
|
-
item.size = maxSize;
|
|
8414
|
-
}
|
|
8415
|
-
if (minSize != null && item.size < minSize) {
|
|
8416
|
-
item.size = minSize;
|
|
8417
|
-
}
|
|
8418
|
-
}
|
|
8419
|
-
if (item.size == null && item.flex == null) {
|
|
8420
|
-
throw `Items must specify either a size or a flex property. Item at index ${i} doesn't have either of those.`;
|
|
8421
|
-
}
|
|
8422
|
-
if (item.flex != null) {
|
|
8423
|
-
totalFlexCount += 1;
|
|
8424
|
-
}
|
|
8425
|
-
totalFlex += (_e = item.flex) != null ? _e : 0;
|
|
8426
|
-
totalFixedSize += (_f = item.size) != null ? _f : 0;
|
|
8427
|
-
});
|
|
8428
|
-
let availableSizeForFlex = Math.max(availableSize - totalFixedSize, 0);
|
|
8429
|
-
let sizePerFlex = availableSizeForFlex / totalFlex;
|
|
8430
|
-
let maxxedFlexItems = {};
|
|
8431
|
-
let minnedFlexItems = {};
|
|
8432
|
-
let constrainedCount = 0;
|
|
8433
|
-
items.forEach((item, index) => {
|
|
8434
|
-
var _a, _b, _c, _d;
|
|
8435
|
-
if (item.flex != null) {
|
|
8436
|
-
const approxFlexSize = sizePerFlex * item.flex;
|
|
8437
|
-
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
8438
|
-
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
8439
|
-
let constrained = false;
|
|
8440
|
-
let substractSize = 0;
|
|
8441
|
-
if (maxSize != null && approxFlexSize > maxSize) {
|
|
8442
|
-
maxxedFlexItems[index] = true;
|
|
8443
|
-
constrained = true;
|
|
8444
|
-
substractSize = maxSize;
|
|
8445
|
-
}
|
|
8446
|
-
if (minSize != null && approxFlexSize < minSize) {
|
|
8447
|
-
minnedFlexItems[index] = true;
|
|
8448
|
-
constrained = true;
|
|
8449
|
-
substractSize = minSize;
|
|
8450
|
-
}
|
|
8451
|
-
if (constrained) {
|
|
8452
|
-
constrainedCount += 1;
|
|
8453
|
-
totalFlexCount -= 1;
|
|
8454
|
-
totalFlex -= item.flex;
|
|
8455
|
-
availableSizeForFlex -= substractSize;
|
|
8456
|
-
}
|
|
8457
|
-
}
|
|
8458
|
-
});
|
|
8459
|
-
if (constrainedCount) {
|
|
8460
|
-
sizePerFlex = availableSizeForFlex / totalFlex;
|
|
8461
|
-
}
|
|
8462
|
-
let flexSizes = [];
|
|
8463
|
-
let currentFlexCount = 0;
|
|
8464
|
-
let remainingSizeForFlex = availableSizeForFlex;
|
|
8465
|
-
let remainingFlex = totalFlex;
|
|
8466
|
-
let totalTakenSize = 0;
|
|
8467
|
-
let flexSizeSum = 0;
|
|
8468
|
-
const computedSizes = [];
|
|
8469
|
-
const resultItems = items.map((item, index) => {
|
|
8470
|
-
var _a, _b, _c, _d, _e;
|
|
8471
|
-
const sizedItem = __spreadValues({}, item);
|
|
8472
|
-
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
8473
|
-
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
8474
|
-
let flexSize = 0;
|
|
8475
|
-
const maxxed = maxxedFlexItems[index];
|
|
8476
|
-
const minned = minnedFlexItems[index];
|
|
8477
|
-
const constrained = maxxed || minned;
|
|
8478
|
-
let computedSize = (_e = item.size) != null ? _e : 0;
|
|
8479
|
-
if (item.flex != null) {
|
|
8480
|
-
if (constrained) {
|
|
8481
|
-
if (minned) {
|
|
8482
|
-
flexSize = minSize;
|
|
8483
|
-
}
|
|
8484
|
-
if (maxxed) {
|
|
8485
|
-
flexSize = maxSize;
|
|
8486
|
-
}
|
|
8487
|
-
} else {
|
|
8488
|
-
currentFlexCount += 1;
|
|
8489
|
-
const constrain = (size) => {
|
|
8490
|
-
if (maxSize != null && size > maxSize) {
|
|
8491
|
-
size = maxSize;
|
|
8492
|
-
}
|
|
8493
|
-
if (minSize != null && size < minSize) {
|
|
8494
|
-
size = minSize;
|
|
8495
|
-
}
|
|
8496
|
-
return size;
|
|
8497
|
-
};
|
|
8498
|
-
if (currentFlexCount === totalFlexCount) {
|
|
8499
|
-
flexSize = constrain(remainingSizeForFlex);
|
|
8500
|
-
} else {
|
|
8501
|
-
flexSize = constrain(Math.round(item.flex * sizePerFlex));
|
|
8502
|
-
flexSizeSum += flexSize;
|
|
8503
|
-
remainingSizeForFlex = availableSizeForFlex - flexSizeSum;
|
|
8504
|
-
remainingFlex -= item.flex;
|
|
8505
|
-
sizePerFlex = remainingSizeForFlex / remainingFlex;
|
|
8506
|
-
}
|
|
8507
|
-
}
|
|
8508
|
-
computedSize = flexSize;
|
|
8509
|
-
sizedItem.flexSize = flexSize;
|
|
8510
|
-
}
|
|
8511
|
-
flexSizes.push(flexSize);
|
|
8512
|
-
computedSizes.push(computedSize);
|
|
8513
|
-
sizedItem.computedSize = computedSize;
|
|
8514
|
-
totalTakenSize += computedSize;
|
|
8515
|
-
return sizedItem;
|
|
8516
|
-
});
|
|
8517
|
-
return {
|
|
8518
|
-
items: resultItems,
|
|
8519
|
-
flexSizes,
|
|
8520
|
-
minSizes,
|
|
8521
|
-
maxSizes,
|
|
8522
|
-
computedSizes,
|
|
8523
|
-
remainingSize: Math.round(availableSize - totalTakenSize)
|
|
8524
|
-
};
|
|
8525
|
-
};
|
|
9166
|
+
var import_react44 = __toModule(require("react"));
|
|
8526
9167
|
|
|
8527
9168
|
// src/components/InfiniteTable/utils/adjustColumnOrderForPinning.ts
|
|
8528
9169
|
var order = ["start", void 0, "end"];
|
|
@@ -8716,8 +9357,8 @@ var getComputedVisibleColumns = ({
|
|
|
8716
9357
|
const computedSortIndex = (_c = sortingInfo == null ? void 0 : sortingInfo.index) != null ? _c : -1;
|
|
8717
9358
|
const computedWidth = computedSizes[i];
|
|
8718
9359
|
const computedFlex = flexSizes[i] || null;
|
|
8719
|
-
const computedMinWidth = minSizes[i] ||
|
|
8720
|
-
const computedMaxWidth = maxSizes[i] ||
|
|
9360
|
+
const computedMinWidth = minSizes[i] || 0;
|
|
9361
|
+
const computedMaxWidth = maxSizes[i] || 1e4;
|
|
8721
9362
|
const computedPinned = getComputedPinned(id, columnPinning);
|
|
8722
9363
|
const computedLast = i === visibleColumnOrder.length - 1;
|
|
8723
9364
|
const computedPinningOffset = computedPinned === "start" ? computedPinnedStartColumnsWidth : computedPinned === "end" ? computedPinnedEndColumnsWidth : computedOffset - computedPinnedStartColumnsWidth;
|
|
@@ -8870,10 +9511,10 @@ var getComputedVisibleColumns = ({
|
|
|
8870
9511
|
};
|
|
8871
9512
|
|
|
8872
9513
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
8873
|
-
var
|
|
9514
|
+
var import_react43 = __toModule(require("react"));
|
|
8874
9515
|
var useRerenderOnKeyChange = (map2) => {
|
|
8875
9516
|
const [renderId, rerender] = useRerender();
|
|
8876
|
-
(0,
|
|
9517
|
+
(0, import_react43.useEffect)(() => {
|
|
8877
9518
|
const update = rafFn(rerender);
|
|
8878
9519
|
return interceptMap(map2, {
|
|
8879
9520
|
set: update,
|
|
@@ -8927,7 +9568,7 @@ var useComputedVisibleColumns = ({
|
|
|
8927
9568
|
computedPinnedEndOffset,
|
|
8928
9569
|
computedPinnedEndWidth,
|
|
8929
9570
|
computedPinnedStartWidth
|
|
8930
|
-
} = (0,
|
|
9571
|
+
} = (0, import_react44.useMemo)(() => {
|
|
8931
9572
|
return getComputedVisibleColumns({
|
|
8932
9573
|
columns,
|
|
8933
9574
|
bodySize,
|
|
@@ -8959,6 +9600,7 @@ var useComputedVisibleColumns = ({
|
|
|
8959
9600
|
columnMinWidth,
|
|
8960
9601
|
columnMaxWidth,
|
|
8961
9602
|
columnDefaultWidth,
|
|
9603
|
+
viewportReservedWidth,
|
|
8962
9604
|
sortable,
|
|
8963
9605
|
sortInfo,
|
|
8964
9606
|
setSortInfo,
|
|
@@ -8967,6 +9609,7 @@ var useComputedVisibleColumns = ({
|
|
|
8967
9609
|
columnOrder,
|
|
8968
9610
|
columnVisibility,
|
|
8969
9611
|
columnVisibilityAssumeVisible,
|
|
9612
|
+
resizableColumns,
|
|
8970
9613
|
pinnedEndMaxWidth,
|
|
8971
9614
|
pinnedStartMaxWidth,
|
|
8972
9615
|
columnSizing,
|
|
@@ -8996,7 +9639,7 @@ var useComputedVisibleColumns = ({
|
|
|
8996
9639
|
};
|
|
8997
9640
|
|
|
8998
9641
|
// src/components/InfiniteTable/hooks/useScrollbars.ts
|
|
8999
|
-
var
|
|
9642
|
+
var import_react45 = __toModule(require("react"));
|
|
9000
9643
|
var INITIAL_SCROLLBARS = {
|
|
9001
9644
|
vertical: false,
|
|
9002
9645
|
horizontal: false
|
|
@@ -9004,8 +9647,8 @@ var INITIAL_SCROLLBARS = {
|
|
|
9004
9647
|
function useScrollbars(brain) {
|
|
9005
9648
|
const { getComponentState: getInfiniteTableState } = useComponentState();
|
|
9006
9649
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
9007
|
-
const [scrollbars, setScrollbars] = (0,
|
|
9008
|
-
(0,
|
|
9650
|
+
const [scrollbars, setScrollbars] = (0, import_react45.useState)(INITIAL_SCROLLBARS);
|
|
9651
|
+
(0, import_react45.useEffect)(() => {
|
|
9009
9652
|
return brain.onRenderCountChange(() => {
|
|
9010
9653
|
const { scrollTopMax, scrollLeftMax } = brain;
|
|
9011
9654
|
setScrollbars({
|
|
@@ -9014,7 +9657,7 @@ function useScrollbars(brain) {
|
|
|
9014
9657
|
});
|
|
9015
9658
|
});
|
|
9016
9659
|
}, [brain]);
|
|
9017
|
-
(0,
|
|
9660
|
+
(0, import_react45.useLayoutEffect)(() => {
|
|
9018
9661
|
const dataSourceState = getDataSourceState();
|
|
9019
9662
|
const { onScrollbarsChange } = getInfiniteTableState();
|
|
9020
9663
|
const { notifyScrollbarsChange } = dataSourceState;
|
|
@@ -9045,7 +9688,7 @@ function useComputed() {
|
|
|
9045
9688
|
bodySize,
|
|
9046
9689
|
showSeparatePivotColumnForSingleAggregation
|
|
9047
9690
|
} = componentState;
|
|
9048
|
-
(0,
|
|
9691
|
+
(0, import_react46.useState)(() => {
|
|
9049
9692
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
9050
9693
|
if (rowHeight) {
|
|
9051
9694
|
componentActions.rowHeight = rowHeight;
|
|
@@ -9057,13 +9700,13 @@ function useComputed() {
|
|
|
9057
9700
|
}
|
|
9058
9701
|
});
|
|
9059
9702
|
});
|
|
9060
|
-
(0,
|
|
9703
|
+
(0, import_react46.useEffect)(() => {
|
|
9061
9704
|
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
9062
9705
|
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
9063
9706
|
const { multiSort, filterValue } = dataSourceState;
|
|
9064
9707
|
useColumnGroups();
|
|
9065
9708
|
const { toggleGroupRow } = useColumnsWhen();
|
|
9066
|
-
const setSortInfo = (0,
|
|
9709
|
+
const setSortInfo = (0, import_react46.useCallback)((sortInfo) => {
|
|
9067
9710
|
var _a2;
|
|
9068
9711
|
const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
9069
9712
|
dataSourceActions.sortInfo = newSortInfo;
|
|
@@ -9141,6 +9784,10 @@ function useComputed() {
|
|
|
9141
9784
|
}
|
|
9142
9785
|
|
|
9143
9786
|
// src/components/InfiniteTable/hooks/useDOMProps.ts
|
|
9787
|
+
var columnWidthAtIndex4 = stripVar(InternalVars.columnWidthAtIndex);
|
|
9788
|
+
var columnOffsetAtIndex2 = stripVar(InternalVars.columnOffsetAtIndex);
|
|
9789
|
+
var activeCellColWidth = stripVar(InternalVars.activeCellColWidth);
|
|
9790
|
+
var activeCellColOffset = stripVar(InternalVars.activeCellColOffset);
|
|
9144
9791
|
function useDOMProps(initialDOMProps) {
|
|
9145
9792
|
const { computed, componentState, componentActions } = useInfiniteTable();
|
|
9146
9793
|
const {
|
|
@@ -9151,9 +9798,24 @@ function useDOMProps(initialDOMProps) {
|
|
|
9151
9798
|
onBlurWithin,
|
|
9152
9799
|
onFocusWithin,
|
|
9153
9800
|
onSelfFocus,
|
|
9154
|
-
onSelfBlur
|
|
9801
|
+
onSelfBlur,
|
|
9802
|
+
activeCellIndex
|
|
9155
9803
|
} = componentState;
|
|
9156
|
-
const {
|
|
9804
|
+
const {
|
|
9805
|
+
computedPinnedStartColumnsWidth,
|
|
9806
|
+
computedPinnedEndColumnsWidth,
|
|
9807
|
+
computedVisibleColumns
|
|
9808
|
+
} = computed;
|
|
9809
|
+
const cssVars = computedVisibleColumns.reduce((vars, col) => {
|
|
9810
|
+
const index = col.computedVisibleIndex;
|
|
9811
|
+
vars[`${columnWidthAtIndex4}-${index}`] = col.computedWidth + "px";
|
|
9812
|
+
vars[`${columnOffsetAtIndex2}-${index}`] = col.computedOffset + "px";
|
|
9813
|
+
return vars;
|
|
9814
|
+
}, {});
|
|
9815
|
+
if (activeCellIndex != null) {
|
|
9816
|
+
cssVars[activeCellColWidth] = `var(${getCSSVarNameForColWidth(activeCellIndex[1])})`;
|
|
9817
|
+
cssVars[activeCellColOffset] = `var(${getCSSVarNameForColOffset(activeCellIndex[1])})`;
|
|
9818
|
+
}
|
|
9157
9819
|
const setFocused = rafFn((focused2) => {
|
|
9158
9820
|
componentActions.focused = focused2;
|
|
9159
9821
|
});
|
|
@@ -9208,7 +9870,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
9208
9870
|
focusedWithin
|
|
9209
9871
|
}));
|
|
9210
9872
|
domProps.className = className;
|
|
9211
|
-
domProps.style = __spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style);
|
|
9873
|
+
domProps.style = __spreadValues(__spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style), cssVars);
|
|
9212
9874
|
if (focused) {
|
|
9213
9875
|
if (componentState.focusedStyle) {
|
|
9214
9876
|
Object.assign(domProps.style, componentState.focusedStyle);
|
|
@@ -9223,7 +9885,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
9223
9885
|
}
|
|
9224
9886
|
|
|
9225
9887
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
9226
|
-
var
|
|
9888
|
+
var import_react47 = __toModule(require("react"));
|
|
9227
9889
|
|
|
9228
9890
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
9229
9891
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -9381,10 +10043,10 @@ var isInsideSandbox = () => {
|
|
|
9381
10043
|
};
|
|
9382
10044
|
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
9383
10045
|
var useLicense = (licenseKey = "") => {
|
|
9384
|
-
const valid = (0,
|
|
10046
|
+
const valid = (0, import_react47.useMemo)(() => {
|
|
9385
10047
|
let valid2 = isValidLicense(licenseKey, {
|
|
9386
10048
|
publishedAt: 1624970570587,
|
|
9387
|
-
version: "0.3.
|
|
10049
|
+
version: "0.3.14"
|
|
9388
10050
|
});
|
|
9389
10051
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
9390
10052
|
return true;
|
|
@@ -9515,10 +10177,23 @@ function handleCellNavigation(options) {
|
|
|
9515
10177
|
actions.activeCellIndex = [rowIndex, colIndex];
|
|
9516
10178
|
return true;
|
|
9517
10179
|
}
|
|
10180
|
+
var validKeys = {
|
|
10181
|
+
ArrowUp: true,
|
|
10182
|
+
ArrowDown: true,
|
|
10183
|
+
ArrowLeft: true,
|
|
10184
|
+
ArrowRight: true,
|
|
10185
|
+
PageUp: true,
|
|
10186
|
+
PageDown: true,
|
|
10187
|
+
Home: true,
|
|
10188
|
+
End: true
|
|
10189
|
+
};
|
|
9518
10190
|
function handleKeyboardNavigation(options) {
|
|
9519
10191
|
const { getState } = options;
|
|
9520
10192
|
const state = getState();
|
|
9521
10193
|
const { activeRowIndex, activeCellIndex, keyboardNavigation } = state;
|
|
10194
|
+
if (!validKeys[options.key]) {
|
|
10195
|
+
return false;
|
|
10196
|
+
}
|
|
9522
10197
|
if (activeRowIndex != null && keyboardNavigation === "row") {
|
|
9523
10198
|
return handleRowNavigation(options);
|
|
9524
10199
|
}
|
|
@@ -9529,7 +10204,7 @@ function handleKeyboardNavigation(options) {
|
|
|
9529
10204
|
}
|
|
9530
10205
|
|
|
9531
10206
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
9532
|
-
var
|
|
10207
|
+
var import_react48 = __toModule(require("react"));
|
|
9533
10208
|
|
|
9534
10209
|
// src/components/VirtualBrain/ScrollListener.ts
|
|
9535
10210
|
var initialScrollPosition = {
|
|
@@ -9609,6 +10284,7 @@ function initSetupState2() {
|
|
|
9609
10284
|
});
|
|
9610
10285
|
if (false) {
|
|
9611
10286
|
globalThis.brain = brain;
|
|
10287
|
+
globalThis.headerBrain = headerBrain;
|
|
9612
10288
|
}
|
|
9613
10289
|
const { renderer, onRenderUpdater } = createRenderer2(brain);
|
|
9614
10290
|
brain.onAvailableSizeChange((size) => {
|
|
@@ -9624,9 +10300,10 @@ function initSetupState2() {
|
|
|
9624
10300
|
brain,
|
|
9625
10301
|
headerBrain,
|
|
9626
10302
|
columnShifts: null,
|
|
9627
|
-
domRef: (0,
|
|
9628
|
-
scrollerDOMRef: (0,
|
|
9629
|
-
portalDOMRef: (0,
|
|
10303
|
+
domRef: (0, import_react48.createRef)(),
|
|
10304
|
+
scrollerDOMRef: (0, import_react48.createRef)(),
|
|
10305
|
+
portalDOMRef: (0, import_react48.createRef)(),
|
|
10306
|
+
activeCellIndicatorDOMRef: (0, import_react48.createRef)(),
|
|
9630
10307
|
onRowHeightCSSVarChange: buildSubscriptionCallback(),
|
|
9631
10308
|
onColumnHeaderHeightCSSVarChange: buildSubscriptionCallback(),
|
|
9632
10309
|
bodySize: {
|
|
@@ -9682,7 +10359,7 @@ var forwardProps3 = (setupState) => {
|
|
|
9682
10359
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
9683
10360
|
resizableColumns: (resizableColumns) => resizableColumns != null ? resizableColumns : true,
|
|
9684
10361
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
9685
|
-
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth :
|
|
10362
|
+
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 5e3,
|
|
9686
10363
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
9687
10364
|
columnCssEllipsis: (columnCssEllipsis) => columnCssEllipsis != null ? columnCssEllipsis : true,
|
|
9688
10365
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
@@ -9728,6 +10405,19 @@ function getGroupRenderStrategy(options) {
|
|
|
9728
10405
|
}
|
|
9729
10406
|
return "multi-column";
|
|
9730
10407
|
}
|
|
10408
|
+
var cleanupState = (state) => {
|
|
10409
|
+
state.brain.destroy();
|
|
10410
|
+
state.headerBrain.destroy();
|
|
10411
|
+
state.renderer.destroy();
|
|
10412
|
+
state.onRenderUpdater.destroy();
|
|
10413
|
+
state.domRef.current = null;
|
|
10414
|
+
state.scrollerDOMRef.current = null;
|
|
10415
|
+
state.portalDOMRef.current = null;
|
|
10416
|
+
state.onRowHeightCSSVarChange.destroy();
|
|
10417
|
+
state.onColumnHeaderHeightCSSVarChange.destroy();
|
|
10418
|
+
state.pinnedEndScrollListener.destroy();
|
|
10419
|
+
state.pinnedStartScrollListener.destroy();
|
|
10420
|
+
};
|
|
9731
10421
|
var mapPropsToState2 = (params) => {
|
|
9732
10422
|
var _a, _b;
|
|
9733
10423
|
const { props, state, oldState, parentState } = params;
|
|
@@ -9764,6 +10454,7 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
9764
10454
|
initSetupState: initSetupState2,
|
|
9765
10455
|
forwardProps: forwardProps3,
|
|
9766
10456
|
mapPropsToState: mapPropsToState2,
|
|
10457
|
+
cleanup: cleanupState,
|
|
9767
10458
|
allowedControlledPropOverrides: {
|
|
9768
10459
|
rowHeight: true,
|
|
9769
10460
|
columnHeaderHeight: true
|
|
@@ -9771,7 +10462,7 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
9771
10462
|
getParentState: () => useDataSource(),
|
|
9772
10463
|
debugName: "InfiniteTable"
|
|
9773
10464
|
});
|
|
9774
|
-
var InfiniteTableComponent =
|
|
10465
|
+
var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
9775
10466
|
var _a;
|
|
9776
10467
|
const {
|
|
9777
10468
|
componentState,
|
|
@@ -9785,7 +10476,7 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9785
10476
|
getState: getDataSourceState,
|
|
9786
10477
|
componentActions: dataSourceActions
|
|
9787
10478
|
} = useDataSourceContextValue();
|
|
9788
|
-
const [imperativeApi] = (0,
|
|
10479
|
+
const [imperativeApi] = (0, import_react49.useState)(() => {
|
|
9789
10480
|
return getImperativeApi(getState, getComputed, getDataSourceState, actions);
|
|
9790
10481
|
});
|
|
9791
10482
|
const {
|
|
@@ -9809,14 +10500,14 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9809
10500
|
activeCellIndex,
|
|
9810
10501
|
onRenderUpdater
|
|
9811
10502
|
} = componentState;
|
|
9812
|
-
(0,
|
|
10503
|
+
(0, import_react49.useEffect)(() => {
|
|
9813
10504
|
if (activeRowIndex != null) {
|
|
9814
10505
|
imperativeApi.scrollRowIntoView(activeRowIndex, {
|
|
9815
10506
|
offset: 30
|
|
9816
10507
|
});
|
|
9817
10508
|
}
|
|
9818
10509
|
}, [activeRowIndex]);
|
|
9819
|
-
(0,
|
|
10510
|
+
(0, import_react49.useEffect)(() => {
|
|
9820
10511
|
if (activeCellIndex != null) {
|
|
9821
10512
|
imperativeApi.scrollCellIntoView(activeCellIndex[0], activeCellIndex[1], {
|
|
9822
10513
|
offset: 30
|
|
@@ -9833,7 +10524,7 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9833
10524
|
bodySize,
|
|
9834
10525
|
computed
|
|
9835
10526
|
});
|
|
9836
|
-
|
|
10527
|
+
React36.useEffect(() => {
|
|
9837
10528
|
const dataSourceState = getDataSourceState();
|
|
9838
10529
|
const onChange = debounce((renderRange) => {
|
|
9839
10530
|
dataSourceState.notifyRenderRangeChange({
|
|
@@ -9846,12 +10537,12 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9846
10537
|
const licenseValid = useLicense(licenseKey);
|
|
9847
10538
|
const domProps = useDOMProps(componentState.domProps);
|
|
9848
10539
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
9849
|
-
|
|
10540
|
+
React36.useEffect(() => {
|
|
9850
10541
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
9851
10542
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
9852
10543
|
}, [scrollStopDelay]);
|
|
9853
10544
|
useAutoSizeColumns();
|
|
9854
|
-
const onKeyDown = (0,
|
|
10545
|
+
const onKeyDown = (0, import_react49.useCallback)((event) => {
|
|
9855
10546
|
if (handleKeyboardNavigation({
|
|
9856
10547
|
getState,
|
|
9857
10548
|
actions,
|
|
@@ -9863,13 +10554,14 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9863
10554
|
event.preventDefault();
|
|
9864
10555
|
}
|
|
9865
10556
|
}, []);
|
|
9866
|
-
return /* @__PURE__ */
|
|
10557
|
+
return /* @__PURE__ */ React36.createElement("div", __spreadValues({
|
|
9867
10558
|
onKeyDown,
|
|
9868
10559
|
ref: domRef
|
|
9869
|
-
}, domProps), header ? /* @__PURE__ */
|
|
9870
|
-
|
|
10560
|
+
}, domProps), header ? /* @__PURE__ */ React36.createElement(TableHeaderWrapper, {
|
|
10561
|
+
bodyBrain: brain,
|
|
10562
|
+
headerBrain,
|
|
9871
10563
|
scrollbars
|
|
9872
|
-
}) : null, /* @__PURE__ */
|
|
10564
|
+
}) : null, /* @__PURE__ */ React36.createElement(InfiniteTableBody, null, /* @__PURE__ */ React36.createElement(HeadlessTable, {
|
|
9873
10565
|
tabIndex: 0,
|
|
9874
10566
|
activeRowIndex: componentState.ready && keyboardNavigation === "row" ? activeRowIndex : null,
|
|
9875
10567
|
activeCellIndex: componentState.ready && keyboardNavigation === "cell" ? activeCellIndex : null,
|
|
@@ -9880,18 +10572,18 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
|
9880
10572
|
renderCell,
|
|
9881
10573
|
cellHoverClassNames: HOVERED_CLASS_NAMES,
|
|
9882
10574
|
scrollerDOMRef
|
|
9883
|
-
}), /* @__PURE__ */
|
|
10575
|
+
}), /* @__PURE__ */ React36.createElement(LoadMaskCmp, {
|
|
9884
10576
|
visible: loading
|
|
9885
|
-
}, loadingText)), /* @__PURE__ */
|
|
10577
|
+
}, loadingText)), /* @__PURE__ */ React36.createElement("div", {
|
|
9886
10578
|
ref: portalDOMRef,
|
|
9887
10579
|
className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
9888
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
10580
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ React36.createElement(CSSVariableWatch, {
|
|
9889
10581
|
varName: rowHeightCSSVar,
|
|
9890
10582
|
onChange: onRowHeightCSSVarChange
|
|
9891
|
-
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */
|
|
10583
|
+
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ React36.createElement(CSSVariableWatch, {
|
|
9892
10584
|
varName: columnHeaderHeightCSSVar,
|
|
9893
10585
|
onChange: onColumnHeaderHeightCSSVarChange
|
|
9894
|
-
}) : null, /* @__PURE__ */
|
|
10586
|
+
}) : null, /* @__PURE__ */ React36.createElement(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ React36.createElement(InfiniteTableLicenseFooter, null));
|
|
9895
10587
|
});
|
|
9896
10588
|
function InfiniteTableContextProvider() {
|
|
9897
10589
|
const { componentActions, componentState } = useComponentState();
|
|
@@ -9911,33 +10603,34 @@ function InfiniteTableContextProvider() {
|
|
|
9911
10603
|
getState
|
|
9912
10604
|
};
|
|
9913
10605
|
useResizeObserver(scrollerDOMRef, (size) => {
|
|
9914
|
-
var _a, _b;
|
|
9915
10606
|
const bodySize = {
|
|
9916
10607
|
width: size.width,
|
|
9917
10608
|
height: size.height
|
|
9918
10609
|
};
|
|
9919
|
-
bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
|
|
9920
10610
|
componentActions.bodySize = bodySize;
|
|
9921
|
-
}, { earlyAttach: true });
|
|
9922
|
-
|
|
10611
|
+
}, { earlyAttach: true, debounce: 50 });
|
|
10612
|
+
React36.useEffect(() => {
|
|
9923
10613
|
return () => {
|
|
9924
10614
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
9925
10615
|
componentState.onColumnHeaderHeightCSSVarChange.destroy();
|
|
9926
10616
|
};
|
|
9927
10617
|
}, []);
|
|
9928
|
-
|
|
10618
|
+
React36.useEffect(() => {
|
|
9929
10619
|
if (scrollerDOMRef.current) {
|
|
9930
10620
|
scrollerDOMRef.current.scrollTop = 0;
|
|
9931
10621
|
}
|
|
9932
10622
|
}, [scrollTopKey, scrollerDOMRef]);
|
|
9933
10623
|
const TableContext2 = getInfiniteTableContext();
|
|
9934
|
-
return /* @__PURE__ */
|
|
10624
|
+
return /* @__PURE__ */ React36.createElement(TableContext2.Provider, {
|
|
9935
10625
|
value: contextValue
|
|
9936
|
-
}, /* @__PURE__ */
|
|
10626
|
+
}, /* @__PURE__ */ React36.createElement(InfiniteTableComponent, null));
|
|
9937
10627
|
}
|
|
9938
10628
|
function InfiniteTable(props) {
|
|
9939
|
-
const table = /* @__PURE__ */
|
|
9940
|
-
|
|
10629
|
+
const table = /* @__PURE__ */ React36.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React36.createElement(InfiniteTableContextProvider, null));
|
|
10630
|
+
if (false) {
|
|
10631
|
+
return /* @__PURE__ */ React36.createElement(React36.StrictMode, null, table);
|
|
10632
|
+
}
|
|
10633
|
+
return table;
|
|
9941
10634
|
}
|
|
9942
10635
|
InfiniteTable.defaultProps = {
|
|
9943
10636
|
rowHeight: 40,
|