@infinite-table/infinite-react 0.3.10 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/index.css +91 -51
- package/index.d.ts +12 -2
- package/index.esm.css +91 -51
- package/index.esm.js +1322 -565
- package/index.js +1366 -613
- package/package.json +2 -2
package/index.esm.js
CHANGED
|
@@ -636,11 +636,11 @@ function debounce(fn, { wait }) {
|
|
|
636
636
|
// src/components/InfiniteTable/index.tsx
|
|
637
637
|
import {
|
|
638
638
|
StrictMode,
|
|
639
|
-
createElement as
|
|
639
|
+
createElement as createElement28,
|
|
640
640
|
memo as memo11,
|
|
641
641
|
useEffect as useEffect26
|
|
642
642
|
} from "react";
|
|
643
|
-
import { useCallback as
|
|
643
|
+
import { useCallback as useCallback18, useEffect as useEffect27, useState as useState16 } from "react";
|
|
644
644
|
|
|
645
645
|
// src/utils/join.ts
|
|
646
646
|
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
@@ -672,7 +672,7 @@ var Logger = class {
|
|
|
672
672
|
constructor(channelName) {
|
|
673
673
|
this.debug = emptyLogFn;
|
|
674
674
|
this.error = emptyLogFn;
|
|
675
|
-
if (
|
|
675
|
+
if (false) {
|
|
676
676
|
this.debug = dbg(channelName);
|
|
677
677
|
this.error = err(channelName);
|
|
678
678
|
}
|
|
@@ -690,13 +690,16 @@ import {
|
|
|
690
690
|
useLayoutEffect,
|
|
691
691
|
useCallback
|
|
692
692
|
} from "react";
|
|
693
|
-
var setupResizeObserver = (node, callback) => {
|
|
693
|
+
var setupResizeObserver = (node, callback, config = { debounce: 0 }) => {
|
|
694
|
+
var _a;
|
|
695
|
+
const debounceTime = (_a = config.debounce) != null ? _a : 0;
|
|
694
696
|
const RO = window.ResizeObserver;
|
|
697
|
+
const onResizeCallback = debounceTime ? debounce(callback, { wait: debounceTime }) : callback;
|
|
695
698
|
const observer = new RO((entries) => {
|
|
696
|
-
var
|
|
699
|
+
var _a2;
|
|
697
700
|
const entry = entries[0];
|
|
698
701
|
let { width, height } = entry.contentRect;
|
|
699
|
-
if ((
|
|
702
|
+
if ((_a2 = entry.borderBoxSize) == null ? void 0 : _a2[0]) {
|
|
700
703
|
height = entry.borderBoxSize[0].blockSize;
|
|
701
704
|
width = entry.borderBoxSize[0].inlineSize;
|
|
702
705
|
} else {
|
|
@@ -704,14 +707,17 @@ var setupResizeObserver = (node, callback) => {
|
|
|
704
707
|
height = rect.height;
|
|
705
708
|
width = rect.width;
|
|
706
709
|
}
|
|
707
|
-
|
|
710
|
+
onResizeCallback({ width, height });
|
|
708
711
|
});
|
|
709
712
|
observer.observe(node);
|
|
710
713
|
return () => {
|
|
711
714
|
observer.disconnect();
|
|
712
715
|
};
|
|
713
716
|
};
|
|
714
|
-
var useResizeObserver = (ref, callback, config = {
|
|
717
|
+
var useResizeObserver = (ref, callback, config = {
|
|
718
|
+
earlyAttach: false,
|
|
719
|
+
debounce: 0
|
|
720
|
+
}) => {
|
|
715
721
|
const sizeRef = useRef({
|
|
716
722
|
width: 0,
|
|
717
723
|
height: 0
|
|
@@ -729,7 +735,7 @@ var useResizeObserver = (ref, callback, config = { earlyAttach: false }) => {
|
|
|
729
735
|
sizeRef.current = size;
|
|
730
736
|
callback2(size);
|
|
731
737
|
}
|
|
732
|
-
});
|
|
738
|
+
}, { debounce: config.debounce });
|
|
733
739
|
}
|
|
734
740
|
return () => {
|
|
735
741
|
if (disconnect) {
|
|
@@ -743,7 +749,7 @@ var useResizeObserver = (ref, callback, config = { earlyAttach: false }) => {
|
|
|
743
749
|
}
|
|
744
750
|
return () => {
|
|
745
751
|
};
|
|
746
|
-
}, [ref.current, callback, config.earlyAttach]);
|
|
752
|
+
}, [ref.current, callback, config.earlyAttach, config.debounce]);
|
|
747
753
|
useLayoutEffect(() => {
|
|
748
754
|
if (config.earlyAttach) {
|
|
749
755
|
return effectFn(callback);
|
|
@@ -872,7 +878,7 @@ import {
|
|
|
872
878
|
useCallback as useCallback4,
|
|
873
879
|
useEffect as useEffect7,
|
|
874
880
|
useRef as useRef7,
|
|
875
|
-
useState as
|
|
881
|
+
useState as useState4
|
|
876
882
|
} from "react";
|
|
877
883
|
|
|
878
884
|
// src/components/VirtualList/SpacePlaceholder.tsx
|
|
@@ -892,8 +898,8 @@ function SpacePlaceholderFn(props) {
|
|
|
892
898
|
};
|
|
893
899
|
return /* @__PURE__ */ createElement3("div", {
|
|
894
900
|
"data-count": count,
|
|
895
|
-
"data-placeholder-width":
|
|
896
|
-
"data-placeholder-height":
|
|
901
|
+
"data-placeholder-width": false ? width : void 0,
|
|
902
|
+
"data-placeholder-height": false ? height : void 0,
|
|
897
903
|
"data-name": "SpacePlaceholder",
|
|
898
904
|
style
|
|
899
905
|
});
|
|
@@ -1088,6 +1094,73 @@ var cancelRaf = getGlobal().cancelAnimationFrame || ((timeoutId) => {
|
|
|
1088
1094
|
return clearTimeout(timeoutId);
|
|
1089
1095
|
});
|
|
1090
1096
|
|
|
1097
|
+
// src/utils/stripVar.ts
|
|
1098
|
+
function stripVar(cssVariableWithVarString) {
|
|
1099
|
+
return cssVariableWithVarString.slice(4, -1);
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
// src/components/InfiniteTable/theme.css.ts
|
|
1103
|
+
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)" };
|
|
1104
|
+
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)" } } };
|
|
1105
|
+
var columnHeaderHeightName = "column-header-height";
|
|
1106
|
+
|
|
1107
|
+
// src/utils/selectParent.ts
|
|
1108
|
+
function selectParent(el, selector) {
|
|
1109
|
+
let node = el;
|
|
1110
|
+
if (node && node.matches(selector)) {
|
|
1111
|
+
return node;
|
|
1112
|
+
}
|
|
1113
|
+
while (node = node.parentElement) {
|
|
1114
|
+
if (node.matches(selector)) {
|
|
1115
|
+
return node;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
return null;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
// src/components/InfiniteTable/internalProps.ts
|
|
1122
|
+
var rootClassName2 = "Infinite";
|
|
1123
|
+
var internalProps = {
|
|
1124
|
+
rootClassName: rootClassName2
|
|
1125
|
+
};
|
|
1126
|
+
|
|
1127
|
+
// src/components/InfiniteTable/utils/infiniteDOMUtils.ts
|
|
1128
|
+
var InfiniteSelector = `.${internalProps.rootClassName}`;
|
|
1129
|
+
function getParentInfiniteNode(node) {
|
|
1130
|
+
return selectParent(node, InfiniteSelector);
|
|
1131
|
+
}
|
|
1132
|
+
var columnWidthAtIndex = stripVar(InternalVars.columnWidthAtIndex);
|
|
1133
|
+
var columnOffsetAtIndex = stripVar(InternalVars.columnOffsetAtIndex);
|
|
1134
|
+
function setInfiniteVarOnRoot(varName, varValue, node) {
|
|
1135
|
+
const infinite = node ? getParentInfiniteNode(node) : document.querySelector(InfiniteSelector);
|
|
1136
|
+
setInfiniteVarOnNode(varName, varValue, infinite);
|
|
1137
|
+
}
|
|
1138
|
+
function setInfiniteVarOnNode(varName, varValue, node) {
|
|
1139
|
+
if (node) {
|
|
1140
|
+
const prop = InternalVars[varName] ? stripVar(InternalVars[varName]) : varName;
|
|
1141
|
+
node.style.setProperty(prop, `${varValue}`);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
function setInfiniteVarsOnNode(vars, node) {
|
|
1145
|
+
if (node) {
|
|
1146
|
+
for (var varName in vars) {
|
|
1147
|
+
node.style.setProperty(InternalVars[varName] ? stripVar(InternalVars[varName]) : varName, `${vars[varName]}`);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
function setInfiniteColumnWidth(colIndex, colWidth, node) {
|
|
1152
|
+
setInfiniteVarOnRoot(`${columnWidthAtIndex}-${colIndex}`, typeof colWidth === "number" ? colWidth + "px" : colWidth, node);
|
|
1153
|
+
}
|
|
1154
|
+
function setInfiniteColumnOffset(colIndex, colOffset, node) {
|
|
1155
|
+
setInfiniteVarOnRoot(`${columnOffsetAtIndex}-${colIndex}`, typeof colOffset === "number" ? colOffset + "px" : colOffset, node);
|
|
1156
|
+
}
|
|
1157
|
+
function getCSSVarNameForColWidth(colIndex) {
|
|
1158
|
+
return `${columnWidthAtIndex}-${colIndex}`;
|
|
1159
|
+
}
|
|
1160
|
+
function getCSSVarNameForColOffset(colIndex) {
|
|
1161
|
+
return `${columnOffsetAtIndex}-${colIndex}`;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1091
1164
|
// src/components/VirtualBrain/MatrixBrain.ts
|
|
1092
1165
|
var import_binary_search = __toModule(require_binary_search());
|
|
1093
1166
|
var getRenderRangeCellCount = (range) => {
|
|
@@ -1123,13 +1196,13 @@ var MatrixBrain = class extends Logger {
|
|
|
1123
1196
|
this.extraSpanCells = [];
|
|
1124
1197
|
this.scrollPosition = { scrollLeft: 0, scrollTop: 0 };
|
|
1125
1198
|
this.onScrollFns = [];
|
|
1126
|
-
this.onRenderRangeChangeFns =
|
|
1127
|
-
this.onVerticalRenderRangeChangeFns =
|
|
1128
|
-
this.onHorizontalRenderRangeChangeFns =
|
|
1199
|
+
this.onRenderRangeChangeFns = new Set();
|
|
1200
|
+
this.onVerticalRenderRangeChangeFns = new Set();
|
|
1201
|
+
this.onHorizontalRenderRangeChangeFns = new Set();
|
|
1129
1202
|
this.onDestroyFns = [];
|
|
1130
1203
|
this.destroyed = false;
|
|
1131
|
-
this.onRenderCountChangeFns =
|
|
1132
|
-
this.onAvailableSizeChangeFns =
|
|
1204
|
+
this.onRenderCountChangeFns = new Set();
|
|
1205
|
+
this.onAvailableSizeChangeFns = new Set();
|
|
1133
1206
|
this.onScrollStartFns = [];
|
|
1134
1207
|
this.onScrollStopFns = [];
|
|
1135
1208
|
this.scrollTimeoutId = 0;
|
|
@@ -1174,7 +1247,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1174
1247
|
if (colWidthDefined) {
|
|
1175
1248
|
this.colWidth = colWidth;
|
|
1176
1249
|
}
|
|
1177
|
-
if (
|
|
1250
|
+
if (false) {
|
|
1178
1251
|
if (widthChanged) {
|
|
1179
1252
|
this.debug("New available width %d (size is %d,%d)", this.width, this.width, this.height);
|
|
1180
1253
|
}
|
|
@@ -1254,12 +1327,18 @@ var MatrixBrain = class extends Logger {
|
|
|
1254
1327
|
}
|
|
1255
1328
|
};
|
|
1256
1329
|
this.notifyScrollStart = () => {
|
|
1330
|
+
if (this.destroyed) {
|
|
1331
|
+
return;
|
|
1332
|
+
}
|
|
1257
1333
|
const fns = this.onScrollStartFns;
|
|
1258
1334
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1259
1335
|
fns[i]();
|
|
1260
1336
|
}
|
|
1261
1337
|
};
|
|
1262
1338
|
this.notifyScrollStop = () => {
|
|
1339
|
+
if (this.destroyed) {
|
|
1340
|
+
return;
|
|
1341
|
+
}
|
|
1263
1342
|
const fns = this.onScrollStopFns;
|
|
1264
1343
|
const scrollPos = this.scrollPosition;
|
|
1265
1344
|
const range = this.getRenderRange();
|
|
@@ -1282,40 +1361,72 @@ var MatrixBrain = class extends Logger {
|
|
|
1282
1361
|
}
|
|
1283
1362
|
};
|
|
1284
1363
|
this.notifyAvailableSizeChange = () => {
|
|
1364
|
+
if (this.destroyed) {
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1285
1367
|
const fns = this.onAvailableSizeChangeFns;
|
|
1286
1368
|
const range = this.getAvailableSize();
|
|
1287
|
-
|
|
1369
|
+
fns.forEach((fn) => {
|
|
1288
1370
|
raf2(() => {
|
|
1289
|
-
|
|
1371
|
+
if (this.destroyed) {
|
|
1372
|
+
return;
|
|
1373
|
+
}
|
|
1374
|
+
if (fns.has(fn)) {
|
|
1375
|
+
fn(range);
|
|
1376
|
+
}
|
|
1290
1377
|
});
|
|
1291
|
-
}
|
|
1378
|
+
});
|
|
1292
1379
|
};
|
|
1293
1380
|
this.notifyRenderRangeChange = () => {
|
|
1381
|
+
if (this.destroyed) {
|
|
1382
|
+
return;
|
|
1383
|
+
}
|
|
1294
1384
|
const fns = this.onRenderRangeChangeFns;
|
|
1295
1385
|
const range = this.getRenderRange();
|
|
1296
|
-
|
|
1386
|
+
fns.forEach((fn) => {
|
|
1297
1387
|
raf2(() => {
|
|
1298
|
-
|
|
1388
|
+
if (this.destroyed) {
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1391
|
+
if (fns.has(fn)) {
|
|
1392
|
+
fn(range);
|
|
1393
|
+
}
|
|
1299
1394
|
});
|
|
1300
|
-
}
|
|
1395
|
+
});
|
|
1301
1396
|
};
|
|
1302
1397
|
this.notifyVerticalRenderRangeChange = () => {
|
|
1398
|
+
if (this.destroyed) {
|
|
1399
|
+
return;
|
|
1400
|
+
}
|
|
1303
1401
|
const fns = this.onVerticalRenderRangeChangeFns;
|
|
1304
1402
|
const range = this.verticalRenderRange;
|
|
1305
|
-
|
|
1403
|
+
fns.forEach((fn) => {
|
|
1306
1404
|
raf2(() => {
|
|
1307
|
-
|
|
1405
|
+
if (this.destroyed) {
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1408
|
+
if (fns.has(fn)) {
|
|
1409
|
+
fn([range.startIndex, range.endIndex]);
|
|
1410
|
+
}
|
|
1308
1411
|
});
|
|
1309
|
-
}
|
|
1412
|
+
});
|
|
1310
1413
|
};
|
|
1311
1414
|
this.notifyHorizontalRenderRangeChange = () => {
|
|
1415
|
+
if (this.destroyed) {
|
|
1416
|
+
return;
|
|
1417
|
+
}
|
|
1312
1418
|
const fns = this.onHorizontalRenderRangeChangeFns;
|
|
1313
1419
|
const range = this.horizontalRenderRange;
|
|
1314
|
-
|
|
1420
|
+
fns.forEach((fn) => {
|
|
1315
1421
|
raf2(() => {
|
|
1316
|
-
|
|
1422
|
+
if (this.destroyed) {
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1425
|
+
if (fns.has(fn)) {
|
|
1426
|
+
fn([range.startIndex, range.endIndex]);
|
|
1427
|
+
}
|
|
1317
1428
|
});
|
|
1318
|
-
}
|
|
1429
|
+
});
|
|
1319
1430
|
};
|
|
1320
1431
|
this.computeDirectionalRenderCount = (direction, itemSize, count, theSize) => {
|
|
1321
1432
|
let renderCount = 0;
|
|
@@ -1327,11 +1438,11 @@ var MatrixBrain = class extends Logger {
|
|
|
1327
1438
|
sizes.push(this.getItemSize(i, direction));
|
|
1328
1439
|
}
|
|
1329
1440
|
sizes.sort(SORT_ASC);
|
|
1330
|
-
let
|
|
1441
|
+
let sum2 = 0;
|
|
1331
1442
|
for (let i = 0; i < count; i++) {
|
|
1332
|
-
|
|
1443
|
+
sum2 += sizes[i];
|
|
1333
1444
|
renderCount++;
|
|
1334
|
-
if (
|
|
1445
|
+
if (sum2 > size) {
|
|
1335
1446
|
break;
|
|
1336
1447
|
}
|
|
1337
1448
|
}
|
|
@@ -1346,11 +1457,11 @@ var MatrixBrain = class extends Logger {
|
|
|
1346
1457
|
if (!this.fixedColsEnd) {
|
|
1347
1458
|
return 0;
|
|
1348
1459
|
}
|
|
1349
|
-
let
|
|
1460
|
+
let sum2 = 0;
|
|
1350
1461
|
for (let i = this.cols - this.fixedColsEnd; i < this.cols; i++) {
|
|
1351
|
-
|
|
1462
|
+
sum2 += this.getColWidth(i);
|
|
1352
1463
|
}
|
|
1353
|
-
return
|
|
1464
|
+
return sum2;
|
|
1354
1465
|
};
|
|
1355
1466
|
this.getFixedEndColsOffsets = () => {
|
|
1356
1467
|
if (!this.fixedColsEnd) {
|
|
@@ -1360,19 +1471,19 @@ var MatrixBrain = class extends Logger {
|
|
|
1360
1471
|
const { width } = this.getAvailableSize();
|
|
1361
1472
|
const offsets = [];
|
|
1362
1473
|
const widths = [];
|
|
1363
|
-
let
|
|
1474
|
+
let sum2 = 0;
|
|
1364
1475
|
for (let colIndex = this.cols - this.fixedColsEnd; colIndex < this.cols; colIndex++) {
|
|
1365
1476
|
const colWidth = this.getColWidth(colIndex);
|
|
1366
1477
|
widths.push(colWidth);
|
|
1367
|
-
|
|
1478
|
+
sum2 += colWidth;
|
|
1368
1479
|
}
|
|
1369
|
-
const baseOffset = width -
|
|
1370
|
-
|
|
1480
|
+
const baseOffset = width - sum2 + scrollLeft;
|
|
1481
|
+
sum2 = 0;
|
|
1371
1482
|
let index = 0;
|
|
1372
1483
|
for (let colIndex = this.cols - this.fixedColsEnd; colIndex < this.cols; colIndex++) {
|
|
1373
|
-
const offset = baseOffset +
|
|
1484
|
+
const offset = baseOffset + sum2;
|
|
1374
1485
|
offsets[colIndex] = offset;
|
|
1375
|
-
|
|
1486
|
+
sum2 += widths[index];
|
|
1376
1487
|
index++;
|
|
1377
1488
|
}
|
|
1378
1489
|
return offsets;
|
|
@@ -1385,19 +1496,19 @@ var MatrixBrain = class extends Logger {
|
|
|
1385
1496
|
const { height } = this.getAvailableSize();
|
|
1386
1497
|
const offsets = [];
|
|
1387
1498
|
const heights = [];
|
|
1388
|
-
let
|
|
1499
|
+
let sum2 = 0;
|
|
1389
1500
|
for (let rowIndex = this.rows - this.fixedRowsEnd; rowIndex < this.rows; rowIndex++) {
|
|
1390
1501
|
const rowHeight = this.getRowHeight(rowIndex);
|
|
1391
1502
|
heights.push(rowHeight);
|
|
1392
|
-
|
|
1503
|
+
sum2 += rowHeight;
|
|
1393
1504
|
}
|
|
1394
|
-
const baseOffset = height -
|
|
1395
|
-
|
|
1505
|
+
const baseOffset = height - sum2 + scrollTop;
|
|
1506
|
+
sum2 = 0;
|
|
1396
1507
|
let index = 0;
|
|
1397
1508
|
for (let rowIndex = this.rows - this.fixedRowsEnd; rowIndex < this.rows; rowIndex++) {
|
|
1398
|
-
const offset = baseOffset +
|
|
1509
|
+
const offset = baseOffset + sum2;
|
|
1399
1510
|
offsets[rowIndex] = offset;
|
|
1400
|
-
|
|
1511
|
+
sum2 += heights[index];
|
|
1401
1512
|
index++;
|
|
1402
1513
|
}
|
|
1403
1514
|
return offsets;
|
|
@@ -1406,31 +1517,31 @@ var MatrixBrain = class extends Logger {
|
|
|
1406
1517
|
if (!this.fixedColsStart) {
|
|
1407
1518
|
return 0;
|
|
1408
1519
|
}
|
|
1409
|
-
let
|
|
1520
|
+
let sum2 = 0;
|
|
1410
1521
|
for (let i = 0; i < this.fixedColsStart; i++) {
|
|
1411
|
-
|
|
1522
|
+
sum2 += this.getColWidth(i);
|
|
1412
1523
|
}
|
|
1413
|
-
return
|
|
1524
|
+
return sum2;
|
|
1414
1525
|
};
|
|
1415
1526
|
this.getFixedEndRowsHeight = () => {
|
|
1416
1527
|
if (!this.fixedRowsEnd) {
|
|
1417
1528
|
return 0;
|
|
1418
1529
|
}
|
|
1419
|
-
let
|
|
1530
|
+
let sum2 = 0;
|
|
1420
1531
|
for (let i = this.rows - this.fixedRowsEnd; i < this.rows; i++) {
|
|
1421
|
-
|
|
1532
|
+
sum2 += this.getRowHeight(i);
|
|
1422
1533
|
}
|
|
1423
|
-
return
|
|
1534
|
+
return sum2;
|
|
1424
1535
|
};
|
|
1425
1536
|
this.getFixedStartRowsHeight = () => {
|
|
1426
1537
|
if (!this.fixedRowsStart) {
|
|
1427
1538
|
return 0;
|
|
1428
1539
|
}
|
|
1429
|
-
let
|
|
1540
|
+
let sum2 = 0;
|
|
1430
1541
|
for (let i = 0; i < this.fixedRowsStart; i++) {
|
|
1431
|
-
|
|
1542
|
+
sum2 += this.getRowHeight(i);
|
|
1432
1543
|
}
|
|
1433
|
-
return
|
|
1544
|
+
return sum2;
|
|
1434
1545
|
};
|
|
1435
1546
|
this.computeRenderCount = (which = ALL_DIRECTIONS) => {
|
|
1436
1547
|
const recomputeHorizontal = which.horizontal;
|
|
@@ -1668,7 +1779,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1668
1779
|
if (cache[i] === void 0) {
|
|
1669
1780
|
cell[direction === "horizontal" ? "colIndex" : "rowIndex"] = i;
|
|
1670
1781
|
let spanValue = itemSpan(cell);
|
|
1671
|
-
if (
|
|
1782
|
+
if (false) {
|
|
1672
1783
|
this.debug(`${direction === "horizontal" ? "colspan" : "rowspan"} cannot be less than 1 - got %d for index %d`, spanValue, i);
|
|
1673
1784
|
}
|
|
1674
1785
|
cache[i] = i;
|
|
@@ -1861,33 +1972,33 @@ var MatrixBrain = class extends Logger {
|
|
|
1861
1972
|
};
|
|
1862
1973
|
};
|
|
1863
1974
|
this.onRenderRangeChange = (fn) => {
|
|
1864
|
-
this.onRenderRangeChangeFns.
|
|
1975
|
+
this.onRenderRangeChangeFns.add(fn);
|
|
1865
1976
|
return () => {
|
|
1866
|
-
this.onRenderRangeChangeFns
|
|
1977
|
+
this.onRenderRangeChangeFns.delete(fn);
|
|
1867
1978
|
};
|
|
1868
1979
|
};
|
|
1869
1980
|
this.onVerticalRenderRangeChange = (fn) => {
|
|
1870
|
-
this.onVerticalRenderRangeChangeFns.
|
|
1981
|
+
this.onVerticalRenderRangeChangeFns.add(fn);
|
|
1871
1982
|
return () => {
|
|
1872
|
-
this.onVerticalRenderRangeChangeFns
|
|
1983
|
+
this.onVerticalRenderRangeChangeFns.delete(fn);
|
|
1873
1984
|
};
|
|
1874
1985
|
};
|
|
1875
1986
|
this.onHorizontalRenderRangeChange = (fn) => {
|
|
1876
|
-
this.onHorizontalRenderRangeChangeFns.
|
|
1987
|
+
this.onHorizontalRenderRangeChangeFns.add(fn);
|
|
1877
1988
|
return () => {
|
|
1878
|
-
this.onHorizontalRenderRangeChangeFns
|
|
1989
|
+
this.onHorizontalRenderRangeChangeFns.delete(fn);
|
|
1879
1990
|
};
|
|
1880
1991
|
};
|
|
1881
1992
|
this.onRenderCountChange = (fn) => {
|
|
1882
|
-
this.onRenderCountChangeFns.
|
|
1993
|
+
this.onRenderCountChangeFns.add(fn);
|
|
1883
1994
|
return () => {
|
|
1884
|
-
this.onRenderCountChangeFns
|
|
1995
|
+
this.onRenderCountChangeFns.delete(fn);
|
|
1885
1996
|
};
|
|
1886
1997
|
};
|
|
1887
1998
|
this.onAvailableSizeChange = (fn) => {
|
|
1888
|
-
this.onAvailableSizeChangeFns.
|
|
1999
|
+
this.onAvailableSizeChangeFns.add(fn);
|
|
1889
2000
|
return () => {
|
|
1890
|
-
this.onAvailableSizeChangeFns
|
|
2001
|
+
this.onAvailableSizeChangeFns.delete(fn);
|
|
1891
2002
|
};
|
|
1892
2003
|
};
|
|
1893
2004
|
this.onDestroy = (fn) => {
|
|
@@ -1915,10 +2026,10 @@ var MatrixBrain = class extends Logger {
|
|
|
1915
2026
|
this.onScrollFns = [];
|
|
1916
2027
|
this.onScrollStartFns = [];
|
|
1917
2028
|
this.onScrollStopFns = [];
|
|
1918
|
-
this.onRenderCountChangeFns =
|
|
1919
|
-
this.onRenderRangeChangeFns =
|
|
1920
|
-
this.onVerticalRenderRangeChangeFns =
|
|
1921
|
-
this.onHorizontalRenderRangeChangeFns =
|
|
2029
|
+
this.onRenderCountChangeFns = new Set();
|
|
2030
|
+
this.onRenderRangeChangeFns = new Set();
|
|
2031
|
+
this.onVerticalRenderRangeChangeFns = new Set();
|
|
2032
|
+
this.onHorizontalRenderRangeChangeFns = new Set();
|
|
1922
2033
|
};
|
|
1923
2034
|
this.reset();
|
|
1924
2035
|
}
|
|
@@ -1964,14 +2075,14 @@ var MatrixBrain = class extends Logger {
|
|
|
1964
2075
|
let { width, height } = size;
|
|
1965
2076
|
width = width != null ? width : this.width;
|
|
1966
2077
|
height = height != null ? height : this.height;
|
|
1967
|
-
const widthSame =
|
|
1968
|
-
const heightSame =
|
|
2078
|
+
const widthSame = width === this.width;
|
|
2079
|
+
const heightSame = height === this.height;
|
|
1969
2080
|
if (widthSame && heightSame) {
|
|
1970
2081
|
return;
|
|
1971
2082
|
}
|
|
1972
2083
|
this.width = width;
|
|
1973
2084
|
this.height = height;
|
|
1974
|
-
if (
|
|
2085
|
+
if (false) {
|
|
1975
2086
|
this.debug("New available size: width %d, height %d", this.width, this.height);
|
|
1976
2087
|
}
|
|
1977
2088
|
this.notifyAvailableSizeChange();
|
|
@@ -1989,6 +2100,9 @@ var MatrixBrain = class extends Logger {
|
|
|
1989
2100
|
return totalSize.width - this.width;
|
|
1990
2101
|
}
|
|
1991
2102
|
notifyScrollChange() {
|
|
2103
|
+
if (this.destroyed) {
|
|
2104
|
+
return;
|
|
2105
|
+
}
|
|
1992
2106
|
const { scrollPosition } = this;
|
|
1993
2107
|
const fns = this.onScrollFns;
|
|
1994
2108
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
@@ -2005,17 +2119,25 @@ var MatrixBrain = class extends Logger {
|
|
|
2005
2119
|
return direction === "horizontal" ? this.getFixedEndColsWidth() : this.getFixedEndRowsHeight();
|
|
2006
2120
|
}
|
|
2007
2121
|
notifyRenderCountChange() {
|
|
2122
|
+
if (this.destroyed) {
|
|
2123
|
+
return;
|
|
2124
|
+
}
|
|
2008
2125
|
const { horizontalRenderCount, verticalRenderCount } = this;
|
|
2009
2126
|
const renderCount = {
|
|
2010
2127
|
horizontal: horizontalRenderCount,
|
|
2011
2128
|
vertical: verticalRenderCount
|
|
2012
2129
|
};
|
|
2013
2130
|
const fns = this.onRenderCountChangeFns;
|
|
2014
|
-
|
|
2131
|
+
fns.forEach((fn) => {
|
|
2015
2132
|
raf2(() => {
|
|
2016
|
-
|
|
2133
|
+
if (this.destroyed) {
|
|
2134
|
+
return;
|
|
2135
|
+
}
|
|
2136
|
+
if (fns.has(fn)) {
|
|
2137
|
+
fn(renderCount);
|
|
2138
|
+
}
|
|
2017
2139
|
});
|
|
2018
|
-
}
|
|
2140
|
+
});
|
|
2019
2141
|
}
|
|
2020
2142
|
getItemSizeCacheFor(itemIndex, direction) {
|
|
2021
2143
|
return (direction === "horizontal" ? this.colWidthCache : this.rowHeightCache)[itemIndex];
|
|
@@ -2438,7 +2560,7 @@ var MappedCells = class extends Logger {
|
|
|
2438
2560
|
return elementIndex != null ? elementIndex : null;
|
|
2439
2561
|
};
|
|
2440
2562
|
this.renderCellAtElement = (rowIndex, colIndex, elementIndex, renderNode) => {
|
|
2441
|
-
if (
|
|
2563
|
+
if (false) {
|
|
2442
2564
|
this.debug(`Render cell ${rowIndex},${colIndex} at element ${elementIndex}`);
|
|
2443
2565
|
}
|
|
2444
2566
|
const key = [rowIndex, colIndex];
|
|
@@ -2509,18 +2631,31 @@ var MappedCells = class extends Logger {
|
|
|
2509
2631
|
|
|
2510
2632
|
// src/components/HeadlessTable/ReactHeadlessTableRenderer.tsx
|
|
2511
2633
|
var ITEM_POSITION_WITH_TRANSFORM = true;
|
|
2634
|
+
var currentColumnTransformY = stripVar(InternalVars.currentColumnTransformY);
|
|
2635
|
+
var columnTransformX = stripVar(InternalVars.columnOffsetAtIndex);
|
|
2512
2636
|
var ReactHeadlessTableRenderer = class extends Logger {
|
|
2513
2637
|
constructor(brain) {
|
|
2514
2638
|
super("ReactHeadlessTableRenderer");
|
|
2515
2639
|
this.destroyed = false;
|
|
2516
2640
|
this.scrolling = false;
|
|
2517
2641
|
this.cellHoverClassNames = [];
|
|
2642
|
+
this.name = "";
|
|
2518
2643
|
this.itemDOMElements = [];
|
|
2519
2644
|
this.itemDOMRefs = [];
|
|
2520
2645
|
this.updaters = [];
|
|
2521
2646
|
this.items = [];
|
|
2522
2647
|
this.currentHoveredRow = -1;
|
|
2523
2648
|
this.hoverRowUpdatesInProgress = new Map();
|
|
2649
|
+
this.infiniteNode = null;
|
|
2650
|
+
this.setTransform = (element, _rowIndex, colIndex, x, y) => {
|
|
2651
|
+
const transformXVar = `${columnTransformX}-${colIndex}`;
|
|
2652
|
+
if (!this.infiniteNode) {
|
|
2653
|
+
this.infiniteNode = getParentInfiniteNode(element);
|
|
2654
|
+
}
|
|
2655
|
+
this.infiniteNode.style.setProperty(transformXVar, `${x}px`);
|
|
2656
|
+
element.style.setProperty(currentColumnTransformY, `${y}px`);
|
|
2657
|
+
element.style.transform = `translate3d(var(${transformXVar}), ${InternalVars.currentColumnTransformY}, 0)`;
|
|
2658
|
+
};
|
|
2524
2659
|
this.getFullyVisibleRowsRange = () => {
|
|
2525
2660
|
let {
|
|
2526
2661
|
start: [startRow],
|
|
@@ -2704,7 +2839,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2704
2839
|
return [];
|
|
2705
2840
|
}
|
|
2706
2841
|
const { start, end } = range;
|
|
2707
|
-
if (
|
|
2842
|
+
if (false) {
|
|
2708
2843
|
this.debug(`Render range ${start}-${end}. Force ${force}`);
|
|
2709
2844
|
}
|
|
2710
2845
|
const { mappedCells } = this;
|
|
@@ -2717,13 +2852,13 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2717
2852
|
extraCellsMap.set(`${rowIndex}:${colIndex}`, true);
|
|
2718
2853
|
});
|
|
2719
2854
|
}
|
|
2720
|
-
const renderCount = ranges.reduce((
|
|
2855
|
+
const renderCount = ranges.reduce((sum2, range2) => sum2 + getRenderRangeCellCount(range2), 0);
|
|
2721
2856
|
if (this.itemDOMElements.length >= renderCount) {
|
|
2722
2857
|
mappedCells.discardElementsStartingWith(renderCount, (elementIndex) => {
|
|
2723
2858
|
if (this.updaters[elementIndex]) {
|
|
2724
2859
|
this.updaters[elementIndex].destroy();
|
|
2725
2860
|
}
|
|
2726
|
-
if (
|
|
2861
|
+
if (false) {
|
|
2727
2862
|
this.debug(`Discard element ${elementIndex}`);
|
|
2728
2863
|
}
|
|
2729
2864
|
});
|
|
@@ -2775,7 +2910,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2775
2910
|
}
|
|
2776
2911
|
const elementIndex = cellRendered ? mappedCells.getElementIndexForCell(row, col) : mappedCells.getElementFromListForColumn(elementsOutsideItemRange, col);
|
|
2777
2912
|
if (elementIndex == null) {
|
|
2778
|
-
if (
|
|
2913
|
+
if (false) {
|
|
2779
2914
|
this.error(`Cannot find element to render cell ${row}:${col}`);
|
|
2780
2915
|
}
|
|
2781
2916
|
continue;
|
|
@@ -2794,7 +2929,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2794
2929
|
}
|
|
2795
2930
|
const elementIndex = elementsOutsideItemRange.pop();
|
|
2796
2931
|
if (elementIndex == null) {
|
|
2797
|
-
if (
|
|
2932
|
+
if (false) {
|
|
2798
2933
|
this.error(`Cannot find element to render cell ${rowIndex}-${colIndex}`);
|
|
2799
2934
|
}
|
|
2800
2935
|
return;
|
|
@@ -2971,6 +3106,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2971
3106
|
if (this.scrolling) {
|
|
2972
3107
|
return;
|
|
2973
3108
|
}
|
|
3109
|
+
if (false) {
|
|
3110
|
+
return;
|
|
3111
|
+
}
|
|
2974
3112
|
if (this.hoverRowUpdatesInProgress.has(rowIndex)) {
|
|
2975
3113
|
return;
|
|
2976
3114
|
}
|
|
@@ -2986,6 +3124,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2986
3124
|
};
|
|
2987
3125
|
raf(() => {
|
|
2988
3126
|
checkHoverClass();
|
|
3127
|
+
if (false) {
|
|
3128
|
+
return;
|
|
3129
|
+
}
|
|
2989
3130
|
this.hoverRowUpdatesInProgress.delete(rowIndex);
|
|
2990
3131
|
});
|
|
2991
3132
|
};
|
|
@@ -2993,7 +3134,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2993
3134
|
const itemElement = this.itemDOMElements[elementIndex];
|
|
2994
3135
|
const cell = this.mappedCells.getRenderedCellAtElement(elementIndex);
|
|
2995
3136
|
if (cell == null) {
|
|
2996
|
-
if (
|
|
3137
|
+
if (false) {
|
|
2997
3138
|
this.error(`Cannot find item for element ${elementIndex}`);
|
|
2998
3139
|
}
|
|
2999
3140
|
return;
|
|
@@ -3006,16 +3147,14 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3006
3147
|
const { x, y } = itemPosition;
|
|
3007
3148
|
if (itemElement) {
|
|
3008
3149
|
this.updateHoverClassNamesForRow(rowIndex);
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
itemElement.dataset.colIndex = colIndex;
|
|
3012
|
-
}
|
|
3150
|
+
itemElement.dataset.rowIndex = rowIndex;
|
|
3151
|
+
itemElement.dataset.colIndex = colIndex;
|
|
3013
3152
|
if (ITEM_POSITION_WITH_TRANSFORM) {
|
|
3014
|
-
itemElement
|
|
3153
|
+
this.setTransform(itemElement, rowIndex, colIndex, x, y);
|
|
3015
3154
|
itemElement.style.willChange = "transform";
|
|
3016
3155
|
itemElement.style.backfaceVisibility = "hidden";
|
|
3017
3156
|
const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
|
|
3018
|
-
itemElement.style.zIndex = hidden ? "-1" : "auto";
|
|
3157
|
+
itemElement.style.zIndex = hidden ? "-1" : itemElement.dataset.zIndex || "auto";
|
|
3019
3158
|
} else {
|
|
3020
3159
|
itemElement.style.display = "";
|
|
3021
3160
|
itemElement.style.left = `${x}px`;
|
|
@@ -3056,39 +3195,39 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3056
3195
|
fn(rowIndex, colIndex, node, itemPosition, scrollPosition);
|
|
3057
3196
|
}
|
|
3058
3197
|
}
|
|
3059
|
-
|
|
3198
|
+
const adjustColStart = (_rowIndex, colIndex, node, { x, y }, { scrollLeft }) => {
|
|
3060
3199
|
node.style.zIndex = `${fixedColsStart - colIndex}`;
|
|
3061
|
-
node
|
|
3062
|
-
}
|
|
3063
|
-
|
|
3200
|
+
this.setTransform(node, _rowIndex, colIndex, x + scrollLeft, y);
|
|
3201
|
+
};
|
|
3202
|
+
const adjustRowStart = (rowIndex, _colIndex, node, coords, scrollPosition2) => {
|
|
3064
3203
|
node.style.zIndex = `${fixedRowsStart - rowIndex}`;
|
|
3065
|
-
node
|
|
3066
|
-
}
|
|
3067
|
-
|
|
3204
|
+
this.setTransform(node, rowIndex, _colIndex, coords.x, coords.y + scrollPosition2.scrollTop);
|
|
3205
|
+
};
|
|
3206
|
+
const adjustColEnd = (_rowIndex, colIndex, node, { y }) => {
|
|
3068
3207
|
node.style.zIndex = `${cols - colIndex}`;
|
|
3069
3208
|
const val = fixedEndColsOffsets[colIndex];
|
|
3070
|
-
node
|
|
3071
|
-
}
|
|
3072
|
-
|
|
3209
|
+
this.setTransform(node, _rowIndex, colIndex, val, y);
|
|
3210
|
+
};
|
|
3211
|
+
const adjustRowEnd = (rowIndex, _colIndex, node, coords) => {
|
|
3073
3212
|
node.style.zIndex = `${rows - rowIndex}`;
|
|
3074
|
-
node
|
|
3075
|
-
}
|
|
3076
|
-
|
|
3077
|
-
node.style.zIndex = `
|
|
3078
|
-
node
|
|
3079
|
-
}
|
|
3080
|
-
|
|
3081
|
-
node.style.zIndex = `
|
|
3082
|
-
node
|
|
3083
|
-
}
|
|
3084
|
-
|
|
3085
|
-
node.style.zIndex = `
|
|
3086
|
-
node
|
|
3087
|
-
}
|
|
3088
|
-
|
|
3089
|
-
node.style.zIndex = `
|
|
3090
|
-
node
|
|
3091
|
-
}
|
|
3213
|
+
this.setTransform(node, rowIndex, _colIndex, coords.x, fixedEndRowsOffsets[rowIndex]);
|
|
3214
|
+
};
|
|
3215
|
+
const adjustColStartRowStart = (_rowIndex, _colIndex, node, { x, y }, scrollPosition2) => {
|
|
3216
|
+
node.style.zIndex = `1000000`;
|
|
3217
|
+
this.setTransform(node, _rowIndex, _colIndex, x + scrollPosition2.scrollLeft, y + scrollPosition2.scrollTop);
|
|
3218
|
+
};
|
|
3219
|
+
const adjustColStartRowEnd = (_rowIndex, _colIndex, node, { x }, scrollPosition2) => {
|
|
3220
|
+
node.style.zIndex = `2000000`;
|
|
3221
|
+
this.setTransform(node, _rowIndex, _colIndex, x + scrollPosition2.scrollLeft, fixedEndRowsOffsets[_rowIndex]);
|
|
3222
|
+
};
|
|
3223
|
+
const adjustColEndRowStart = (_rowIndex, colIndex, node, coords) => {
|
|
3224
|
+
node.style.zIndex = `3000000`;
|
|
3225
|
+
this.setTransform(node, _rowIndex, colIndex, fixedEndColsOffsets[colIndex], coords.y + scrollPosition.scrollTop);
|
|
3226
|
+
};
|
|
3227
|
+
const adjustColEndRowEnd = (rowIndex, colIndex, node) => {
|
|
3228
|
+
node.style.zIndex = `4000000`;
|
|
3229
|
+
this.setTransform(node, rowIndex, colIndex, fixedEndColsOffsets[colIndex], fixedEndRowsOffsets[rowIndex]);
|
|
3230
|
+
};
|
|
3092
3231
|
if (fixedColsStart || fixedColsEnd) {
|
|
3093
3232
|
for (let rowIndex = startRow; rowIndex < endRow; rowIndex++) {
|
|
3094
3233
|
for (let colIndex = 0; colIndex < fixedColsStart; colIndex++) {
|
|
@@ -3149,6 +3288,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3149
3288
|
}
|
|
3150
3289
|
};
|
|
3151
3290
|
this.destroy = () => {
|
|
3291
|
+
if (this.destroyed) {
|
|
3292
|
+
return;
|
|
3293
|
+
}
|
|
3152
3294
|
this.destroyed = true;
|
|
3153
3295
|
this.reset();
|
|
3154
3296
|
this.onDestroy();
|
|
@@ -3230,7 +3372,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3230
3372
|
return;
|
|
3231
3373
|
}
|
|
3232
3374
|
this.mappedCells.renderCellAtElement(rowIndex, colIndex, elementIndex, renderedNode);
|
|
3233
|
-
if (
|
|
3375
|
+
if (false) {
|
|
3234
3376
|
this.debug(`Render cell ${rowIndex},${colIndex} at element ${elementIndex}`);
|
|
3235
3377
|
}
|
|
3236
3378
|
itemUpdater(renderedNode);
|
|
@@ -3319,14 +3461,12 @@ var useRerender = () => {
|
|
|
3319
3461
|
];
|
|
3320
3462
|
};
|
|
3321
3463
|
|
|
3322
|
-
// src/components/InfiniteTable/
|
|
3323
|
-
var
|
|
3324
|
-
var
|
|
3325
|
-
rootClassName: rootClassName2
|
|
3326
|
-
};
|
|
3464
|
+
// src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
|
|
3465
|
+
var ActiveCellIndicatorCls = { visible: "nxbq1c2 nxbq1c1 _16lm1iwf _16lm1iw3 _16lm1iwx _16lm1iwv", hidden: "nxbq1c3 nxbq1c1 _16lm1iwf _16lm1iw3 _16lm1iwx _16lm1iwv" };
|
|
3466
|
+
var ActiveIndicatorWrapperCls = "_16lm1iwf _16lm1iw3 _16lm1iwx _16lm1iwv _16lm1iwr";
|
|
3327
3467
|
|
|
3328
3468
|
// src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
|
|
3329
|
-
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0
|
|
3469
|
+
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwf _16lm1iw3 _16lm1iwu _16lm1iwv _16lm1iwx", hidden: "j26lrx2 j26lrx0 _16lm1iwf _16lm1iw3 _16lm1iwu _16lm1iwv _16lm1iwx" };
|
|
3330
3470
|
|
|
3331
3471
|
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
3332
3472
|
var { rootClassName: rootClassName3 } = internalProps;
|
|
@@ -3363,6 +3503,9 @@ var ActiveRowIndicatorFn = (props) => {
|
|
|
3363
3503
|
};
|
|
3364
3504
|
}, [brain]);
|
|
3365
3505
|
return /* @__PURE__ */ createElement6("div", {
|
|
3506
|
+
className: ActiveIndicatorWrapperCls,
|
|
3507
|
+
"data-name": "active-row"
|
|
3508
|
+
}, /* @__PURE__ */ createElement6("div", {
|
|
3366
3509
|
ref: domRef,
|
|
3367
3510
|
"data-name": "active-row-indicator",
|
|
3368
3511
|
className: `${baseCls} ${active ? ActiveRowIndicatorCls.visible : ActiveRowIndicatorCls.hidden}`,
|
|
@@ -3370,7 +3513,7 @@ var ActiveRowIndicatorFn = (props) => {
|
|
|
3370
3513
|
transform: `translate3d(0px, ${-brain.getScrollPosition().scrollTop + state.top}px,0)`,
|
|
3371
3514
|
height: state.rowHeight
|
|
3372
3515
|
} : void 0
|
|
3373
|
-
});
|
|
3516
|
+
}));
|
|
3374
3517
|
};
|
|
3375
3518
|
var ActiveRowIndicator = memo4(ActiveRowIndicatorFn);
|
|
3376
3519
|
|
|
@@ -3379,68 +3522,56 @@ import {
|
|
|
3379
3522
|
createElement as createElement7,
|
|
3380
3523
|
memo as memo5
|
|
3381
3524
|
} from "react";
|
|
3382
|
-
import { useEffect as useEffect6, useLayoutEffect as useLayoutEffect4, useRef as useRef6
|
|
3383
|
-
|
|
3384
|
-
// src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
|
|
3385
|
-
var ActiveCellIndicatorCls = { visible: "nxbq1c1 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu", hidden: "nxbq1c2 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu" };
|
|
3386
|
-
|
|
3387
|
-
// src/components/InfiniteTable/components/ActiveCellIndicator.tsx
|
|
3525
|
+
import { useEffect as useEffect6, useLayoutEffect as useLayoutEffect4, useRef as useRef6 } from "react";
|
|
3388
3526
|
var { rootClassName: rootClassName4 } = internalProps;
|
|
3389
3527
|
var baseCls2 = `${rootClassName4}-ActiveCellIndicator`;
|
|
3528
|
+
var ActiveStyle = {
|
|
3529
|
+
[stripVar(InternalVars.activeCellOffsetX)]: `calc( ${InternalVars.scrollLeftForActiveCell} + ${InternalVars.activeCellColOffset} )`,
|
|
3530
|
+
[stripVar(InternalVars.activeCellOffsetY)]: `calc( ${InternalVars.scrollTopForActiveCell} + ${InternalVars.activeCellRowOffset} )`,
|
|
3531
|
+
transform: `translate3d(${InternalVars.activeCellOffsetX}, ${InternalVars.activeCellOffsetY}, 0px)`,
|
|
3532
|
+
width: InternalVars.activeCellColWidth,
|
|
3533
|
+
height: InternalVars.activeCellRowHeight
|
|
3534
|
+
};
|
|
3390
3535
|
var ActiveCellIndicatorFn = (props) => {
|
|
3391
3536
|
const { brain } = props;
|
|
3392
|
-
const [rerenderId, rerender] = useRerender();
|
|
3393
|
-
const [state, setState] = useState4({
|
|
3394
|
-
top: 0,
|
|
3395
|
-
rowHeight: 0,
|
|
3396
|
-
colWidth: 0,
|
|
3397
|
-
left: 0
|
|
3398
|
-
});
|
|
3399
3537
|
const domRef = useRef6(null);
|
|
3400
|
-
const stateRef = useRef6(state);
|
|
3401
3538
|
const active = props.activeCellIndex != null && brain.getRowCount() > props.activeCellIndex[0];
|
|
3402
3539
|
useLayoutEffect4(() => {
|
|
3403
3540
|
if (props.activeCellIndex == null) {
|
|
3404
3541
|
return;
|
|
3405
3542
|
}
|
|
3406
3543
|
const rowIndex = props.activeCellIndex[0];
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3544
|
+
const activeCellRowHeight = brain.getRowHeight(rowIndex);
|
|
3545
|
+
const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical");
|
|
3546
|
+
const node = domRef.current;
|
|
3547
|
+
const scrollPosition = brain.getScrollPosition();
|
|
3548
|
+
setInfiniteVarsOnNode({
|
|
3549
|
+
scrollTopForActiveCell: `${-scrollPosition.scrollTop}px`,
|
|
3550
|
+
scrollLeftForActiveCell: `${-scrollPosition.scrollLeft}px`,
|
|
3551
|
+
activeCellRowHeight: `${activeCellRowHeight}px`,
|
|
3552
|
+
activeCellRowOffset: `${activeCellRowOffset}px`
|
|
3553
|
+
}, node);
|
|
3554
|
+
}, [props.activeCellIndex]);
|
|
3414
3555
|
useEffect6(() => {
|
|
3415
|
-
const removeOnSCroll = brain.onScroll((
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
});
|
|
3421
|
-
const removeOnRenderCountChange = brain.onRenderCountChange(() => {
|
|
3422
|
-
rerender();
|
|
3423
|
-
});
|
|
3424
|
-
const removeOnAvailableSizeChange = brain.onAvailableSizeChange(() => {
|
|
3425
|
-
rerender();
|
|
3556
|
+
const removeOnSCroll = brain.onScroll((scrollPosition) => {
|
|
3557
|
+
setInfiniteVarsOnNode({
|
|
3558
|
+
scrollTopForActiveCell: `${-scrollPosition.scrollTop}px`,
|
|
3559
|
+
scrollLeftForActiveCell: `${-scrollPosition.scrollLeft}px`
|
|
3560
|
+
}, domRef.current);
|
|
3426
3561
|
});
|
|
3427
3562
|
return () => {
|
|
3428
|
-
removeOnAvailableSizeChange();
|
|
3429
|
-
removeOnRenderCountChange();
|
|
3430
3563
|
removeOnSCroll();
|
|
3431
3564
|
};
|
|
3432
3565
|
}, [brain]);
|
|
3433
|
-
const scrollPosition = brain.getScrollPosition();
|
|
3434
3566
|
return /* @__PURE__ */ createElement7("div", {
|
|
3567
|
+
className: ActiveIndicatorWrapperCls,
|
|
3568
|
+
"data-name": "active-cell"
|
|
3569
|
+
}, /* @__PURE__ */ createElement7("div", {
|
|
3435
3570
|
ref: domRef,
|
|
3436
3571
|
"data-name": "active-cell-indicator",
|
|
3437
3572
|
className: `${baseCls2} ${active ? ActiveCellIndicatorCls.visible : ActiveCellIndicatorCls.hidden}`,
|
|
3438
|
-
style: active ?
|
|
3439
|
-
|
|
3440
|
-
width: state.colWidth,
|
|
3441
|
-
height: state.rowHeight
|
|
3442
|
-
} : void 0
|
|
3443
|
-
});
|
|
3573
|
+
style: active ? ActiveStyle : void 0
|
|
3574
|
+
}));
|
|
3444
3575
|
};
|
|
3445
3576
|
var ActiveCellIndicator = memo5(ActiveCellIndicatorFn);
|
|
3446
3577
|
|
|
@@ -3488,7 +3619,7 @@ function HeadlessTable(props) {
|
|
|
3488
3619
|
"onRenderUpdater"
|
|
3489
3620
|
]);
|
|
3490
3621
|
const domRef = useRef7(null);
|
|
3491
|
-
const [scrollSize, setTotalScrollSize] =
|
|
3622
|
+
const [scrollSize, setTotalScrollSize] = useState4({
|
|
3492
3623
|
width: 0,
|
|
3493
3624
|
height: 0
|
|
3494
3625
|
});
|
|
@@ -3510,7 +3641,7 @@ function HeadlessTable(props) {
|
|
|
3510
3641
|
};
|
|
3511
3642
|
brain.update(size);
|
|
3512
3643
|
};
|
|
3513
|
-
const remove = setupResizeObserver(node, onResize);
|
|
3644
|
+
const remove = setupResizeObserver(node, onResize, { debounce: 50 });
|
|
3514
3645
|
return remove;
|
|
3515
3646
|
}, []);
|
|
3516
3647
|
const onContainerScroll = useCallback4((scrollPos) => {
|
|
@@ -3562,7 +3693,7 @@ import {
|
|
|
3562
3693
|
createContext as createContext2,
|
|
3563
3694
|
useMemo as useMemo3,
|
|
3564
3695
|
useEffect as useEffect8,
|
|
3565
|
-
useState as
|
|
3696
|
+
useState as useState5,
|
|
3566
3697
|
useRef as useRef10
|
|
3567
3698
|
} from "react";
|
|
3568
3699
|
|
|
@@ -3700,14 +3831,14 @@ function forwardProps(propsToForward, props) {
|
|
|
3700
3831
|
function getComponentStateRoot(config) {
|
|
3701
3832
|
return memo6(function ComponentStateRoot(props) {
|
|
3702
3833
|
var _a, _b;
|
|
3703
|
-
const [initialSetupState] =
|
|
3834
|
+
const [initialSetupState] = useState5(() => {
|
|
3704
3835
|
return config.initSetupState ? config.initSetupState() : {};
|
|
3705
3836
|
});
|
|
3706
3837
|
const propsToStateSetRef = useRef10(new Set());
|
|
3707
3838
|
const propsToForward = useMemo3(() => config.forwardProps ? config.forwardProps(initialSetupState) : {}, [initialSetupState]);
|
|
3708
3839
|
const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
|
|
3709
3840
|
const getParentState = useLatest(parentState);
|
|
3710
|
-
const [wholeState] =
|
|
3841
|
+
const [wholeState] = useState5(() => {
|
|
3711
3842
|
let mappedState = {};
|
|
3712
3843
|
if (propsToForward) {
|
|
3713
3844
|
mappedState = forwardProps(propsToForward, props);
|
|
@@ -3848,6 +3979,12 @@ function getComponentStateRoot(config) {
|
|
|
3848
3979
|
}
|
|
3849
3980
|
}
|
|
3850
3981
|
});
|
|
3982
|
+
useEffect8(() => {
|
|
3983
|
+
return () => {
|
|
3984
|
+
var _a2;
|
|
3985
|
+
(_a2 = config.cleanup) == null ? void 0 : _a2.call(config, getComponentState());
|
|
3986
|
+
};
|
|
3987
|
+
}, []);
|
|
3851
3988
|
return /* @__PURE__ */ createElement9(Context.Provider, {
|
|
3852
3989
|
value: contextValue
|
|
3853
3990
|
}, props.children);
|
|
@@ -3870,28 +4007,28 @@ var useInternalProps = () => {
|
|
|
3870
4007
|
};
|
|
3871
4008
|
|
|
3872
4009
|
// src/components/InfiniteTable/utilities.css.ts
|
|
3873
|
-
var alignItems = { center: "
|
|
3874
|
-
var cssEllipsisClassName = "
|
|
3875
|
-
var cursor = { pointer: "_16lm1iwd" };
|
|
3876
|
-
var display = { flex: "
|
|
3877
|
-
var flex = { "1": "
|
|
3878
|
-
var flexFlow = { column: "
|
|
3879
|
-
var justifyContent = { center: "
|
|
3880
|
-
var left = { "0": "
|
|
3881
|
-
var overflow = { hidden: "
|
|
4010
|
+
var alignItems = { center: "_16lm1iw15", stretch: "_16lm1iw16" };
|
|
4011
|
+
var cssEllipsisClassName = "_16lm1iw1e _16lm1iw1f _16lm1iw1a";
|
|
4012
|
+
var cursor = { pointer: "_16lm1iwd", colResize: "_16lm1iwe" };
|
|
4013
|
+
var display = { flex: "_16lm1iwn", block: "_16lm1iwo", inlineBlock: "_16lm1iwp" };
|
|
4014
|
+
var flex = { "1": "_16lm1iwg", none: "_16lm1iwh" };
|
|
4015
|
+
var flexFlow = { column: "_16lm1iw13", row: "_16lm1iw14" };
|
|
4016
|
+
var justifyContent = { center: "_16lm1iw17", start: "_16lm1iw18", end: "_16lm1iw19" };
|
|
4017
|
+
var left = { "0": "_16lm1iwx", "100%": "_16lm1iwy" };
|
|
4018
|
+
var overflow = { hidden: "_16lm1iw1a", auto: "_16lm1iw1b", visible: "_16lm1iw1c" };
|
|
3882
4019
|
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
3883
|
-
var top = { "0": "
|
|
4020
|
+
var top = { "0": "_16lm1iwv", "100%": "_16lm1iww" };
|
|
3884
4021
|
var transformTranslateZero = "_16lm1iwa";
|
|
3885
|
-
var userSelect = { none: "
|
|
3886
|
-
var zIndex = { "1": "
|
|
4022
|
+
var userSelect = { none: "_16lm1iwq" };
|
|
4023
|
+
var zIndex = { "1": "_16lm1iwi", "10": "_16lm1iwj", "1000": "_16lm1iwk", "10000": "_16lm1iwl", "100000": "_16lm1iwm" };
|
|
3887
4024
|
|
|
3888
4025
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3889
4026
|
var InfiniteTableBody = forwardRef2(function InfiniteTableBody2(props, ref) {
|
|
3890
|
-
const { rootClassName:
|
|
4027
|
+
const { rootClassName: rootClassName13 } = useInternalProps();
|
|
3891
4028
|
return /* @__PURE__ */ createElement10("div", __spreadProps(__spreadValues({
|
|
3892
4029
|
ref
|
|
3893
4030
|
}, props), {
|
|
3894
|
-
className: join(`${
|
|
4031
|
+
className: join(`${rootClassName13}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
|
|
3895
4032
|
}));
|
|
3896
4033
|
});
|
|
3897
4034
|
|
|
@@ -3901,11 +4038,11 @@ import {
|
|
|
3901
4038
|
forwardRef as forwardRef3
|
|
3902
4039
|
} from "react";
|
|
3903
4040
|
var InfiniteTableFooter = forwardRef3(function InfiniteTableFooter2(props, ref) {
|
|
3904
|
-
const { rootClassName:
|
|
4041
|
+
const { rootClassName: rootClassName13 } = useInternalProps();
|
|
3905
4042
|
return /* @__PURE__ */ createElement11("div", __spreadProps(__spreadValues({
|
|
3906
4043
|
ref
|
|
3907
4044
|
}, props), {
|
|
3908
|
-
className: join(`${
|
|
4045
|
+
className: join(`${rootClassName13}Footer`, position.relative, display.flex, flexFlow.row, props.className)
|
|
3909
4046
|
}));
|
|
3910
4047
|
});
|
|
3911
4048
|
|
|
@@ -3913,10 +4050,10 @@ var InfiniteTableFooter = forwardRef3(function InfiniteTableFooter2(props, ref)
|
|
|
3913
4050
|
import {
|
|
3914
4051
|
Fragment as Fragment2,
|
|
3915
4052
|
createContext as createContext4,
|
|
3916
|
-
createElement as
|
|
4053
|
+
createElement as createElement16,
|
|
3917
4054
|
useMemo as useMemo5
|
|
3918
4055
|
} from "react";
|
|
3919
|
-
import { useCallback as
|
|
4056
|
+
import { useCallback as useCallback8, useContext as useContext5, useEffect as useEffect11, useRef as useRef13 } from "react";
|
|
3920
4057
|
import { createPortal } from "react-dom";
|
|
3921
4058
|
|
|
3922
4059
|
// src/components/DataSource/defaultFilterTypes.ts
|
|
@@ -4024,7 +4161,7 @@ import {
|
|
|
4024
4161
|
useCallback as useCallback6,
|
|
4025
4162
|
useMemo as useMemo4,
|
|
4026
4163
|
useRef as useRef11,
|
|
4027
|
-
useState as
|
|
4164
|
+
useState as useState6
|
|
4028
4165
|
} from "react";
|
|
4029
4166
|
|
|
4030
4167
|
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
@@ -4078,10 +4215,9 @@ var useColumnPointerEvents = ({
|
|
|
4078
4215
|
columns,
|
|
4079
4216
|
computedRemainingSpace
|
|
4080
4217
|
}) => {
|
|
4081
|
-
const [draggingDiff, setDraggingDiff] =
|
|
4082
|
-
const [proxyOffset, setProxyOffset] =
|
|
4218
|
+
const [draggingDiff, setDraggingDiff] = useState6(null);
|
|
4219
|
+
const [proxyOffset, setProxyOffset] = useState6(null);
|
|
4083
4220
|
const breakpointsRef = useRef11([]);
|
|
4084
|
-
const pointerMoveRef = useRef11(null);
|
|
4085
4221
|
const didDragRef = useRef11(false);
|
|
4086
4222
|
const initialClientPos = useRef11(null);
|
|
4087
4223
|
const currentDropIndexRef = useRef11(null);
|
|
@@ -4157,35 +4293,40 @@ var useColumnPointerEvents = ({
|
|
|
4157
4293
|
}
|
|
4158
4294
|
setDraggingDiff({ left: diffX, top: diffY });
|
|
4159
4295
|
};
|
|
4160
|
-
|
|
4296
|
+
const onPointerUp = (e2) => {
|
|
4297
|
+
const target2 = domRef.current;
|
|
4298
|
+
target2.style.cursor = cursorRef.current;
|
|
4299
|
+
target2.releasePointerCapture(e2.pointerId);
|
|
4300
|
+
target2.removeEventListener("pointermove", onPointerMove);
|
|
4301
|
+
target2.removeEventListener("pointerup", onPointerUp);
|
|
4302
|
+
setDraggingDiff(null);
|
|
4303
|
+
componentActions.columnShifts = null;
|
|
4304
|
+
componentActions.draggingColumnId = null;
|
|
4305
|
+
if (!didDragRef.current && column.computedSortable) {
|
|
4306
|
+
column.toggleSort();
|
|
4307
|
+
}
|
|
4308
|
+
const dropIndex = currentDropIndexRef.current;
|
|
4309
|
+
if (dropIndex != null && dropIndex !== columnIndex) {
|
|
4310
|
+
const newOrder = moveXatY(computedColumnOrder, columnIndex, dropIndex > columnIndex ? dropIndex - 1 : dropIndex);
|
|
4311
|
+
componentActions.columnOrder = newOrder;
|
|
4312
|
+
}
|
|
4313
|
+
breakpointsRef.current = [];
|
|
4314
|
+
didDragRef.current = false;
|
|
4315
|
+
initialClientPos.current = null;
|
|
4316
|
+
currentDropIndexRef.current = null;
|
|
4317
|
+
};
|
|
4161
4318
|
target.addEventListener("pointermove", onPointerMove);
|
|
4319
|
+
target.addEventListener("pointerup", onPointerUp);
|
|
4162
4320
|
target.setPointerCapture(e.pointerId);
|
|
4163
|
-
}, [
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
componentActions.draggingColumnId = null;
|
|
4172
|
-
if (!didDragRef.current && column.computedSortable) {
|
|
4173
|
-
column.toggleSort();
|
|
4174
|
-
}
|
|
4175
|
-
const dropIndex = currentDropIndexRef.current;
|
|
4176
|
-
if (dropIndex != null && dropIndex !== columnIndex) {
|
|
4177
|
-
const newOrder = moveXatY(computedColumnOrder, columnIndex, dropIndex > columnIndex ? dropIndex - 1 : dropIndex);
|
|
4178
|
-
componentActions.columnOrder = newOrder;
|
|
4179
|
-
}
|
|
4180
|
-
breakpointsRef.current = [];
|
|
4181
|
-
pointerMoveRef.current = null;
|
|
4182
|
-
didDragRef.current = false;
|
|
4183
|
-
initialClientPos.current = null;
|
|
4184
|
-
currentDropIndexRef.current = null;
|
|
4185
|
-
}, [column, columnIndex, componentActions, computedColumnOrder]);
|
|
4321
|
+
}, [
|
|
4322
|
+
columns,
|
|
4323
|
+
column,
|
|
4324
|
+
columnIndex,
|
|
4325
|
+
columnsArray,
|
|
4326
|
+
computedRemainingSpace,
|
|
4327
|
+
computedColumnOrder
|
|
4328
|
+
]);
|
|
4186
4329
|
return {
|
|
4187
|
-
onPointerUp: column.computedDraggable ? onPointerUp : () => {
|
|
4188
|
-
},
|
|
4189
4330
|
onPointerDown: column.computedDraggable ? onPointerDown : () => {
|
|
4190
4331
|
},
|
|
4191
4332
|
dragging,
|
|
@@ -4240,23 +4381,23 @@ function NumberFilterEditor(props) {
|
|
|
4240
4381
|
import {
|
|
4241
4382
|
createElement as createElement12
|
|
4242
4383
|
} from "react";
|
|
4243
|
-
import { useEffect as useEffect9, useState as
|
|
4384
|
+
import { useEffect as useEffect9, useState as useState7 } from "react";
|
|
4244
4385
|
|
|
4245
4386
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
4246
4387
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4247
|
-
var CellCls = "_1eexc2a5
|
|
4248
|
-
var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob117
|
|
4388
|
+
var CellCls = "_1eexc2a5 _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw2 _16lm1iw1d _16lm1iw1e";
|
|
4389
|
+
var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob117 _16lm1iws _16lm1iwu _16lm1iwn _16lm1iw14 _16lm1iw15", variantClassNames: { filtered: { false: "_12zfob118", true: "_12zfob119" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4249
4390
|
var HeaderCellProxy = "_12zfob10";
|
|
4250
|
-
var HeaderCellRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob1h
|
|
4251
|
-
var HeaderClsRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob17
|
|
4252
|
-
var HeaderFilterCls = "_12zfob11c
|
|
4253
|
-
var HeaderFilterEditorCls = "
|
|
4254
|
-
var HeaderGroupCls = "_12zfob11b
|
|
4391
|
+
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"]] });
|
|
4392
|
+
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"]] });
|
|
4393
|
+
var HeaderFilterCls = "_12zfob11c _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw1";
|
|
4394
|
+
var HeaderFilterEditorCls = "_16lm1iwu _16lm1iws";
|
|
4395
|
+
var HeaderGroupCls = "_12zfob11b _16lm1iwn _16lm1iw14 _16lm1iw15";
|
|
4255
4396
|
var HeaderScrollbarPlaceholderCls = "_12zfob16 _16lm1iw2";
|
|
4256
4397
|
var HeaderSortIconCls = "_16lm1iw1";
|
|
4257
4398
|
var HeaderSortIconIndexCls = "_12zfob15";
|
|
4258
4399
|
var HeaderSortIconRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob12", center: "_12zfob13", end: "_12zfob14" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4259
|
-
var HeaderWrapperCls = "_12zfob11a
|
|
4400
|
+
var HeaderWrapperCls = "_12zfob11a _16lm1iw1a _16lm1iw1 _16lm1iwn _16lm1iw14";
|
|
4260
4401
|
|
|
4261
4402
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
4262
4403
|
var defaultLineStyle = {
|
|
@@ -4267,8 +4408,8 @@ var defaultLineStyle = {
|
|
|
4267
4408
|
var InfiniteTableIconClassName = "InfiniteTableIcon";
|
|
4268
4409
|
function SortIcon(props) {
|
|
4269
4410
|
var _a;
|
|
4270
|
-
const [rendered, setRendered] =
|
|
4271
|
-
const [opacity, setOpacity] =
|
|
4411
|
+
const [rendered, setRendered] = useState7(true);
|
|
4412
|
+
const [opacity, setOpacity] = useState7(0);
|
|
4272
4413
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
4273
4414
|
const showIndex = index != null && index > 0;
|
|
4274
4415
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -4347,20 +4488,20 @@ var useInfiniteTableState = () => {
|
|
|
4347
4488
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
4348
4489
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4349
4490
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
4350
|
-
var ColumnCellCls = "_1eexc2a5
|
|
4491
|
+
var ColumnCellCls = "_1eexc2a5 _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw2 _16lm1iw1d _16lm1iw1e";
|
|
4351
4492
|
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"]] });
|
|
4352
4493
|
|
|
4353
4494
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4354
4495
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
4355
4496
|
var InfiniteTableCellClassName = `${rootClassName5}Cell`;
|
|
4356
4497
|
var InfiniteTableCellContentClassName = `${rootClassName5}Cell_content`;
|
|
4498
|
+
var columnWidthAtIndex2 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4357
4499
|
function InfiniteTableCellFn(props) {
|
|
4358
4500
|
var _b, _c, _d;
|
|
4359
4501
|
const _a = props, {
|
|
4360
4502
|
cssEllipsis = true,
|
|
4361
4503
|
virtualized = true,
|
|
4362
4504
|
skipColumnShifting = false,
|
|
4363
|
-
offsetProperty = "left",
|
|
4364
4505
|
contentStyle,
|
|
4365
4506
|
column,
|
|
4366
4507
|
domRef,
|
|
@@ -4368,7 +4509,6 @@ function InfiniteTableCellFn(props) {
|
|
|
4368
4509
|
contentClassName,
|
|
4369
4510
|
afterChildren,
|
|
4370
4511
|
beforeChildren,
|
|
4371
|
-
offset,
|
|
4372
4512
|
cellType,
|
|
4373
4513
|
cssPosition: _cssPosition,
|
|
4374
4514
|
renderChildren
|
|
@@ -4376,7 +4516,6 @@ function InfiniteTableCellFn(props) {
|
|
|
4376
4516
|
"cssEllipsis",
|
|
4377
4517
|
"virtualized",
|
|
4378
4518
|
"skipColumnShifting",
|
|
4379
|
-
"offsetProperty",
|
|
4380
4519
|
"contentStyle",
|
|
4381
4520
|
"column",
|
|
4382
4521
|
"domRef",
|
|
@@ -4384,7 +4523,6 @@ function InfiniteTableCellFn(props) {
|
|
|
4384
4523
|
"contentClassName",
|
|
4385
4524
|
"afterChildren",
|
|
4386
4525
|
"beforeChildren",
|
|
4387
|
-
"offset",
|
|
4388
4526
|
"cellType",
|
|
4389
4527
|
"cssPosition",
|
|
4390
4528
|
"renderChildren"
|
|
@@ -4393,10 +4531,10 @@ function InfiniteTableCellFn(props) {
|
|
|
4393
4531
|
const { columnShifts } = useInfiniteTableState();
|
|
4394
4532
|
const shifting = !!columnShifts;
|
|
4395
4533
|
const style = __spreadValues({
|
|
4396
|
-
width
|
|
4534
|
+
width: `var(${columnWidthAtIndex2}-${column.computedVisibleIndex})`
|
|
4397
4535
|
}, domProps.style);
|
|
4398
4536
|
if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
|
|
4399
|
-
const shiftLeft = columnShifts[column.computedVisibleIndex]
|
|
4537
|
+
const shiftLeft = columnShifts[column.computedVisibleIndex];
|
|
4400
4538
|
if (virtualized) {
|
|
4401
4539
|
style.left = shiftLeft;
|
|
4402
4540
|
} else {
|
|
@@ -4426,13 +4564,13 @@ var InfiniteTableCell = memo7(InfiniteTableCellFn);
|
|
|
4426
4564
|
import {
|
|
4427
4565
|
createElement as createElement14
|
|
4428
4566
|
} from "react";
|
|
4429
|
-
import { useEffect as useEffect10, useState as
|
|
4567
|
+
import { useEffect as useEffect10, useState as useState8 } from "react";
|
|
4430
4568
|
var { rootClassName: rootClassName6 } = internalProps;
|
|
4431
4569
|
var InfiniteTableColumnHeaderFilterClassName = `${rootClassName6}HeaderCell__filter`;
|
|
4432
4570
|
var stopPropagation = (e) => e.stopPropagation();
|
|
4433
4571
|
function InfiniteTableColumnHeaderFilter(props) {
|
|
4434
4572
|
var _a, _b, _c, _d;
|
|
4435
|
-
const [theValue, setTheValue] =
|
|
4573
|
+
const [theValue, setTheValue] = useState8((_b = (_a = props.columnFilterValue) == null ? void 0 : _a.filterValue) != null ? _b : "");
|
|
4436
4574
|
const onInputChange = (filterValue) => {
|
|
4437
4575
|
setTheValue(filterValue);
|
|
4438
4576
|
props.onChange(filterValue);
|
|
@@ -4480,10 +4618,544 @@ function InfiniteTableColumnHeaderFilterEmpty() {
|
|
|
4480
4618
|
});
|
|
4481
4619
|
}
|
|
4482
4620
|
|
|
4621
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx
|
|
4622
|
+
import {
|
|
4623
|
+
createElement as createElement15
|
|
4624
|
+
} from "react";
|
|
4625
|
+
import { useCallback as useCallback7 } from "react";
|
|
4626
|
+
|
|
4627
|
+
// src/components/flexbox/index.ts
|
|
4628
|
+
var computeFlex = (params) => {
|
|
4629
|
+
const {
|
|
4630
|
+
availableSize,
|
|
4631
|
+
items,
|
|
4632
|
+
minSize: defaultMinSize,
|
|
4633
|
+
maxSize: defaultMaxSize
|
|
4634
|
+
} = params;
|
|
4635
|
+
if (availableSize < 0) {
|
|
4636
|
+
throw "The provided availableSize cannot be negative!";
|
|
4637
|
+
}
|
|
4638
|
+
let totalFixedSize = 0;
|
|
4639
|
+
let totalFlex = 0;
|
|
4640
|
+
let totalFlexCount = 0;
|
|
4641
|
+
const minSizes = [];
|
|
4642
|
+
const maxSizes = [];
|
|
4643
|
+
items.forEach((item, i) => {
|
|
4644
|
+
var _a, _b, _c, _d, _e;
|
|
4645
|
+
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
4646
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
4647
|
+
minSizes.push(minSize);
|
|
4648
|
+
maxSizes.push(maxSize);
|
|
4649
|
+
if (item.size != null) {
|
|
4650
|
+
if (maxSize != null && item.size > maxSize) {
|
|
4651
|
+
item.size = maxSize;
|
|
4652
|
+
}
|
|
4653
|
+
if (minSize != null && item.size < minSize) {
|
|
4654
|
+
item.size = minSize;
|
|
4655
|
+
}
|
|
4656
|
+
}
|
|
4657
|
+
const itemFlex = item.flex == 0 ? null : item.flex;
|
|
4658
|
+
if (item.size == null && itemFlex == null) {
|
|
4659
|
+
throw `Items must specify either a size or a flex property. Item at index ${i} doesn't have either of those.`;
|
|
4660
|
+
}
|
|
4661
|
+
if (itemFlex != null) {
|
|
4662
|
+
totalFlexCount += 1;
|
|
4663
|
+
}
|
|
4664
|
+
totalFlex += itemFlex != null ? itemFlex : 0;
|
|
4665
|
+
totalFixedSize += (_e = item.size) != null ? _e : 0;
|
|
4666
|
+
});
|
|
4667
|
+
let availableSizeForFlex = Math.max(availableSize - totalFixedSize, 0);
|
|
4668
|
+
let sizePerFlex = availableSizeForFlex / totalFlex;
|
|
4669
|
+
let maxxedFlexItems = {};
|
|
4670
|
+
let minnedFlexItems = {};
|
|
4671
|
+
let constrainedCount = 0;
|
|
4672
|
+
items.forEach((item, index) => {
|
|
4673
|
+
var _a, _b, _c, _d;
|
|
4674
|
+
if (item.flex != null) {
|
|
4675
|
+
const approxFlexSize = sizePerFlex * item.flex;
|
|
4676
|
+
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
4677
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
4678
|
+
let constrained = false;
|
|
4679
|
+
let substractSize = 0;
|
|
4680
|
+
if (maxSize != null && approxFlexSize > maxSize) {
|
|
4681
|
+
maxxedFlexItems[index] = true;
|
|
4682
|
+
constrained = true;
|
|
4683
|
+
substractSize = maxSize;
|
|
4684
|
+
}
|
|
4685
|
+
if (minSize != null && approxFlexSize < minSize) {
|
|
4686
|
+
minnedFlexItems[index] = true;
|
|
4687
|
+
constrained = true;
|
|
4688
|
+
substractSize = minSize;
|
|
4689
|
+
}
|
|
4690
|
+
if (constrained) {
|
|
4691
|
+
constrainedCount += 1;
|
|
4692
|
+
totalFlexCount -= 1;
|
|
4693
|
+
totalFlex -= item.flex;
|
|
4694
|
+
availableSizeForFlex -= substractSize;
|
|
4695
|
+
}
|
|
4696
|
+
}
|
|
4697
|
+
});
|
|
4698
|
+
if (constrainedCount) {
|
|
4699
|
+
sizePerFlex = availableSizeForFlex / totalFlex;
|
|
4700
|
+
}
|
|
4701
|
+
let flexSizes = [];
|
|
4702
|
+
let currentFlexCount = 0;
|
|
4703
|
+
let remainingSizeForFlex = availableSizeForFlex;
|
|
4704
|
+
let remainingFlex = totalFlex;
|
|
4705
|
+
let totalTakenSize = 0;
|
|
4706
|
+
let flexSizeSum = 0;
|
|
4707
|
+
const computedSizes = [];
|
|
4708
|
+
const resultItems = items.map((item, index) => {
|
|
4709
|
+
var _a, _b, _c, _d, _e;
|
|
4710
|
+
const sizedItem = __spreadValues({}, item);
|
|
4711
|
+
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
4712
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
4713
|
+
let flexSize = 0;
|
|
4714
|
+
const maxxed = maxxedFlexItems[index];
|
|
4715
|
+
const minned = minnedFlexItems[index];
|
|
4716
|
+
const constrained = maxxed || minned;
|
|
4717
|
+
let computedSize = (_e = item.size) != null ? _e : 0;
|
|
4718
|
+
if (item.flex != null) {
|
|
4719
|
+
if (constrained) {
|
|
4720
|
+
if (minned) {
|
|
4721
|
+
flexSize = minSize;
|
|
4722
|
+
}
|
|
4723
|
+
if (maxxed) {
|
|
4724
|
+
flexSize = maxSize;
|
|
4725
|
+
}
|
|
4726
|
+
} else {
|
|
4727
|
+
currentFlexCount += 1;
|
|
4728
|
+
const constrain = (size) => {
|
|
4729
|
+
if (maxSize != null && size > maxSize) {
|
|
4730
|
+
size = maxSize;
|
|
4731
|
+
}
|
|
4732
|
+
if (minSize != null && size < minSize) {
|
|
4733
|
+
size = minSize;
|
|
4734
|
+
}
|
|
4735
|
+
return size;
|
|
4736
|
+
};
|
|
4737
|
+
if (currentFlexCount === totalFlexCount) {
|
|
4738
|
+
flexSize = constrain(remainingSizeForFlex);
|
|
4739
|
+
} else {
|
|
4740
|
+
flexSize = constrain(Math.round(item.flex * sizePerFlex));
|
|
4741
|
+
flexSizeSum += flexSize;
|
|
4742
|
+
remainingSizeForFlex = availableSizeForFlex - flexSizeSum;
|
|
4743
|
+
remainingFlex -= item.flex;
|
|
4744
|
+
sizePerFlex = remainingSizeForFlex / remainingFlex;
|
|
4745
|
+
}
|
|
4746
|
+
}
|
|
4747
|
+
computedSize = flexSize;
|
|
4748
|
+
sizedItem.flexSize = flexSize;
|
|
4749
|
+
}
|
|
4750
|
+
flexSizes.push(flexSize);
|
|
4751
|
+
computedSizes.push(computedSize);
|
|
4752
|
+
sizedItem.computedSize = computedSize;
|
|
4753
|
+
totalTakenSize += computedSize;
|
|
4754
|
+
return sizedItem;
|
|
4755
|
+
});
|
|
4756
|
+
return {
|
|
4757
|
+
items: resultItems,
|
|
4758
|
+
flexSizes,
|
|
4759
|
+
minSizes,
|
|
4760
|
+
maxSizes,
|
|
4761
|
+
computedSizes,
|
|
4762
|
+
remainingSize: Math.round(availableSize - totalTakenSize)
|
|
4763
|
+
};
|
|
4764
|
+
};
|
|
4765
|
+
function resizeClamp(value, min, max, direction) {
|
|
4766
|
+
if (min != null && value <= min) {
|
|
4767
|
+
return { value: min, clamped: "min", diff: (value - min) * direction };
|
|
4768
|
+
}
|
|
4769
|
+
if (max != null && value >= max) {
|
|
4770
|
+
return { value: max, clamped: "max", diff: (max - value) * direction };
|
|
4771
|
+
}
|
|
4772
|
+
return { value, clamped: false, diff: 0 };
|
|
4773
|
+
}
|
|
4774
|
+
var computeResize = (params) => {
|
|
4775
|
+
const { availableSize, reservedWidth = 0 } = params;
|
|
4776
|
+
const columnSizing = Object.keys(params.columnSizing).reduce((acc, key) => {
|
|
4777
|
+
acc[key] = __spreadValues({}, params.columnSizing[key]);
|
|
4778
|
+
return acc;
|
|
4779
|
+
}, {});
|
|
4780
|
+
if (availableSize < 0) {
|
|
4781
|
+
throw "The provided availableSize cannot be negative!";
|
|
4782
|
+
}
|
|
4783
|
+
let dragHandleOffset = params.dragHandleOffset;
|
|
4784
|
+
const firstIndex = params.dragHandlePositionAfter;
|
|
4785
|
+
const secondIndex = params.dragHandlePositionAfter + 1;
|
|
4786
|
+
const firstItem = params.items[firstIndex];
|
|
4787
|
+
const secondItem = params.items[secondIndex];
|
|
4788
|
+
const firstId = firstItem.id;
|
|
4789
|
+
const secondId = secondItem == null ? void 0 : secondItem.id;
|
|
4790
|
+
const firstSize = firstItem.computedWidth;
|
|
4791
|
+
const firstMinSize = firstItem.computedMinWidth;
|
|
4792
|
+
const firstMaxSize = firstItem.computedMaxWidth;
|
|
4793
|
+
const firstPropertyToAdjust = firstItem.computedFlex ? "flex" : "width";
|
|
4794
|
+
const secondSize = secondItem == null ? void 0 : secondItem.computedWidth;
|
|
4795
|
+
const secondMinSize = secondItem == null ? void 0 : secondItem.computedMinWidth;
|
|
4796
|
+
const secondMaxSize = secondItem == null ? void 0 : secondItem.computedMaxWidth;
|
|
4797
|
+
const secondPropertyToAdjust = (secondItem == null ? void 0 : secondItem.computedFlex) ? "flex" : "width";
|
|
4798
|
+
let maxReached = false;
|
|
4799
|
+
let minReached = false;
|
|
4800
|
+
const direction = dragHandleOffset > 0 ? 1 : -1;
|
|
4801
|
+
let {
|
|
4802
|
+
value: firstAdjustedSize,
|
|
4803
|
+
clamped: firstClamped,
|
|
4804
|
+
diff: firstDiff
|
|
4805
|
+
} = resizeClamp(firstSize + dragHandleOffset, firstMinSize, firstMaxSize, direction);
|
|
4806
|
+
if (params.shareSpaceOnResize) {
|
|
4807
|
+
if (secondItem == null) {
|
|
4808
|
+
columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
|
|
4809
|
+
[firstPropertyToAdjust]: firstAdjustedSize
|
|
4810
|
+
});
|
|
4811
|
+
minReached = firstClamped === "min";
|
|
4812
|
+
maxReached = firstClamped === "max";
|
|
4813
|
+
const adjustedDiff2 = firstAdjustedSize - firstSize;
|
|
4814
|
+
return {
|
|
4815
|
+
adjustedDiff: adjustedDiff2,
|
|
4816
|
+
reservedWidth,
|
|
4817
|
+
columnSizing,
|
|
4818
|
+
minReached,
|
|
4819
|
+
maxReached,
|
|
4820
|
+
constrained: minReached || maxReached
|
|
4821
|
+
};
|
|
4822
|
+
}
|
|
4823
|
+
let {
|
|
4824
|
+
value: secondAdjustedSize,
|
|
4825
|
+
clamped: secondClamped,
|
|
4826
|
+
diff: secondDiff
|
|
4827
|
+
} = resizeClamp(secondSize - dragHandleOffset, secondMinSize, secondMaxSize, direction);
|
|
4828
|
+
if (firstClamped && secondClamped) {
|
|
4829
|
+
if (Math.abs(firstDiff) > Math.abs(secondDiff)) {
|
|
4830
|
+
secondClamped = false;
|
|
4831
|
+
} else {
|
|
4832
|
+
firstClamped = false;
|
|
4833
|
+
}
|
|
4834
|
+
}
|
|
4835
|
+
if (!firstClamped && !secondClamped) {
|
|
4836
|
+
} else if (firstClamped) {
|
|
4837
|
+
const clampResultForSecond = resizeClamp(secondSize - dragHandleOffset - firstDiff, secondMinSize, secondMaxSize, direction);
|
|
4838
|
+
secondAdjustedSize = clampResultForSecond.value;
|
|
4839
|
+
secondClamped = clampResultForSecond.clamped;
|
|
4840
|
+
secondDiff = clampResultForSecond.diff;
|
|
4841
|
+
} else if (secondClamped) {
|
|
4842
|
+
const clampResultForFirst = resizeClamp(firstSize + dragHandleOffset + secondDiff, firstMinSize, firstMaxSize, direction);
|
|
4843
|
+
firstAdjustedSize = clampResultForFirst.value;
|
|
4844
|
+
firstClamped = clampResultForFirst.clamped;
|
|
4845
|
+
firstDiff = clampResultForFirst.diff;
|
|
4846
|
+
}
|
|
4847
|
+
columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
|
|
4848
|
+
[firstPropertyToAdjust]: firstAdjustedSize
|
|
4849
|
+
});
|
|
4850
|
+
columnSizing[secondId] = __spreadProps(__spreadValues({}, columnSizing[secondId]), {
|
|
4851
|
+
[secondPropertyToAdjust]: secondAdjustedSize
|
|
4852
|
+
});
|
|
4853
|
+
minReached = firstClamped === "min" || secondClamped === "min";
|
|
4854
|
+
maxReached = firstClamped === "max" || secondClamped === "max";
|
|
4855
|
+
} else {
|
|
4856
|
+
columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
|
|
4857
|
+
[firstPropertyToAdjust]: firstAdjustedSize
|
|
4858
|
+
});
|
|
4859
|
+
minReached = firstClamped === "min";
|
|
4860
|
+
maxReached = firstClamped === "max";
|
|
4861
|
+
}
|
|
4862
|
+
const adjustedDiff = firstAdjustedSize - firstSize;
|
|
4863
|
+
return {
|
|
4864
|
+
adjustedDiff,
|
|
4865
|
+
reservedWidth: !params.shareSpaceOnResize ? reservedWidth - adjustedDiff : reservedWidth,
|
|
4866
|
+
columnSizing,
|
|
4867
|
+
minReached,
|
|
4868
|
+
maxReached,
|
|
4869
|
+
constrained: minReached || maxReached
|
|
4870
|
+
};
|
|
4871
|
+
};
|
|
4872
|
+
function sum(a, b) {
|
|
4873
|
+
return a + b;
|
|
4874
|
+
}
|
|
4875
|
+
function cloneColumnSizing(columnSizing) {
|
|
4876
|
+
const newColumnSizing = Object.keys(columnSizing).reduce((acc, key) => {
|
|
4877
|
+
acc[key] = __spreadValues({}, columnSizing[key]);
|
|
4878
|
+
return acc;
|
|
4879
|
+
}, {});
|
|
4880
|
+
return newColumnSizing;
|
|
4881
|
+
}
|
|
4882
|
+
var computeGroupResize = (params) => {
|
|
4883
|
+
const { availableSize, reservedWidth = 0 } = params;
|
|
4884
|
+
const columnSizing = Object.keys(params.columnSizing).reduce((acc, key) => {
|
|
4885
|
+
acc[key] = __spreadValues({}, params.columnSizing[key]);
|
|
4886
|
+
return acc;
|
|
4887
|
+
}, {});
|
|
4888
|
+
if (availableSize < 0) {
|
|
4889
|
+
throw "The provided availableSize cannot be negative!";
|
|
4890
|
+
}
|
|
4891
|
+
let dragHandleOffset = params.dragHandleOffset;
|
|
4892
|
+
const beforeIndexes = [...new Array(params.columnGroupSize)].map((_, index) => params.dragHandlePositionAfter - index).reverse();
|
|
4893
|
+
const beforeItems = beforeIndexes.map((i) => params.items[i]);
|
|
4894
|
+
const beforeSizes = beforeItems.map((item) => item.computedWidth);
|
|
4895
|
+
const beforePropertiesToAdjust = beforeItems.map((item) => item.computedFlex ? "flex" : "width");
|
|
4896
|
+
let unresizableWidth = 0;
|
|
4897
|
+
const { computedSizes } = computeFlex({
|
|
4898
|
+
items: beforeItems.map((item) => {
|
|
4899
|
+
if (item.resizable === false) {
|
|
4900
|
+
unresizableWidth += item.computedWidth;
|
|
4901
|
+
}
|
|
4902
|
+
return {
|
|
4903
|
+
flex: item.resizable ? item.computedWidth : null,
|
|
4904
|
+
size: 0
|
|
4905
|
+
};
|
|
4906
|
+
}),
|
|
4907
|
+
availableSize: Math.max(beforeSizes.reduce(sum, 0) + dragHandleOffset - unresizableWidth, 0)
|
|
4908
|
+
});
|
|
4909
|
+
const diffsForEachItem = beforeItems.map((item, index) => {
|
|
4910
|
+
return computedSizes[index] - item.computedWidth;
|
|
4911
|
+
});
|
|
4912
|
+
let groupMinReached = true;
|
|
4913
|
+
let groupMaxReached = true;
|
|
4914
|
+
let groupConstrained = true;
|
|
4915
|
+
const adjustedDiffs = [];
|
|
4916
|
+
diffsForEachItem.forEach((diff, i) => {
|
|
4917
|
+
const item = beforeItems[i];
|
|
4918
|
+
if (!item.resizable) {
|
|
4919
|
+
adjustedDiffs.push(0);
|
|
4920
|
+
return;
|
|
4921
|
+
}
|
|
4922
|
+
const propertyToAdjust = beforePropertiesToAdjust[i];
|
|
4923
|
+
const itemSize = beforeSizes[i];
|
|
4924
|
+
const currentColumnSizing = cloneColumnSizing(columnSizing);
|
|
4925
|
+
const { maxReached, minReached, constrained, adjustedDiff: adjustedDiff2 } = computeResize({
|
|
4926
|
+
availableSize: params.availableSize,
|
|
4927
|
+
reservedWidth: params.reservedWidth,
|
|
4928
|
+
dragHandleOffset: diff,
|
|
4929
|
+
dragHandlePositionAfter: beforeIndexes[i],
|
|
4930
|
+
shareSpaceOnResize: false,
|
|
4931
|
+
items: params.items,
|
|
4932
|
+
columnSizing: currentColumnSizing
|
|
4933
|
+
});
|
|
4934
|
+
columnSizing[item.id] = __spreadProps(__spreadValues({}, currentColumnSizing[item.id]), {
|
|
4935
|
+
[propertyToAdjust]: itemSize + adjustedDiff2
|
|
4936
|
+
});
|
|
4937
|
+
adjustedDiffs.push(adjustedDiff2);
|
|
4938
|
+
if (!maxReached) {
|
|
4939
|
+
groupMaxReached = false;
|
|
4940
|
+
}
|
|
4941
|
+
if (!minReached) {
|
|
4942
|
+
groupMinReached = false;
|
|
4943
|
+
}
|
|
4944
|
+
if (!constrained) {
|
|
4945
|
+
groupConstrained = false;
|
|
4946
|
+
}
|
|
4947
|
+
});
|
|
4948
|
+
const adjustedDiff = adjustedDiffs.reduce(sum, 0);
|
|
4949
|
+
return {
|
|
4950
|
+
minReached: groupMinReached,
|
|
4951
|
+
maxReached: groupMaxReached,
|
|
4952
|
+
constrained: groupConstrained,
|
|
4953
|
+
adjustedDiffs,
|
|
4954
|
+
adjustedDiff,
|
|
4955
|
+
columnSizing,
|
|
4956
|
+
reservedWidth: reservedWidth - adjustedDiff
|
|
4957
|
+
};
|
|
4958
|
+
};
|
|
4959
|
+
|
|
4960
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
|
|
4961
|
+
import React20, { useRef as useRef12, useState as useState9 } from "react";
|
|
4962
|
+
|
|
4963
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/columnResizer.ts
|
|
4964
|
+
function getColumnResizer(colIndex, {
|
|
4965
|
+
columns,
|
|
4966
|
+
shareSpaceOnResize,
|
|
4967
|
+
domRef
|
|
4968
|
+
}) {
|
|
4969
|
+
const column = columns[colIndex];
|
|
4970
|
+
return {
|
|
4971
|
+
resize(diff) {
|
|
4972
|
+
setInfiniteColumnWidth(colIndex, column.computedWidth + diff, domRef.current);
|
|
4973
|
+
const nextColIndex = colIndex + 1;
|
|
4974
|
+
if (shareSpaceOnResize) {
|
|
4975
|
+
const nextColumn = columns[nextColIndex];
|
|
4976
|
+
if (!nextColumn) {
|
|
4977
|
+
return;
|
|
4978
|
+
}
|
|
4979
|
+
setInfiniteColumnWidth(nextColIndex, nextColumn.computedWidth - diff, domRef.current);
|
|
4980
|
+
setInfiniteColumnOffset(nextColIndex, nextColumn.computedOffset + diff, domRef.current);
|
|
4981
|
+
return;
|
|
4982
|
+
}
|
|
4983
|
+
for (let i = nextColIndex, len = columns.length; i < len; i++) {
|
|
4984
|
+
setInfiniteColumnOffset(i, columns[i].computedOffset + diff, domRef.current);
|
|
4985
|
+
}
|
|
4986
|
+
}
|
|
4987
|
+
};
|
|
4988
|
+
}
|
|
4989
|
+
function getColumnGroupResizer(colIndexes, config) {
|
|
4990
|
+
const lastColIndex = colIndexes[colIndexes.length - 1];
|
|
4991
|
+
return {
|
|
4992
|
+
resize(diffs) {
|
|
4993
|
+
const { columns, domRef } = config;
|
|
4994
|
+
let offset = columns[colIndexes[0]].computedOffset;
|
|
4995
|
+
let diffSum = 0;
|
|
4996
|
+
const node = domRef.current;
|
|
4997
|
+
diffs.forEach((diff, i) => {
|
|
4998
|
+
diffSum += diff;
|
|
4999
|
+
const colIndex = colIndexes[i];
|
|
5000
|
+
const column = columns[colIndex];
|
|
5001
|
+
const newWidth = column.computedWidth + diff;
|
|
5002
|
+
setInfiniteColumnWidth(colIndex, newWidth, node);
|
|
5003
|
+
if (offset) {
|
|
5004
|
+
setInfiniteColumnOffset(colIndex, offset, node);
|
|
5005
|
+
}
|
|
5006
|
+
offset += newWidth;
|
|
5007
|
+
});
|
|
5008
|
+
for (let i = lastColIndex + 1; i < columns.length; i++) {
|
|
5009
|
+
setInfiniteColumnOffset(i, columns[i].computedOffset + diffSum, node);
|
|
5010
|
+
}
|
|
5011
|
+
}
|
|
5012
|
+
};
|
|
5013
|
+
}
|
|
5014
|
+
|
|
5015
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts
|
|
5016
|
+
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5017
|
+
var ResizeHandleCls = "zneyzh0 _16lm1iw2 _16lm1iwv _16lm1iw11 _16lm1iwz _16lm1iwe";
|
|
5018
|
+
var ResizeHandleDraggerClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "zneyzh1 _16lm1iw2 _16lm1iwv _16lm1iwz", variantClassNames: { constrained: { false: "zneyzh2", true: "zneyzh3" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5019
|
+
|
|
5020
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
|
|
5021
|
+
var { rootClassName: rootClassName7 } = internalProps;
|
|
5022
|
+
var InfiniteTableHeaderCellResizeHandleCls = `${rootClassName7}HeaderCell_ResizeHandle`;
|
|
5023
|
+
function ResizeHandleFn(props) {
|
|
5024
|
+
const domRef = useRef12(null);
|
|
5025
|
+
const [constrained, setConstrained] = useState9(false);
|
|
5026
|
+
const constrainedRef = useRef12(constrained);
|
|
5027
|
+
constrainedRef.current = constrained;
|
|
5028
|
+
const onPointerDown = (e) => {
|
|
5029
|
+
e.stopPropagation();
|
|
5030
|
+
const shareSpaceOnResize = !!e.shiftKey;
|
|
5031
|
+
const pointerId = e.pointerId;
|
|
5032
|
+
const initialX = e.clientX;
|
|
5033
|
+
const target = e.target;
|
|
5034
|
+
target.setPointerCapture(pointerId);
|
|
5035
|
+
const resizer = getColumnResizer(props.columnIndex, {
|
|
5036
|
+
columns: props.columns,
|
|
5037
|
+
shareSpaceOnResize,
|
|
5038
|
+
domRef
|
|
5039
|
+
});
|
|
5040
|
+
const resizeDiff = (diff) => {
|
|
5041
|
+
const { adjustedDiff, constrained: constrained2 } = props.computeResize({
|
|
5042
|
+
diff,
|
|
5043
|
+
shareSpaceOnResize
|
|
5044
|
+
});
|
|
5045
|
+
if (constrainedRef.current !== constrained2) {
|
|
5046
|
+
setConstrained(constrained2);
|
|
5047
|
+
}
|
|
5048
|
+
resizer.resize(adjustedDiff);
|
|
5049
|
+
return adjustedDiff;
|
|
5050
|
+
};
|
|
5051
|
+
const onPointerMove = (e2) => {
|
|
5052
|
+
resizeDiff(Math.round(e2.clientX - initialX));
|
|
5053
|
+
};
|
|
5054
|
+
const onPointerUp = (e2) => {
|
|
5055
|
+
target.releasePointerCapture(pointerId);
|
|
5056
|
+
target.removeEventListener("pointermove", onPointerMove);
|
|
5057
|
+
target.removeEventListener("pointerup", onPointerUp);
|
|
5058
|
+
const diff = Math.round(e2.clientX - initialX);
|
|
5059
|
+
const adjustedDiff = resizeDiff(diff);
|
|
5060
|
+
props.onResize({ diff: adjustedDiff, shareSpaceOnResize });
|
|
5061
|
+
};
|
|
5062
|
+
target.addEventListener("pointermove", onPointerMove);
|
|
5063
|
+
target.addEventListener("pointerup", onPointerUp);
|
|
5064
|
+
};
|
|
5065
|
+
return /* @__PURE__ */ React20.createElement("div", {
|
|
5066
|
+
ref: domRef,
|
|
5067
|
+
className: `${InfiniteTableHeaderCellResizeHandleCls} ${ResizeHandleCls}`,
|
|
5068
|
+
onPointerDown
|
|
5069
|
+
}, /* @__PURE__ */ React20.createElement("div", {
|
|
5070
|
+
className: ResizeHandleDraggerClsRecipe({
|
|
5071
|
+
constrained
|
|
5072
|
+
})
|
|
5073
|
+
}));
|
|
5074
|
+
}
|
|
5075
|
+
var ResizeHandle = React20.memo(ResizeHandleFn);
|
|
5076
|
+
|
|
5077
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx
|
|
5078
|
+
function useColumnResizeHandle(column) {
|
|
5079
|
+
const {
|
|
5080
|
+
computed: { computedVisibleColumns },
|
|
5081
|
+
componentState: { domRef },
|
|
5082
|
+
getState,
|
|
5083
|
+
getComputed,
|
|
5084
|
+
componentActions
|
|
5085
|
+
} = useInfiniteTable();
|
|
5086
|
+
const computeResizeForDiff = useCallback7(({
|
|
5087
|
+
diff,
|
|
5088
|
+
shareSpaceOnResize
|
|
5089
|
+
}) => {
|
|
5090
|
+
const state = getState();
|
|
5091
|
+
const { columnSizing, viewportReservedWidth, bodySize, activeCellIndex } = state;
|
|
5092
|
+
const columns = getComputed().computedVisibleColumns;
|
|
5093
|
+
let atLeastOneFlex = false;
|
|
5094
|
+
const columnSizingWithFlex = columns.reduce((acc, col) => {
|
|
5095
|
+
if (col.computedFlex) {
|
|
5096
|
+
acc[col.id] = { flex: col.computedWidth };
|
|
5097
|
+
atLeastOneFlex = true;
|
|
5098
|
+
}
|
|
5099
|
+
return acc;
|
|
5100
|
+
}, {});
|
|
5101
|
+
const columnSizingForResize = atLeastOneFlex ? __spreadValues(__spreadValues({}, columnSizing), columnSizingWithFlex) : columnSizing;
|
|
5102
|
+
const result = computeResize({
|
|
5103
|
+
shareSpaceOnResize,
|
|
5104
|
+
availableSize: bodySize.width,
|
|
5105
|
+
reservedWidth: viewportReservedWidth || 0,
|
|
5106
|
+
dragHandleOffset: diff,
|
|
5107
|
+
dragHandlePositionAfter: column.computedVisibleIndex,
|
|
5108
|
+
columnSizing: columnSizingForResize,
|
|
5109
|
+
items: columns.map((c) => {
|
|
5110
|
+
return {
|
|
5111
|
+
id: c.id,
|
|
5112
|
+
computedFlex: c.computedFlex,
|
|
5113
|
+
computedWidth: c.computedWidth,
|
|
5114
|
+
computedMinWidth: c.computedMinWidth,
|
|
5115
|
+
computedMaxWidth: c.computedMaxWidth
|
|
5116
|
+
};
|
|
5117
|
+
})
|
|
5118
|
+
});
|
|
5119
|
+
if (activeCellIndex && activeCellIndex[1] >= column.computedVisibleIndex) {
|
|
5120
|
+
const activeColumn = columns[activeCellIndex[1]];
|
|
5121
|
+
const currentColumn = columns[column.computedVisibleIndex];
|
|
5122
|
+
if (activeCellIndex[1] === currentColumn.computedVisibleIndex) {
|
|
5123
|
+
setInfiniteColumnWidth(currentColumn.computedVisibleIndex, currentColumn.computedWidth + result.adjustedDiff, domRef.current);
|
|
5124
|
+
} else if (activeColumn) {
|
|
5125
|
+
setInfiniteColumnOffset(activeColumn.computedVisibleIndex, activeColumn.computedOffset + result.adjustedDiff, domRef.current);
|
|
5126
|
+
}
|
|
5127
|
+
if (shareSpaceOnResize && activeCellIndex[1] === currentColumn.computedVisibleIndex + 1 && activeColumn) {
|
|
5128
|
+
setInfiniteColumnWidth(activeColumn.computedVisibleIndex, activeColumn.computedWidth - result.adjustedDiff, domRef.current);
|
|
5129
|
+
}
|
|
5130
|
+
}
|
|
5131
|
+
return result;
|
|
5132
|
+
}, []);
|
|
5133
|
+
const onColumnResize = useCallback7(({
|
|
5134
|
+
diff,
|
|
5135
|
+
shareSpaceOnResize
|
|
5136
|
+
}) => {
|
|
5137
|
+
const { columnSizing, reservedWidth } = computeResizeForDiff({
|
|
5138
|
+
diff,
|
|
5139
|
+
shareSpaceOnResize
|
|
5140
|
+
});
|
|
5141
|
+
if (!shareSpaceOnResize) {
|
|
5142
|
+
componentActions.viewportReservedWidth = reservedWidth;
|
|
5143
|
+
}
|
|
5144
|
+
componentActions.columnSizing = columnSizing;
|
|
5145
|
+
}, []);
|
|
5146
|
+
const resizeHandle = column.computedResizable ? /* @__PURE__ */ createElement15(ResizeHandle, {
|
|
5147
|
+
columns: computedVisibleColumns,
|
|
5148
|
+
columnIndex: column.computedVisibleIndex,
|
|
5149
|
+
computeResize: computeResizeForDiff,
|
|
5150
|
+
onResize: onColumnResize
|
|
5151
|
+
}) : null;
|
|
5152
|
+
return resizeHandle;
|
|
5153
|
+
}
|
|
5154
|
+
|
|
4483
5155
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
4484
5156
|
var InfiniteTableHeaderCellContext = createContext4(null);
|
|
4485
|
-
var { rootClassName:
|
|
4486
|
-
var InfiniteTableHeaderCellClassName = `${
|
|
5157
|
+
var { rootClassName: rootClassName8 } = internalProps;
|
|
5158
|
+
var InfiniteTableHeaderCellClassName = `${rootClassName8}HeaderCell`;
|
|
4487
5159
|
function InfiniteTableHeaderCell(props) {
|
|
4488
5160
|
var _a, _b, _c, _d, _e;
|
|
4489
5161
|
const column = props.column;
|
|
@@ -4491,13 +5163,13 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4491
5163
|
const { onResize, height, width, headerOptions } = props;
|
|
4492
5164
|
const sortInfo = column.computedSortInfo;
|
|
4493
5165
|
let header = column.header;
|
|
4494
|
-
const ref =
|
|
5166
|
+
const ref = useCallback8((node) => {
|
|
4495
5167
|
var _a2;
|
|
4496
5168
|
domRef.current = node;
|
|
4497
5169
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
4498
5170
|
}, [props.domRef]);
|
|
4499
5171
|
const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
|
|
4500
|
-
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */
|
|
5172
|
+
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ createElement16(SortIcon, {
|
|
4501
5173
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
4502
5174
|
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
|
|
4503
5175
|
align: column.align || "start"
|
|
@@ -4514,17 +5186,21 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4514
5186
|
const align = column.align || "start";
|
|
4515
5187
|
const renderChildren = () => {
|
|
4516
5188
|
if (header instanceof Function) {
|
|
4517
|
-
header = /* @__PURE__ */
|
|
5189
|
+
header = /* @__PURE__ */ createElement16(RenderHookComponent, {
|
|
4518
5190
|
render: header,
|
|
4519
5191
|
renderParam
|
|
4520
5192
|
});
|
|
4521
5193
|
}
|
|
4522
5194
|
header = header != null ? header : column.name;
|
|
4523
|
-
return /* @__PURE__ */
|
|
5195
|
+
return /* @__PURE__ */ createElement16(Fragment2, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
|
|
4524
5196
|
};
|
|
4525
|
-
const domRef =
|
|
5197
|
+
const domRef = useRef13(null);
|
|
4526
5198
|
const {
|
|
4527
|
-
computed: {
|
|
5199
|
+
computed: {
|
|
5200
|
+
computedRemainingSpace,
|
|
5201
|
+
showColumnFilters,
|
|
5202
|
+
computedVisibleColumns
|
|
5203
|
+
},
|
|
4528
5204
|
componentState: { portalDOMRef, columnHeaderHeight, filterEditors }
|
|
4529
5205
|
} = useInfiniteTable();
|
|
4530
5206
|
const {
|
|
@@ -4545,7 +5221,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4545
5221
|
const style = {
|
|
4546
5222
|
height
|
|
4547
5223
|
};
|
|
4548
|
-
const { onPointerDown,
|
|
5224
|
+
const { onPointerDown, dragging, draggingDiff, proxyOffset } = useColumnPointerEvents({
|
|
4549
5225
|
computedRemainingSpace,
|
|
4550
5226
|
columnId: column.id,
|
|
4551
5227
|
domRef,
|
|
@@ -4553,7 +5229,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4553
5229
|
});
|
|
4554
5230
|
let draggingProxy = null;
|
|
4555
5231
|
if (dragging) {
|
|
4556
|
-
draggingProxy = /* @__PURE__ */
|
|
5232
|
+
draggingProxy = /* @__PURE__ */ createElement16("div", {
|
|
4557
5233
|
className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
|
|
4558
5234
|
style: {
|
|
4559
5235
|
position: "absolute",
|
|
@@ -4570,7 +5246,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4570
5246
|
const contentRecipeVariants = {
|
|
4571
5247
|
filtered: column.computedFiltered
|
|
4572
5248
|
};
|
|
4573
|
-
const setFilterValue =
|
|
5249
|
+
const setFilterValue = useCallback8((filterValue) => {
|
|
4574
5250
|
var _a2;
|
|
4575
5251
|
const state = getDataSourceState();
|
|
4576
5252
|
let newFilterValue = (_a2 = state.filterValue) != null ? _a2 : [];
|
|
@@ -4631,23 +5307,24 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4631
5307
|
]);
|
|
4632
5308
|
const filterType = column.computedFilterType;
|
|
4633
5309
|
const FilterEditor = filterEditors[filterType] || defaultFilterEditors[filterType] || StringFilterEditor;
|
|
4634
|
-
|
|
5310
|
+
const resizeHandle = useColumnResizeHandle(column);
|
|
5311
|
+
return /* @__PURE__ */ createElement16(ContextProvider, {
|
|
4635
5312
|
value: renderParam
|
|
4636
|
-
}, /* @__PURE__ */
|
|
5313
|
+
}, /* @__PURE__ */ createElement16(InfiniteTableCell, {
|
|
4637
5314
|
domRef: ref,
|
|
4638
5315
|
cellType: "header",
|
|
4639
5316
|
column,
|
|
4640
5317
|
"data-name": `HeaderCell`,
|
|
4641
5318
|
"data-column-id": column.id,
|
|
5319
|
+
"data-z-index": computedVisibleColumns.length * 10 - column.computedVisibleIndex * 10,
|
|
4642
5320
|
style,
|
|
4643
5321
|
width,
|
|
4644
5322
|
onPointerDown,
|
|
4645
|
-
onPointerUp,
|
|
4646
5323
|
contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
|
|
4647
5324
|
contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
|
|
4648
5325
|
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false, rowActive: false }), CellCls),
|
|
4649
5326
|
cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
|
|
4650
|
-
afterChildren: showColumnFilters ? column.computedFilterable ? /* @__PURE__ */
|
|
5327
|
+
afterChildren: /* @__PURE__ */ createElement16(Fragment2, null, showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ createElement16(InfiniteTableColumnHeaderFilter, {
|
|
4651
5328
|
filterEditor: FilterEditor,
|
|
4652
5329
|
filterTypes,
|
|
4653
5330
|
onChange: debouncedOnFilterValueChange,
|
|
@@ -4655,7 +5332,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4655
5332
|
columnLabel: column.field || column.name || column.id,
|
|
4656
5333
|
columnFilterValue: column.computedFilterValue,
|
|
4657
5334
|
columnHeaderHeight
|
|
4658
|
-
}) : /* @__PURE__ */
|
|
5335
|
+
}) : /* @__PURE__ */ createElement16(InfiniteTableColumnHeaderFilterEmpty, null) : null, resizeHandle),
|
|
4659
5336
|
renderChildren
|
|
4660
5337
|
}), draggingProxy);
|
|
4661
5338
|
}
|
|
@@ -4666,8 +5343,8 @@ function useInfiniteHeaderCell() {
|
|
|
4666
5343
|
|
|
4667
5344
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4668
5345
|
import {
|
|
4669
|
-
createElement as
|
|
4670
|
-
useCallback as
|
|
5346
|
+
createElement as createElement20,
|
|
5347
|
+
useCallback as useCallback11,
|
|
4671
5348
|
useMemo as useMemo6
|
|
4672
5349
|
} from "react";
|
|
4673
5350
|
|
|
@@ -4755,7 +5432,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, c
|
|
|
4755
5432
|
let groupOffset = 0;
|
|
4756
5433
|
map2.forEach((item) => {
|
|
4757
5434
|
if (!item.ref.columnGroup) {
|
|
4758
|
-
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((
|
|
5435
|
+
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum2, col) => sum2 + col.ref.computedWidth, 0);
|
|
4759
5436
|
item.groupOffset = groupOffset;
|
|
4760
5437
|
item.computedWidth = itemWidth;
|
|
4761
5438
|
if (item.type === "group") {
|
|
@@ -4780,7 +5457,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, c
|
|
|
4780
5457
|
}
|
|
4781
5458
|
function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
4782
5459
|
items.forEach((item) => {
|
|
4783
|
-
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((
|
|
5460
|
+
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum2, col) => sum2 + col.ref.computedWidth, 0);
|
|
4784
5461
|
item.computedWidth = itemWidth;
|
|
4785
5462
|
item.groupOffset = groupOffset;
|
|
4786
5463
|
if (item.type === "group") {
|
|
@@ -4792,40 +5469,192 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
4792
5469
|
|
|
4793
5470
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4794
5471
|
import {
|
|
4795
|
-
createElement as
|
|
5472
|
+
createElement as createElement19,
|
|
4796
5473
|
memo as memo8
|
|
4797
5474
|
} from "react";
|
|
4798
|
-
import { useCallback as
|
|
5475
|
+
import { useCallback as useCallback10, useEffect as useEffect12, useRef as useRef15 } from "react";
|
|
4799
5476
|
|
|
4800
5477
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
4801
5478
|
import {
|
|
4802
|
-
createElement as
|
|
5479
|
+
createElement as createElement18
|
|
5480
|
+
} from "react";
|
|
5481
|
+
|
|
5482
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx
|
|
5483
|
+
import {
|
|
5484
|
+
createElement as createElement17
|
|
4803
5485
|
} from "react";
|
|
5486
|
+
import { useCallback as useCallback9 } from "react";
|
|
5487
|
+
|
|
5488
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/GroupResizeHandle.tsx
|
|
5489
|
+
import React23, { useRef as useRef14, useState as useState10 } from "react";
|
|
5490
|
+
var { rootClassName: rootClassName9 } = internalProps;
|
|
5491
|
+
var InfiniteTableHeaderCellResizeHandleCls2 = `${rootClassName9}HeaderCell_ResizeHandle`;
|
|
5492
|
+
function GroupResizeHandleFn(props) {
|
|
5493
|
+
const domRef = useRef14(null);
|
|
5494
|
+
const [constrained, setConstrained] = useState10(false);
|
|
5495
|
+
const constrainedRef = useRef14(constrained);
|
|
5496
|
+
constrainedRef.current = constrained;
|
|
5497
|
+
const onPointerDown = (e) => {
|
|
5498
|
+
e.stopPropagation();
|
|
5499
|
+
const pointerId = e.pointerId;
|
|
5500
|
+
const initialX = e.clientX;
|
|
5501
|
+
const target = e.target;
|
|
5502
|
+
target.setPointerCapture(pointerId);
|
|
5503
|
+
let initialMove = true;
|
|
5504
|
+
const resizer = getColumnGroupResizer(props.groupColumns.map((c) => c.computedVisibleIndex), {
|
|
5505
|
+
columns: props.columns,
|
|
5506
|
+
domRef
|
|
5507
|
+
});
|
|
5508
|
+
const resizeDiff = (diff) => {
|
|
5509
|
+
const { constrained: constrained2, adjustedDiffs, adjustedDiff } = props.computeResize(diff);
|
|
5510
|
+
if (constrainedRef.current !== constrained2) {
|
|
5511
|
+
setConstrained(constrained2);
|
|
5512
|
+
}
|
|
5513
|
+
resizer.resize(adjustedDiffs);
|
|
5514
|
+
return adjustedDiff;
|
|
5515
|
+
};
|
|
5516
|
+
const onPointerMove = (e2) => {
|
|
5517
|
+
if (initialMove) {
|
|
5518
|
+
const maxDiff = props.groupColumns.reduce((diff, col) => {
|
|
5519
|
+
return diff + col.computedWidth - col.computedMinWidth;
|
|
5520
|
+
}, 0);
|
|
5521
|
+
const currentSize = props.brain.getAvailableSize();
|
|
5522
|
+
const newSize = {
|
|
5523
|
+
width: currentSize.width + maxDiff,
|
|
5524
|
+
height: currentSize.height
|
|
5525
|
+
};
|
|
5526
|
+
props.brain.setAvailableSize(newSize);
|
|
5527
|
+
initialMove = false;
|
|
5528
|
+
}
|
|
5529
|
+
resizeDiff(Math.round(e2.clientX - initialX));
|
|
5530
|
+
};
|
|
5531
|
+
const onPointerUp = (e2) => {
|
|
5532
|
+
target.releasePointerCapture(pointerId);
|
|
5533
|
+
target.removeEventListener("pointermove", onPointerMove);
|
|
5534
|
+
target.removeEventListener("pointerup", onPointerUp);
|
|
5535
|
+
const diff = Math.round(e2.clientX - initialX);
|
|
5536
|
+
const adjustedDiffs = resizeDiff(diff);
|
|
5537
|
+
props.onResize(adjustedDiffs);
|
|
5538
|
+
};
|
|
5539
|
+
target.addEventListener("pointermove", onPointerMove);
|
|
5540
|
+
target.addEventListener("pointerup", onPointerUp);
|
|
5541
|
+
};
|
|
5542
|
+
return /* @__PURE__ */ React23.createElement("div", {
|
|
5543
|
+
ref: domRef,
|
|
5544
|
+
className: `${InfiniteTableHeaderCellResizeHandleCls2} ${ResizeHandleCls}`,
|
|
5545
|
+
onPointerDown
|
|
5546
|
+
}, /* @__PURE__ */ React23.createElement("div", {
|
|
5547
|
+
style: props.style,
|
|
5548
|
+
className: ResizeHandleDraggerClsRecipe({
|
|
5549
|
+
constrained
|
|
5550
|
+
})
|
|
5551
|
+
}));
|
|
5552
|
+
}
|
|
5553
|
+
var GroupResizeHandle = React23.memo(GroupResizeHandleFn);
|
|
5554
|
+
|
|
5555
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx
|
|
5556
|
+
function useColumnGroupResizeHandle(groupColumns, config) {
|
|
5557
|
+
const { bodyBrain, groupHeight, columnGroup, columnGroupsMaxDepth } = config;
|
|
5558
|
+
const {
|
|
5559
|
+
computed: { computedVisibleColumns },
|
|
5560
|
+
getState,
|
|
5561
|
+
getComputed,
|
|
5562
|
+
componentActions
|
|
5563
|
+
} = useInfiniteTable();
|
|
5564
|
+
const lastColumnInGroup = groupColumns[groupColumns.length - 1];
|
|
5565
|
+
const computeResizeForDiff = useCallback9((diff) => {
|
|
5566
|
+
const state = getState();
|
|
5567
|
+
const { columnSizing, viewportReservedWidth, bodySize } = state;
|
|
5568
|
+
const columns = getComputed().computedVisibleColumns;
|
|
5569
|
+
let atLeastOneFlex = false;
|
|
5570
|
+
const columnSizingWithFlex = columns.reduce((acc, col) => {
|
|
5571
|
+
if (col.computedFlex) {
|
|
5572
|
+
acc[col.id] = { flex: col.computedWidth };
|
|
5573
|
+
atLeastOneFlex = true;
|
|
5574
|
+
}
|
|
5575
|
+
return acc;
|
|
5576
|
+
}, {});
|
|
5577
|
+
const columnSizingForResize = atLeastOneFlex ? __spreadValues(__spreadValues({}, columnSizing), columnSizingWithFlex) : columnSizing;
|
|
5578
|
+
const result = computeGroupResize({
|
|
5579
|
+
availableSize: bodySize.width,
|
|
5580
|
+
reservedWidth: viewportReservedWidth || 0,
|
|
5581
|
+
dragHandleOffset: diff,
|
|
5582
|
+
dragHandlePositionAfter: lastColumnInGroup.computedVisibleIndex,
|
|
5583
|
+
columnSizing: columnSizingForResize,
|
|
5584
|
+
columnGroupSize: groupColumns.length,
|
|
5585
|
+
items: columns.map((c) => {
|
|
5586
|
+
return {
|
|
5587
|
+
id: c.id,
|
|
5588
|
+
resizable: c.computedResizable,
|
|
5589
|
+
computedFlex: c.computedFlex,
|
|
5590
|
+
computedWidth: c.computedWidth,
|
|
5591
|
+
computedMinWidth: c.computedMinWidth,
|
|
5592
|
+
computedMaxWidth: c.computedMaxWidth
|
|
5593
|
+
};
|
|
5594
|
+
})
|
|
5595
|
+
});
|
|
5596
|
+
return result;
|
|
5597
|
+
}, []);
|
|
5598
|
+
const onColumnResize = useCallback9((diff) => {
|
|
5599
|
+
const { columnSizing, reservedWidth } = computeResizeForDiff(diff);
|
|
5600
|
+
componentActions.viewportReservedWidth = reservedWidth;
|
|
5601
|
+
componentActions.columnSizing = columnSizing;
|
|
5602
|
+
}, []);
|
|
5603
|
+
const groupResizable = groupColumns.some((c) => c.computedResizable);
|
|
5604
|
+
const resizeHandle = groupResizable ? /* @__PURE__ */ createElement17(GroupResizeHandle, {
|
|
5605
|
+
brain: bodyBrain,
|
|
5606
|
+
style: {
|
|
5607
|
+
height: groupHeight * (columnGroupsMaxDepth - columnGroup.depth + 2)
|
|
5608
|
+
},
|
|
5609
|
+
columns: computedVisibleColumns,
|
|
5610
|
+
groupColumns,
|
|
5611
|
+
computeResize: computeResizeForDiff,
|
|
5612
|
+
onResize: onColumnResize
|
|
5613
|
+
}) : null;
|
|
5614
|
+
return resizeHandle;
|
|
5615
|
+
}
|
|
5616
|
+
|
|
5617
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
4804
5618
|
var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
|
|
5619
|
+
var columnWidthAtIndex3 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4805
5620
|
function InfiniteTableHeaderGroup(props) {
|
|
4806
|
-
const {
|
|
5621
|
+
const {
|
|
5622
|
+
computed: { computedVisibleColumns }
|
|
5623
|
+
} = useInfiniteTable();
|
|
5624
|
+
const { columnGroup, height, columns, bodyBrain, columnGroupsMaxDepth } = props;
|
|
4807
5625
|
let { header } = columnGroup;
|
|
4808
5626
|
if (header instanceof Function) {
|
|
4809
5627
|
header = header({
|
|
4810
5628
|
columnGroup
|
|
4811
5629
|
});
|
|
4812
5630
|
}
|
|
4813
|
-
|
|
5631
|
+
const handle = useColumnGroupResizeHandle(columns, {
|
|
5632
|
+
bodyBrain,
|
|
5633
|
+
groupHeight: height,
|
|
5634
|
+
columnGroup,
|
|
5635
|
+
columnGroupsMaxDepth
|
|
5636
|
+
});
|
|
5637
|
+
const firstColumn = columns[0];
|
|
5638
|
+
const width = columns.length > 1 ? `calc( ` + columns.map((col) => `var(${columnWidthAtIndex3}-${col.computedVisibleIndex})`).join(" + ") + " )" : `var(${columnWidthAtIndex3}-${firstColumn.computedVisibleIndex})`;
|
|
5639
|
+
const zIndex2 = computedVisibleColumns.length * 10 - firstColumn.computedVisibleIndex * 10 + height * (columnGroupsMaxDepth - columnGroup.depth + 2);
|
|
5640
|
+
return /* @__PURE__ */ createElement18("div", {
|
|
4814
5641
|
ref: props.domRef,
|
|
4815
5642
|
"data-group-id": columnGroup.uniqueGroupId,
|
|
4816
5643
|
className: join(HeaderGroupCls, TableHeaderGroupClassName),
|
|
4817
|
-
style: { width, height }
|
|
4818
|
-
|
|
5644
|
+
style: { width, height },
|
|
5645
|
+
"data-z-index": zIndex2
|
|
5646
|
+
}, /* @__PURE__ */ createElement18("div", {
|
|
4819
5647
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4820
|
-
}, header));
|
|
5648
|
+
}, header), handle);
|
|
4821
5649
|
}
|
|
4822
5650
|
|
|
4823
5651
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4824
|
-
var { rootClassName:
|
|
4825
|
-
var TableHeaderClassName = `${
|
|
5652
|
+
var { rootClassName: rootClassName10 } = internalProps;
|
|
5653
|
+
var TableHeaderClassName = `${rootClassName10}Header`;
|
|
4826
5654
|
function InfiniteTableHeaderFn(props) {
|
|
4827
5655
|
const {
|
|
4828
|
-
|
|
5656
|
+
bodyBrain,
|
|
5657
|
+
headerBrain: brain,
|
|
4829
5658
|
columns,
|
|
4830
5659
|
style,
|
|
4831
5660
|
className,
|
|
@@ -4847,7 +5676,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4847
5676
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4848
5677
|
return removeOnScroll;
|
|
4849
5678
|
}, [brain]);
|
|
4850
|
-
const domRef =
|
|
5679
|
+
const domRef = useRef15(null);
|
|
4851
5680
|
const headerCls = HeaderClsRecipe({
|
|
4852
5681
|
overflow: false,
|
|
4853
5682
|
virtualized: true
|
|
@@ -4857,7 +5686,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4857
5686
|
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4858
5687
|
style: __spreadProps(__spreadValues({}, style), { height: columnHeaderHeight })
|
|
4859
5688
|
};
|
|
4860
|
-
const renderCell =
|
|
5689
|
+
const renderCell = useCallback10((params) => {
|
|
4861
5690
|
const {
|
|
4862
5691
|
rowIndex,
|
|
4863
5692
|
colIndex,
|
|
@@ -4882,7 +5711,9 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4882
5711
|
computedWidth: colGroupItem.computedWidth,
|
|
4883
5712
|
groupOffset: colGroupItem.groupOffset
|
|
4884
5713
|
});
|
|
4885
|
-
return /* @__PURE__ */
|
|
5714
|
+
return /* @__PURE__ */ createElement19(InfiniteTableHeaderGroup, {
|
|
5715
|
+
bodyBrain,
|
|
5716
|
+
columnGroupsMaxDepth,
|
|
4886
5717
|
domRef: domRef2,
|
|
4887
5718
|
columns: columns2,
|
|
4888
5719
|
width: widthWithColspan,
|
|
@@ -4890,7 +5721,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4890
5721
|
columnGroup: computedColumnGroup
|
|
4891
5722
|
});
|
|
4892
5723
|
}
|
|
4893
|
-
return /* @__PURE__ */
|
|
5724
|
+
return /* @__PURE__ */ createElement19(InfiniteTableHeaderCell, {
|
|
4894
5725
|
domRef: domRef2,
|
|
4895
5726
|
column,
|
|
4896
5727
|
headerOptions,
|
|
@@ -4906,7 +5737,8 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4906
5737
|
columnGroupsMaxDepth,
|
|
4907
5738
|
showColumnFilters
|
|
4908
5739
|
]);
|
|
4909
|
-
return /* @__PURE__ */
|
|
5740
|
+
return /* @__PURE__ */ createElement19("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement19(RawTable, {
|
|
5741
|
+
name: "header",
|
|
4910
5742
|
renderCell,
|
|
4911
5743
|
brain: headerBrain,
|
|
4912
5744
|
cellHoverClassNames: []
|
|
@@ -4916,7 +5748,7 @@ var InfiniteTableHeader = memo8(InfiniteTableHeaderFn);
|
|
|
4916
5748
|
|
|
4917
5749
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4918
5750
|
function TableHeaderWrapper(props) {
|
|
4919
|
-
const {
|
|
5751
|
+
const { headerBrain, bodyBrain, scrollbars } = props;
|
|
4920
5752
|
const tableContextValue = useInfiniteTable();
|
|
4921
5753
|
const {
|
|
4922
5754
|
computedPinnedStartColumns,
|
|
@@ -4941,7 +5773,7 @@ function TableHeaderWrapper(props) {
|
|
|
4941
5773
|
}
|
|
4942
5774
|
return buildColumnAndGroupTree(computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth);
|
|
4943
5775
|
}, [computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap]);
|
|
4944
|
-
const cellspan =
|
|
5776
|
+
const cellspan = useCallback11(({ rowIndex, colIndex }) => {
|
|
4945
5777
|
const column = computedVisibleColumns[colIndex];
|
|
4946
5778
|
const rowspan2 = 1;
|
|
4947
5779
|
const colspan2 = 1;
|
|
@@ -4974,12 +5806,12 @@ function TableHeaderWrapper(props) {
|
|
|
4974
5806
|
rows,
|
|
4975
5807
|
columnGroupsDepthsMap
|
|
4976
5808
|
]);
|
|
4977
|
-
const rowspan =
|
|
4978
|
-
const colspan =
|
|
4979
|
-
const rowHeight =
|
|
5809
|
+
const rowspan = useCallback11(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
|
|
5810
|
+
const colspan = useCallback11(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
|
|
5811
|
+
const rowHeight = useCallback11((index) => {
|
|
4980
5812
|
return showColumnFilters ? index < rows - 1 ? columnHeaderHeight : 2 * columnHeaderHeight : columnHeaderHeight;
|
|
4981
5813
|
}, [rows, showColumnFilters, columnHeaderHeight]);
|
|
4982
|
-
useMatrixBrain(
|
|
5814
|
+
useMatrixBrain(headerBrain, {
|
|
4983
5815
|
colWidth: columnSize,
|
|
4984
5816
|
rowHeight,
|
|
4985
5817
|
rows,
|
|
@@ -4991,21 +5823,22 @@ function TableHeaderWrapper(props) {
|
|
|
4991
5823
|
fixedColsEnd: computedPinnedEndColumns.length,
|
|
4992
5824
|
fixedColsStart: computedPinnedStartColumns.length
|
|
4993
5825
|
});
|
|
4994
|
-
const header = /* @__PURE__ */
|
|
5826
|
+
const header = /* @__PURE__ */ createElement20(InfiniteTableHeader, {
|
|
4995
5827
|
columns: computedVisibleColumns,
|
|
4996
|
-
|
|
5828
|
+
headerBrain,
|
|
5829
|
+
bodyBrain,
|
|
4997
5830
|
columnHeaderHeight: height,
|
|
4998
5831
|
columnGroupsMaxDepth,
|
|
4999
5832
|
columnAndGroupTreeInfo
|
|
5000
5833
|
});
|
|
5001
|
-
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */
|
|
5834
|
+
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ createElement20("div", {
|
|
5002
5835
|
className: HeaderScrollbarPlaceholderCls,
|
|
5003
5836
|
style: {
|
|
5004
5837
|
zIndex: 1e3,
|
|
5005
5838
|
width: getScrollbarWidth()
|
|
5006
5839
|
}
|
|
5007
5840
|
}) : null;
|
|
5008
|
-
return /* @__PURE__ */
|
|
5841
|
+
return /* @__PURE__ */ createElement20("div", {
|
|
5009
5842
|
className: HeaderWrapperCls,
|
|
5010
5843
|
style: {
|
|
5011
5844
|
height
|
|
@@ -5015,10 +5848,10 @@ function TableHeaderWrapper(props) {
|
|
|
5015
5848
|
|
|
5016
5849
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
5017
5850
|
import {
|
|
5018
|
-
createElement as
|
|
5851
|
+
createElement as createElement21,
|
|
5019
5852
|
forwardRef as forwardRef4,
|
|
5020
|
-
useCallback as
|
|
5021
|
-
useRef as
|
|
5853
|
+
useCallback as useCallback12,
|
|
5854
|
+
useRef as useRef16
|
|
5022
5855
|
} from "react";
|
|
5023
5856
|
import { useEffect as useEffect13 } from "react";
|
|
5024
5857
|
|
|
@@ -5028,17 +5861,13 @@ function decamelize(str, options) {
|
|
|
5028
5861
|
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();
|
|
5029
5862
|
}
|
|
5030
5863
|
|
|
5031
|
-
// src/components/InfiniteTable/theme.css.ts
|
|
5032
|
-
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)" } } };
|
|
5033
|
-
var columnHeaderHeightName = "column-header-height";
|
|
5034
|
-
|
|
5035
5864
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5036
|
-
var
|
|
5865
|
+
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5037
5866
|
var FooterCls = "_16lm1iw1";
|
|
5038
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
5039
|
-
var InfiniteClsRecipe = (0,
|
|
5040
|
-
var InfiniteClsShiftingColumns = "
|
|
5041
|
-
var PinnedRowsContainerClsVariants = (0,
|
|
5867
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwn _16lm1iw13 _16lm1iw0";
|
|
5868
|
+
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"]] });
|
|
5869
|
+
var InfiniteClsShiftingColumns = "_16lm1iwq";
|
|
5870
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5042
5871
|
|
|
5043
5872
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
5044
5873
|
var defaultStyle = {
|
|
@@ -5068,9 +5897,9 @@ var enforceStyle = (node, style) => {
|
|
|
5068
5897
|
}
|
|
5069
5898
|
};
|
|
5070
5899
|
var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter2(props, ref) {
|
|
5071
|
-
const { rootClassName:
|
|
5072
|
-
const domRef =
|
|
5073
|
-
const domCallback =
|
|
5900
|
+
const { rootClassName: rootClassName13 } = useInternalProps();
|
|
5901
|
+
const domRef = useRef16(null);
|
|
5902
|
+
const domCallback = useCallback12((node) => {
|
|
5074
5903
|
domRef.current = node;
|
|
5075
5904
|
if (!ref) {
|
|
5076
5905
|
return;
|
|
@@ -5095,12 +5924,12 @@ var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter
|
|
|
5095
5924
|
clearInterval(intervalId);
|
|
5096
5925
|
};
|
|
5097
5926
|
}, []);
|
|
5098
|
-
return /* @__PURE__ */
|
|
5927
|
+
return /* @__PURE__ */ createElement21("div", __spreadProps(__spreadValues({
|
|
5099
5928
|
ref: domCallback
|
|
5100
5929
|
}, props), {
|
|
5101
|
-
className: join(`${
|
|
5930
|
+
className: join(`${rootClassName13}-Footer`, FooterCls, props.className),
|
|
5102
5931
|
style: defaultStyle
|
|
5103
|
-
}), "Powered by", " ", /* @__PURE__ */
|
|
5932
|
+
}), "Powered by", " ", /* @__PURE__ */ createElement21("a", {
|
|
5104
5933
|
href: "https://infinite-table.com",
|
|
5105
5934
|
rel: "noopener noreferrer",
|
|
5106
5935
|
role: "link",
|
|
@@ -5111,13 +5940,13 @@ var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter
|
|
|
5111
5940
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5112
5941
|
import {
|
|
5113
5942
|
createContext as createContext5,
|
|
5114
|
-
createElement as
|
|
5943
|
+
createElement as createElement22,
|
|
5115
5944
|
memo as memo9
|
|
5116
5945
|
} from "react";
|
|
5117
|
-
import { useCallback as
|
|
5118
|
-
var { rootClassName:
|
|
5946
|
+
import { useCallback as useCallback13, useContext as useContext6, useMemo as useMemo7 } from "react";
|
|
5947
|
+
var { rootClassName: rootClassName11 } = internalProps;
|
|
5119
5948
|
var InfiniteTableColumnCellContext = createContext5(null);
|
|
5120
|
-
var InfiniteTableColumnCellClassName = `${
|
|
5949
|
+
var InfiniteTableColumnCellClassName = `${rootClassName11}ColumnCell`;
|
|
5121
5950
|
function isColumnWithField(c) {
|
|
5122
5951
|
return typeof c.field === "string";
|
|
5123
5952
|
}
|
|
@@ -5131,9 +5960,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5131
5960
|
column,
|
|
5132
5961
|
onMouseLeave,
|
|
5133
5962
|
onMouseEnter,
|
|
5134
|
-
offsetProperty,
|
|
5135
5963
|
toggleGroupRow,
|
|
5136
|
-
virtualized,
|
|
5137
5964
|
rowIndex,
|
|
5138
5965
|
rowHeight,
|
|
5139
5966
|
domRef,
|
|
@@ -5141,7 +5968,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5141
5968
|
showZebraRows
|
|
5142
5969
|
} = props;
|
|
5143
5970
|
if (!column) {
|
|
5144
|
-
return /* @__PURE__ */
|
|
5971
|
+
return /* @__PURE__ */ createElement22("div", {
|
|
5145
5972
|
ref: domRef
|
|
5146
5973
|
}, "no column");
|
|
5147
5974
|
}
|
|
@@ -5174,7 +6001,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5174
6001
|
value
|
|
5175
6002
|
});
|
|
5176
6003
|
}
|
|
5177
|
-
const onClick =
|
|
6004
|
+
const onClick = useCallback13(() => {
|
|
5178
6005
|
if (keyboardNavigation === "row") {
|
|
5179
6006
|
componentActions.activeRowIndex = rowIndex;
|
|
5180
6007
|
return;
|
|
@@ -5214,7 +6041,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5214
6041
|
isGroupRow,
|
|
5215
6042
|
rowIndex,
|
|
5216
6043
|
toggleGroupRow,
|
|
5217
|
-
toggleCurrentGroupRow:
|
|
6044
|
+
toggleCurrentGroupRow: useCallback13(() => {
|
|
5218
6045
|
if (!rowInfo.isGroupRow) {
|
|
5219
6046
|
return;
|
|
5220
6047
|
}
|
|
@@ -5223,13 +6050,13 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5223
6050
|
groupBy: computedDataSource.groupBy,
|
|
5224
6051
|
pivotBy: computedDataSource.pivotBy
|
|
5225
6052
|
});
|
|
5226
|
-
const renderChildren =
|
|
6053
|
+
const renderChildren = useCallback13(() => {
|
|
5227
6054
|
if (hidden) {
|
|
5228
6055
|
return null;
|
|
5229
6056
|
}
|
|
5230
6057
|
const renderFn = column.render || column.renderValue;
|
|
5231
6058
|
if (renderFn) {
|
|
5232
|
-
return /* @__PURE__ */
|
|
6059
|
+
return /* @__PURE__ */ createElement22(RenderHookComponent, {
|
|
5233
6060
|
render: renderFn,
|
|
5234
6061
|
renderParam
|
|
5235
6062
|
});
|
|
@@ -5246,18 +6073,15 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5246
6073
|
style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
|
|
5247
6074
|
}
|
|
5248
6075
|
style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
|
|
5249
|
-
style.width = width;
|
|
5250
6076
|
style.height = rowHeight;
|
|
5251
6077
|
const memoizedStyle = useMemo7(() => style, [!style ? null : JSON.stringify(style)]);
|
|
5252
6078
|
const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
|
|
5253
6079
|
const zebra = showZebraRows ? odd ? "odd" : "even" : false;
|
|
5254
6080
|
const cellProps = {
|
|
5255
6081
|
domRef,
|
|
5256
|
-
offsetProperty,
|
|
5257
6082
|
cellType: "body",
|
|
5258
6083
|
column,
|
|
5259
6084
|
width,
|
|
5260
|
-
offset: virtualized ? 0 : column.computedPinningOffset,
|
|
5261
6085
|
style: memoizedStyle,
|
|
5262
6086
|
onMouseLeave,
|
|
5263
6087
|
onMouseEnter,
|
|
@@ -5267,9 +6091,9 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5267
6091
|
renderChildren
|
|
5268
6092
|
};
|
|
5269
6093
|
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
5270
|
-
return /* @__PURE__ */
|
|
6094
|
+
return /* @__PURE__ */ createElement22(ContextProvider, {
|
|
5271
6095
|
value: renderParam
|
|
5272
|
-
}, /* @__PURE__ */
|
|
6096
|
+
}, /* @__PURE__ */ createElement22(InfiniteTableCell, __spreadValues({}, cellProps)));
|
|
5273
6097
|
}
|
|
5274
6098
|
var InfiniteTableColumnCell = memo9(InfiniteTableColumnCellFn);
|
|
5275
6099
|
function useInfiniteColumnCell() {
|
|
@@ -5278,32 +6102,32 @@ function useInfiniteColumnCell() {
|
|
|
5278
6102
|
}
|
|
5279
6103
|
|
|
5280
6104
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
5281
|
-
var
|
|
6105
|
+
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5282
6106
|
var GroupRowExpanderCls = "_7pupv0b";
|
|
5283
|
-
var RowClsRecipe = (0,
|
|
6107
|
+
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: [] });
|
|
5284
6108
|
var RowHoverCls = "_7pupv01";
|
|
5285
6109
|
|
|
5286
6110
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
5287
6111
|
import {
|
|
5288
|
-
createElement as
|
|
6112
|
+
createElement as createElement23,
|
|
5289
6113
|
memo as memo10
|
|
5290
6114
|
} from "react";
|
|
5291
6115
|
|
|
5292
6116
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
5293
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
5294
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
6117
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz" };
|
|
6118
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz";
|
|
5295
6119
|
var LoadMaskTextCls = "qy58ya4";
|
|
5296
6120
|
|
|
5297
6121
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
5298
|
-
var { rootClassName:
|
|
5299
|
-
var baseCls3 = `${
|
|
6122
|
+
var { rootClassName: rootClassName12 } = internalProps;
|
|
6123
|
+
var baseCls3 = `${rootClassName12}-LoadMask`;
|
|
5300
6124
|
function LoadMaskFn(props) {
|
|
5301
6125
|
const { visible, children = "Loading" } = props;
|
|
5302
|
-
return /* @__PURE__ */
|
|
6126
|
+
return /* @__PURE__ */ createElement23("div", {
|
|
5303
6127
|
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls3}`
|
|
5304
|
-
}, /* @__PURE__ */
|
|
6128
|
+
}, /* @__PURE__ */ createElement23("div", {
|
|
5305
6129
|
className: `${LoadMaskOverlayCls} ${baseCls3}-Overlay`
|
|
5306
|
-
}), /* @__PURE__ */
|
|
6130
|
+
}), /* @__PURE__ */ createElement23("div", {
|
|
5307
6131
|
className: `${LoadMaskTextCls} ${baseCls3}-Text`
|
|
5308
6132
|
}, children));
|
|
5309
6133
|
}
|
|
@@ -5374,8 +6198,8 @@ function getImperativeApi(getState, getComputed, getDataSourceState, componentAc
|
|
|
5374
6198
|
// src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
|
|
5375
6199
|
import {
|
|
5376
6200
|
useEffect as useEffect14,
|
|
5377
|
-
useRef as
|
|
5378
|
-
useState as
|
|
6201
|
+
useRef as useRef17,
|
|
6202
|
+
useState as useState11
|
|
5379
6203
|
} from "react";
|
|
5380
6204
|
var OFFSET = 10;
|
|
5381
6205
|
function getColumnContentMaxWidths(domRef, options) {
|
|
@@ -5412,9 +6236,15 @@ function getColumnContentMaxWidths(domRef, options) {
|
|
|
5412
6236
|
cell.childNodes.forEach((child) => {
|
|
5413
6237
|
if (child !== content) {
|
|
5414
6238
|
const el = child;
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
6239
|
+
let elWidth = Math.max(el.offsetWidth, parseInt(el.style.width, 10));
|
|
6240
|
+
if (isNaN(elWidth)) {
|
|
6241
|
+
elWidth = 0;
|
|
6242
|
+
}
|
|
6243
|
+
otherElementsLength += elWidth;
|
|
6244
|
+
if (elWidth > 0) {
|
|
6245
|
+
const style = getGlobal().getComputedStyle(el);
|
|
6246
|
+
otherElementsLength += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
|
|
6247
|
+
}
|
|
5418
6248
|
}
|
|
5419
6249
|
});
|
|
5420
6250
|
measuredWidth += otherElementsLength;
|
|
@@ -5436,10 +6266,10 @@ function useAutoSizeColumns() {
|
|
|
5436
6266
|
componentActions,
|
|
5437
6267
|
componentState: { domRef, ready, autoSizeColumnsKey, brain }
|
|
5438
6268
|
} = useComponentState();
|
|
5439
|
-
const [refreshId, setRefreshId] =
|
|
6269
|
+
const [refreshId, setRefreshId] = useState11(0);
|
|
5440
6270
|
const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
|
|
5441
6271
|
const getTheKey = useLatest(theKey);
|
|
5442
|
-
const lastExecutedIdentifierRef =
|
|
6272
|
+
const lastExecutedIdentifierRef = useRef17(null);
|
|
5443
6273
|
useEffect14(() => {
|
|
5444
6274
|
const key = getTheKey();
|
|
5445
6275
|
if (key == null) {
|
|
@@ -5498,8 +6328,8 @@ function useAutoSizeColumns() {
|
|
|
5498
6328
|
}
|
|
5499
6329
|
|
|
5500
6330
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
5501
|
-
import { useCallback as
|
|
5502
|
-
import
|
|
6331
|
+
import { useCallback as useCallback14, useEffect as useEffect15, useRef as useRef18 } from "react";
|
|
6332
|
+
import React31 from "react";
|
|
5503
6333
|
|
|
5504
6334
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
5505
6335
|
function useYourBrain(param) {
|
|
@@ -5569,7 +6399,7 @@ function useCellRendering(param) {
|
|
|
5569
6399
|
bodySize,
|
|
5570
6400
|
rowspan
|
|
5571
6401
|
});
|
|
5572
|
-
const scrollTopMaxRef =
|
|
6402
|
+
const scrollTopMaxRef = useRef18(0);
|
|
5573
6403
|
useEffect15(() => {
|
|
5574
6404
|
return brain.onRenderCountChange(() => {
|
|
5575
6405
|
scrollTopMaxRef.current = brain.scrollTopMax;
|
|
@@ -5606,7 +6436,7 @@ function useCellRendering(param) {
|
|
|
5606
6436
|
useEffect15(() => {
|
|
5607
6437
|
rerender();
|
|
5608
6438
|
}, [dataSourceState]);
|
|
5609
|
-
const renderCell =
|
|
6439
|
+
const renderCell = useCallback14((params) => {
|
|
5610
6440
|
const {
|
|
5611
6441
|
rowIndex,
|
|
5612
6442
|
colIndex,
|
|
@@ -5641,7 +6471,7 @@ function useCellRendering(param) {
|
|
|
5641
6471
|
rowStyle,
|
|
5642
6472
|
rowClassName
|
|
5643
6473
|
};
|
|
5644
|
-
return /* @__PURE__ */
|
|
6474
|
+
return /* @__PURE__ */ React31.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
|
|
5645
6475
|
}, [
|
|
5646
6476
|
rowHeight,
|
|
5647
6477
|
getData,
|
|
@@ -5659,7 +6489,7 @@ function useCellRendering(param) {
|
|
|
5659
6489
|
}
|
|
5660
6490
|
|
|
5661
6491
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
5662
|
-
import { useCallback as
|
|
6492
|
+
import { useCallback as useCallback17, useEffect as useEffect25, useState as useState15 } from "react";
|
|
5663
6493
|
|
|
5664
6494
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
5665
6495
|
import { useEffect as useEffect17 } from "react";
|
|
@@ -5716,7 +6546,7 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
5716
6546
|
while (parentGroupId) {
|
|
5717
6547
|
const parent = columnGroups.get(parentGroupId);
|
|
5718
6548
|
if (!parent) {
|
|
5719
|
-
if (
|
|
6549
|
+
if (false) {
|
|
5720
6550
|
console.warn(`Cannot find column group ${parentGroupId}`);
|
|
5721
6551
|
}
|
|
5722
6552
|
break;
|
|
@@ -5828,12 +6658,12 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
5828
6658
|
}
|
|
5829
6659
|
|
|
5830
6660
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
5831
|
-
import { useCallback as
|
|
6661
|
+
import { useCallback as useCallback15 } from "react";
|
|
5832
6662
|
var debug4 = dbg("useColumnSizeFn");
|
|
5833
6663
|
function useColumnSizeFn(columns) {
|
|
5834
|
-
const columnSize =
|
|
6664
|
+
const columnSize = useCallback15((index) => {
|
|
5835
6665
|
const column = columns[index];
|
|
5836
|
-
if (
|
|
6666
|
+
if (false) {
|
|
5837
6667
|
debug4("cannot find column at index", index, columns);
|
|
5838
6668
|
}
|
|
5839
6669
|
return column ? column.computedWidth : 0;
|
|
@@ -5846,14 +6676,9 @@ import { useEffect as useEffect22, useMemo as useMemo10 } from "react";
|
|
|
5846
6676
|
|
|
5847
6677
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
5848
6678
|
import {
|
|
5849
|
-
createElement as
|
|
6679
|
+
createElement as createElement26
|
|
5850
6680
|
} from "react";
|
|
5851
6681
|
|
|
5852
|
-
// src/utils/stripVar.ts
|
|
5853
|
-
function stripVar(cssVariableWithVarString) {
|
|
5854
|
-
return cssVariableWithVarString.slice(4, -1);
|
|
5855
|
-
}
|
|
5856
|
-
|
|
5857
6682
|
// src/components/DataSource/state/rowInfoStatus.ts
|
|
5858
6683
|
var showLoadingIcon = (rowInfo) => {
|
|
5859
6684
|
if (rowInfo.dataSourceHasGrouping) {
|
|
@@ -5864,21 +6689,21 @@ var showLoadingIcon = (rowInfo) => {
|
|
|
5864
6689
|
|
|
5865
6690
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5866
6691
|
import {
|
|
5867
|
-
createElement as
|
|
6692
|
+
createElement as createElement24,
|
|
5868
6693
|
useEffect as useEffect18
|
|
5869
6694
|
} from "react";
|
|
5870
|
-
import { useState as
|
|
6695
|
+
import { useState as useState12 } from "react";
|
|
5871
6696
|
|
|
5872
6697
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
5873
|
-
var
|
|
5874
|
-
var ExpanderIconCls = "_16lm1iw6
|
|
5875
|
-
var ExpanderIconClsVariants = (0,
|
|
6698
|
+
var import_createRuntimeFn6 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
6699
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwh _16lm1iwd";
|
|
6700
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn6.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5876
6701
|
|
|
5877
6702
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5878
6703
|
function ExpanderIcon(props) {
|
|
5879
6704
|
var _a;
|
|
5880
6705
|
const { size = 24 } = props;
|
|
5881
|
-
const [expanded, setExpanded] =
|
|
6706
|
+
const [expanded, setExpanded] = useState12((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
5882
6707
|
const onClick = () => {
|
|
5883
6708
|
var _a2;
|
|
5884
6709
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
@@ -5891,7 +6716,7 @@ function ExpanderIcon(props) {
|
|
|
5891
6716
|
setExpanded(props.expanded);
|
|
5892
6717
|
}
|
|
5893
6718
|
}, [props.expanded]);
|
|
5894
|
-
return /* @__PURE__ */
|
|
6719
|
+
return /* @__PURE__ */ createElement24("svg", {
|
|
5895
6720
|
"data-name": "expander-icon",
|
|
5896
6721
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5897
6722
|
height: `${size}px`,
|
|
@@ -5902,22 +6727,22 @@ function ExpanderIcon(props) {
|
|
|
5902
6727
|
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
5903
6728
|
expanded
|
|
5904
6729
|
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
5905
|
-
}, /* @__PURE__ */
|
|
6730
|
+
}, /* @__PURE__ */ createElement24("path", {
|
|
5906
6731
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
5907
6732
|
}));
|
|
5908
6733
|
}
|
|
5909
6734
|
|
|
5910
6735
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5911
6736
|
import {
|
|
5912
|
-
createElement as
|
|
6737
|
+
createElement as createElement25
|
|
5913
6738
|
} from "react";
|
|
5914
6739
|
|
|
5915
6740
|
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
5916
|
-
var LoadingIconCls = "_16lm1iw8
|
|
6741
|
+
var LoadingIconCls = "_16lm1iw8 _16lm1iwh _16lm1iwd";
|
|
5917
6742
|
|
|
5918
6743
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5919
6744
|
var LoadingIcon = (props) => {
|
|
5920
|
-
return /* @__PURE__ */
|
|
6745
|
+
return /* @__PURE__ */ createElement25("svg", {
|
|
5921
6746
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5922
6747
|
style: {
|
|
5923
6748
|
margin: "auto",
|
|
@@ -5929,14 +6754,14 @@ var LoadingIcon = (props) => {
|
|
|
5929
6754
|
viewBox: "0 0 100 100",
|
|
5930
6755
|
preserveAspectRatio: "xMidYMid",
|
|
5931
6756
|
className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
|
|
5932
|
-
}, /* @__PURE__ */
|
|
6757
|
+
}, /* @__PURE__ */ createElement25("circle", {
|
|
5933
6758
|
cx: "50",
|
|
5934
6759
|
cy: "50",
|
|
5935
6760
|
fill: "none",
|
|
5936
6761
|
strokeWidth: "10",
|
|
5937
6762
|
r: "35",
|
|
5938
6763
|
strokeDasharray: "164.93361431346415 56.97787143782138"
|
|
5939
|
-
}, /* @__PURE__ */
|
|
6764
|
+
}, /* @__PURE__ */ createElement25("animateTransform", {
|
|
5940
6765
|
attributeName: "transform",
|
|
5941
6766
|
type: "rotate",
|
|
5942
6767
|
repeatCount: "indefinite",
|
|
@@ -5956,7 +6781,7 @@ function getGroupColumnRender({
|
|
|
5956
6781
|
var _a, _b, _c;
|
|
5957
6782
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5958
6783
|
if (column.renderValue) {
|
|
5959
|
-
value = /* @__PURE__ */
|
|
6784
|
+
value = /* @__PURE__ */ createElement26(RenderHookComponent, {
|
|
5960
6785
|
render: column.renderValue,
|
|
5961
6786
|
renderParam: renderOptions
|
|
5962
6787
|
});
|
|
@@ -5986,22 +6811,22 @@ function getGroupColumnRender({
|
|
|
5986
6811
|
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);
|
|
5987
6812
|
const isLoading = showLoadingIcon(groupRowInfo);
|
|
5988
6813
|
if (isLoading) {
|
|
5989
|
-
icon = /* @__PURE__ */
|
|
6814
|
+
icon = /* @__PURE__ */ createElement26(LoadingIcon, null);
|
|
5990
6815
|
} else if (showExpanderIcon) {
|
|
5991
|
-
const defaultIcon = /* @__PURE__ */
|
|
6816
|
+
const defaultIcon = /* @__PURE__ */ createElement26(ExpanderIcon, {
|
|
5992
6817
|
expanded: !collapsed,
|
|
5993
6818
|
onChange: () => {
|
|
5994
6819
|
toggleGroupRow(groupKeys);
|
|
5995
6820
|
}
|
|
5996
6821
|
});
|
|
5997
|
-
icon = column.renderGroupIcon ? /* @__PURE__ */
|
|
6822
|
+
icon = column.renderGroupIcon ? /* @__PURE__ */ createElement26(RenderHookComponent, {
|
|
5998
6823
|
render: column.renderGroupIcon,
|
|
5999
6824
|
renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
|
|
6000
6825
|
}) : defaultIcon;
|
|
6001
6826
|
}
|
|
6002
|
-
return /* @__PURE__ */
|
|
6827
|
+
return /* @__PURE__ */ createElement26("div", {
|
|
6003
6828
|
className: join(display.flex, alignItems.center)
|
|
6004
|
-
}, icon, /* @__PURE__ */
|
|
6829
|
+
}, icon, /* @__PURE__ */ createElement26("div", {
|
|
6005
6830
|
className: cssEllipsisClassName
|
|
6006
6831
|
}, value != null ? value : null));
|
|
6007
6832
|
};
|
|
@@ -6046,9 +6871,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
6046
6871
|
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;
|
|
6047
6872
|
const isLoading = showLoadingIcon(rowInfo);
|
|
6048
6873
|
if (isLoading) {
|
|
6049
|
-
icon = /* @__PURE__ */
|
|
6874
|
+
icon = /* @__PURE__ */ createElement26(LoadingIcon, null);
|
|
6050
6875
|
} else if (showExpanderIcon) {
|
|
6051
|
-
const defaultIcon = /* @__PURE__ */
|
|
6876
|
+
const defaultIcon = /* @__PURE__ */ createElement26(ExpanderIcon, {
|
|
6052
6877
|
expanded: !collapsed,
|
|
6053
6878
|
onChange: () => {
|
|
6054
6879
|
if (!rowInfo.isGroupRow) {
|
|
@@ -6063,9 +6888,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
6063
6888
|
icon = column.renderGroupIcon(renderParam);
|
|
6064
6889
|
}
|
|
6065
6890
|
}
|
|
6066
|
-
return /* @__PURE__ */
|
|
6891
|
+
return /* @__PURE__ */ createElement26("div", {
|
|
6067
6892
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
6068
|
-
}, icon, /* @__PURE__ */
|
|
6893
|
+
}, icon, /* @__PURE__ */ createElement26("div", {
|
|
6069
6894
|
className: cssEllipsisClassName
|
|
6070
6895
|
}, value != null ? value : null));
|
|
6071
6896
|
}
|
|
@@ -6081,10 +6906,10 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
6081
6906
|
}
|
|
6082
6907
|
|
|
6083
6908
|
// src/components/InfiniteTable/hooks/useEffectWithRaf.ts
|
|
6084
|
-
import { useEffect as useEffect19, useRef as
|
|
6909
|
+
import { useEffect as useEffect19, useRef as useRef19 } from "react";
|
|
6085
6910
|
function useEffectWithRaf(fn, deps) {
|
|
6086
|
-
const rafId =
|
|
6087
|
-
const removeFnRaf =
|
|
6911
|
+
const rafId = useRef19(0);
|
|
6912
|
+
const removeFnRaf = useRef19();
|
|
6088
6913
|
useEffect19(() => {
|
|
6089
6914
|
rafId.current = requestAnimationFrame(() => {
|
|
6090
6915
|
removeFnRaf.current = fn();
|
|
@@ -6102,7 +6927,7 @@ function useEffectWithRaf(fn, deps) {
|
|
|
6102
6927
|
}
|
|
6103
6928
|
|
|
6104
6929
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
6105
|
-
import { useCallback as
|
|
6930
|
+
import { useCallback as useCallback16 } from "react";
|
|
6106
6931
|
|
|
6107
6932
|
// src/utils/groupAndPivot/index.ts
|
|
6108
6933
|
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
@@ -6557,7 +7382,7 @@ function enhancedFlatten(param) {
|
|
|
6557
7382
|
// src/components/DataSource/index.tsx
|
|
6558
7383
|
import {
|
|
6559
7384
|
Fragment as Fragment3,
|
|
6560
|
-
createElement as
|
|
7385
|
+
createElement as createElement27
|
|
6561
7386
|
} from "react";
|
|
6562
7387
|
|
|
6563
7388
|
// src/utils/multisort/sortTypes.ts
|
|
@@ -6746,15 +7571,15 @@ var GroupRowsState = class {
|
|
|
6746
7571
|
};
|
|
6747
7572
|
|
|
6748
7573
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
6749
|
-
import { useEffect as useEffect21, useMemo as useMemo9, useRef as
|
|
7574
|
+
import { useEffect as useEffect21, useMemo as useMemo9, useRef as useRef21, useState as useState13 } from "react";
|
|
6750
7575
|
|
|
6751
7576
|
// src/components/hooks/useEffectWithChanges.ts
|
|
6752
|
-
import { useEffect as useEffect20, useRef as
|
|
7577
|
+
import { useEffect as useEffect20, useRef as useRef20 } from "react";
|
|
6753
7578
|
function useEffectWithChanges(fn, deps) {
|
|
6754
|
-
const prevRef =
|
|
6755
|
-
const oldValuesRef =
|
|
7579
|
+
const prevRef = useRef20({});
|
|
7580
|
+
const oldValuesRef = useRef20({});
|
|
6756
7581
|
const oldValues = oldValuesRef.current;
|
|
6757
|
-
const changesRef =
|
|
7582
|
+
const changesRef = useRef20({});
|
|
6758
7583
|
const changes = changesRef.current;
|
|
6759
7584
|
const useEffectDeps = [];
|
|
6760
7585
|
for (const k in deps) {
|
|
@@ -7035,11 +7860,11 @@ function useLoadData() {
|
|
|
7035
7860
|
livePaginationCursor,
|
|
7036
7861
|
cursorId: stateCursorId
|
|
7037
7862
|
} = componentState;
|
|
7038
|
-
const [scrollbars, setScrollbars] =
|
|
7863
|
+
const [scrollbars, setScrollbars] = useState13({
|
|
7039
7864
|
vertical: false,
|
|
7040
7865
|
horizontal: false
|
|
7041
7866
|
});
|
|
7042
|
-
const scrollbarsRef =
|
|
7867
|
+
const scrollbarsRef = useRef21(scrollbars);
|
|
7043
7868
|
useEffect21(() => {
|
|
7044
7869
|
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
7045
7870
|
if (!scrollbars2) {
|
|
@@ -7096,7 +7921,7 @@ function useLoadData() {
|
|
|
7096
7921
|
filterValue,
|
|
7097
7922
|
cursorId: livePagination ? stateCursorId : null
|
|
7098
7923
|
};
|
|
7099
|
-
const initialRef =
|
|
7924
|
+
const initialRef = useRef21(true);
|
|
7100
7925
|
useLazyLoadRange();
|
|
7101
7926
|
useEffectWithChanges(() => {
|
|
7102
7927
|
const componentState2 = getComponentState();
|
|
@@ -7137,7 +7962,7 @@ function useLazyLoadRange() {
|
|
|
7137
7962
|
dataArray,
|
|
7138
7963
|
scrollStopDelayUpdatedByTable
|
|
7139
7964
|
} = componentState;
|
|
7140
|
-
const latestRenderRangeRef =
|
|
7965
|
+
const latestRenderRangeRef = useRef21(null);
|
|
7141
7966
|
const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
|
|
7142
7967
|
const componentState2 = getComponentState();
|
|
7143
7968
|
renderRange = renderRange || latestRenderRangeRef.current;
|
|
@@ -7950,7 +8775,7 @@ function concludeReducer(params) {
|
|
|
7950
8775
|
}
|
|
7951
8776
|
state.dataArray = rowInfoDataArray;
|
|
7952
8777
|
state.reducedAt = now;
|
|
7953
|
-
if (
|
|
8778
|
+
if (false) {
|
|
7954
8779
|
globalThis.state = state;
|
|
7955
8780
|
}
|
|
7956
8781
|
return state;
|
|
@@ -7969,7 +8794,7 @@ function DataSourceWithContext(props) {
|
|
|
7969
8794
|
if (typeof children === "function") {
|
|
7970
8795
|
children = children(computedValues);
|
|
7971
8796
|
}
|
|
7972
|
-
return /* @__PURE__ */
|
|
8797
|
+
return /* @__PURE__ */ createElement27(Fragment3, null, children);
|
|
7973
8798
|
}
|
|
7974
8799
|
var DataSourceRoot = getComponentStateRoot({
|
|
7975
8800
|
initSetupState,
|
|
@@ -7988,18 +8813,18 @@ function DataSourceCmp({ children }) {
|
|
|
7988
8813
|
componentActions,
|
|
7989
8814
|
getState
|
|
7990
8815
|
};
|
|
7991
|
-
if (
|
|
8816
|
+
if (false) {
|
|
7992
8817
|
globalThis.getDataSourceState = getState;
|
|
7993
8818
|
}
|
|
7994
8819
|
useLoadData();
|
|
7995
|
-
return /* @__PURE__ */
|
|
8820
|
+
return /* @__PURE__ */ createElement27(DataSourceContext.Provider, {
|
|
7996
8821
|
value: contextValue
|
|
7997
|
-
}, /* @__PURE__ */
|
|
8822
|
+
}, /* @__PURE__ */ createElement27(DataSourceWithContext, {
|
|
7998
8823
|
children
|
|
7999
8824
|
}));
|
|
8000
8825
|
}
|
|
8001
8826
|
function DataSource(props) {
|
|
8002
|
-
return /* @__PURE__ */
|
|
8827
|
+
return /* @__PURE__ */ createElement27(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ createElement27(DataSourceCmp, {
|
|
8003
8828
|
children: props.children
|
|
8004
8829
|
}));
|
|
8005
8830
|
}
|
|
@@ -8007,7 +8832,7 @@ function DataSource(props) {
|
|
|
8007
8832
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
8008
8833
|
function useToggleGroupRow() {
|
|
8009
8834
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
8010
|
-
const toggleGroupRow =
|
|
8835
|
+
const toggleGroupRow = useCallback16((groupKeys) => {
|
|
8011
8836
|
const state = getDataSourceState();
|
|
8012
8837
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
8013
8838
|
newState.toggleGroupRow(groupKeys);
|
|
@@ -8425,138 +9250,6 @@ function getColumnsWhenGrouping(params) {
|
|
|
8425
9250
|
// src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
|
|
8426
9251
|
import { useMemo as useMemo11 } from "react";
|
|
8427
9252
|
|
|
8428
|
-
// src/components/flexbox/index.ts
|
|
8429
|
-
var computeFlex = (params) => {
|
|
8430
|
-
const {
|
|
8431
|
-
availableSize,
|
|
8432
|
-
items,
|
|
8433
|
-
minSize: defaultMinSize,
|
|
8434
|
-
maxSize: defaultMaxSize
|
|
8435
|
-
} = params;
|
|
8436
|
-
if (availableSize < 0) {
|
|
8437
|
-
throw "The provided availableSize cannot be negative!";
|
|
8438
|
-
}
|
|
8439
|
-
let totalFixedSize = 0;
|
|
8440
|
-
let totalFlex = 0;
|
|
8441
|
-
let totalFlexCount = 0;
|
|
8442
|
-
items.forEach((item, i) => {
|
|
8443
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8444
|
-
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
8445
|
-
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
8446
|
-
if (item.size != null) {
|
|
8447
|
-
if (maxSize != null && item.size > maxSize) {
|
|
8448
|
-
item.size = maxSize;
|
|
8449
|
-
}
|
|
8450
|
-
if (minSize != null && item.size < minSize) {
|
|
8451
|
-
item.size = minSize;
|
|
8452
|
-
}
|
|
8453
|
-
}
|
|
8454
|
-
if (item.size == null && item.flex == null) {
|
|
8455
|
-
throw `Items must specify either a size or a flex property. Item at index ${i} doesn't have either of those.`;
|
|
8456
|
-
}
|
|
8457
|
-
if (item.flex != null) {
|
|
8458
|
-
totalFlexCount += 1;
|
|
8459
|
-
}
|
|
8460
|
-
totalFlex += (_e = item.flex) != null ? _e : 0;
|
|
8461
|
-
totalFixedSize += (_f = item.size) != null ? _f : 0;
|
|
8462
|
-
});
|
|
8463
|
-
let availableSizeForFlex = Math.max(availableSize - totalFixedSize, 0);
|
|
8464
|
-
let sizePerFlex = availableSizeForFlex / totalFlex;
|
|
8465
|
-
let maxxedFlexItems = {};
|
|
8466
|
-
let minnedFlexItems = {};
|
|
8467
|
-
let constrainedCount = 0;
|
|
8468
|
-
items.forEach((item, index) => {
|
|
8469
|
-
var _a, _b, _c, _d;
|
|
8470
|
-
if (item.flex != null) {
|
|
8471
|
-
const approxFlexSize = sizePerFlex * item.flex;
|
|
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 constrained = false;
|
|
8475
|
-
let substractSize = 0;
|
|
8476
|
-
if (maxSize != null && approxFlexSize > maxSize) {
|
|
8477
|
-
maxxedFlexItems[index] = true;
|
|
8478
|
-
constrained = true;
|
|
8479
|
-
substractSize = maxSize;
|
|
8480
|
-
}
|
|
8481
|
-
if (minSize != null && approxFlexSize < minSize) {
|
|
8482
|
-
minnedFlexItems[index] = true;
|
|
8483
|
-
constrained = true;
|
|
8484
|
-
substractSize = minSize;
|
|
8485
|
-
}
|
|
8486
|
-
if (constrained) {
|
|
8487
|
-
constrainedCount += 1;
|
|
8488
|
-
totalFlexCount -= 1;
|
|
8489
|
-
totalFlex -= item.flex;
|
|
8490
|
-
availableSizeForFlex -= substractSize;
|
|
8491
|
-
}
|
|
8492
|
-
}
|
|
8493
|
-
});
|
|
8494
|
-
if (constrainedCount) {
|
|
8495
|
-
sizePerFlex = availableSizeForFlex / totalFlex;
|
|
8496
|
-
}
|
|
8497
|
-
let flexSizes = [];
|
|
8498
|
-
let currentFlexCount = 0;
|
|
8499
|
-
let remainingSizeForFlex = availableSizeForFlex;
|
|
8500
|
-
let remainingFlex = totalFlex;
|
|
8501
|
-
let totalTakenSize = 0;
|
|
8502
|
-
let flexSizeSum = 0;
|
|
8503
|
-
const computedSizes = [];
|
|
8504
|
-
const resultItems = items.map((item, index) => {
|
|
8505
|
-
var _a, _b, _c, _d, _e;
|
|
8506
|
-
const sizedItem = __spreadValues({}, item);
|
|
8507
|
-
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
8508
|
-
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
8509
|
-
let flexSize = 0;
|
|
8510
|
-
const maxxed = maxxedFlexItems[index];
|
|
8511
|
-
const minned = minnedFlexItems[index];
|
|
8512
|
-
const constrained = maxxed || minned;
|
|
8513
|
-
let computedSize = (_e = item.size) != null ? _e : 0;
|
|
8514
|
-
if (item.flex != null) {
|
|
8515
|
-
if (constrained) {
|
|
8516
|
-
if (minned) {
|
|
8517
|
-
flexSize = minSize;
|
|
8518
|
-
}
|
|
8519
|
-
if (maxxed) {
|
|
8520
|
-
flexSize = maxSize;
|
|
8521
|
-
}
|
|
8522
|
-
} else {
|
|
8523
|
-
currentFlexCount += 1;
|
|
8524
|
-
const constrain = (size) => {
|
|
8525
|
-
if (maxSize != null && size > maxSize) {
|
|
8526
|
-
size = maxSize;
|
|
8527
|
-
}
|
|
8528
|
-
if (minSize != null && size < minSize) {
|
|
8529
|
-
size = minSize;
|
|
8530
|
-
}
|
|
8531
|
-
return size;
|
|
8532
|
-
};
|
|
8533
|
-
if (currentFlexCount === totalFlexCount) {
|
|
8534
|
-
flexSize = constrain(remainingSizeForFlex);
|
|
8535
|
-
} else {
|
|
8536
|
-
flexSize = constrain(Math.round(item.flex * sizePerFlex));
|
|
8537
|
-
flexSizeSum += flexSize;
|
|
8538
|
-
remainingSizeForFlex = availableSizeForFlex - flexSizeSum;
|
|
8539
|
-
remainingFlex -= item.flex;
|
|
8540
|
-
sizePerFlex = remainingSizeForFlex / remainingFlex;
|
|
8541
|
-
}
|
|
8542
|
-
}
|
|
8543
|
-
computedSize = flexSize;
|
|
8544
|
-
sizedItem.flexSize = flexSize;
|
|
8545
|
-
}
|
|
8546
|
-
flexSizes.push(flexSize);
|
|
8547
|
-
computedSizes.push(computedSize);
|
|
8548
|
-
sizedItem.computedSize = computedSize;
|
|
8549
|
-
totalTakenSize += computedSize;
|
|
8550
|
-
return sizedItem;
|
|
8551
|
-
});
|
|
8552
|
-
return {
|
|
8553
|
-
items: resultItems,
|
|
8554
|
-
flexSizes,
|
|
8555
|
-
computedSizes,
|
|
8556
|
-
remainingSize: Math.round(availableSize - totalTakenSize)
|
|
8557
|
-
};
|
|
8558
|
-
};
|
|
8559
|
-
|
|
8560
9253
|
// src/components/InfiniteTable/utils/adjustColumnOrderForPinning.ts
|
|
8561
9254
|
var order = ["start", void 0, "end"];
|
|
8562
9255
|
var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
|
|
@@ -8624,6 +9317,7 @@ var getComputedVisibleColumns = ({
|
|
|
8624
9317
|
setSortInfo,
|
|
8625
9318
|
multiSort,
|
|
8626
9319
|
viewportReservedWidth,
|
|
9320
|
+
resizableColumns,
|
|
8627
9321
|
draggableColumns,
|
|
8628
9322
|
columnOrder,
|
|
8629
9323
|
columnPinning,
|
|
@@ -8708,7 +9402,7 @@ var getComputedVisibleColumns = ({
|
|
|
8708
9402
|
};
|
|
8709
9403
|
})
|
|
8710
9404
|
});
|
|
8711
|
-
const { computedSizes } = flexResult;
|
|
9405
|
+
const { computedSizes, flexSizes, minSizes, maxSizes } = flexResult;
|
|
8712
9406
|
const computedPinnedStartColumns = [];
|
|
8713
9407
|
const computedPinnedEndColumns = [];
|
|
8714
9408
|
const computedUnpinnedColumns = [];
|
|
@@ -8736,7 +9430,7 @@ var getComputedVisibleColumns = ({
|
|
|
8736
9430
|
});
|
|
8737
9431
|
const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
|
|
8738
9432
|
columnsArray.forEach((c, i) => {
|
|
8739
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
9433
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
8740
9434
|
const id = visibleColumnOrder[i];
|
|
8741
9435
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
8742
9436
|
const colType = getColumnComputedType(c, columnTypes);
|
|
@@ -8747,6 +9441,9 @@ var getComputedVisibleColumns = ({
|
|
|
8747
9441
|
const computedSortedDesc = computedSorted && !computedSortedAsc;
|
|
8748
9442
|
const computedSortIndex = (_c = sortingInfo == null ? void 0 : sortingInfo.index) != null ? _c : -1;
|
|
8749
9443
|
const computedWidth = computedSizes[i];
|
|
9444
|
+
const computedFlex = flexSizes[i] || null;
|
|
9445
|
+
const computedMinWidth = minSizes[i] || 0;
|
|
9446
|
+
const computedMaxWidth = maxSizes[i] || 1e4;
|
|
8750
9447
|
const computedPinned = getComputedPinned(id, columnPinning);
|
|
8751
9448
|
const computedLast = i === visibleColumnOrder.length - 1;
|
|
8752
9449
|
const computedPinningOffset = computedPinned === "start" ? computedPinnedStartColumnsWidth : computedPinned === "end" ? computedPinnedEndColumnsWidth : computedOffset - computedPinnedStartColumnsWidth;
|
|
@@ -8780,8 +9477,13 @@ var getComputedVisibleColumns = ({
|
|
|
8780
9477
|
render: colType.render,
|
|
8781
9478
|
style: colType.style,
|
|
8782
9479
|
components: colType.components,
|
|
9480
|
+
columnGroup: colType.columnGroup,
|
|
8783
9481
|
field
|
|
8784
9482
|
}, c), {
|
|
9483
|
+
computedResizable: (_s = (_r = (_q = c.resizable) != null ? _q : colType.resizable) != null ? _r : resizableColumns) != null ? _s : true,
|
|
9484
|
+
computedMinWidth,
|
|
9485
|
+
computedMaxWidth,
|
|
9486
|
+
computedFlex,
|
|
8785
9487
|
computedDataType,
|
|
8786
9488
|
computedSortType,
|
|
8787
9489
|
computedFilterType,
|
|
@@ -8803,7 +9505,7 @@ var getComputedVisibleColumns = ({
|
|
|
8803
9505
|
computedSortedDesc,
|
|
8804
9506
|
computedVisibleIndex: i,
|
|
8805
9507
|
computedPinned,
|
|
8806
|
-
computedDraggable: (
|
|
9508
|
+
computedDraggable: (_u = (_t = c.draggable) != null ? _t : draggableColumns) != null ? _u : true,
|
|
8807
9509
|
computedFirstInCategory,
|
|
8808
9510
|
computedLastInCategory,
|
|
8809
9511
|
computedFirst: i === 0,
|
|
@@ -8853,7 +9555,7 @@ var getComputedVisibleColumns = ({
|
|
|
8853
9555
|
setSortInfo(finalSortInfo);
|
|
8854
9556
|
},
|
|
8855
9557
|
id,
|
|
8856
|
-
header: (
|
|
9558
|
+
header: (_x = (_w = (_v = c.header) != null ? _v : colType.header) != null ? _w : c.name) != null ? _x : c.field
|
|
8857
9559
|
});
|
|
8858
9560
|
computedOffset += computedWidth;
|
|
8859
9561
|
computedVisibleColumnsMap.set(result2.id, result2);
|
|
@@ -8929,6 +9631,7 @@ var useComputedVisibleColumns = ({
|
|
|
8929
9631
|
pinnedEndMaxWidth,
|
|
8930
9632
|
pinnedStartMaxWidth,
|
|
8931
9633
|
viewportReservedWidth,
|
|
9634
|
+
resizableColumns,
|
|
8932
9635
|
columnVisibility,
|
|
8933
9636
|
columnVisibilityAssumeVisible,
|
|
8934
9637
|
columnSizing
|
|
@@ -8960,6 +9663,7 @@ var useComputedVisibleColumns = ({
|
|
|
8960
9663
|
columnCssEllipsis,
|
|
8961
9664
|
columnHeaderCssEllipsis,
|
|
8962
9665
|
viewportReservedWidth,
|
|
9666
|
+
resizableColumns,
|
|
8963
9667
|
filterValue,
|
|
8964
9668
|
sortable,
|
|
8965
9669
|
sortInfo,
|
|
@@ -8981,6 +9685,7 @@ var useComputedVisibleColumns = ({
|
|
|
8981
9685
|
columnMinWidth,
|
|
8982
9686
|
columnMaxWidth,
|
|
8983
9687
|
columnDefaultWidth,
|
|
9688
|
+
viewportReservedWidth,
|
|
8984
9689
|
sortable,
|
|
8985
9690
|
sortInfo,
|
|
8986
9691
|
setSortInfo,
|
|
@@ -9018,7 +9723,7 @@ var useComputedVisibleColumns = ({
|
|
|
9018
9723
|
};
|
|
9019
9724
|
|
|
9020
9725
|
// src/components/InfiniteTable/hooks/useScrollbars.ts
|
|
9021
|
-
import { useState as
|
|
9726
|
+
import { useState as useState14, useEffect as useEffect24, useLayoutEffect as useLayoutEffect6 } from "react";
|
|
9022
9727
|
var INITIAL_SCROLLBARS = {
|
|
9023
9728
|
vertical: false,
|
|
9024
9729
|
horizontal: false
|
|
@@ -9026,7 +9731,7 @@ var INITIAL_SCROLLBARS = {
|
|
|
9026
9731
|
function useScrollbars(brain) {
|
|
9027
9732
|
const { getComponentState: getInfiniteTableState } = useComponentState();
|
|
9028
9733
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
9029
|
-
const [scrollbars, setScrollbars] =
|
|
9734
|
+
const [scrollbars, setScrollbars] = useState14(INITIAL_SCROLLBARS);
|
|
9030
9735
|
useEffect24(() => {
|
|
9031
9736
|
return brain.onRenderCountChange(() => {
|
|
9032
9737
|
const { scrollTopMax, scrollLeftMax } = brain;
|
|
@@ -9067,7 +9772,7 @@ function useComputed() {
|
|
|
9067
9772
|
bodySize,
|
|
9068
9773
|
showSeparatePivotColumnForSingleAggregation
|
|
9069
9774
|
} = componentState;
|
|
9070
|
-
|
|
9775
|
+
useState15(() => {
|
|
9071
9776
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
9072
9777
|
if (rowHeight) {
|
|
9073
9778
|
componentActions.rowHeight = rowHeight;
|
|
@@ -9085,7 +9790,7 @@ function useComputed() {
|
|
|
9085
9790
|
const { multiSort, filterValue } = dataSourceState;
|
|
9086
9791
|
useColumnGroups();
|
|
9087
9792
|
const { toggleGroupRow } = useColumnsWhen();
|
|
9088
|
-
const setSortInfo =
|
|
9793
|
+
const setSortInfo = useCallback17((sortInfo) => {
|
|
9089
9794
|
var _a2;
|
|
9090
9795
|
const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
9091
9796
|
dataSourceActions.sortInfo = newSortInfo;
|
|
@@ -9117,6 +9822,7 @@ function useComputed() {
|
|
|
9117
9822
|
pinnedEndMaxWidth: componentState.pinnedEndMaxWidth,
|
|
9118
9823
|
bodySize,
|
|
9119
9824
|
viewportReservedWidth: componentState.viewportReservedWidth,
|
|
9825
|
+
resizableColumns: componentState.resizableColumns,
|
|
9120
9826
|
sortable: componentState.sortable,
|
|
9121
9827
|
draggableColumns: componentState.draggableColumns,
|
|
9122
9828
|
sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
|
|
@@ -9162,6 +9868,10 @@ function useComputed() {
|
|
|
9162
9868
|
}
|
|
9163
9869
|
|
|
9164
9870
|
// src/components/InfiniteTable/hooks/useDOMProps.ts
|
|
9871
|
+
var columnWidthAtIndex4 = stripVar(InternalVars.columnWidthAtIndex);
|
|
9872
|
+
var columnOffsetAtIndex2 = stripVar(InternalVars.columnOffsetAtIndex);
|
|
9873
|
+
var activeCellColWidth = stripVar(InternalVars.activeCellColWidth);
|
|
9874
|
+
var activeCellColOffset = stripVar(InternalVars.activeCellColOffset);
|
|
9165
9875
|
function useDOMProps(initialDOMProps) {
|
|
9166
9876
|
const { computed, componentState, componentActions } = useInfiniteTable();
|
|
9167
9877
|
const {
|
|
@@ -9172,9 +9882,24 @@ function useDOMProps(initialDOMProps) {
|
|
|
9172
9882
|
onBlurWithin,
|
|
9173
9883
|
onFocusWithin,
|
|
9174
9884
|
onSelfFocus,
|
|
9175
|
-
onSelfBlur
|
|
9885
|
+
onSelfBlur,
|
|
9886
|
+
activeCellIndex
|
|
9176
9887
|
} = componentState;
|
|
9177
|
-
const {
|
|
9888
|
+
const {
|
|
9889
|
+
computedPinnedStartColumnsWidth,
|
|
9890
|
+
computedPinnedEndColumnsWidth,
|
|
9891
|
+
computedVisibleColumns
|
|
9892
|
+
} = computed;
|
|
9893
|
+
const cssVars = computedVisibleColumns.reduce((vars, col) => {
|
|
9894
|
+
const index = col.computedVisibleIndex;
|
|
9895
|
+
vars[`${columnWidthAtIndex4}-${index}`] = col.computedWidth + "px";
|
|
9896
|
+
vars[`${columnOffsetAtIndex2}-${index}`] = col.computedOffset + "px";
|
|
9897
|
+
return vars;
|
|
9898
|
+
}, {});
|
|
9899
|
+
if (activeCellIndex != null) {
|
|
9900
|
+
cssVars[activeCellColWidth] = `var(${getCSSVarNameForColWidth(activeCellIndex[1])})`;
|
|
9901
|
+
cssVars[activeCellColOffset] = `var(${getCSSVarNameForColOffset(activeCellIndex[1])})`;
|
|
9902
|
+
}
|
|
9178
9903
|
const setFocused = rafFn((focused2) => {
|
|
9179
9904
|
componentActions.focused = focused2;
|
|
9180
9905
|
});
|
|
@@ -9229,7 +9954,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
9229
9954
|
focusedWithin
|
|
9230
9955
|
}));
|
|
9231
9956
|
domProps.className = className;
|
|
9232
|
-
domProps.style = __spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style);
|
|
9957
|
+
domProps.style = __spreadValues(__spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style), cssVars);
|
|
9233
9958
|
if (focused) {
|
|
9234
9959
|
if (componentState.focusedStyle) {
|
|
9235
9960
|
Object.assign(domProps.style, componentState.focusedStyle);
|
|
@@ -9405,7 +10130,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
9405
10130
|
const valid = useMemo12(() => {
|
|
9406
10131
|
let valid2 = isValidLicense(licenseKey, {
|
|
9407
10132
|
publishedAt: 1624970570587,
|
|
9408
|
-
version: "0.3.
|
|
10133
|
+
version: "0.3.13"
|
|
9409
10134
|
});
|
|
9410
10135
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
9411
10136
|
return true;
|
|
@@ -9536,10 +10261,23 @@ function handleCellNavigation(options) {
|
|
|
9536
10261
|
actions.activeCellIndex = [rowIndex, colIndex];
|
|
9537
10262
|
return true;
|
|
9538
10263
|
}
|
|
10264
|
+
var validKeys = {
|
|
10265
|
+
ArrowUp: true,
|
|
10266
|
+
ArrowDown: true,
|
|
10267
|
+
ArrowLeft: true,
|
|
10268
|
+
ArrowRight: true,
|
|
10269
|
+
PageUp: true,
|
|
10270
|
+
PageDown: true,
|
|
10271
|
+
Home: true,
|
|
10272
|
+
End: true
|
|
10273
|
+
};
|
|
9539
10274
|
function handleKeyboardNavigation(options) {
|
|
9540
10275
|
const { getState } = options;
|
|
9541
10276
|
const state = getState();
|
|
9542
10277
|
const { activeRowIndex, activeCellIndex, keyboardNavigation } = state;
|
|
10278
|
+
if (!validKeys[options.key]) {
|
|
10279
|
+
return false;
|
|
10280
|
+
}
|
|
9543
10281
|
if (activeRowIndex != null && keyboardNavigation === "row") {
|
|
9544
10282
|
return handleRowNavigation(options);
|
|
9545
10283
|
}
|
|
@@ -9628,14 +10366,15 @@ function initSetupState2() {
|
|
|
9628
10366
|
scrollTop: 0
|
|
9629
10367
|
});
|
|
9630
10368
|
});
|
|
9631
|
-
if (
|
|
10369
|
+
if (false) {
|
|
9632
10370
|
globalThis.brain = brain;
|
|
10371
|
+
globalThis.headerBrain = headerBrain;
|
|
9633
10372
|
}
|
|
9634
10373
|
const { renderer, onRenderUpdater } = createRenderer2(brain);
|
|
9635
10374
|
brain.onAvailableSizeChange((size) => {
|
|
9636
10375
|
headerBrain.setAvailableSize({ width: size.width });
|
|
9637
10376
|
});
|
|
9638
|
-
if (
|
|
10377
|
+
if (false) {
|
|
9639
10378
|
globalThis.renderer = renderer;
|
|
9640
10379
|
}
|
|
9641
10380
|
return {
|
|
@@ -9648,6 +10387,7 @@ function initSetupState2() {
|
|
|
9648
10387
|
domRef: createRef(),
|
|
9649
10388
|
scrollerDOMRef: createRef(),
|
|
9650
10389
|
portalDOMRef: createRef(),
|
|
10390
|
+
activeCellIndicatorDOMRef: createRef(),
|
|
9651
10391
|
onRowHeightCSSVarChange: buildSubscriptionCallback(),
|
|
9652
10392
|
onColumnHeaderHeightCSSVarChange: buildSubscriptionCallback(),
|
|
9653
10393
|
bodySize: {
|
|
@@ -9701,8 +10441,9 @@ var forwardProps3 = (setupState) => {
|
|
|
9701
10441
|
scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
|
|
9702
10442
|
filterEditors: (filterEditors) => __spreadValues(__spreadValues({}, defaultFilterEditors), filterEditors),
|
|
9703
10443
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
10444
|
+
resizableColumns: (resizableColumns) => resizableColumns != null ? resizableColumns : true,
|
|
9704
10445
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
9705
|
-
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth :
|
|
10446
|
+
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 5e3,
|
|
9706
10447
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
9707
10448
|
columnCssEllipsis: (columnCssEllipsis) => columnCssEllipsis != null ? columnCssEllipsis : true,
|
|
9708
10449
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
@@ -9748,6 +10489,19 @@ function getGroupRenderStrategy(options) {
|
|
|
9748
10489
|
}
|
|
9749
10490
|
return "multi-column";
|
|
9750
10491
|
}
|
|
10492
|
+
var cleanupState = (state) => {
|
|
10493
|
+
state.brain.destroy();
|
|
10494
|
+
state.headerBrain.destroy();
|
|
10495
|
+
state.renderer.destroy();
|
|
10496
|
+
state.onRenderUpdater.destroy();
|
|
10497
|
+
state.domRef.current = null;
|
|
10498
|
+
state.scrollerDOMRef.current = null;
|
|
10499
|
+
state.portalDOMRef.current = null;
|
|
10500
|
+
state.onRowHeightCSSVarChange.destroy();
|
|
10501
|
+
state.onColumnHeaderHeightCSSVarChange.destroy();
|
|
10502
|
+
state.pinnedEndScrollListener.destroy();
|
|
10503
|
+
state.pinnedStartScrollListener.destroy();
|
|
10504
|
+
};
|
|
9751
10505
|
var mapPropsToState2 = (params) => {
|
|
9752
10506
|
var _a, _b;
|
|
9753
10507
|
const { props, state, oldState, parentState } = params;
|
|
@@ -9784,6 +10538,7 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
9784
10538
|
initSetupState: initSetupState2,
|
|
9785
10539
|
forwardProps: forwardProps3,
|
|
9786
10540
|
mapPropsToState: mapPropsToState2,
|
|
10541
|
+
cleanup: cleanupState,
|
|
9787
10542
|
allowedControlledPropOverrides: {
|
|
9788
10543
|
rowHeight: true,
|
|
9789
10544
|
columnHeaderHeight: true
|
|
@@ -9805,7 +10560,7 @@ var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
|
|
|
9805
10560
|
getState: getDataSourceState,
|
|
9806
10561
|
componentActions: dataSourceActions
|
|
9807
10562
|
} = useDataSourceContextValue();
|
|
9808
|
-
const [imperativeApi] =
|
|
10563
|
+
const [imperativeApi] = useState16(() => {
|
|
9809
10564
|
return getImperativeApi(getState, getComputed, getDataSourceState, actions);
|
|
9810
10565
|
});
|
|
9811
10566
|
const {
|
|
@@ -9871,7 +10626,7 @@ var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
|
|
|
9871
10626
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
9872
10627
|
}, [scrollStopDelay]);
|
|
9873
10628
|
useAutoSizeColumns();
|
|
9874
|
-
const onKeyDown =
|
|
10629
|
+
const onKeyDown = useCallback18((event) => {
|
|
9875
10630
|
if (handleKeyboardNavigation({
|
|
9876
10631
|
getState,
|
|
9877
10632
|
actions,
|
|
@@ -9883,13 +10638,14 @@ var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
|
|
|
9883
10638
|
event.preventDefault();
|
|
9884
10639
|
}
|
|
9885
10640
|
}, []);
|
|
9886
|
-
return /* @__PURE__ */
|
|
10641
|
+
return /* @__PURE__ */ createElement28("div", __spreadValues({
|
|
9887
10642
|
onKeyDown,
|
|
9888
10643
|
ref: domRef
|
|
9889
|
-
}, domProps), header ? /* @__PURE__ */
|
|
9890
|
-
|
|
10644
|
+
}, domProps), header ? /* @__PURE__ */ createElement28(TableHeaderWrapper, {
|
|
10645
|
+
bodyBrain: brain,
|
|
10646
|
+
headerBrain,
|
|
9891
10647
|
scrollbars
|
|
9892
|
-
}) : null, /* @__PURE__ */
|
|
10648
|
+
}) : null, /* @__PURE__ */ createElement28(InfiniteTableBody, null, /* @__PURE__ */ createElement28(HeadlessTable, {
|
|
9893
10649
|
tabIndex: 0,
|
|
9894
10650
|
activeRowIndex: componentState.ready && keyboardNavigation === "row" ? activeRowIndex : null,
|
|
9895
10651
|
activeCellIndex: componentState.ready && keyboardNavigation === "cell" ? activeCellIndex : null,
|
|
@@ -9900,18 +10656,18 @@ var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
|
|
|
9900
10656
|
renderCell,
|
|
9901
10657
|
cellHoverClassNames: HOVERED_CLASS_NAMES,
|
|
9902
10658
|
scrollerDOMRef
|
|
9903
|
-
}), /* @__PURE__ */
|
|
10659
|
+
}), /* @__PURE__ */ createElement28(LoadMaskCmp, {
|
|
9904
10660
|
visible: loading
|
|
9905
|
-
}, loadingText)), /* @__PURE__ */
|
|
10661
|
+
}, loadingText)), /* @__PURE__ */ createElement28("div", {
|
|
9906
10662
|
ref: portalDOMRef,
|
|
9907
10663
|
className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
9908
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
10664
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ createElement28(CSSVariableWatch, {
|
|
9909
10665
|
varName: rowHeightCSSVar,
|
|
9910
10666
|
onChange: onRowHeightCSSVarChange
|
|
9911
|
-
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */
|
|
10667
|
+
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ createElement28(CSSVariableWatch, {
|
|
9912
10668
|
varName: columnHeaderHeightCSSVar,
|
|
9913
10669
|
onChange: onColumnHeaderHeightCSSVarChange
|
|
9914
|
-
}) : null, /* @__PURE__ */
|
|
10670
|
+
}) : null, /* @__PURE__ */ createElement28(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ createElement28(InfiniteTableLicenseFooter, null));
|
|
9915
10671
|
});
|
|
9916
10672
|
function InfiniteTableContextProvider() {
|
|
9917
10673
|
const { componentActions, componentState } = useComponentState();
|
|
@@ -9919,7 +10675,7 @@ function InfiniteTableContextProvider() {
|
|
|
9919
10675
|
const computed = useComputed();
|
|
9920
10676
|
const getComputed = useLatest(computed);
|
|
9921
10677
|
const getState = useLatest(componentState);
|
|
9922
|
-
if (
|
|
10678
|
+
if (false) {
|
|
9923
10679
|
globalThis.getState = getState;
|
|
9924
10680
|
globalThis.getComputed = getComputed;
|
|
9925
10681
|
}
|
|
@@ -9931,14 +10687,12 @@ function InfiniteTableContextProvider() {
|
|
|
9931
10687
|
getState
|
|
9932
10688
|
};
|
|
9933
10689
|
useResizeObserver(scrollerDOMRef, (size) => {
|
|
9934
|
-
var _a, _b;
|
|
9935
10690
|
const bodySize = {
|
|
9936
10691
|
width: size.width,
|
|
9937
10692
|
height: size.height
|
|
9938
10693
|
};
|
|
9939
|
-
bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
|
|
9940
10694
|
componentActions.bodySize = bodySize;
|
|
9941
|
-
}, { earlyAttach: true });
|
|
10695
|
+
}, { earlyAttach: true, debounce: 50 });
|
|
9942
10696
|
useEffect26(() => {
|
|
9943
10697
|
return () => {
|
|
9944
10698
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
@@ -9951,13 +10705,16 @@ function InfiniteTableContextProvider() {
|
|
|
9951
10705
|
}
|
|
9952
10706
|
}, [scrollTopKey, scrollerDOMRef]);
|
|
9953
10707
|
const TableContext2 = getInfiniteTableContext();
|
|
9954
|
-
return /* @__PURE__ */
|
|
10708
|
+
return /* @__PURE__ */ createElement28(TableContext2.Provider, {
|
|
9955
10709
|
value: contextValue
|
|
9956
|
-
}, /* @__PURE__ */
|
|
10710
|
+
}, /* @__PURE__ */ createElement28(InfiniteTableComponent, null));
|
|
9957
10711
|
}
|
|
9958
10712
|
function InfiniteTable(props) {
|
|
9959
|
-
const table = /* @__PURE__ */
|
|
9960
|
-
|
|
10713
|
+
const table = /* @__PURE__ */ createElement28(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ createElement28(InfiniteTableContextProvider, null));
|
|
10714
|
+
if (false) {
|
|
10715
|
+
return /* @__PURE__ */ createElement28(StrictMode, null, table);
|
|
10716
|
+
}
|
|
10717
|
+
return table;
|
|
9961
10718
|
}
|
|
9962
10719
|
InfiniteTable.defaultProps = {
|
|
9963
10720
|
rowHeight: 40,
|