@infinite-table/infinite-react 0.0.2-canary.1 → 0.0.2-canary.5
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/index.css +505 -354
- package/index.d.ts +1159 -293
- package/index.esm.css +615 -0
- package/index.esm.js +1636 -933
- package/index.js +1662 -969
- package/package.json +2 -2
- package/tmp.css.map +1 -0
- package/index.css.map +0 -1
package/index.esm.js
CHANGED
|
@@ -465,14 +465,14 @@ var require_browser = __commonJS({
|
|
|
465
465
|
} else {
|
|
466
466
|
exports.storage.removeItem("debug");
|
|
467
467
|
}
|
|
468
|
-
} catch (
|
|
468
|
+
} catch (error3) {
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
function load() {
|
|
472
472
|
let r;
|
|
473
473
|
try {
|
|
474
474
|
r = exports.storage.getItem("debug");
|
|
475
|
-
} catch (
|
|
475
|
+
} catch (error3) {
|
|
476
476
|
}
|
|
477
477
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
478
478
|
r = process.env.DEBUG;
|
|
@@ -482,7 +482,7 @@ var require_browser = __commonJS({
|
|
|
482
482
|
function localstorage() {
|
|
483
483
|
try {
|
|
484
484
|
return localStorage;
|
|
485
|
-
} catch (
|
|
485
|
+
} catch (error3) {
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
module.exports = require_common()(exports);
|
|
@@ -490,8 +490,8 @@ var require_browser = __commonJS({
|
|
|
490
490
|
formatters.j = function(v) {
|
|
491
491
|
try {
|
|
492
492
|
return JSON.stringify(v);
|
|
493
|
-
} catch (
|
|
494
|
-
return "[UnexpectedJSONParseError]: " +
|
|
493
|
+
} catch (error3) {
|
|
494
|
+
return "[UnexpectedJSONParseError]: " + error3.message;
|
|
495
495
|
}
|
|
496
496
|
};
|
|
497
497
|
}
|
|
@@ -566,16 +566,13 @@ var require_decamelize = __commonJS({
|
|
|
566
566
|
// src/components/InfiniteTable/index.tsx
|
|
567
567
|
import {
|
|
568
568
|
StrictMode,
|
|
569
|
-
createElement as
|
|
570
|
-
memo as
|
|
571
|
-
useEffect as
|
|
569
|
+
createElement as createElement33,
|
|
570
|
+
memo as memo13,
|
|
571
|
+
useEffect as useEffect22
|
|
572
572
|
} from "react";
|
|
573
573
|
|
|
574
|
-
// src/utils/join.ts
|
|
575
|
-
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
576
|
-
|
|
577
574
|
// src/components/InfiniteTable/internalProps.ts
|
|
578
|
-
var rootClassName = "
|
|
575
|
+
var rootClassName = "Infinite";
|
|
579
576
|
var internalProps = {
|
|
580
577
|
rootClassName
|
|
581
578
|
};
|
|
@@ -617,19 +614,6 @@ function buildSubscriptionCallback() {
|
|
|
617
614
|
return updater;
|
|
618
615
|
}
|
|
619
616
|
|
|
620
|
-
// src/components/utils/isControlledValue.ts
|
|
621
|
-
function isControlledValue(value) {
|
|
622
|
-
const controlled = value !== void 0;
|
|
623
|
-
return controlled;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
// src/components/utils/isControlled.ts
|
|
627
|
-
function isControlled(propName, props) {
|
|
628
|
-
const propValue = props[propName];
|
|
629
|
-
const controlled = isControlledValue(propValue);
|
|
630
|
-
return controlled;
|
|
631
|
-
}
|
|
632
|
-
|
|
633
617
|
// src/components/VirtualBrain/ScrollListener.ts
|
|
634
618
|
var initialScrollPosition = {
|
|
635
619
|
scrollLeft: 0,
|
|
@@ -688,25 +672,15 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
688
672
|
}
|
|
689
673
|
|
|
690
674
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
691
|
-
function
|
|
692
|
-
|
|
693
|
-
const { props } = params;
|
|
694
|
-
const columnGroups = (_a = isControlled("columnGroups", props) ? props.columnGroups : props.defaultColumnGroups) != null ? _a : new Map();
|
|
695
|
-
const pivotColumnGroups = props.pivotColumnGroups;
|
|
696
|
-
const collapsedColumnGroups = (_b = isControlled("collapsedColumnGroups", props) ? props.collapsedColumnGroups : props.defaultCollapsedColumnGroups) != null ? _b : new Map();
|
|
697
|
-
const computedColumnGroups = pivotColumnGroups || columnGroups;
|
|
698
|
-
const columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
699
|
-
const generatedColumns = new Map();
|
|
700
|
-
const pivotColumns = props.pivotColumns;
|
|
675
|
+
function initSetupState() {
|
|
676
|
+
const columnsGeneratedForGrouping = new Map();
|
|
701
677
|
return {
|
|
702
|
-
|
|
703
|
-
headerHeight: typeof props.headerHeight === "number" ? props.headerHeight : 0,
|
|
678
|
+
columnShifts: null,
|
|
704
679
|
domRef: createRef(),
|
|
705
|
-
|
|
680
|
+
scrollerDOMRef: createRef(),
|
|
706
681
|
portalDOMRef: createRef(),
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
onHeaderHeightChange: buildSubscriptionCallback(),
|
|
682
|
+
onRowHeightCSSVarChange: buildSubscriptionCallback(),
|
|
683
|
+
onHeaderHeightCSSVarChange: buildSubscriptionCallback(),
|
|
710
684
|
bodySize: {
|
|
711
685
|
width: 0,
|
|
712
686
|
height: 0
|
|
@@ -715,65 +689,105 @@ function getInitialState(params) {
|
|
|
715
689
|
scrollTop: 0,
|
|
716
690
|
scrollLeft: 0
|
|
717
691
|
},
|
|
692
|
+
focused: false,
|
|
693
|
+
focusedWithin: false,
|
|
694
|
+
columnsWhenGrouping: columnsGeneratedForGrouping,
|
|
718
695
|
draggingColumnId: null,
|
|
719
|
-
columns: props.columns,
|
|
720
|
-
pivotColumns,
|
|
721
|
-
pivotColumnGroups,
|
|
722
|
-
generatedColumns,
|
|
723
|
-
columnOrder: (_c = isControlled("columnOrder", props) ? props.columnOrder : props.defaultColumnOrder) != null ? _c : true,
|
|
724
|
-
computedColumnGroups,
|
|
725
696
|
pinnedStartScrollListener: new ScrollListener(),
|
|
726
697
|
pinnedEndScrollListener: new ScrollListener(),
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
698
|
+
computedPivotColumns: void 0,
|
|
699
|
+
columnsWhenInlineGroupRenderStrategy: void 0
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
var forwardProps = () => {
|
|
703
|
+
return {
|
|
704
|
+
columns: 1,
|
|
705
|
+
components: 1,
|
|
706
|
+
loadingText: 1,
|
|
707
|
+
pivotColumns: 1,
|
|
708
|
+
groupColumn: 1,
|
|
709
|
+
onReady: 1,
|
|
710
|
+
domProps: 1,
|
|
711
|
+
focusedClassName: 1,
|
|
712
|
+
focusedWithinClassName: 1,
|
|
713
|
+
focusedStyle: 1,
|
|
714
|
+
focusedWithinStyle: 1,
|
|
715
|
+
onSelfFocus: 1,
|
|
716
|
+
onFocusWithin: 1,
|
|
717
|
+
onSelfBlur: 1,
|
|
718
|
+
onBlurWithin: 1,
|
|
719
|
+
onScrollToTop: 1,
|
|
720
|
+
onScrollToBottom: 1,
|
|
721
|
+
scrollToBottomOffset: 1,
|
|
722
|
+
rowStyle: 1,
|
|
723
|
+
rowProps: 1,
|
|
724
|
+
rowClassName: 1,
|
|
725
|
+
pinnedStartMaxWidth: 1,
|
|
726
|
+
pinnedEndMaxWidth: 1,
|
|
727
|
+
pivotColumn: 1,
|
|
728
|
+
pivotRowLabelsColumn: 1,
|
|
729
|
+
pivotColumnGroups: 1,
|
|
730
|
+
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
731
|
+
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
732
|
+
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
733
|
+
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 300,
|
|
734
|
+
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
735
|
+
sortable: (sortable) => sortable != null ? sortable : true,
|
|
736
|
+
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
737
|
+
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
738
|
+
licenseKey: (licenseKey) => licenseKey || globalThis.InfiniteTableLicenseKey || "",
|
|
739
|
+
columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
|
|
740
|
+
header: (header) => header != null ? header : true,
|
|
741
|
+
showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
|
|
742
|
+
showHoverRows: (showHoverRows) => showHoverRows != null ? showHoverRows : true,
|
|
743
|
+
virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
|
|
744
|
+
rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
|
|
745
|
+
headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
|
|
746
|
+
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : new Map(),
|
|
747
|
+
columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
|
|
748
|
+
columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
|
|
749
|
+
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
750
|
+
columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
|
|
736
751
|
};
|
|
752
|
+
};
|
|
753
|
+
function getGroupRenderStrategy(options) {
|
|
754
|
+
const { groupRowsBy, groupColumn, groupRenderStrategy } = options;
|
|
755
|
+
if (groupRenderStrategy) {
|
|
756
|
+
return groupRenderStrategy;
|
|
757
|
+
}
|
|
758
|
+
if (groupColumn != null && typeof groupColumn === "object") {
|
|
759
|
+
return "single-column";
|
|
760
|
+
}
|
|
761
|
+
const columnsInGroupRowsBy = groupRowsBy.filter((g) => g.column);
|
|
762
|
+
if (columnsInGroupRowsBy.length) {
|
|
763
|
+
return "multi-column";
|
|
764
|
+
}
|
|
765
|
+
return "multi-column";
|
|
737
766
|
}
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
const {
|
|
741
|
-
const virtualizeColumns = (_a = props.virtualizeColumns) != null ? _a : true;
|
|
742
|
-
const header = (_b = props.header) != null ? _b : true;
|
|
767
|
+
var mapPropsToState = (params) => {
|
|
768
|
+
const { props, state, oldState, parentState } = params;
|
|
769
|
+
const { virtualizeColumns, header } = state;
|
|
743
770
|
const computedColumnGroups = state.pivotColumnGroups || state.columnGroups;
|
|
744
771
|
const virtualizeHeader = header && virtualizeColumns && (!computedColumnGroups || (computedColumnGroups == null ? void 0 : computedColumnGroups.size) === 0);
|
|
745
|
-
const columnGroupsDepthsMap = (
|
|
746
|
-
const
|
|
772
|
+
const columnGroupsDepthsMap = state.columnGroups && state.columnGroups != (oldState == null ? void 0 : oldState.columnGroups) || state.pivotColumnGroups && state.pivotColumnGroups != (oldState == null ? void 0 : oldState.pivotColumnGroups) ? computeColumnGroupsDepths(computedColumnGroups) : state.columnGroupsDepthsMap;
|
|
773
|
+
const groupRowsBy = parentState == null ? void 0 : parentState.groupRowsBy;
|
|
774
|
+
const groupRenderStrategy = getGroupRenderStrategy({
|
|
775
|
+
groupRenderStrategy: props.groupRenderStrategy,
|
|
776
|
+
groupRowsBy,
|
|
777
|
+
groupColumn: props.groupColumn
|
|
778
|
+
});
|
|
747
779
|
return {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
showZebraRows: (_d = props.showZebraRows) != null ? _d : true,
|
|
752
|
-
virtualizeColumns,
|
|
780
|
+
groupRenderStrategy,
|
|
781
|
+
groupRowsBy,
|
|
782
|
+
computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || props.columns,
|
|
753
783
|
virtualizeHeader,
|
|
754
|
-
header,
|
|
755
|
-
rowStyle: props.rowStyle,
|
|
756
|
-
rowProps: props.rowProps,
|
|
757
|
-
rowClassName: props.rowClassName,
|
|
758
|
-
pinnedStartMaxWidth: props.pinnedStartMaxWidth,
|
|
759
|
-
pinnedEndMaxWidth: props.pinnedEndMaxWidth,
|
|
760
|
-
groupRenderStrategy: (_e = props.groupRenderStrategy) != null ? _e : "multi-column",
|
|
761
|
-
pivotTotalColumnPosition,
|
|
762
|
-
columnMinWidth: (_f = props.columnMinWidth) != null ? _f : 30,
|
|
763
|
-
columnMaxWidth: (_g = props.columnMaxWidth) != null ? _g : 2e3,
|
|
764
|
-
columnDefaultWidth: (_h = props.columnDefaultWidth) != null ? _h : 300,
|
|
765
|
-
draggableColumns: (_i = props.draggableColumns) != null ? _i : true,
|
|
766
|
-
pivotColumn: props.pivotColumn,
|
|
767
|
-
pivotRowLabelsColumn: props.pivotRowLabelsColumn,
|
|
768
|
-
sortable: (_j = props.sortable) != null ? _j : true,
|
|
769
784
|
columnGroupsDepthsMap,
|
|
770
|
-
columnGroupsMaxDepth: Math.max(...columnGroupsDepthsMap.values(), 0),
|
|
785
|
+
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
771
786
|
computedColumnGroups,
|
|
772
|
-
licenseKey: props.licenseKey || globalThis.InfiniteTableLicenseKey || "",
|
|
773
787
|
rowHeightCSSVar: typeof props.rowHeight === "string" ? props.rowHeight : "",
|
|
774
|
-
headerHeightCSSVar: typeof props.headerHeight === "string" ? props.headerHeight : ""
|
|
788
|
+
headerHeightCSSVar: typeof props.headerHeight === "string" ? props.headerHeight || "--ITableHeader__height" : ""
|
|
775
789
|
};
|
|
776
|
-
}
|
|
790
|
+
};
|
|
777
791
|
|
|
778
792
|
// src/components/ResizeObserver/index.tsx
|
|
779
793
|
import {
|
|
@@ -1042,7 +1056,34 @@ var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
|
|
|
1042
1056
|
return columnOrder;
|
|
1043
1057
|
};
|
|
1044
1058
|
|
|
1059
|
+
// src/utils/debug.ts
|
|
1060
|
+
var debug = require_browser();
|
|
1061
|
+
var debugTable = debug(`InfiniteTable`);
|
|
1062
|
+
var dbg = (channelName) => {
|
|
1063
|
+
const result = debugTable.extend(channelName);
|
|
1064
|
+
result.log = console.log.bind(console);
|
|
1065
|
+
return result;
|
|
1066
|
+
};
|
|
1067
|
+
var err = (channelName) => {
|
|
1068
|
+
const result = debugTable.extend(`${channelName}:error`);
|
|
1069
|
+
result.log = console.error.bind(console);
|
|
1070
|
+
return result;
|
|
1071
|
+
};
|
|
1072
|
+
var emptyLogFn = () => emptyLogFn;
|
|
1073
|
+
emptyLogFn.extend = () => emptyLogFn;
|
|
1074
|
+
var Logger = class {
|
|
1075
|
+
constructor(channelName) {
|
|
1076
|
+
this.debug = emptyLogFn;
|
|
1077
|
+
this.error = emptyLogFn;
|
|
1078
|
+
if (false) {
|
|
1079
|
+
this.debug = dbg(channelName);
|
|
1080
|
+
this.error = err(channelName);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1045
1085
|
// src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
|
|
1086
|
+
var error = err("getComputedVisibleColumns");
|
|
1046
1087
|
var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
|
|
1047
1088
|
return !columnVisibility.has(colId) || columnVisibility.get(colId) !== false;
|
|
1048
1089
|
};
|
|
@@ -1053,7 +1094,6 @@ var getComputedPinned = (colId, columnPinning) => {
|
|
|
1053
1094
|
};
|
|
1054
1095
|
var getComputedVisibleColumns = ({
|
|
1055
1096
|
columns,
|
|
1056
|
-
generatedColumns,
|
|
1057
1097
|
bodySize,
|
|
1058
1098
|
columnMinWidth,
|
|
1059
1099
|
columnMaxWidth,
|
|
@@ -1071,18 +1111,15 @@ var getComputedVisibleColumns = ({
|
|
|
1071
1111
|
columnVisibilityAssumeVisible
|
|
1072
1112
|
}) => {
|
|
1073
1113
|
let computedOffset = 0;
|
|
1074
|
-
const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ?
|
|
1114
|
+
const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
|
|
1075
1115
|
const visibleColumnOrder = normalizedColumnOrder.filter(isColumnVisible.bind(null, columnVisibility, columnVisibilityAssumeVisible));
|
|
1076
1116
|
const columnsArray = visibleColumnOrder.map((columnId) => {
|
|
1077
1117
|
let col = columns.get(columnId);
|
|
1078
1118
|
if (!col) {
|
|
1079
|
-
|
|
1080
|
-
if (!col) {
|
|
1081
|
-
throw `Column with id "${columnId}" specified in columnOrder array cannot be found in the columns map.`;
|
|
1082
|
-
}
|
|
1119
|
+
error(`Column with id "${columnId}" specified in columnOrder array cannot be found in the columns map.`);
|
|
1083
1120
|
}
|
|
1084
1121
|
return col;
|
|
1085
|
-
});
|
|
1122
|
+
}).filter(Boolean);
|
|
1086
1123
|
const sortedMap = (sortInfo != null ? sortInfo : []).reduce((acc, info, index) => {
|
|
1087
1124
|
if (info.id) {
|
|
1088
1125
|
acc[info.id] = { sortInfo: info, index };
|
|
@@ -1323,13 +1360,13 @@ function interceptMap(map, fns) {
|
|
|
1323
1360
|
// src/components/InfiniteTable/utils/rafFn.ts
|
|
1324
1361
|
var rafFn = (fn) => {
|
|
1325
1362
|
let rafId = 0;
|
|
1326
|
-
return () => {
|
|
1363
|
+
return (...args) => {
|
|
1327
1364
|
if (rafId) {
|
|
1328
1365
|
cancelAnimationFrame(rafId);
|
|
1329
1366
|
}
|
|
1330
1367
|
rafId = requestAnimationFrame(() => {
|
|
1331
1368
|
rafId = 0;
|
|
1332
|
-
fn();
|
|
1369
|
+
fn(...args);
|
|
1333
1370
|
});
|
|
1334
1371
|
};
|
|
1335
1372
|
};
|
|
@@ -1351,7 +1388,6 @@ var useRerenderOnKeyChange = (map) => {
|
|
|
1351
1388
|
// src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
|
|
1352
1389
|
var useComputedVisibleColumns = ({
|
|
1353
1390
|
columns,
|
|
1354
|
-
generatedColumns,
|
|
1355
1391
|
bodySize,
|
|
1356
1392
|
columnMinWidth,
|
|
1357
1393
|
columnMaxWidth,
|
|
@@ -1389,7 +1425,6 @@ var useComputedVisibleColumns = ({
|
|
|
1389
1425
|
} = useMemo2(() => {
|
|
1390
1426
|
return getComputedVisibleColumns({
|
|
1391
1427
|
columns,
|
|
1392
|
-
generatedColumns,
|
|
1393
1428
|
bodySize,
|
|
1394
1429
|
columnMinWidth,
|
|
1395
1430
|
columnMaxWidth,
|
|
@@ -1408,7 +1443,6 @@ var useComputedVisibleColumns = ({
|
|
|
1408
1443
|
});
|
|
1409
1444
|
}, [
|
|
1410
1445
|
columns,
|
|
1411
|
-
generatedColumns,
|
|
1412
1446
|
bodySize.width,
|
|
1413
1447
|
columnMinWidth,
|
|
1414
1448
|
columnMaxWidth,
|
|
@@ -1490,46 +1524,62 @@ import {
|
|
|
1490
1524
|
memo,
|
|
1491
1525
|
useContext as useContext3
|
|
1492
1526
|
} from "react";
|
|
1493
|
-
import {
|
|
1527
|
+
import {
|
|
1528
|
+
useReducer,
|
|
1529
|
+
createContext as createContext3,
|
|
1530
|
+
useMemo as useMemo3,
|
|
1531
|
+
useEffect as useEffect4,
|
|
1532
|
+
useState as useState2,
|
|
1533
|
+
useRef as useRef4
|
|
1534
|
+
} from "react";
|
|
1494
1535
|
|
|
1495
|
-
// src/utils/
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
var Logger = class {
|
|
1511
|
-
constructor(channelName) {
|
|
1512
|
-
this.debug = emptyLogFn;
|
|
1513
|
-
this.error = emptyLogFn;
|
|
1514
|
-
if (false) {
|
|
1515
|
-
this.debug = dbg(channelName);
|
|
1516
|
-
this.error = err(channelName);
|
|
1517
|
-
}
|
|
1536
|
+
// src/utils/proxyFnCall.ts
|
|
1537
|
+
function proxyFn(fn, config) {
|
|
1538
|
+
const propertyReads = new Set();
|
|
1539
|
+
function proxiedFn(...params) {
|
|
1540
|
+
const paramToProxy = config ? config.getProxyTargetFromArgs(...params) : params[0];
|
|
1541
|
+
propertyReads.clear();
|
|
1542
|
+
const handler = {
|
|
1543
|
+
get: function(obj, prop) {
|
|
1544
|
+
propertyReads.add(prop);
|
|
1545
|
+
return obj[prop];
|
|
1546
|
+
}
|
|
1547
|
+
};
|
|
1548
|
+
const proxy = new Proxy(paramToProxy, handler);
|
|
1549
|
+
const newParams = config ? config.putProxyToArgs(proxy, ...params) : [proxy];
|
|
1550
|
+
return fn.apply(this, newParams);
|
|
1518
1551
|
}
|
|
1519
|
-
|
|
1552
|
+
return {
|
|
1553
|
+
fn: proxiedFn,
|
|
1554
|
+
propertyReads
|
|
1555
|
+
};
|
|
1556
|
+
}
|
|
1520
1557
|
|
|
1521
1558
|
// src/utils/toUpperFirst.ts
|
|
1522
1559
|
var toUpperFirst = (s) => {
|
|
1523
1560
|
return s ? s.substr(0, 1).toUpperCase() + s.substr(1) : s;
|
|
1524
1561
|
};
|
|
1525
1562
|
|
|
1526
|
-
// src/components/
|
|
1563
|
+
// src/components/utils/isControlledValue.ts
|
|
1564
|
+
function isControlledValue(value) {
|
|
1565
|
+
const controlled = value !== void 0;
|
|
1566
|
+
return controlled;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
// src/components/utils/isControlled.ts
|
|
1570
|
+
function isControlled(propName, props) {
|
|
1571
|
+
const propValue = props[propName];
|
|
1572
|
+
const controlled = isControlledValue(propValue);
|
|
1573
|
+
return controlled;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
// src/components/hooks/useLatest.tsx
|
|
1527
1577
|
import { useCallback as useCallback3, useRef as useRef2 } from "react";
|
|
1528
|
-
|
|
1578
|
+
function useLatest(value) {
|
|
1529
1579
|
const ref = useRef2(value);
|
|
1530
1580
|
ref.current = value;
|
|
1531
1581
|
return useCallback3(() => ref.current, []);
|
|
1532
|
-
}
|
|
1582
|
+
}
|
|
1533
1583
|
|
|
1534
1584
|
// src/components/hooks/usePrevious.ts
|
|
1535
1585
|
import { useRef as useRef3, useLayoutEffect as useLayoutEffect2 } from "react";
|
|
@@ -1558,18 +1608,33 @@ function getComponentStateContext() {
|
|
|
1558
1608
|
}
|
|
1559
1609
|
return ComponentContext = createContext3(null);
|
|
1560
1610
|
}
|
|
1561
|
-
function getReducerActions(dispatch,
|
|
1611
|
+
function getReducerActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides) {
|
|
1612
|
+
const state = getState();
|
|
1562
1613
|
return Object.keys(state).reduce((actions, stateKey) => {
|
|
1563
1614
|
const key = stateKey;
|
|
1564
1615
|
const setter = (value) => {
|
|
1565
1616
|
const props = getProps();
|
|
1617
|
+
const state2 = getState();
|
|
1618
|
+
const currentValue = state2[key];
|
|
1619
|
+
if (currentValue === value) {
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1566
1622
|
notifyChange(props, stateKey, value);
|
|
1567
|
-
|
|
1623
|
+
const forwardFn = propsToForward[key];
|
|
1624
|
+
if (typeof forwardFn === "function") {
|
|
1625
|
+
value = forwardFn(value);
|
|
1626
|
+
}
|
|
1627
|
+
const allowControlled = !!(allowedControlledPropOverrides == null ? void 0 : allowedControlledPropOverrides[key]);
|
|
1628
|
+
if (isControlled(stateKey, props) && !allowControlled) {
|
|
1568
1629
|
return;
|
|
1569
1630
|
}
|
|
1570
1631
|
dispatch({
|
|
1571
|
-
|
|
1572
|
-
|
|
1632
|
+
payload: {
|
|
1633
|
+
updatedProps: null,
|
|
1634
|
+
mappedState: {
|
|
1635
|
+
[stateKey]: value
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1573
1638
|
});
|
|
1574
1639
|
};
|
|
1575
1640
|
Object.defineProperty(actions, stateKey, {
|
|
@@ -1578,116 +1643,152 @@ function getReducerActions(dispatch, state, getProps) {
|
|
|
1578
1643
|
return actions;
|
|
1579
1644
|
}, {});
|
|
1580
1645
|
}
|
|
1646
|
+
function forwardProps2(propsToForward, props) {
|
|
1647
|
+
const mappedState = {};
|
|
1648
|
+
for (let k in propsToForward)
|
|
1649
|
+
if (propsToForward.hasOwnProperty(k)) {
|
|
1650
|
+
const forwardFn = propsToForward[k];
|
|
1651
|
+
let propValue = isControlled(k, props) ? props[k] : props[`default${toUpperFirst(k)}`];
|
|
1652
|
+
if (typeof forwardFn === "function") {
|
|
1653
|
+
propValue = forwardFn(propValue);
|
|
1654
|
+
}
|
|
1655
|
+
mappedState[k] = propValue;
|
|
1656
|
+
}
|
|
1657
|
+
return mappedState;
|
|
1658
|
+
}
|
|
1581
1659
|
function getComponentStateRoot(config) {
|
|
1582
1660
|
return memo(function ComponentStateRoot(props) {
|
|
1583
|
-
var _a;
|
|
1584
|
-
const
|
|
1585
|
-
const
|
|
1586
|
-
const
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
}
|
|
1591
|
-
if (
|
|
1592
|
-
|
|
1661
|
+
var _a, _b;
|
|
1662
|
+
const propsToStateSetRef = useRef4(new Set());
|
|
1663
|
+
const propsToForward = useMemo3(() => config.forwardProps ? config.forwardProps() : {}, []);
|
|
1664
|
+
const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
|
|
1665
|
+
const getParentState = useLatest(parentState);
|
|
1666
|
+
const [wholeState] = useState2(() => {
|
|
1667
|
+
const initialSetupState = config.initSetupState ? config.initSetupState() : {};
|
|
1668
|
+
let mappedState = {};
|
|
1669
|
+
if (propsToForward) {
|
|
1670
|
+
mappedState = forwardProps2(propsToForward, props);
|
|
1671
|
+
}
|
|
1672
|
+
const state2 = __spreadValues(__spreadValues({}, initialSetupState), mappedState);
|
|
1673
|
+
if (config.mapPropsToState) {
|
|
1674
|
+
const { fn: mapPropsToState3, propertyReads } = proxyFn(config.mapPropsToState, {
|
|
1675
|
+
getProxyTargetFromArgs: (initialArg) => initialArg.props,
|
|
1676
|
+
putProxyToArgs: (props2, initialArg) => {
|
|
1677
|
+
return [__spreadProps(__spreadValues({}, initialArg), { props: props2 })];
|
|
1678
|
+
}
|
|
1679
|
+
});
|
|
1680
|
+
propsToStateSetRef.current = new Set([
|
|
1681
|
+
...propsToStateSetRef.current,
|
|
1682
|
+
...propertyReads
|
|
1683
|
+
]);
|
|
1684
|
+
const stateFromProps = mapPropsToState3({
|
|
1593
1685
|
props,
|
|
1594
|
-
state:
|
|
1595
|
-
|
|
1686
|
+
state: state2,
|
|
1687
|
+
oldState: null,
|
|
1596
1688
|
parentState
|
|
1597
1689
|
});
|
|
1598
|
-
return {
|
|
1599
|
-
state: __spreadValues(__spreadValues({}, initialState2), readOnlyState),
|
|
1600
|
-
initialState: initialState2,
|
|
1601
|
-
readOnlyState
|
|
1602
|
-
};
|
|
1690
|
+
return __spreadValues(__spreadValues({}, state2), stateFromProps);
|
|
1603
1691
|
}
|
|
1604
|
-
return
|
|
1605
|
-
initialState: initialState2,
|
|
1606
|
-
readOnlyState: {},
|
|
1607
|
-
state: initialState2
|
|
1608
|
-
};
|
|
1692
|
+
return state2;
|
|
1609
1693
|
});
|
|
1610
1694
|
const getProps = useLatest(props);
|
|
1611
|
-
const theReducer = (
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1695
|
+
const theReducer = (previousState, action) => {
|
|
1696
|
+
var _a2;
|
|
1697
|
+
const parentState2 = (_a2 = getParentState == null ? void 0 : getParentState()) != null ? _a2 : null;
|
|
1698
|
+
const mappedState = action.payload.mappedState;
|
|
1699
|
+
const updatedProps = action.payload.updatedProps;
|
|
1700
|
+
const newState = Object.assign({}, previousState);
|
|
1701
|
+
if (mappedState) {
|
|
1702
|
+
Object.assign(newState, mappedState);
|
|
1703
|
+
}
|
|
1704
|
+
if (config.mapPropsToState) {
|
|
1705
|
+
const { fn: mapPropsToState3, propertyReads } = proxyFn(config.mapPropsToState, {
|
|
1706
|
+
getProxyTargetFromArgs: (initialArg) => initialArg.props,
|
|
1707
|
+
putProxyToArgs: (props2, initialArg) => {
|
|
1708
|
+
return [__spreadProps(__spreadValues({}, initialArg), { props: props2 })];
|
|
1709
|
+
}
|
|
1710
|
+
});
|
|
1711
|
+
propsToStateSetRef.current = new Set([
|
|
1712
|
+
...propsToStateSetRef.current,
|
|
1713
|
+
...propertyReads
|
|
1714
|
+
]);
|
|
1715
|
+
const stateFromProps = mapPropsToState3({
|
|
1627
1716
|
props: getProps(),
|
|
1628
|
-
state:
|
|
1629
|
-
|
|
1630
|
-
parentState
|
|
1717
|
+
state: newState,
|
|
1718
|
+
oldState: previousState,
|
|
1719
|
+
parentState: parentState2
|
|
1631
1720
|
});
|
|
1632
|
-
|
|
1721
|
+
Object.assign(newState, stateFromProps);
|
|
1633
1722
|
}
|
|
1634
1723
|
const result = config.concludeReducer ? config.concludeReducer({
|
|
1635
1724
|
previousState,
|
|
1636
|
-
state:
|
|
1637
|
-
|
|
1638
|
-
parentState
|
|
1639
|
-
}) :
|
|
1725
|
+
state: newState,
|
|
1726
|
+
updatedProps,
|
|
1727
|
+
parentState: parentState2
|
|
1728
|
+
}) : newState;
|
|
1640
1729
|
return result;
|
|
1641
1730
|
};
|
|
1642
1731
|
const [state, dispatch] = useReducer(theReducer, wholeState);
|
|
1643
|
-
const
|
|
1644
|
-
|
|
1645
|
-
return (_b = (_a2 = config.getReducerActions) == null ? void 0 : _a2.call(config, dispatch)) != null ? _b : {};
|
|
1646
|
-
}, [dispatch]);
|
|
1732
|
+
const getComponentState = useLatest(state);
|
|
1733
|
+
const { allowedControlledPropOverrides } = config;
|
|
1647
1734
|
const actions = useMemo3(() => {
|
|
1648
|
-
const generatedActions = getReducerActions(dispatch,
|
|
1649
|
-
return
|
|
1650
|
-
}, [
|
|
1735
|
+
const generatedActions = getReducerActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides);
|
|
1736
|
+
return generatedActions;
|
|
1737
|
+
}, [
|
|
1738
|
+
dispatch,
|
|
1739
|
+
propsToForward,
|
|
1740
|
+
allowedControlledPropOverrides
|
|
1741
|
+
]);
|
|
1651
1742
|
const Context = getComponentStateContext();
|
|
1652
|
-
const getComponentState = useLatest(state);
|
|
1653
1743
|
const contextValue = useMemo3(() => ({
|
|
1654
1744
|
componentState: state,
|
|
1655
1745
|
componentActions: actions,
|
|
1656
|
-
getComponentState
|
|
1657
|
-
updateStateProperty: (propertyName, propertyValue) => {
|
|
1658
|
-
dispatch({
|
|
1659
|
-
propertyName,
|
|
1660
|
-
payload: propertyValue
|
|
1661
|
-
});
|
|
1662
|
-
}
|
|
1746
|
+
getComponentState
|
|
1663
1747
|
}), [state, actions, getComponentState]);
|
|
1664
1748
|
const prevProps = usePrevious(props);
|
|
1665
1749
|
useEffect4(() => {
|
|
1666
1750
|
const currentProps = props;
|
|
1667
|
-
const
|
|
1668
|
-
let
|
|
1669
|
-
|
|
1751
|
+
const newMappedState = {};
|
|
1752
|
+
let newMappedStateCount = 0;
|
|
1753
|
+
const updatedProps = {};
|
|
1754
|
+
let updatedPropsCount = 0;
|
|
1755
|
+
for (var k in props) {
|
|
1670
1756
|
const key = k;
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1757
|
+
const oldValue = prevProps[key];
|
|
1758
|
+
const newValue = currentProps[key];
|
|
1759
|
+
if (key === "children") {
|
|
1760
|
+
continue;
|
|
1761
|
+
}
|
|
1762
|
+
if (oldValue === newValue) {
|
|
1763
|
+
continue;
|
|
1764
|
+
}
|
|
1765
|
+
if (isControlled(key, props)) {
|
|
1766
|
+
if (propsToForward.hasOwnProperty(k)) {
|
|
1767
|
+
let valueToSet = newValue;
|
|
1768
|
+
const forwardFn = propsToForward[k];
|
|
1769
|
+
if (typeof forwardFn === "function") {
|
|
1770
|
+
valueToSet = forwardFn(newValue);
|
|
1771
|
+
}
|
|
1772
|
+
if (state[key] !== valueToSet) {
|
|
1773
|
+
newMappedState[key] = valueToSet;
|
|
1774
|
+
newMappedStateCount++;
|
|
1680
1775
|
}
|
|
1681
|
-
|
|
1682
|
-
|
|
1776
|
+
} else if (propsToStateSetRef.current.has(k)) {
|
|
1777
|
+
updatedProps[key] = currentProps[key];
|
|
1778
|
+
updatedPropsCount++;
|
|
1683
1779
|
}
|
|
1684
1780
|
}
|
|
1685
1781
|
}
|
|
1686
|
-
if (
|
|
1687
|
-
debug2("Triggered by new values for the following props",
|
|
1782
|
+
if (updatedPropsCount > 0 || newMappedStateCount > 0) {
|
|
1783
|
+
debug2("Triggered by new values for the following props", ...[
|
|
1784
|
+
...Object.keys(newMappedState != null ? newMappedState : {}),
|
|
1785
|
+
...Object.keys(updatedProps != null ? updatedProps : {})
|
|
1786
|
+
]);
|
|
1688
1787
|
dispatch({
|
|
1689
|
-
|
|
1690
|
-
|
|
1788
|
+
payload: {
|
|
1789
|
+
mappedState: newMappedStateCount ? newMappedState : null,
|
|
1790
|
+
updatedProps: updatedPropsCount ? updatedProps : null
|
|
1791
|
+
}
|
|
1691
1792
|
});
|
|
1692
1793
|
}
|
|
1693
1794
|
});
|
|
@@ -1714,7 +1815,7 @@ function useColumnAggregations() {
|
|
|
1714
1815
|
const componentState = getComponentState();
|
|
1715
1816
|
columnAggregations.forEach((aggregator, key) => {
|
|
1716
1817
|
var _a;
|
|
1717
|
-
const colField = (_a = componentState.
|
|
1818
|
+
const colField = (_a = componentState.computedColumns.get(key)) == null ? void 0 : _a.field;
|
|
1718
1819
|
const newAggregator = __spreadValues({
|
|
1719
1820
|
getter: (data) => colField ? data[colField] : data
|
|
1720
1821
|
}, aggregator);
|
|
@@ -1799,61 +1900,351 @@ function useColumnGroups() {
|
|
|
1799
1900
|
}, [collapsedColumnGroups]);
|
|
1800
1901
|
}
|
|
1801
1902
|
|
|
1802
|
-
// src/components/InfiniteTable/hooks/
|
|
1803
|
-
import {
|
|
1903
|
+
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
1904
|
+
import { useEffect as useEffect8, useMemo as useMemo5 } from "react";
|
|
1804
1905
|
|
|
1805
|
-
// src/components/
|
|
1906
|
+
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
1806
1907
|
import {
|
|
1807
|
-
|
|
1808
|
-
createElement as createElement3
|
|
1908
|
+
createElement as createElement4
|
|
1809
1909
|
} from "react";
|
|
1810
1910
|
|
|
1811
|
-
// src/
|
|
1812
|
-
|
|
1911
|
+
// src/utils/join.ts
|
|
1912
|
+
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
1813
1913
|
|
|
1814
|
-
// src/components/
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1914
|
+
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
1915
|
+
import {
|
|
1916
|
+
createElement as createElement3,
|
|
1917
|
+
useEffect as useEffect7
|
|
1918
|
+
} from "react";
|
|
1919
|
+
import { useState as useState3 } from "react";
|
|
1920
|
+
|
|
1921
|
+
// src/components/InfiniteTable/utilities.css.ts
|
|
1922
|
+
var alignItems = { center: "_16lm1iwz", stretch: "_16lm1iw10" };
|
|
1923
|
+
var cssEllipsisClassName = "_16lm1iw18 _16lm1iw19 _16lm1iw14";
|
|
1924
|
+
var cursor = { pointer: "_16lm1iw9" };
|
|
1925
|
+
var display = { flex: "_16lm1iwh", block: "_16lm1iwi", inlineBlock: "_16lm1iwj" };
|
|
1926
|
+
var fill = { currentColor: "_16lm1iw5", accentColor: "_16lm1iw6" };
|
|
1927
|
+
var flex = { "1": "_16lm1iwa", none: "_16lm1iwb" };
|
|
1928
|
+
var flexFlow = { column: "_16lm1iwx", row: "_16lm1iwy" };
|
|
1929
|
+
var justifyContent = { center: "_16lm1iw11", start: "_16lm1iw12", end: "_16lm1iw13" };
|
|
1930
|
+
var left = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
1931
|
+
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
1932
|
+
var top = { "0": "_16lm1iwp", "100%": "_16lm1iwq" };
|
|
1933
|
+
var transformTranslateZero = "_16lm1iw8";
|
|
1934
|
+
var userSelect = { none: "_16lm1iwk" };
|
|
1935
|
+
var willChange = { transform: "_16lm1iw17" };
|
|
1936
|
+
var zIndex = { "1": "_16lm1iwc", "10": "_16lm1iwd", "1000": "_16lm1iwe", "10000": "_16lm1iwf", "100000": "_16lm1iwg" };
|
|
1937
|
+
|
|
1938
|
+
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
1939
|
+
function ExpanderIcon(props) {
|
|
1940
|
+
var _a;
|
|
1941
|
+
const { size = 24 } = props;
|
|
1942
|
+
const style = __spreadValues({}, props.style);
|
|
1943
|
+
const [expanded, setExpanded] = useState3((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
1944
|
+
if (expanded) {
|
|
1945
|
+
style.transform = `rotate(90deg)`;
|
|
1821
1946
|
}
|
|
1822
|
-
|
|
1823
|
-
|
|
1947
|
+
const onClick = () => {
|
|
1948
|
+
var _a2;
|
|
1949
|
+
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
1950
|
+
if (!isControlled("expanded", props)) {
|
|
1951
|
+
setExpanded(!expanded);
|
|
1952
|
+
}
|
|
1824
1953
|
};
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
function loadDataAsync(data) {
|
|
1829
|
-
return __async(this, null, function* () {
|
|
1830
|
-
if (typeof data === "function") {
|
|
1831
|
-
data = data();
|
|
1954
|
+
useEffect7(() => {
|
|
1955
|
+
if (isControlled("expanded", props)) {
|
|
1956
|
+
setExpanded(props.expanded);
|
|
1832
1957
|
}
|
|
1833
|
-
|
|
1834
|
-
|
|
1958
|
+
}, [props.expanded]);
|
|
1959
|
+
return /* @__PURE__ */ createElement3("svg", {
|
|
1960
|
+
"data-name": "expander-icon",
|
|
1961
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1962
|
+
height: `${size}px`,
|
|
1963
|
+
viewBox: "0 0 24 24",
|
|
1964
|
+
width: `${size}px`,
|
|
1965
|
+
style,
|
|
1966
|
+
onClick,
|
|
1967
|
+
className: join(props.className, fill.currentColor, flex.none, cursor.pointer, expanded ? fill.accentColor : "", "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
1968
|
+
}, /* @__PURE__ */ createElement3("path", {
|
|
1969
|
+
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
1970
|
+
}));
|
|
1835
1971
|
}
|
|
1836
1972
|
|
|
1837
|
-
// src/components/
|
|
1838
|
-
function
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1973
|
+
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
1974
|
+
function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
|
|
1975
|
+
if (!pivotColumns) {
|
|
1976
|
+
return void 0;
|
|
1977
|
+
}
|
|
1842
1978
|
const {
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1979
|
+
pivotColumn,
|
|
1980
|
+
pivotRowLabelsColumn,
|
|
1981
|
+
pivotBy,
|
|
1982
|
+
groupRowsBy,
|
|
1983
|
+
pivotTotalColumnPosition,
|
|
1984
|
+
toggleGroupRow
|
|
1985
|
+
} = params;
|
|
1986
|
+
const computedPivotColumns = new Map();
|
|
1987
|
+
pivotColumns.forEach((col, key) => {
|
|
1988
|
+
if (col.pivotTotalColumn && pivotTotalColumnPosition === false) {
|
|
1989
|
+
return;
|
|
1852
1990
|
}
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1991
|
+
let column = __spreadValues({}, col);
|
|
1992
|
+
if (pivotColumn) {
|
|
1993
|
+
if (typeof pivotColumn === "function") {
|
|
1994
|
+
column = __spreadValues(__spreadValues({}, column), pivotColumn({
|
|
1995
|
+
column,
|
|
1996
|
+
pivotBy,
|
|
1997
|
+
groupRowsBy
|
|
1998
|
+
}));
|
|
1999
|
+
} else {
|
|
2000
|
+
column = __spreadValues(__spreadValues({}, column), pivotColumn);
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
const isPivotRowLabelsColumn = !column.pivotColumn && !column.pivotTotalColumn;
|
|
2004
|
+
if (pivotRowLabelsColumn && isPivotRowLabelsColumn) {
|
|
2005
|
+
if (typeof pivotRowLabelsColumn === "function") {
|
|
2006
|
+
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
|
|
2007
|
+
column,
|
|
2008
|
+
pivotBy,
|
|
2009
|
+
groupRowsBy
|
|
2010
|
+
}));
|
|
2011
|
+
} else {
|
|
2012
|
+
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
if (isPivotRowLabelsColumn && !column.render) {
|
|
2016
|
+
column.render = (renderOptions) => {
|
|
2017
|
+
var _a;
|
|
2018
|
+
let { value, rowInfo, column: column2, groupRowsBy: groupRowsBy2 } = renderOptions;
|
|
2019
|
+
if (column2.renderValue) {
|
|
2020
|
+
value = column2.renderValue(renderOptions);
|
|
2021
|
+
}
|
|
2022
|
+
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < groupRowsBy2.length;
|
|
2023
|
+
return /* @__PURE__ */ createElement4("div", {
|
|
2024
|
+
className: join(display.flex, alignItems.center),
|
|
2025
|
+
style: {
|
|
2026
|
+
paddingInlineStart: `calc(${rowInfo.groupNesting - 1} * var(--ITableRow-group-column-nesting))`
|
|
2027
|
+
}
|
|
2028
|
+
}, showExpanderIcon ? /* @__PURE__ */ createElement4(ExpanderIcon, {
|
|
2029
|
+
expanded: !rowInfo.collapsed,
|
|
2030
|
+
onChange: () => {
|
|
2031
|
+
toggleGroupRow(rowInfo.groupKeys);
|
|
2032
|
+
}
|
|
2033
|
+
}) : null, /* @__PURE__ */ createElement4("div", {
|
|
2034
|
+
className: cssEllipsisClassName
|
|
2035
|
+
}, value != null ? value : null));
|
|
2036
|
+
};
|
|
2037
|
+
}
|
|
2038
|
+
if (!column.render && column.renderValue) {
|
|
2039
|
+
column.render = (renderOptions) => {
|
|
2040
|
+
return column.renderValue(renderOptions);
|
|
2041
|
+
};
|
|
2042
|
+
}
|
|
2043
|
+
computedPivotColumns.set(key, column);
|
|
2044
|
+
});
|
|
2045
|
+
return computedPivotColumns;
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
2049
|
+
import {
|
|
2050
|
+
createElement as createElement5
|
|
2051
|
+
} from "react";
|
|
2052
|
+
|
|
2053
|
+
// node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.esm.js
|
|
2054
|
+
var shouldApplyCompound = (compoundCheck, selections) => {
|
|
2055
|
+
for (const key of Object.keys(compoundCheck)) {
|
|
2056
|
+
if (compoundCheck[key] !== selections[key]) {
|
|
2057
|
+
return false;
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
return true;
|
|
2061
|
+
};
|
|
2062
|
+
var createRuntimeFn = (config) => (options) => {
|
|
2063
|
+
let className = config.defaultClassName;
|
|
2064
|
+
const selections = {
|
|
2065
|
+
...config.defaultVariants,
|
|
2066
|
+
...options
|
|
2067
|
+
};
|
|
2068
|
+
for (const variantName in selections) {
|
|
2069
|
+
var _selections$variantNa;
|
|
2070
|
+
const variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
2071
|
+
if (variantSelection != null) {
|
|
2072
|
+
let selection = variantSelection;
|
|
2073
|
+
if (typeof selection === "boolean") {
|
|
2074
|
+
selection = selection === true ? "true" : "false";
|
|
2075
|
+
}
|
|
2076
|
+
className += " " + config.variantClassNames[variantName][selection];
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
for (const [compoundCheck, compoundClassName] of config.compoundVariants) {
|
|
2080
|
+
if (shouldApplyCompound(compoundCheck, selections)) {
|
|
2081
|
+
className += " " + compoundClassName;
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
return className;
|
|
2085
|
+
};
|
|
2086
|
+
|
|
2087
|
+
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
2088
|
+
var GroupRowExpanderCls = "_7pupv0b";
|
|
2089
|
+
var RowClsRecipe = 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: [] });
|
|
2090
|
+
var RowHoverCls = "_7pupv01";
|
|
2091
|
+
|
|
2092
|
+
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
2093
|
+
function getGroupColumnRender({
|
|
2094
|
+
groupIndex,
|
|
2095
|
+
groupRenderStrategy,
|
|
2096
|
+
toggleGroupRow
|
|
2097
|
+
}) {
|
|
2098
|
+
return (renderOptions) => {
|
|
2099
|
+
var _a;
|
|
2100
|
+
let { value, rowInfo, column } = renderOptions;
|
|
2101
|
+
if (column.renderValue) {
|
|
2102
|
+
value = column.renderValue(renderOptions);
|
|
2103
|
+
}
|
|
2104
|
+
let groupRowInfo = groupRenderStrategy !== "inline" ? rowInfo : ((_a = rowInfo.parents) == null ? void 0 : _a[groupIndex]) || rowInfo;
|
|
2105
|
+
if (!groupRowInfo) {
|
|
2106
|
+
return null;
|
|
2107
|
+
}
|
|
2108
|
+
const collapsed = groupRowInfo.collapsed;
|
|
2109
|
+
const groupKeys = groupRowInfo.groupKeys;
|
|
2110
|
+
if (groupRenderStrategy === "inline") {
|
|
2111
|
+
if (groupRowInfo.groupCount === 1) {
|
|
2112
|
+
return value;
|
|
2113
|
+
}
|
|
2114
|
+
if (groupRowInfo.groupNesting === groupIndex && collapsed) {
|
|
2115
|
+
return null;
|
|
2116
|
+
}
|
|
2117
|
+
} else {
|
|
2118
|
+
if (!groupRowInfo.isGroupRow) {
|
|
2119
|
+
return null;
|
|
2120
|
+
}
|
|
2121
|
+
if (groupIndex + 1 !== groupRowInfo.groupNesting) {
|
|
2122
|
+
return null;
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
return /* @__PURE__ */ createElement5("div", {
|
|
2126
|
+
className: join(display.flex, alignItems.center)
|
|
2127
|
+
}, /* @__PURE__ */ createElement5(ExpanderIcon, {
|
|
2128
|
+
expanded: !collapsed,
|
|
2129
|
+
onChange: () => {
|
|
2130
|
+
toggleGroupRow(groupKeys);
|
|
2131
|
+
}
|
|
2132
|
+
}), /* @__PURE__ */ createElement5("div", {
|
|
2133
|
+
className: cssEllipsisClassName
|
|
2134
|
+
}, value != null ? value : null));
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2137
|
+
function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
2138
|
+
const { groupBy, groupIndex, groupRenderStrategy } = options;
|
|
2139
|
+
let generatedGroupColumn = __spreadValues({
|
|
2140
|
+
header: `Group by ${groupBy.field}`,
|
|
2141
|
+
groupByField: groupBy.field,
|
|
2142
|
+
sortable: false,
|
|
2143
|
+
render: getGroupColumnRender({
|
|
2144
|
+
groupIndex,
|
|
2145
|
+
toggleGroupRow,
|
|
2146
|
+
groupRenderStrategy
|
|
2147
|
+
})
|
|
2148
|
+
}, groupBy.column);
|
|
2149
|
+
if (groupColumnFromProps) {
|
|
2150
|
+
if (typeof groupColumnFromProps === "function") {
|
|
2151
|
+
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
|
|
2152
|
+
} else {
|
|
2153
|
+
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
return generatedGroupColumn;
|
|
2157
|
+
}
|
|
2158
|
+
function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
2159
|
+
let generatedGroupColumn = {
|
|
2160
|
+
header: `Group`,
|
|
2161
|
+
groupByField: options.groupRowsBy.map((g) => g.field),
|
|
2162
|
+
sortable: false,
|
|
2163
|
+
render: (renderOptions) => {
|
|
2164
|
+
let { value, rowInfo, column } = renderOptions;
|
|
2165
|
+
if (!rowInfo.isGroupRow) {
|
|
2166
|
+
return null;
|
|
2167
|
+
}
|
|
2168
|
+
if (column.renderValue) {
|
|
2169
|
+
value = column.renderValue(renderOptions);
|
|
2170
|
+
}
|
|
2171
|
+
return /* @__PURE__ */ createElement5("div", {
|
|
2172
|
+
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
2173
|
+
}, /* @__PURE__ */ createElement5(ExpanderIcon, {
|
|
2174
|
+
expanded: !rowInfo.collapsed,
|
|
2175
|
+
onChange: () => {
|
|
2176
|
+
toggleGroupRow(rowInfo.groupKeys);
|
|
2177
|
+
}
|
|
2178
|
+
}), /* @__PURE__ */ createElement5("div", {
|
|
2179
|
+
className: cssEllipsisClassName
|
|
2180
|
+
}, value != null ? value : null));
|
|
2181
|
+
}
|
|
2182
|
+
};
|
|
2183
|
+
if (groupColumnFromProps) {
|
|
2184
|
+
if (typeof groupColumnFromProps === "function") {
|
|
2185
|
+
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
|
|
2186
|
+
} else {
|
|
2187
|
+
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
return generatedGroupColumn;
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
2194
|
+
import { useCallback as useCallback4 } from "react";
|
|
2195
|
+
|
|
2196
|
+
// src/components/DataSource/index.tsx
|
|
2197
|
+
import {
|
|
2198
|
+
Fragment,
|
|
2199
|
+
createElement as createElement6
|
|
2200
|
+
} from "react";
|
|
2201
|
+
|
|
2202
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2203
|
+
import { useLayoutEffect as useLayoutEffect3 } from "react";
|
|
2204
|
+
|
|
2205
|
+
// src/components/DataSource/privateHooks/buildDataSourceDataInfo.ts
|
|
2206
|
+
function buildDataSourceDataInfo(dataParam) {
|
|
2207
|
+
let dataArray = [];
|
|
2208
|
+
if (Array.isArray(dataParam.data)) {
|
|
2209
|
+
dataArray = dataParam.data;
|
|
2210
|
+
} else {
|
|
2211
|
+
dataArray = dataParam;
|
|
2212
|
+
}
|
|
2213
|
+
return {
|
|
2214
|
+
originalDataArray: dataArray
|
|
2215
|
+
};
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
// src/components/DataSource/privateHooks/loadDataAsync.ts
|
|
2219
|
+
function loadDataAsync(data) {
|
|
2220
|
+
return __async(this, null, function* () {
|
|
2221
|
+
if (typeof data === "function") {
|
|
2222
|
+
data = data();
|
|
2223
|
+
}
|
|
2224
|
+
return buildDataSourceDataInfo(yield data);
|
|
2225
|
+
});
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2229
|
+
function buildDataSourceInfo(data) {
|
|
2230
|
+
return { originalDataArray: data };
|
|
2231
|
+
}
|
|
2232
|
+
function useLoadData() {
|
|
2233
|
+
const {
|
|
2234
|
+
componentActions: actions,
|
|
2235
|
+
componentState: { data }
|
|
2236
|
+
} = useComponentState();
|
|
2237
|
+
const loadData = (data2) => {
|
|
2238
|
+
let dataSourceInfo = {
|
|
2239
|
+
originalDataArray: []
|
|
2240
|
+
};
|
|
2241
|
+
if (typeof data2 === "function") {
|
|
2242
|
+
data2 = data2();
|
|
2243
|
+
}
|
|
2244
|
+
if (Array.isArray(data2)) {
|
|
2245
|
+
dataSourceInfo = buildDataSourceInfo(data2);
|
|
2246
|
+
actions.originalDataArray = dataSourceInfo.originalDataArray;
|
|
2247
|
+
} else {
|
|
1857
2248
|
actions.loading = true;
|
|
1858
2249
|
loadDataAsync(data2).then((dataSourceInfo2) => {
|
|
1859
2250
|
actions.originalDataArray = dataSourceInfo2.originalDataArray;
|
|
@@ -2250,47 +2641,51 @@ var GroupRowsState = class {
|
|
|
2250
2641
|
};
|
|
2251
2642
|
|
|
2252
2643
|
// src/components/DataSource/state/getInitialState.ts
|
|
2253
|
-
function
|
|
2254
|
-
var _a, _b, _c, _d, _e;
|
|
2255
|
-
const { props: initialProps } = params;
|
|
2256
|
-
const dataArray = [];
|
|
2257
|
-
const originalDataArray = [];
|
|
2258
|
-
const sortInfo = normalizeSortInfo(isControlled("sortInfo", initialProps) ? initialProps.sortInfo : initialProps.defaultSortInfo);
|
|
2259
|
-
const groupRowsState = initialProps.groupRowsState || initialProps.defaultGroupRowsState || new GroupRowsState({
|
|
2260
|
-
expandedRows: true,
|
|
2261
|
-
collapsedRows: []
|
|
2262
|
-
});
|
|
2644
|
+
function initSetupState2() {
|
|
2263
2645
|
const now = Date.now();
|
|
2646
|
+
const originalDataArray = [];
|
|
2647
|
+
const dataArray = [];
|
|
2264
2648
|
return {
|
|
2265
|
-
|
|
2266
|
-
loading: (_b = (_a = initialProps.loading) != null ? _a : initialProps.defaultLoading) != null ? _b : false,
|
|
2267
|
-
dataArray,
|
|
2649
|
+
pivotTotalColumnPosition: "end",
|
|
2268
2650
|
originalDataArray,
|
|
2269
|
-
|
|
2270
|
-
|
|
2651
|
+
pivotColumns: void 0,
|
|
2652
|
+
pivotColumnGroups: void 0,
|
|
2653
|
+
dataArray,
|
|
2271
2654
|
updatedAt: now,
|
|
2272
2655
|
groupedAt: 0,
|
|
2273
2656
|
sortedAt: 0,
|
|
2274
2657
|
reducedAt: now,
|
|
2275
|
-
|
|
2276
|
-
pivotColumnGroups: void 0,
|
|
2277
|
-
groupRowsBy: isControlled("groupRowsBy", initialProps) ? (_c = initialProps.groupRowsBy) != null ? _c : [] : (_d = initialProps.defaultGroupRowsBy) != null ? _d : [],
|
|
2278
|
-
pivotBy: isControlled("pivotBy", initialProps) ? (_e = initialProps.pivotBy) != null ? _e : [] : initialProps.defaultPivotBy,
|
|
2658
|
+
generateGroupRows: true,
|
|
2279
2659
|
aggregationReducers: void 0,
|
|
2280
|
-
|
|
2660
|
+
groupDeepMap: void 0,
|
|
2661
|
+
postSortDataArray: void 0,
|
|
2662
|
+
postGroupDataArray: void 0,
|
|
2663
|
+
lastSortDataArray: void 0,
|
|
2664
|
+
lastGroupDataArray: void 0
|
|
2281
2665
|
};
|
|
2282
2666
|
}
|
|
2283
|
-
|
|
2667
|
+
var forwardProps3 = () => {
|
|
2668
|
+
return {
|
|
2669
|
+
remoteCount: 1,
|
|
2670
|
+
data: 1,
|
|
2671
|
+
pivotBy: 1,
|
|
2672
|
+
primaryKey: 1,
|
|
2673
|
+
loading: (loading) => loading != null ? loading : false,
|
|
2674
|
+
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
|
|
2675
|
+
groupRowsBy: (groupRowsBy) => groupRowsBy != null ? groupRowsBy : [],
|
|
2676
|
+
groupRowsState: (groupRowsState) => {
|
|
2677
|
+
return groupRowsState || new GroupRowsState({
|
|
2678
|
+
expandedRows: true,
|
|
2679
|
+
collapsedRows: []
|
|
2680
|
+
});
|
|
2681
|
+
}
|
|
2682
|
+
};
|
|
2683
|
+
};
|
|
2684
|
+
function mapPropsToState2(params) {
|
|
2284
2685
|
var _a;
|
|
2285
|
-
const { props
|
|
2286
|
-
const sortInfo = isControlled("sortInfo", props) ? props.sortInfo : (_a = props.defaultSortInfo) != null ? _a : null;
|
|
2686
|
+
const { props } = params;
|
|
2287
2687
|
return {
|
|
2288
|
-
multiSort: Array.isArray(sortInfo)
|
|
2289
|
-
sortInfo: normalizeSortInfo(state.sortInfo),
|
|
2290
|
-
primaryKey: props.primaryKey,
|
|
2291
|
-
groupDeepMap: void 0,
|
|
2292
|
-
postSortDataArray: void 0,
|
|
2293
|
-
postGroupDataArray: void 0
|
|
2688
|
+
multiSort: Array.isArray((_a = props.sortInfo) != null ? _a : props.defaultSortInfo)
|
|
2294
2689
|
};
|
|
2295
2690
|
}
|
|
2296
2691
|
|
|
@@ -2494,7 +2889,7 @@ function flatten(groupResult) {
|
|
|
2494
2889
|
return result;
|
|
2495
2890
|
}
|
|
2496
2891
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
2497
|
-
const { groupBy, groupKeys, collapsed } = options;
|
|
2892
|
+
const { groupBy, groupKeys, collapsed, parents } = options;
|
|
2498
2893
|
const groupNesting = groupKeys.length;
|
|
2499
2894
|
const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
|
|
2500
2895
|
const enhancedGroupData = {
|
|
@@ -2504,6 +2899,10 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
2504
2899
|
groupKeys,
|
|
2505
2900
|
id: groupKeys,
|
|
2506
2901
|
collapsed,
|
|
2902
|
+
parents,
|
|
2903
|
+
collapsedChildrenCount: 0,
|
|
2904
|
+
collapsedGroupsCount: 0,
|
|
2905
|
+
indexInParentGroups: options.indexInParentGroups,
|
|
2507
2906
|
indexInGroup: options.indexInGroup,
|
|
2508
2907
|
indexInAll: options.indexInAll,
|
|
2509
2908
|
value: groupKeys[groupKeys.length - 1],
|
|
@@ -2525,12 +2924,14 @@ function completeReducers(reducers, reducerResults, items) {
|
|
|
2525
2924
|
}
|
|
2526
2925
|
return reducerResults;
|
|
2527
2926
|
}
|
|
2528
|
-
function enhancedFlatten(
|
|
2927
|
+
function enhancedFlatten(param) {
|
|
2928
|
+
const { groupResult, toPrimaryKey, groupRowsState, generateGroupRows } = param;
|
|
2529
2929
|
const { groupParams, deepMap, pivot } = groupResult;
|
|
2530
2930
|
const { groupBy } = groupParams;
|
|
2531
2931
|
const groupByStrings = groupBy.map((g) => g.field);
|
|
2532
2932
|
const result = [];
|
|
2533
2933
|
const parents = [];
|
|
2934
|
+
const indexInParentGroups = [];
|
|
2534
2935
|
deepMap.visitDepthFirst((deepMapValue, groupKeys, indexInGroup, next) => {
|
|
2535
2936
|
var _a;
|
|
2536
2937
|
const items = deepMapValue.items;
|
|
@@ -2538,12 +2939,24 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
|
|
|
2538
2939
|
const collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
|
|
2539
2940
|
const enhancedGroupData = getEnhancedGroupData({
|
|
2540
2941
|
groupBy: groupByStrings,
|
|
2942
|
+
parents: Array.from(parents),
|
|
2541
2943
|
indexInGroup,
|
|
2944
|
+
indexInParentGroups: Array.from(indexInParentGroups),
|
|
2542
2945
|
indexInAll: result.length,
|
|
2543
2946
|
groupKeys,
|
|
2544
2947
|
collapsed
|
|
2545
2948
|
}, deepMapValue);
|
|
2546
|
-
|
|
2949
|
+
const include = generateGroupRows || collapsed;
|
|
2950
|
+
if (include) {
|
|
2951
|
+
result.push(enhancedGroupData);
|
|
2952
|
+
}
|
|
2953
|
+
if (collapsed) {
|
|
2954
|
+
parents.forEach((parent) => {
|
|
2955
|
+
parent.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
2956
|
+
parent.collapsedGroupsCount += 1;
|
|
2957
|
+
});
|
|
2958
|
+
}
|
|
2959
|
+
indexInParentGroups.push(indexInGroup);
|
|
2547
2960
|
parents.push(enhancedGroupData);
|
|
2548
2961
|
if (!collapsed) {
|
|
2549
2962
|
if (!next) {
|
|
@@ -2555,11 +2968,14 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
|
|
|
2555
2968
|
data: item,
|
|
2556
2969
|
isGroupRow: false,
|
|
2557
2970
|
collapsed: false,
|
|
2558
|
-
|
|
2971
|
+
groupKeys,
|
|
2972
|
+
parents: Array.from(parents),
|
|
2973
|
+
indexInParentGroups: [...indexInParentGroups, index],
|
|
2559
2974
|
indexInGroup: index,
|
|
2560
2975
|
indexInAll: startIndex + index,
|
|
2561
2976
|
groupBy: groupByStrings,
|
|
2562
|
-
groupNesting
|
|
2977
|
+
groupNesting,
|
|
2978
|
+
groupCount: enhancedGroupData.groupCount
|
|
2563
2979
|
};
|
|
2564
2980
|
}));
|
|
2565
2981
|
}
|
|
@@ -2568,6 +2984,7 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
|
|
|
2568
2984
|
}
|
|
2569
2985
|
}
|
|
2570
2986
|
parents.pop();
|
|
2987
|
+
indexInParentGroups.pop();
|
|
2571
2988
|
});
|
|
2572
2989
|
return {
|
|
2573
2990
|
data: result
|
|
@@ -2582,8 +2999,8 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
2582
2999
|
header: "Row labels",
|
|
2583
3000
|
valueGetter: (params) => {
|
|
2584
3001
|
var _a;
|
|
2585
|
-
const {
|
|
2586
|
-
return
|
|
3002
|
+
const { rowInfo } = params;
|
|
3003
|
+
return rowInfo.groupKeys ? rowInfo.groupKeys[((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) - 1] : null;
|
|
2587
3004
|
}
|
|
2588
3005
|
}
|
|
2589
3006
|
]
|
|
@@ -2604,9 +3021,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
2604
3021
|
sortable: false,
|
|
2605
3022
|
columnGroup: parentKeys.length ? `${columnGroupId}` : void 0,
|
|
2606
3023
|
header: keys[keys.length - 1],
|
|
2607
|
-
valueGetter: ({
|
|
3024
|
+
valueGetter: ({ rowInfo }) => {
|
|
2608
3025
|
var _a, _b, _c;
|
|
2609
|
-
const value = (_c = (_b = (_a =
|
|
3026
|
+
const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
|
|
2610
3027
|
return value;
|
|
2611
3028
|
}
|
|
2612
3029
|
});
|
|
@@ -2625,9 +3042,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
2625
3042
|
pivotGroupKeys: keys,
|
|
2626
3043
|
pivotBy,
|
|
2627
3044
|
sortable: false,
|
|
2628
|
-
valueGetter: ({
|
|
3045
|
+
valueGetter: ({ rowInfo }) => {
|
|
2629
3046
|
var _a, _b, _c;
|
|
2630
|
-
const value = (_c = (_b = (_a =
|
|
3047
|
+
const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
|
|
2631
3048
|
return value;
|
|
2632
3049
|
}
|
|
2633
3050
|
});
|
|
@@ -2640,9 +3057,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
2640
3057
|
if (columns.size === 1) {
|
|
2641
3058
|
columns.set("single", {
|
|
2642
3059
|
header: "Reduced",
|
|
2643
|
-
valueGetter: ({
|
|
3060
|
+
valueGetter: ({ rowInfo }) => {
|
|
2644
3061
|
var _a;
|
|
2645
|
-
return (_a =
|
|
3062
|
+
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[0];
|
|
2646
3063
|
}
|
|
2647
3064
|
});
|
|
2648
3065
|
}
|
|
@@ -2654,26 +3071,26 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
2654
3071
|
}
|
|
2655
3072
|
|
|
2656
3073
|
// src/components/DataSource/state/reducer.ts
|
|
2657
|
-
var haveDepsChanged = (
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
if (
|
|
3074
|
+
var haveDepsChanged = (state1, state2, deps) => {
|
|
3075
|
+
for (let i = 0, len = deps.length; i < len; i++) {
|
|
3076
|
+
const k = deps[i];
|
|
3077
|
+
const oldValue = state1[k];
|
|
3078
|
+
const newValue = state2[k];
|
|
3079
|
+
if (oldValue !== newValue) {
|
|
2663
3080
|
return true;
|
|
2664
3081
|
}
|
|
2665
3082
|
}
|
|
2666
3083
|
return false;
|
|
2667
3084
|
};
|
|
2668
|
-
function
|
|
3085
|
+
function toRowInfo(data, id, index) {
|
|
2669
3086
|
return { data, collapsed: true, id, indexInAll: index, indexInGroup: index };
|
|
2670
3087
|
}
|
|
2671
3088
|
function concludeReducer(params) {
|
|
2672
3089
|
var _a;
|
|
2673
|
-
const { state, previousState
|
|
3090
|
+
const { state, previousState } = params;
|
|
2674
3091
|
const sortInfo = state.sortInfo;
|
|
2675
|
-
const shouldSort = sortInfo == null ? void 0 : sortInfo.length;
|
|
2676
|
-
const sortDepsChanged = haveDepsChanged(
|
|
3092
|
+
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length);
|
|
3093
|
+
const sortDepsChanged = haveDepsChanged(previousState, state, [
|
|
2677
3094
|
"originalDataArray",
|
|
2678
3095
|
"sortInfo"
|
|
2679
3096
|
]);
|
|
@@ -2681,7 +3098,8 @@ function concludeReducer(params) {
|
|
|
2681
3098
|
const groupBy = state.groupRowsBy;
|
|
2682
3099
|
const pivotBy = state.pivotBy;
|
|
2683
3100
|
const shouldGroup = groupBy.length || pivotBy;
|
|
2684
|
-
const groupsDepsChanged = haveDepsChanged(
|
|
3101
|
+
const groupsDepsChanged = haveDepsChanged(previousState, state, [
|
|
3102
|
+
"generateGroupRows",
|
|
2685
3103
|
"originalDataArray",
|
|
2686
3104
|
"groupRowsBy",
|
|
2687
3105
|
"groupRowsState",
|
|
@@ -2693,7 +3111,7 @@ function concludeReducer(params) {
|
|
|
2693
3111
|
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
|
|
2694
3112
|
const now = Date.now();
|
|
2695
3113
|
let dataArray = state.originalDataArray;
|
|
2696
|
-
let
|
|
3114
|
+
let rowInfoDataArray = state.dataArray;
|
|
2697
3115
|
if (shouldSort) {
|
|
2698
3116
|
dataArray = shouldSortAgain ? multisort(sortInfo, [...dataArray]) : state.lastSortDataArray;
|
|
2699
3117
|
state.lastSortDataArray = dataArray;
|
|
@@ -2711,30 +3129,35 @@ function concludeReducer(params) {
|
|
|
2711
3129
|
pivot: pivotBy,
|
|
2712
3130
|
reducers: state.aggregationReducers
|
|
2713
3131
|
}, dataArray);
|
|
2714
|
-
const flattenResult = enhancedFlatten(
|
|
2715
|
-
|
|
3132
|
+
const flattenResult = enhancedFlatten({
|
|
3133
|
+
groupResult,
|
|
3134
|
+
toPrimaryKey,
|
|
3135
|
+
groupRowsState: state.groupRowsState,
|
|
3136
|
+
generateGroupRows: state.generateGroupRows
|
|
3137
|
+
});
|
|
3138
|
+
rowInfoDataArray = flattenResult.data;
|
|
2716
3139
|
state.groupDeepMap = groupResult.deepMap;
|
|
2717
3140
|
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups(groupResult.topLevelPivotColumns, pivotBy, (_a = state.pivotTotalColumnPosition) != null ? _a : "end") : void 0;
|
|
2718
3141
|
state.pivotColumns = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columns;
|
|
2719
3142
|
state.pivotColumnGroups = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columnGroups;
|
|
2720
3143
|
} else {
|
|
2721
|
-
|
|
3144
|
+
rowInfoDataArray = state.lastGroupDataArray;
|
|
2722
3145
|
}
|
|
2723
|
-
state.lastGroupDataArray =
|
|
3146
|
+
state.lastGroupDataArray = rowInfoDataArray;
|
|
2724
3147
|
state.groupedAt = now;
|
|
2725
3148
|
} else {
|
|
2726
3149
|
state.groupDeepMap = void 0;
|
|
2727
3150
|
state.pivotColumns = void 0;
|
|
2728
3151
|
const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
|
|
2729
3152
|
if (arrayDifferentAfterSortStep) {
|
|
2730
|
-
|
|
3153
|
+
rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, toPrimaryKey(data), index));
|
|
2731
3154
|
}
|
|
2732
3155
|
}
|
|
2733
|
-
state.postGroupDataArray =
|
|
2734
|
-
if (
|
|
3156
|
+
state.postGroupDataArray = rowInfoDataArray;
|
|
3157
|
+
if (rowInfoDataArray !== state.dataArray) {
|
|
2735
3158
|
state.updatedAt = now;
|
|
2736
3159
|
}
|
|
2737
|
-
state.dataArray =
|
|
3160
|
+
state.dataArray = rowInfoDataArray;
|
|
2738
3161
|
state.reducedAt = now;
|
|
2739
3162
|
globalThis.state = state;
|
|
2740
3163
|
return state;
|
|
@@ -2753,12 +3176,13 @@ function DataSourceWithContext(props) {
|
|
|
2753
3176
|
if (typeof children === "function") {
|
|
2754
3177
|
children = children(computedValues);
|
|
2755
3178
|
}
|
|
2756
|
-
return /* @__PURE__ */
|
|
3179
|
+
return /* @__PURE__ */ createElement6(Fragment, null, children);
|
|
2757
3180
|
}
|
|
2758
3181
|
var DataSourceRoot = getComponentStateRoot({
|
|
2759
|
-
|
|
3182
|
+
initSetupState: initSetupState2,
|
|
3183
|
+
forwardProps: forwardProps3,
|
|
2760
3184
|
concludeReducer,
|
|
2761
|
-
|
|
3185
|
+
mapPropsToState: mapPropsToState2
|
|
2762
3186
|
});
|
|
2763
3187
|
function DataSourceCmp({ children }) {
|
|
2764
3188
|
const DataSourceContext = getDataSourceContext();
|
|
@@ -2769,382 +3193,147 @@ function DataSourceCmp({ children }) {
|
|
|
2769
3193
|
componentActions,
|
|
2770
3194
|
getState
|
|
2771
3195
|
};
|
|
3196
|
+
if (false) {
|
|
3197
|
+
globalThis.getDataSourceState = getState;
|
|
3198
|
+
}
|
|
2772
3199
|
useLoadData();
|
|
2773
|
-
return /* @__PURE__ */
|
|
3200
|
+
return /* @__PURE__ */ createElement6(DataSourceContext.Provider, {
|
|
2774
3201
|
value: contextValue
|
|
2775
|
-
}, /* @__PURE__ */
|
|
3202
|
+
}, /* @__PURE__ */ createElement6(DataSourceWithContext, {
|
|
2776
3203
|
children
|
|
2777
3204
|
}));
|
|
2778
3205
|
}
|
|
2779
3206
|
function DataSource(props) {
|
|
2780
|
-
return /* @__PURE__ */
|
|
3207
|
+
return /* @__PURE__ */ createElement6(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ createElement6(DataSourceCmp, {
|
|
2781
3208
|
children: props.children
|
|
2782
3209
|
}));
|
|
2783
3210
|
}
|
|
2784
3211
|
|
|
2785
|
-
// src/components/InfiniteTable/
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
space: [
|
|
2795
|
-
"--it-space-0",
|
|
2796
|
-
"--it-space-1",
|
|
2797
|
-
"--it-space-2",
|
|
2798
|
-
"--it-space-3",
|
|
2799
|
-
"--it-space-4",
|
|
2800
|
-
"--it-space-5",
|
|
2801
|
-
"--it-space-6",
|
|
2802
|
-
"--it-space-7",
|
|
2803
|
-
"--it-space-8",
|
|
2804
|
-
"--it-space-9",
|
|
2805
|
-
"--it-space-10"
|
|
2806
|
-
],
|
|
2807
|
-
borderRadius: "--it__border-radius",
|
|
2808
|
-
fontSize: [
|
|
2809
|
-
"--it-font-size-0",
|
|
2810
|
-
"--it-font-size-1",
|
|
2811
|
-
"--it-font-size-2",
|
|
2812
|
-
"--it-font-size-3",
|
|
2813
|
-
"--it-font-size-4",
|
|
2814
|
-
"--it-font-size-5",
|
|
2815
|
-
"--it-font-size-6",
|
|
2816
|
-
"--it-font-size-7"
|
|
2817
|
-
]
|
|
2818
|
-
},
|
|
2819
|
-
alignItems: {
|
|
2820
|
-
center: rule("align-items", "center"),
|
|
2821
|
-
stretch: rule("align-items", "stretch")
|
|
2822
|
-
},
|
|
2823
|
-
justifyContent: {
|
|
2824
|
-
center: rule("justify-content", "center"),
|
|
2825
|
-
"flex-start": rule("justify-content", "flex-start"),
|
|
2826
|
-
flexStart: rule("justify-content", "flex-start"),
|
|
2827
|
-
"flex-end": rule("justify-content", "flex-end"),
|
|
2828
|
-
flexEnd: rule("justify-content", "flex-end")
|
|
2829
|
-
},
|
|
2830
|
-
overflow: {
|
|
2831
|
-
hidden: rule("overflow", "hidden"),
|
|
2832
|
-
visible: rule("overflow", "visible"),
|
|
2833
|
-
auto: rule("overflow", "auto")
|
|
2834
|
-
},
|
|
2835
|
-
overflowX: {
|
|
2836
|
-
hidden: rule("overflow-x", "hidden"),
|
|
2837
|
-
visible: rule("overflow-x", "visible"),
|
|
2838
|
-
auto: rule("overflow-x", "auto")
|
|
2839
|
-
},
|
|
2840
|
-
overflowY: {
|
|
2841
|
-
hidden: rule("overflow-y", "hidden"),
|
|
2842
|
-
visible: rule("overflow-y", "visible"),
|
|
2843
|
-
auto: rule("overflow-y", "auto")
|
|
2844
|
-
},
|
|
2845
|
-
cursor: {
|
|
2846
|
-
pointer: rule("cursor", "pointer")
|
|
2847
|
-
},
|
|
2848
|
-
height: {
|
|
2849
|
-
0: rule("height", "0"),
|
|
2850
|
-
"100%": rule("height", "100%")
|
|
2851
|
-
},
|
|
2852
|
-
width: {
|
|
2853
|
-
0: rule("width", "0"),
|
|
2854
|
-
"100%": rule("width", "100%")
|
|
2855
|
-
},
|
|
2856
|
-
top: {
|
|
2857
|
-
0: rule("top", "0"),
|
|
2858
|
-
"100%": rule("top", "100%")
|
|
2859
|
-
},
|
|
2860
|
-
left: {
|
|
2861
|
-
0: rule("left", "0"),
|
|
2862
|
-
"100%": rule("left", "100%")
|
|
2863
|
-
},
|
|
2864
|
-
transform: {
|
|
2865
|
-
translate3D000: rule("transform", "translate3D000")
|
|
2866
|
-
},
|
|
2867
|
-
willChange: {
|
|
2868
|
-
transform: rule("will-change", "transform")
|
|
2869
|
-
},
|
|
2870
|
-
position: {
|
|
2871
|
-
relative: rule("position", "relative"),
|
|
2872
|
-
absolute: rule("position", "absolute"),
|
|
2873
|
-
fixed: rule("position", "fixed")
|
|
2874
|
-
},
|
|
2875
|
-
display: {
|
|
2876
|
-
flex: rule("display", "flex")
|
|
2877
|
-
},
|
|
2878
|
-
flexFlow: {
|
|
2879
|
-
row: rule("flex-flow", "row"),
|
|
2880
|
-
column: rule("flex-flow", "column")
|
|
2881
|
-
},
|
|
2882
|
-
whiteSpace: {
|
|
2883
|
-
nowrap: rule("white-space", "nowrap")
|
|
2884
|
-
},
|
|
2885
|
-
textOverflow: {
|
|
2886
|
-
ellipsis: rule("text-overflow", "ellipsis")
|
|
2887
|
-
},
|
|
2888
|
-
userSelect: {
|
|
2889
|
-
none: rule("user-select", "none")
|
|
2890
|
-
}
|
|
2891
|
-
};
|
|
2892
|
-
|
|
2893
|
-
// src/style/css.ts
|
|
2894
|
-
var cssEllipsisClassName = `${ICSS.whiteSpace.nowrap} ${ICSS.textOverflow.ellipsis} ${ICSS.overflow.hidden}`;
|
|
2895
|
-
|
|
2896
|
-
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2897
|
-
import {
|
|
2898
|
-
createElement as createElement4,
|
|
2899
|
-
useEffect as useEffect7
|
|
2900
|
-
} from "react";
|
|
2901
|
-
import { useState as useState3 } from "react";
|
|
2902
|
-
function ExpanderIcon(props) {
|
|
2903
|
-
var _a;
|
|
2904
|
-
const { size = 24 } = props;
|
|
2905
|
-
const style = __spreadValues({}, props.style);
|
|
2906
|
-
const [expanded, setExpanded] = useState3((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
2907
|
-
if (expanded) {
|
|
2908
|
-
style.transform = `rotate(90deg)`;
|
|
2909
|
-
}
|
|
2910
|
-
const onClick = () => {
|
|
2911
|
-
var _a2;
|
|
2912
|
-
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
2913
|
-
if (!isControlled("expanded", props)) {
|
|
2914
|
-
setExpanded(!expanded);
|
|
2915
|
-
}
|
|
2916
|
-
};
|
|
2917
|
-
useEffect7(() => {
|
|
2918
|
-
if (isControlled("expanded", props)) {
|
|
2919
|
-
setExpanded(props.expanded);
|
|
2920
|
-
}
|
|
2921
|
-
}, [props.expanded]);
|
|
2922
|
-
return /* @__PURE__ */ createElement4("svg", {
|
|
2923
|
-
"data-name": "expander-icon",
|
|
2924
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2925
|
-
height: `${size}px`,
|
|
2926
|
-
viewBox: "0 0 24 24",
|
|
2927
|
-
width: `${size}px`,
|
|
2928
|
-
style,
|
|
2929
|
-
onClick,
|
|
2930
|
-
className: join(props.className, "ITableIcon", "ITableIcon-expander", `ITableIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
2931
|
-
}, /* @__PURE__ */ createElement4("path", {
|
|
2932
|
-
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
2933
|
-
}));
|
|
3212
|
+
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
3213
|
+
function useToggleGroupRow() {
|
|
3214
|
+
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
3215
|
+
const toggleGroupRow = useCallback4((groupKeys) => {
|
|
3216
|
+
const newState = new GroupRowsState(getDataSourceState().groupRowsState);
|
|
3217
|
+
newState.toggleGroupRow(groupKeys);
|
|
3218
|
+
dataSourceActions.groupRowsState = newState;
|
|
3219
|
+
}, []);
|
|
3220
|
+
return toggleGroupRow;
|
|
2934
3221
|
}
|
|
2935
3222
|
|
|
2936
|
-
// src/components/InfiniteTable/
|
|
2937
|
-
function
|
|
2938
|
-
|
|
2939
|
-
return
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
} = params;
|
|
2949
|
-
const computedPivotColumns = new Map();
|
|
2950
|
-
pivotColumns.forEach((col, key) => {
|
|
2951
|
-
if (col.pivotTotalColumn && pivotTotalColumnPosition === false) {
|
|
2952
|
-
return;
|
|
2953
|
-
}
|
|
2954
|
-
let column = __spreadValues({}, col);
|
|
2955
|
-
if (pivotColumn) {
|
|
2956
|
-
if (typeof pivotColumn === "function") {
|
|
2957
|
-
column = __spreadValues(__spreadValues({}, column), pivotColumn({
|
|
2958
|
-
column,
|
|
2959
|
-
pivotBy,
|
|
2960
|
-
groupRowsBy
|
|
2961
|
-
}));
|
|
2962
|
-
} else {
|
|
2963
|
-
column = __spreadValues(__spreadValues({}, column), pivotColumn);
|
|
2964
|
-
}
|
|
2965
|
-
}
|
|
2966
|
-
const isPivotRowLabelsColumn = !column.pivotColumn && !column.pivotTotalColumn;
|
|
2967
|
-
if (pivotRowLabelsColumn && isPivotRowLabelsColumn) {
|
|
2968
|
-
if (typeof pivotRowLabelsColumn === "function") {
|
|
2969
|
-
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
|
|
2970
|
-
column,
|
|
2971
|
-
pivotBy,
|
|
2972
|
-
groupRowsBy
|
|
2973
|
-
}));
|
|
2974
|
-
} else {
|
|
2975
|
-
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
|
|
2976
|
-
}
|
|
2977
|
-
}
|
|
2978
|
-
if (isPivotRowLabelsColumn && !column.render) {
|
|
2979
|
-
column.render = (renderOptions) => {
|
|
2980
|
-
var _a;
|
|
2981
|
-
let { value, enhancedData, column: column2, groupRowsBy: groupRowsBy2 } = renderOptions;
|
|
2982
|
-
if (column2.renderValue) {
|
|
2983
|
-
value = column2.renderValue(renderOptions);
|
|
2984
|
-
}
|
|
2985
|
-
const showExpanderIcon = (((_a = enhancedData.groupKeys) == null ? void 0 : _a.length) || 0) < groupRowsBy2.length;
|
|
2986
|
-
return /* @__PURE__ */ createElement5("div", {
|
|
2987
|
-
className: join(ICSS.display.flex, ICSS.alignItems.center),
|
|
2988
|
-
style: {
|
|
2989
|
-
paddingInlineStart: `calc(${enhancedData.groupNesting - 1} * var(--ITableRow-group-column-nesting))`
|
|
2990
|
-
}
|
|
2991
|
-
}, showExpanderIcon ? /* @__PURE__ */ createElement5(ExpanderIcon, {
|
|
2992
|
-
expanded: !enhancedData.collapsed,
|
|
2993
|
-
onChange: () => {
|
|
2994
|
-
toggleGroupRow(enhancedData.groupKeys);
|
|
2995
|
-
}
|
|
2996
|
-
}) : null, /* @__PURE__ */ createElement5("div", {
|
|
2997
|
-
className: cssEllipsisClassName
|
|
2998
|
-
}, value != null ? value : null));
|
|
2999
|
-
};
|
|
3000
|
-
}
|
|
3001
|
-
if (!column.render && column.renderValue) {
|
|
3002
|
-
column.render = (renderOptions) => {
|
|
3003
|
-
return column.renderValue(renderOptions);
|
|
3004
|
-
};
|
|
3005
|
-
}
|
|
3006
|
-
computedPivotColumns.set(key, column);
|
|
3007
|
-
});
|
|
3008
|
-
return computedPivotColumns;
|
|
3223
|
+
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
3224
|
+
function useGroupRowsMap(groupRowsBy) {
|
|
3225
|
+
const groupRowsMap = useMemo5(() => {
|
|
3226
|
+
return groupRowsBy.reduce((acc, groupBy, index) => {
|
|
3227
|
+
acc.set(groupBy.field, {
|
|
3228
|
+
groupBy,
|
|
3229
|
+
groupIndex: index
|
|
3230
|
+
});
|
|
3231
|
+
return acc;
|
|
3232
|
+
}, new Map());
|
|
3233
|
+
}, [groupRowsBy]);
|
|
3234
|
+
return groupRowsMap;
|
|
3009
3235
|
}
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
}
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
if (column.renderValue) {
|
|
3030
|
-
value = column.renderValue(renderOptions);
|
|
3031
|
-
}
|
|
3032
|
-
return /* @__PURE__ */ createElement6("div", {
|
|
3033
|
-
className: join(ICSS.display.flex, ICSS.alignItems.center)
|
|
3034
|
-
}, /* @__PURE__ */ createElement6(ExpanderIcon, {
|
|
3035
|
-
expanded: !enhancedData.collapsed,
|
|
3036
|
-
onChange: () => {
|
|
3037
|
-
toggleGroupRow(enhancedData.groupKeys);
|
|
3038
|
-
}
|
|
3039
|
-
}), /* @__PURE__ */ createElement6("div", {
|
|
3040
|
-
className: cssEllipsisClassName
|
|
3041
|
-
}, value != null ? value : null));
|
|
3042
|
-
}
|
|
3043
|
-
}, groupBy.column);
|
|
3044
|
-
if (groupColumnFromProps) {
|
|
3045
|
-
if (typeof groupColumnFromProps === "function") {
|
|
3046
|
-
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
|
|
3047
|
-
} else {
|
|
3048
|
-
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
|
|
3049
|
-
}
|
|
3050
|
-
}
|
|
3051
|
-
return generatedGroupColumn;
|
|
3236
|
+
function useColumnsWhen() {
|
|
3237
|
+
const {
|
|
3238
|
+
componentState: { groupRowsBy },
|
|
3239
|
+
componentActions: dataSourceActions
|
|
3240
|
+
} = useDataSourceContextValue();
|
|
3241
|
+
const {
|
|
3242
|
+
componentState: { groupRenderStrategy, pivotTotalColumnPosition }
|
|
3243
|
+
} = useComponentState();
|
|
3244
|
+
const groupRowsMap = useGroupRowsMap(groupRowsBy);
|
|
3245
|
+
useEffect8(() => {
|
|
3246
|
+
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
3247
|
+
}, [groupRenderStrategy]);
|
|
3248
|
+
useEffect8(() => {
|
|
3249
|
+
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3250
|
+
}, [pivotTotalColumnPosition]);
|
|
3251
|
+
useColumnsWhenInlineGroupRenderStrategy(groupRowsMap);
|
|
3252
|
+
useColumnsWhenPivoting();
|
|
3253
|
+
useColumnsWhenGrouping();
|
|
3254
|
+
useHideEmptyGroupColumns(groupRowsMap);
|
|
3052
3255
|
}
|
|
3053
|
-
function
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
}
|
|
3063
|
-
|
|
3064
|
-
|
|
3256
|
+
function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
3257
|
+
const toggleGroupRow = useToggleGroupRow();
|
|
3258
|
+
const {
|
|
3259
|
+
componentActions,
|
|
3260
|
+
componentState: { columns, groupRenderStrategy }
|
|
3261
|
+
} = useComponentState();
|
|
3262
|
+
function computeColumnsWhenInlineGroupRenderStrategy(columns2, groupRowsMap2, groupRenderStrategy2, toggleGroupRow2) {
|
|
3263
|
+
const computedColumns = new Map();
|
|
3264
|
+
columns2.forEach((column, id) => {
|
|
3265
|
+
let base = {};
|
|
3266
|
+
const groupByForColumn = groupRowsMap2.get(column.field);
|
|
3267
|
+
if (groupByForColumn && groupRenderStrategy2 === "inline") {
|
|
3268
|
+
const { groupIndex } = groupByForColumn;
|
|
3269
|
+
const field = groupByForColumn.groupBy.field;
|
|
3270
|
+
base = {
|
|
3271
|
+
groupByField: field,
|
|
3272
|
+
field,
|
|
3273
|
+
valueGetter: ({ rowInfo }) => {
|
|
3274
|
+
var _a;
|
|
3275
|
+
return (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex];
|
|
3276
|
+
},
|
|
3277
|
+
rowspan: ({ rowInfo, dataArray }) => {
|
|
3278
|
+
const prevRowInfo = dataArray[rowInfo.indexInAll - 1] || {
|
|
3279
|
+
indexInParentGroups: []
|
|
3280
|
+
};
|
|
3281
|
+
const prevIndexes = prevRowInfo.indexInParentGroups || [];
|
|
3282
|
+
const currentIndexes = rowInfo.indexInParentGroups || [];
|
|
3283
|
+
let computeSpan = false;
|
|
3284
|
+
for (let i = 0; i <= groupIndex; i++) {
|
|
3285
|
+
const prev = prevIndexes[i];
|
|
3286
|
+
const current = currentIndexes[i];
|
|
3287
|
+
if (current !== prev) {
|
|
3288
|
+
computeSpan = true;
|
|
3289
|
+
break;
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
if (!computeSpan) {
|
|
3293
|
+
return 1;
|
|
3294
|
+
}
|
|
3295
|
+
const parentGroup = rowInfo.parents[groupIndex];
|
|
3296
|
+
const rowspan = parentGroup ? parentGroup.groupCount - (parentGroup.collapsedChildrenCount || 0) + (parentGroup.collapsedGroupsCount || 0) : 1;
|
|
3297
|
+
return rowspan;
|
|
3298
|
+
},
|
|
3299
|
+
render: getGroupColumnRender({
|
|
3300
|
+
groupIndex,
|
|
3301
|
+
groupRenderStrategy: groupRenderStrategy2,
|
|
3302
|
+
toggleGroupRow: toggleGroupRow2
|
|
3303
|
+
})
|
|
3304
|
+
};
|
|
3065
3305
|
}
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
}
|
|
3071
|
-
}, /* @__PURE__ */ createElement6(ExpanderIcon, {
|
|
3072
|
-
expanded: !enhancedData.collapsed,
|
|
3073
|
-
onChange: () => {
|
|
3074
|
-
toggleGroupRow(enhancedData.groupKeys);
|
|
3075
|
-
}
|
|
3076
|
-
}), /* @__PURE__ */ createElement6("div", {
|
|
3077
|
-
className: cssEllipsisClassName
|
|
3078
|
-
}, value != null ? value : null));
|
|
3079
|
-
}
|
|
3080
|
-
};
|
|
3081
|
-
if (groupColumnFromProps) {
|
|
3082
|
-
if (typeof groupColumnFromProps === "function") {
|
|
3083
|
-
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
|
|
3084
|
-
} else {
|
|
3085
|
-
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
|
|
3086
|
-
}
|
|
3087
|
-
}
|
|
3088
|
-
return generatedGroupColumn;
|
|
3089
|
-
}
|
|
3090
|
-
|
|
3091
|
-
// src/components/InfiniteTable/hooks/useGeneratedGroupAndPivotColumns.ts
|
|
3092
|
-
function getGroupRenderStrategy(options) {
|
|
3093
|
-
const { groupRowsBy, groupColumn, groupRenderStrategy } = options;
|
|
3094
|
-
if (groupRenderStrategy) {
|
|
3095
|
-
return groupRenderStrategy;
|
|
3096
|
-
}
|
|
3097
|
-
if (groupColumn != null && typeof groupColumn === "object") {
|
|
3098
|
-
return "single-column";
|
|
3099
|
-
}
|
|
3100
|
-
const columnsInGroupRowsBy = groupRowsBy.filter((g) => g.column);
|
|
3101
|
-
if (columnsInGroupRowsBy.length) {
|
|
3102
|
-
return "multi-column";
|
|
3306
|
+
const clone = __spreadValues(__spreadValues({}, base), column);
|
|
3307
|
+
computedColumns.set(id, clone);
|
|
3308
|
+
});
|
|
3309
|
+
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
3103
3310
|
}
|
|
3104
|
-
|
|
3311
|
+
useEffect8(() => {
|
|
3312
|
+
const update = () => {
|
|
3313
|
+
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupRowsMap, groupRenderStrategy, toggleGroupRow);
|
|
3314
|
+
};
|
|
3315
|
+
update();
|
|
3316
|
+
return interceptMap(columns, {
|
|
3317
|
+
set: update,
|
|
3318
|
+
delete: update,
|
|
3319
|
+
clear: update
|
|
3320
|
+
});
|
|
3321
|
+
}, [columns, groupRowsMap, groupRenderStrategy, toggleGroupRow]);
|
|
3105
3322
|
}
|
|
3106
|
-
function
|
|
3323
|
+
function useColumnsWhenPivoting() {
|
|
3107
3324
|
const {
|
|
3108
|
-
componentState: { groupRowsBy, pivotBy }
|
|
3109
|
-
getState: getDataSourceState,
|
|
3110
|
-
componentActions: dataSourceActions
|
|
3325
|
+
componentState: { groupRowsBy, pivotBy }
|
|
3111
3326
|
} = useDataSourceContextValue();
|
|
3112
3327
|
const {
|
|
3113
|
-
getComponentState,
|
|
3114
3328
|
componentActions,
|
|
3115
3329
|
componentState: {
|
|
3116
|
-
|
|
3117
|
-
groupRenderStrategy,
|
|
3330
|
+
pivotColumns,
|
|
3118
3331
|
pivotColumn,
|
|
3119
3332
|
pivotRowLabelsColumn,
|
|
3120
|
-
pivotColumns,
|
|
3121
3333
|
pivotTotalColumnPosition
|
|
3122
3334
|
}
|
|
3123
3335
|
} = useComponentState();
|
|
3124
|
-
const toggleGroupRow =
|
|
3125
|
-
const newState = new GroupRowsState(getDataSourceState().groupRowsState);
|
|
3126
|
-
newState.toggleGroupRow(groupKeys);
|
|
3127
|
-
dataSourceActions.groupRowsState = newState;
|
|
3128
|
-
}, []);
|
|
3129
|
-
useEffect8(() => {
|
|
3130
|
-
const currentState = getComponentState();
|
|
3131
|
-
if (pivotColumns) {
|
|
3132
|
-
if (currentState.generatedColumns.size) {
|
|
3133
|
-
componentActions.generatedColumns = new Map();
|
|
3134
|
-
}
|
|
3135
|
-
return;
|
|
3136
|
-
}
|
|
3137
|
-
componentActions.generatedColumns = getGeneratedGroupColumns({
|
|
3138
|
-
groupColumn,
|
|
3139
|
-
groupRenderStrategy,
|
|
3140
|
-
groupRowsBy,
|
|
3141
|
-
pivotColumns,
|
|
3142
|
-
toggleGroupRow
|
|
3143
|
-
});
|
|
3144
|
-
}, [groupRowsBy, groupColumn, groupRenderStrategy, pivotColumns]);
|
|
3145
|
-
useEffect8(() => {
|
|
3146
|
-
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3147
|
-
}, [pivotTotalColumnPosition]);
|
|
3336
|
+
const toggleGroupRow = useToggleGroupRow();
|
|
3148
3337
|
useEffect8(() => {
|
|
3149
3338
|
const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
|
|
3150
3339
|
pivotColumn,
|
|
@@ -3157,64 +3346,166 @@ function useGeneratedGroupAndPivotColumns() {
|
|
|
3157
3346
|
componentActions.computedPivotColumns = computedPivotColumns;
|
|
3158
3347
|
}, [pivotColumns, pivotColumn, pivotRowLabelsColumn]);
|
|
3159
3348
|
}
|
|
3160
|
-
function
|
|
3349
|
+
function useColumnsWhenGrouping() {
|
|
3350
|
+
const {
|
|
3351
|
+
componentState: { groupRowsBy }
|
|
3352
|
+
} = useDataSourceContextValue();
|
|
3353
|
+
const {
|
|
3354
|
+
componentActions,
|
|
3355
|
+
componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
|
|
3356
|
+
} = useComponentState();
|
|
3357
|
+
const toggleGroupRow = useToggleGroupRow();
|
|
3358
|
+
useEffect8(() => {
|
|
3359
|
+
if (pivotColumns) {
|
|
3360
|
+
return;
|
|
3361
|
+
}
|
|
3362
|
+
const update = () => {
|
|
3363
|
+
componentActions.columnsWhenGrouping = getColumnsWhenGrouping({
|
|
3364
|
+
columns,
|
|
3365
|
+
groupColumn,
|
|
3366
|
+
groupRenderStrategy,
|
|
3367
|
+
groupRowsBy,
|
|
3368
|
+
pivotColumns,
|
|
3369
|
+
toggleGroupRow
|
|
3370
|
+
});
|
|
3371
|
+
};
|
|
3372
|
+
update();
|
|
3373
|
+
return interceptMap(columns, {
|
|
3374
|
+
set: update,
|
|
3375
|
+
delete: update,
|
|
3376
|
+
clear: update
|
|
3377
|
+
});
|
|
3378
|
+
}, [groupRowsBy, groupColumn, groupRenderStrategy, pivotColumns]);
|
|
3379
|
+
}
|
|
3380
|
+
function useHideEmptyGroupColumns(groupRowsMap) {
|
|
3381
|
+
const {
|
|
3382
|
+
componentState: { groupRowsBy, groupRowsState },
|
|
3383
|
+
getState: getDataSourceState
|
|
3384
|
+
} = useDataSourceContextValue();
|
|
3385
|
+
const {
|
|
3386
|
+
getComponentState,
|
|
3387
|
+
componentActions,
|
|
3388
|
+
componentState: {
|
|
3389
|
+
columnsWhenGrouping: generatedColumns,
|
|
3390
|
+
hideEmptyGroupColumns,
|
|
3391
|
+
groupRenderStrategy
|
|
3392
|
+
}
|
|
3393
|
+
} = useComponentState();
|
|
3394
|
+
useEffect8(() => {
|
|
3395
|
+
if (groupRenderStrategy === "single-column") {
|
|
3396
|
+
return;
|
|
3397
|
+
}
|
|
3398
|
+
const groupsLength = groupRowsBy.length;
|
|
3399
|
+
let expandedGroupsLevel = 0;
|
|
3400
|
+
const { dataArray } = getDataSourceState();
|
|
3401
|
+
const len = dataArray.length;
|
|
3402
|
+
for (let i = 0; i < len; i++) {
|
|
3403
|
+
const data = dataArray[i];
|
|
3404
|
+
expandedGroupsLevel = Math.max(expandedGroupsLevel, data.groupNesting - 1);
|
|
3405
|
+
if (expandedGroupsLevel === groupsLength - 1) {
|
|
3406
|
+
break;
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
const currentState = getComponentState();
|
|
3410
|
+
const { computedColumns } = currentState;
|
|
3411
|
+
let updated = false;
|
|
3412
|
+
const columnVisibility = new Map(currentState.columnVisibility);
|
|
3413
|
+
const cols = computedColumns;
|
|
3414
|
+
groupRowsBy.forEach(({ field }, index) => {
|
|
3415
|
+
const colId = groupRenderStrategy === "multi-column" ? `group-by-${field}` : field;
|
|
3416
|
+
const col = cols.get(colId);
|
|
3417
|
+
if (!col) {
|
|
3418
|
+
return;
|
|
3419
|
+
}
|
|
3420
|
+
const shouldBeHidden = index > expandedGroupsLevel;
|
|
3421
|
+
updated = true;
|
|
3422
|
+
if (shouldBeHidden && hideEmptyGroupColumns) {
|
|
3423
|
+
columnVisibility.set(colId, false);
|
|
3424
|
+
} else {
|
|
3425
|
+
columnVisibility.delete(colId);
|
|
3426
|
+
}
|
|
3427
|
+
});
|
|
3428
|
+
if (updated) {
|
|
3429
|
+
componentActions.columnVisibility = columnVisibility;
|
|
3430
|
+
}
|
|
3431
|
+
}, [
|
|
3432
|
+
getDataSourceState,
|
|
3433
|
+
groupRenderStrategy,
|
|
3434
|
+
generatedColumns,
|
|
3435
|
+
groupRowsBy,
|
|
3436
|
+
groupRowsMap,
|
|
3437
|
+
hideEmptyGroupColumns ? groupRowsState : null,
|
|
3438
|
+
hideEmptyGroupColumns
|
|
3439
|
+
]);
|
|
3440
|
+
}
|
|
3441
|
+
function getColumnsWhenGrouping(params) {
|
|
3161
3442
|
const {
|
|
3162
3443
|
pivotColumns,
|
|
3163
3444
|
groupRowsBy,
|
|
3164
3445
|
groupColumn,
|
|
3165
3446
|
groupRenderStrategy,
|
|
3166
|
-
toggleGroupRow
|
|
3447
|
+
toggleGroupRow,
|
|
3448
|
+
columns
|
|
3167
3449
|
} = params;
|
|
3168
|
-
const generatedColumns = new Map();
|
|
3169
3450
|
if (pivotColumns) {
|
|
3170
|
-
return
|
|
3451
|
+
return void 0;
|
|
3171
3452
|
}
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
});
|
|
3453
|
+
if (groupRenderStrategy === "inline") {
|
|
3454
|
+
return void 0;
|
|
3455
|
+
}
|
|
3456
|
+
const computedColumns = new Map();
|
|
3177
3457
|
if (groupRenderStrategy === "multi-column") {
|
|
3178
3458
|
groupRowsBy.forEach((groupBy, index, arr) => {
|
|
3179
|
-
|
|
3459
|
+
computedColumns.set(`group-by-${groupBy.field}`, getColumnForGroupBy({
|
|
3460
|
+
groupBy,
|
|
3461
|
+
groupRowsBy,
|
|
3462
|
+
groupIndex: index,
|
|
3463
|
+
groupCount: arr.length,
|
|
3464
|
+
groupRenderStrategy
|
|
3465
|
+
}, toggleGroupRow, groupColumn));
|
|
3180
3466
|
});
|
|
3181
|
-
} else if (
|
|
3182
|
-
|
|
3467
|
+
} else if (groupRenderStrategy === "single-column") {
|
|
3468
|
+
computedColumns.set("group-by", getSingleGroupColumn({
|
|
3183
3469
|
groupCount: groupRowsBy.length,
|
|
3184
3470
|
groupRowsBy
|
|
3185
3471
|
}, toggleGroupRow, groupColumn));
|
|
3186
3472
|
}
|
|
3187
|
-
|
|
3473
|
+
columns.forEach((col, colId) => {
|
|
3474
|
+
computedColumns.set(colId, col);
|
|
3475
|
+
});
|
|
3476
|
+
return computedColumns;
|
|
3188
3477
|
}
|
|
3189
3478
|
|
|
3190
3479
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
3191
3480
|
function useComputed() {
|
|
3192
|
-
|
|
3481
|
+
var _a;
|
|
3482
|
+
const { componentActions, componentState } = useComponentState();
|
|
3193
3483
|
const {
|
|
3194
3484
|
componentActions: dataSourceActions,
|
|
3195
3485
|
componentState: dataSourceState
|
|
3196
3486
|
} = useDataSourceContextValue();
|
|
3197
3487
|
const { columnOrder, columnVisibility, columnPinning, bodySize } = componentState;
|
|
3198
3488
|
useState4(() => {
|
|
3199
|
-
componentState.
|
|
3489
|
+
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
3200
3490
|
if (rowHeight) {
|
|
3201
|
-
componentActions.
|
|
3491
|
+
componentActions.rowHeight = rowHeight;
|
|
3202
3492
|
}
|
|
3203
3493
|
});
|
|
3204
|
-
componentState.
|
|
3494
|
+
componentState.onHeaderHeightCSSVarChange.onChange((headerHeight) => {
|
|
3205
3495
|
if (headerHeight) {
|
|
3206
|
-
|
|
3496
|
+
componentActions.headerHeight = headerHeight;
|
|
3207
3497
|
}
|
|
3208
3498
|
});
|
|
3209
3499
|
});
|
|
3210
3500
|
useColumnAggregations();
|
|
3211
3501
|
const { multiSort } = dataSourceState;
|
|
3212
3502
|
useColumnGroups();
|
|
3213
|
-
|
|
3503
|
+
useColumnsWhen();
|
|
3214
3504
|
const setSortInfo = useCallback5((sortInfo) => {
|
|
3215
|
-
var
|
|
3216
|
-
dataSourceActions.sortInfo = multiSort ? sortInfo : (
|
|
3217
|
-
}, [
|
|
3505
|
+
var _a2;
|
|
3506
|
+
dataSourceActions.sortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
3507
|
+
}, []);
|
|
3508
|
+
const columns = componentState.computedColumns;
|
|
3218
3509
|
const {
|
|
3219
3510
|
computedColumnOrder,
|
|
3220
3511
|
computedVisibleColumns,
|
|
@@ -3231,8 +3522,7 @@ function useComputed() {
|
|
|
3231
3522
|
computedPinnedStartWidth,
|
|
3232
3523
|
computedPinnedEndWidth
|
|
3233
3524
|
} = useComputedVisibleColumns({
|
|
3234
|
-
columns
|
|
3235
|
-
generatedColumns: componentState.generatedColumns,
|
|
3525
|
+
columns,
|
|
3236
3526
|
columnMinWidth: componentState.columnMinWidth,
|
|
3237
3527
|
columnMaxWidth: componentState.columnMaxWidth,
|
|
3238
3528
|
columnDefaultWidth: componentState.columnDefaultWidth,
|
|
@@ -3241,7 +3531,7 @@ function useComputed() {
|
|
|
3241
3531
|
bodySize,
|
|
3242
3532
|
sortable: componentState.sortable,
|
|
3243
3533
|
draggableColumns: componentState.draggableColumns,
|
|
3244
|
-
sortInfo: dataSourceState.sortInfo,
|
|
3534
|
+
sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
|
|
3245
3535
|
multiSort,
|
|
3246
3536
|
setSortInfo,
|
|
3247
3537
|
columnOrder,
|
|
@@ -3310,11 +3600,11 @@ var useInternalProps = () => {
|
|
|
3310
3600
|
|
|
3311
3601
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3312
3602
|
var InfiniteTableBody = forwardRef(function InfiniteTableBody2(props, ref) {
|
|
3313
|
-
const { rootClassName:
|
|
3603
|
+
const { rootClassName: rootClassName12 } = useInternalProps();
|
|
3314
3604
|
return /* @__PURE__ */ createElement7("div", __spreadProps(__spreadValues({
|
|
3315
3605
|
ref
|
|
3316
3606
|
}, props), {
|
|
3317
|
-
className: join(`${
|
|
3607
|
+
className: join(`${rootClassName12}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
|
|
3318
3608
|
}));
|
|
3319
3609
|
});
|
|
3320
3610
|
|
|
@@ -3388,19 +3678,30 @@ function VerticalScrollbarPlaceholderFn(props) {
|
|
|
3388
3678
|
}
|
|
3389
3679
|
var VerticalScrollbarPlaceholder = memo2(VerticalScrollbarPlaceholderFn);
|
|
3390
3680
|
|
|
3681
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
3682
|
+
var CellCls = "_1eexc2a5 _16lm1iwh _16lm1iwy _16lm1iwz _16lm1iw2 _16lm1iw17 _16lm1iw18";
|
|
3683
|
+
var HeaderCellProxy = "_12zfob10";
|
|
3684
|
+
var HeaderCellRecipe = createRuntimeFn({ defaultClassName: "_12zfob1c", variantClassNames: { dragging: { true: "_12zfob1d", false: "_12zfob1e" }, first: { true: "_12zfob1f", false: "_12zfob1g" }, last: { true: "_12zfob1h", false: "_12zfob1i" }, groupByField: { true: "_12zfob1j", false: "_12zfob1k" }, firstInCategory: { true: "_12zfob1l", false: "_12zfob1m" }, lastInCategory: { true: "_12zfob1n", false: "_12zfob1o" }, pinned: { start: "_12zfob1p", end: "_12zfob1q", false: "_12zfob1r" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob1s"], [{ pinned: "end", firstInCategory: true }, "_12zfob1t"], [{ pinned: false, lastInCategory: true }, "_12zfob1u"]] });
|
|
3685
|
+
var HeaderClsRecipe = createRuntimeFn({ defaultClassName: "_12zfob12 _16lm1iwy", variantClassNames: { pinned: { start: "_12zfob13", end: "_12zfob14", false: "_12zfob15" }, virtualized: { true: "_12zfob16", false: "_12zfob17" }, overflow: { true: "_12zfob18", false: "_12zfob19" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1a"], [{ overflow: true, pinned: "end" }, "_12zfob1b"]] });
|
|
3686
|
+
var HeaderGroupCls = "_16lm1iwx _16lm1iwh";
|
|
3687
|
+
var HeaderGroup_Children = "_16lm1iwh _16lm1iwy _16lm1iw10 _16lm1iwa";
|
|
3688
|
+
var HeaderGroup_Header = "_12zfob1x _16lm1iwh _16lm1iwy _16lm1iwz";
|
|
3689
|
+
var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
|
|
3690
|
+
var HeaderWrapperCls = "_12zfob1v _16lm1iw14 _16lm1iw1 _16lm1iwh _16lm1iwy";
|
|
3691
|
+
|
|
3391
3692
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
3392
3693
|
import {
|
|
3393
3694
|
createElement as createElement15,
|
|
3394
3695
|
memo as memo6
|
|
3395
3696
|
} from "react";
|
|
3396
|
-
import { useCallback as useCallback8, useEffect as useEffect12, useRef as
|
|
3697
|
+
import { useCallback as useCallback8, useEffect as useEffect12, useRef as useRef7 } from "react";
|
|
3397
3698
|
|
|
3398
3699
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3399
3700
|
import {
|
|
3400
3701
|
Fragment as Fragment2,
|
|
3401
3702
|
createElement as createElement11
|
|
3402
3703
|
} from "react";
|
|
3403
|
-
import { useCallback as useCallback7, useEffect as useEffect10, useRef as
|
|
3704
|
+
import { useCallback as useCallback7, useEffect as useEffect10, useRef as useRef6 } from "react";
|
|
3404
3705
|
|
|
3405
3706
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
3406
3707
|
import {
|
|
@@ -3416,10 +3717,17 @@ var useInfiniteTableState = () => {
|
|
|
3416
3717
|
return componentState;
|
|
3417
3718
|
};
|
|
3418
3719
|
|
|
3720
|
+
// src/components/InfiniteTable/components/cell.css.ts
|
|
3721
|
+
var CellCls2 = "_1eexc2a5 _16lm1iwh _16lm1iwy _16lm1iwz _16lm1iw2 _16lm1iw17 _16lm1iw18";
|
|
3722
|
+
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
3723
|
+
var ColumnCellRecipe = createRuntimeFn({ defaultClassName: "_16lm1iw2 _16lm1iwm _16lm1iw7 _16lm1iwp", variantClassNames: { dragging: { false: "_1eexc2a7" }, first: { true: "_1eexc2a8", false: "_1eexc2a9" }, last: { true: "_1eexc2aa", false: "_1eexc2ab" }, groupByField: { true: "_1eexc2ac", false: "_1eexc2ad" }, firstInCategory: { true: "_1eexc2ae", false: "_1eexc2af" }, lastInCategory: { true: "_1eexc2ag", false: "_1eexc2ah" }, pinned: { start: "_1eexc2ai", end: "_1eexc2aj", false: "_1eexc2ak" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2al"], [{ pinned: "end", firstInCategory: true }, "_1eexc2am"]] });
|
|
3724
|
+
var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
|
|
3725
|
+
|
|
3419
3726
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
3420
3727
|
var { rootClassName: rootClassName2 } = internalProps;
|
|
3421
3728
|
var InfiniteTableCellClassName = `${rootClassName2}Cell`;
|
|
3422
3729
|
function InfiniteTableCellFn(props) {
|
|
3730
|
+
var _b, _c;
|
|
3423
3731
|
const _a = props, {
|
|
3424
3732
|
cssEllipsis = true,
|
|
3425
3733
|
virtualized = true,
|
|
@@ -3461,7 +3769,7 @@ function InfiniteTableCellFn(props) {
|
|
|
3461
3769
|
ref: domRef,
|
|
3462
3770
|
style,
|
|
3463
3771
|
"data-name": `Cell`,
|
|
3464
|
-
className: join(domProps.className,
|
|
3772
|
+
className: join(domProps.className, columnAlignCellStyle[(_b = column.align) != null ? _b : "start"], justifyContent[(_c = column.align) != null ? _c : "start"], InfiniteTableCellClassName, CellCls2, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : "")
|
|
3465
3773
|
}), beforeChildren, cssEllipsis ? /* @__PURE__ */ createElement9("div", {
|
|
3466
3774
|
className: `${rootClassName2}Cell_content ${cssEllipsisClassName}`
|
|
3467
3775
|
}, children) : children, afterChildren);
|
|
@@ -3472,8 +3780,8 @@ var InfiniteTableCell = memo3(InfiniteTableCellFn);
|
|
|
3472
3780
|
var import_binary_search = __toModule(require_binary_search());
|
|
3473
3781
|
import {
|
|
3474
3782
|
useCallback as useCallback6,
|
|
3475
|
-
useMemo as
|
|
3476
|
-
useRef as
|
|
3783
|
+
useMemo as useMemo6,
|
|
3784
|
+
useRef as useRef5,
|
|
3477
3785
|
useState as useState5
|
|
3478
3786
|
} from "react";
|
|
3479
3787
|
|
|
@@ -3511,16 +3819,16 @@ var useColumnPointerEvents = ({
|
|
|
3511
3819
|
}) => {
|
|
3512
3820
|
const [draggingDiff, setDraggingDiff] = useState5(null);
|
|
3513
3821
|
const [proxyOffset, setProxyOffset] = useState5(null);
|
|
3514
|
-
const breakpointsRef =
|
|
3515
|
-
const pointerMoveRef =
|
|
3516
|
-
const didDragRef =
|
|
3517
|
-
const initialClientPos =
|
|
3518
|
-
const currentDropIndexRef =
|
|
3822
|
+
const breakpointsRef = useRef5([]);
|
|
3823
|
+
const pointerMoveRef = useRef5(null);
|
|
3824
|
+
const didDragRef = useRef5(false);
|
|
3825
|
+
const initialClientPos = useRef5(null);
|
|
3826
|
+
const currentDropIndexRef = useRef5(null);
|
|
3519
3827
|
const dragging = draggingDiff != null;
|
|
3520
3828
|
const { componentActions, computed } = useInfiniteTable();
|
|
3521
3829
|
const { computedColumnOrder } = computed;
|
|
3522
|
-
const column =
|
|
3523
|
-
const { columnIndex, columnWidth, columnsArray } =
|
|
3830
|
+
const column = useMemo6(() => columns.get(columnId), [columnId, columns]);
|
|
3831
|
+
const { columnIndex, columnWidth, columnsArray } = useMemo6(() => {
|
|
3524
3832
|
const columnsArray2 = Array.from(columns.values());
|
|
3525
3833
|
return {
|
|
3526
3834
|
columnsArray: columnsArray2,
|
|
@@ -3528,7 +3836,7 @@ var useColumnPointerEvents = ({
|
|
|
3528
3836
|
columnWidth: column.computedWidth
|
|
3529
3837
|
};
|
|
3530
3838
|
}, [columns, columnId, column]);
|
|
3531
|
-
let cursorRef =
|
|
3839
|
+
let cursorRef = useRef5("auto");
|
|
3532
3840
|
const onPointerDown = useCallback6((e) => {
|
|
3533
3841
|
const target = domRef.current;
|
|
3534
3842
|
cursorRef.current = target.style.cursor;
|
|
@@ -3626,11 +3934,25 @@ var useColumnPointerEvents = ({
|
|
|
3626
3934
|
};
|
|
3627
3935
|
|
|
3628
3936
|
// src/components/InfiniteTable/hooks/useCellClassName.ts
|
|
3629
|
-
function useCellClassName(column, baseClasses) {
|
|
3937
|
+
function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
3630
3938
|
const result = [...baseClasses];
|
|
3939
|
+
const variantObject = {
|
|
3940
|
+
first: column.computedFirst,
|
|
3941
|
+
last: column.computedLast,
|
|
3942
|
+
groupByField: !!column.groupByField,
|
|
3943
|
+
firstInCategory: column.computedFirstInCategory,
|
|
3944
|
+
lastInCategory: column.computedLastInCategory,
|
|
3945
|
+
pinned: column.computedPinned || false,
|
|
3946
|
+
dragging: extraFlags.dragging
|
|
3947
|
+
};
|
|
3948
|
+
const theVariant = variants(variantObject);
|
|
3949
|
+
result.push(theVariant);
|
|
3631
3950
|
if (column.computedFirst) {
|
|
3632
3951
|
result.push(...baseClasses.map((c) => `${c}--first`));
|
|
3633
3952
|
}
|
|
3953
|
+
if (column.groupByField) {
|
|
3954
|
+
result.push(...baseClasses.map((c) => `${c}--group-column`));
|
|
3955
|
+
}
|
|
3634
3956
|
if (column.computedLast) {
|
|
3635
3957
|
result.push(...baseClasses.map((c) => `${c}--last`));
|
|
3636
3958
|
}
|
|
@@ -3645,7 +3967,7 @@ function useCellClassName(column, baseClasses) {
|
|
|
3645
3967
|
} else {
|
|
3646
3968
|
result.push(...baseClasses.map((c) => `${c}--unpinned`));
|
|
3647
3969
|
}
|
|
3648
|
-
return result.join(" ");
|
|
3970
|
+
return result.filter(Boolean).join(" ");
|
|
3649
3971
|
}
|
|
3650
3972
|
|
|
3651
3973
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
@@ -3752,10 +4074,10 @@ function InfiniteTableHeaderCell(props) {
|
|
|
3752
4074
|
header = header != null ? header : column.name;
|
|
3753
4075
|
const sortTool = /* @__PURE__ */ createElement11(SortIcon, {
|
|
3754
4076
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
3755
|
-
className: `${baseCls}__sort-icon`,
|
|
4077
|
+
className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
|
|
3756
4078
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
3757
4079
|
});
|
|
3758
|
-
const domRef =
|
|
4080
|
+
const domRef = useRef6(null);
|
|
3759
4081
|
const ref = useCallback7((node) => {
|
|
3760
4082
|
var _a2;
|
|
3761
4083
|
domRef.current = node;
|
|
@@ -3789,7 +4111,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
3789
4111
|
let draggingProxy = null;
|
|
3790
4112
|
if (dragging) {
|
|
3791
4113
|
draggingProxy = /* @__PURE__ */ createElement11("div", {
|
|
3792
|
-
className: `${baseCls}Proxy`,
|
|
4114
|
+
className: `${baseCls}Proxy ${HeaderCellProxy}`,
|
|
3793
4115
|
style: {
|
|
3794
4116
|
position: "absolute",
|
|
3795
4117
|
height: headerHeight,
|
|
@@ -3810,7 +4132,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
3810
4132
|
offset,
|
|
3811
4133
|
onPointerDown,
|
|
3812
4134
|
onPointerUp,
|
|
3813
|
-
className: join(baseCls,
|
|
4135
|
+
className: join(baseCls, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [baseCls, InfiniteTableCellClassName], HeaderCellRecipe, { dragging }), CellCls),
|
|
3814
4136
|
cssEllipsis: (_d = (_c = column.headerCssEllipsis) != null ? _c : column.cssEllipsis) != null ? _d : true,
|
|
3815
4137
|
afterChildren: sortTool
|
|
3816
4138
|
}, header), draggingProxy);
|
|
@@ -3821,7 +4143,7 @@ import {
|
|
|
3821
4143
|
createElement as createElement14,
|
|
3822
4144
|
memo as memo5
|
|
3823
4145
|
} from "react";
|
|
3824
|
-
import { useMemo as
|
|
4146
|
+
import { useMemo as useMemo7, useEffect as useEffect11 } from "react";
|
|
3825
4147
|
|
|
3826
4148
|
// src/components/RawList/ReactVirtualRenderer.tsx
|
|
3827
4149
|
import {
|
|
@@ -4101,9 +4423,21 @@ var ReactVirtualRenderer = class extends Logger {
|
|
|
4101
4423
|
if (this.destroyed) {
|
|
4102
4424
|
return;
|
|
4103
4425
|
}
|
|
4426
|
+
const spanParent = this.brain.getItemSpanParent(itemIndex);
|
|
4427
|
+
let covered = false;
|
|
4428
|
+
if (spanParent !== itemIndex) {
|
|
4429
|
+
covered = true;
|
|
4430
|
+
}
|
|
4431
|
+
const itemSize = this.brain.getItemSize(itemIndex);
|
|
4432
|
+
const itemSpan = this.brain.getItemSpan(itemIndex);
|
|
4433
|
+
const itemSizeWithSpan = itemSpan === 1 ? itemSize : this.brain.getItemSizeWithSpan(itemIndex, itemSpan);
|
|
4104
4434
|
const renderedNode = renderItem({
|
|
4435
|
+
spanParent,
|
|
4105
4436
|
itemIndex,
|
|
4106
|
-
itemSize
|
|
4437
|
+
itemSize,
|
|
4438
|
+
itemSizeWithSpan,
|
|
4439
|
+
itemSpan,
|
|
4440
|
+
covered,
|
|
4107
4441
|
domRef: this.itemDOMRefs[elementIndex]
|
|
4108
4442
|
});
|
|
4109
4443
|
const itemUpdater = this.updaters[elementIndex];
|
|
@@ -4123,7 +4457,7 @@ var ReactVirtualRenderer = class extends Logger {
|
|
|
4123
4457
|
// src/components/RawList/index.tsx
|
|
4124
4458
|
function RawListFn(props) {
|
|
4125
4459
|
const { renderItem, brain, debugChannel } = props;
|
|
4126
|
-
const { onRenderUpdater, renderer } =
|
|
4460
|
+
const { onRenderUpdater, renderer } = useMemo7(() => {
|
|
4127
4461
|
const onRenderUpdater2 = buildSubscriptionCallback();
|
|
4128
4462
|
const renderer2 = new ReactVirtualRenderer(brain, {
|
|
4129
4463
|
channel: debugChannel
|
|
@@ -4166,7 +4500,7 @@ var debug3 = dbg("Header");
|
|
|
4166
4500
|
var { rootClassName: rootClassName4 } = internalProps;
|
|
4167
4501
|
var TableHeaderClassName = `${rootClassName4}Header`;
|
|
4168
4502
|
function InfiniteTableHeaderFn(props) {
|
|
4169
|
-
const { repaintId, brain, columns, style, className } = props;
|
|
4503
|
+
const { repaintId, brain, columns, style, className, pinning } = props;
|
|
4170
4504
|
const {
|
|
4171
4505
|
computed,
|
|
4172
4506
|
componentState: { headerHeight }
|
|
@@ -4194,10 +4528,15 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4194
4528
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4195
4529
|
return removeOnScroll;
|
|
4196
4530
|
}, [brain]);
|
|
4197
|
-
const domRef =
|
|
4531
|
+
const domRef = useRef7(null);
|
|
4532
|
+
const headerCls = HeaderClsRecipe({
|
|
4533
|
+
pinned: pinning,
|
|
4534
|
+
overflow: false,
|
|
4535
|
+
virtualized: true
|
|
4536
|
+
});
|
|
4198
4537
|
const domProps = {
|
|
4199
4538
|
ref: domRef,
|
|
4200
|
-
className: join(
|
|
4539
|
+
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4201
4540
|
style
|
|
4202
4541
|
};
|
|
4203
4542
|
return /* @__PURE__ */ createElement15("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement15(RawList, {
|
|
@@ -4211,8 +4550,8 @@ var InfiniteTableHeader = memo6(InfiniteTableHeaderFn);
|
|
|
4211
4550
|
import {
|
|
4212
4551
|
createElement as createElement18,
|
|
4213
4552
|
memo as memo7,
|
|
4214
|
-
useMemo as
|
|
4215
|
-
useRef as
|
|
4553
|
+
useMemo as useMemo8,
|
|
4554
|
+
useRef as useRef8
|
|
4216
4555
|
} from "react";
|
|
4217
4556
|
|
|
4218
4557
|
// src/components/InfiniteTable/components/InfiniteTableHeader/renderColumnHeaderGroups.tsx
|
|
@@ -4326,15 +4665,15 @@ function InfiniteTableHeaderGroup(props) {
|
|
|
4326
4665
|
};
|
|
4327
4666
|
return /* @__PURE__ */ createElement16("div", {
|
|
4328
4667
|
"data-group-id": columnGroup.id,
|
|
4329
|
-
className: join(
|
|
4668
|
+
className: join(HeaderGroupCls, TableHeaderGroupClassName, `${TableHeaderGroupClassName}--unvirtualized`),
|
|
4330
4669
|
style
|
|
4331
4670
|
}, /* @__PURE__ */ createElement16("div", {
|
|
4332
|
-
className: join(`${TableHeaderGroupClassName}__header`,
|
|
4671
|
+
className: join(`${TableHeaderGroupClassName}__header`, HeaderGroup_Header),
|
|
4333
4672
|
style: { height: headerHeight }
|
|
4334
4673
|
}, /* @__PURE__ */ createElement16("div", {
|
|
4335
4674
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4336
4675
|
}, header)), /* @__PURE__ */ createElement16("div", {
|
|
4337
|
-
className: join(`${TableHeaderGroupClassName}__children`,
|
|
4676
|
+
className: join(`${TableHeaderGroupClassName}__children`, HeaderGroup_Children)
|
|
4338
4677
|
}, props.children));
|
|
4339
4678
|
}
|
|
4340
4679
|
|
|
@@ -4400,17 +4739,17 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4400
4739
|
const _a = props, {
|
|
4401
4740
|
columns,
|
|
4402
4741
|
scrollable,
|
|
4403
|
-
classNameModifiers,
|
|
4404
4742
|
brain,
|
|
4405
4743
|
scrollListener,
|
|
4744
|
+
pinning,
|
|
4406
4745
|
totalWidth,
|
|
4407
4746
|
availableWidth
|
|
4408
4747
|
} = _a, domProps = __objRest(_a, [
|
|
4409
4748
|
"columns",
|
|
4410
4749
|
"scrollable",
|
|
4411
|
-
"classNameModifiers",
|
|
4412
4750
|
"brain",
|
|
4413
4751
|
"scrollListener",
|
|
4752
|
+
"pinning",
|
|
4414
4753
|
"totalWidth",
|
|
4415
4754
|
"availableWidth"
|
|
4416
4755
|
]);
|
|
@@ -4423,9 +4762,9 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4423
4762
|
},
|
|
4424
4763
|
computed: { computedVisibleColumnsMap: columnsMap }
|
|
4425
4764
|
} = useInfiniteTable();
|
|
4426
|
-
const domRef =
|
|
4765
|
+
const domRef = useRef8(null);
|
|
4427
4766
|
const hasColumnGroups = computedColumnGroups.size > 0;
|
|
4428
|
-
const columnHeaderGroups =
|
|
4767
|
+
const columnHeaderGroups = useMemo8(() => {
|
|
4429
4768
|
return hasColumnGroups ? renderColumnHeaderGroups({
|
|
4430
4769
|
columnGroups: computedColumnGroups,
|
|
4431
4770
|
columnGroupsDepthsMap,
|
|
@@ -4468,11 +4807,15 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4468
4807
|
return removeOnScroll;
|
|
4469
4808
|
}, [brain, scrollListener]);
|
|
4470
4809
|
return /* @__PURE__ */ createElement18("div", __spreadProps(__spreadValues({}, domProps), {
|
|
4471
|
-
className: join(TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`,
|
|
4810
|
+
className: join(TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`, pinning ? `${TableHeaderClassName2}--pinned ${TableHeaderClassName2}-${pinning}` : "", scrollable ? `${TableHeaderClassName2}--overflow` : "", domProps.className, HeaderClsRecipe({
|
|
4811
|
+
pinned: pinning,
|
|
4812
|
+
virtualized: false,
|
|
4813
|
+
overflow: scrollable
|
|
4814
|
+
})),
|
|
4472
4815
|
style
|
|
4473
4816
|
}), /* @__PURE__ */ createElement18("div", {
|
|
4474
4817
|
style: { width: totalWidth },
|
|
4475
|
-
className: join(
|
|
4818
|
+
className: join(flexFlow.row, display.flex),
|
|
4476
4819
|
ref: domRef
|
|
4477
4820
|
}, children));
|
|
4478
4821
|
}
|
|
@@ -4510,6 +4853,7 @@ function TableHeaderWrapper(props) {
|
|
|
4510
4853
|
columns: computedUnpinnedColumns,
|
|
4511
4854
|
repaintId: virtualizeHeader ? repaintId : void 0,
|
|
4512
4855
|
brain,
|
|
4856
|
+
pinning: false,
|
|
4513
4857
|
style: {
|
|
4514
4858
|
position: "absolute",
|
|
4515
4859
|
left: computedPinnedStartWidth,
|
|
@@ -4521,14 +4865,14 @@ function TableHeaderWrapper(props) {
|
|
|
4521
4865
|
}) : /* @__PURE__ */ createElement19(InfiniteTableHeaderUnvirtualized, {
|
|
4522
4866
|
brain,
|
|
4523
4867
|
scrollable: true,
|
|
4868
|
+
pinning: false,
|
|
4524
4869
|
columns: computedUnpinnedColumns,
|
|
4525
4870
|
availableWidth: computedUnpinnedColumnsWidth,
|
|
4526
4871
|
totalWidth: computedUnpinnedColumnsWidth
|
|
4527
4872
|
});
|
|
4528
4873
|
return /* @__PURE__ */ createElement19("div", {
|
|
4529
|
-
className:
|
|
4874
|
+
className: HeaderWrapperCls,
|
|
4530
4875
|
style: {
|
|
4531
|
-
background: "var(--ITableHeader__background)",
|
|
4532
4876
|
height: virtualizeHeader ? height : void 0
|
|
4533
4877
|
}
|
|
4534
4878
|
}, hasPinnedStart ? /* @__PURE__ */ createElement19(InfiniteTableHeaderUnvirtualized, {
|
|
@@ -4541,11 +4885,7 @@ function TableHeaderWrapper(props) {
|
|
|
4541
4885
|
totalWidth: computedPinnedStartColumnsWidth,
|
|
4542
4886
|
columns: computedPinnedStartColumns,
|
|
4543
4887
|
scrollable: computedPinnedStartOverflow,
|
|
4544
|
-
|
|
4545
|
-
"pinned",
|
|
4546
|
-
"pinned-start",
|
|
4547
|
-
computedPinnedStartOverflow ? "overflow" : ""
|
|
4548
|
-
],
|
|
4888
|
+
pinning: "start",
|
|
4549
4889
|
scrollListener: computedPinnedStartOverflow ? pinnedStartScrollListener : void 0
|
|
4550
4890
|
}) : null, header, hasPinnedEnd ? /* @__PURE__ */ createElement19(InfiniteTableHeaderUnvirtualized, {
|
|
4551
4891
|
style: {
|
|
@@ -4557,11 +4897,7 @@ function TableHeaderWrapper(props) {
|
|
|
4557
4897
|
availableWidth: computedPinnedEndWidth,
|
|
4558
4898
|
totalWidth: computedPinnedEndColumnsWidth,
|
|
4559
4899
|
scrollable: computedPinnedEndOverflow,
|
|
4560
|
-
|
|
4561
|
-
"pinned",
|
|
4562
|
-
"pinned-end",
|
|
4563
|
-
computedPinnedEndOverflow ? "overflow" : ""
|
|
4564
|
-
],
|
|
4900
|
+
pinning: "end",
|
|
4565
4901
|
scrollListener: computedPinnedEndOverflow ? pinnedEndScrollListener : void 0
|
|
4566
4902
|
}) : null, scrollbars.vertical ? /* @__PURE__ */ createElement19(VerticalScrollbarPlaceholder, {
|
|
4567
4903
|
style: {
|
|
@@ -4576,7 +4912,7 @@ import {
|
|
|
4576
4912
|
createElement as createElement20,
|
|
4577
4913
|
forwardRef as forwardRef2
|
|
4578
4914
|
} from "react";
|
|
4579
|
-
import { useRef as
|
|
4915
|
+
import { useRef as useRef9 } from "react";
|
|
4580
4916
|
|
|
4581
4917
|
// src/components/hooks/useOnScroll.ts
|
|
4582
4918
|
import { useEffect as useEffect14 } from "react";
|
|
@@ -4600,21 +4936,25 @@ var useOnScroll = (domRef, onScroll) => {
|
|
|
4600
4936
|
}, [onScroll, domRef == null ? void 0 : domRef.current]);
|
|
4601
4937
|
};
|
|
4602
4938
|
|
|
4939
|
+
// src/components/VirtualScrollContainer/VirtualScrollContainer.css.ts
|
|
4940
|
+
var ScrollableCls = { true: "_1ueijco1", false: "_1ueijco2", visible: "_1ueijco3", auto: "_1ueijco4", hidden: "_1ueijco5" };
|
|
4941
|
+
var ScrollableHorizontalCls = { true: "_1ueijco6", false: "_1ueijco7", visible: "_1ueijco8", auto: "_1ueijco9", hidden: "_1ueijcoa" };
|
|
4942
|
+
var ScrollableVerticalCls = { true: "_1ueijcob", false: "_1ueijcoc", visible: "_1ueijcod", auto: "_1ueijcoe", hidden: "_1ueijcof" };
|
|
4943
|
+
var VirtualScrollContainerCls = "_1ueijco0 _16lm1iw0";
|
|
4944
|
+
|
|
4603
4945
|
// src/components/VirtualScrollContainer/getScrollableClassName.ts
|
|
4604
4946
|
var getScrollableClassName = (scrollable) => {
|
|
4605
4947
|
let scrollableClassName = "";
|
|
4606
|
-
if (typeof scrollable === "boolean") {
|
|
4607
|
-
scrollableClassName = scrollable
|
|
4608
|
-
} else if (typeof scrollable === "string") {
|
|
4609
|
-
scrollableClassName = ICSS.overflow[scrollable];
|
|
4948
|
+
if (typeof scrollable === "boolean" || typeof scrollable === "string") {
|
|
4949
|
+
scrollableClassName = ScrollableCls[`${scrollable}`];
|
|
4610
4950
|
} else {
|
|
4611
|
-
scrollableClassName = join(
|
|
4951
|
+
scrollableClassName = join(ScrollableHorizontalCls[`${scrollable.horizontal}`], ScrollableVerticalCls[`${scrollable.vertical}`]);
|
|
4612
4952
|
}
|
|
4613
4953
|
return scrollableClassName;
|
|
4614
4954
|
};
|
|
4615
4955
|
|
|
4616
4956
|
// src/components/VirtualScrollContainer/index.tsx
|
|
4617
|
-
var rootClassName6 = "
|
|
4957
|
+
var rootClassName6 = "Infinite-VirtualScrollContainer";
|
|
4618
4958
|
var VirtualScrollContainer = forwardRef2(function VirtualScrollContainer2(props, ref) {
|
|
4619
4959
|
const {
|
|
4620
4960
|
children,
|
|
@@ -4623,16 +4963,12 @@ var VirtualScrollContainer = forwardRef2(function VirtualScrollContainer2(props,
|
|
|
4623
4963
|
className,
|
|
4624
4964
|
style
|
|
4625
4965
|
} = props;
|
|
4626
|
-
const domRef = ref != null ? ref :
|
|
4966
|
+
const domRef = ref != null ? ref : useRef9(null);
|
|
4627
4967
|
useOnScroll(domRef, onContainerScroll);
|
|
4628
4968
|
return /* @__PURE__ */ createElement20("div", {
|
|
4629
4969
|
ref: domRef,
|
|
4630
4970
|
style,
|
|
4631
|
-
className:
|
|
4632
|
-
className,
|
|
4633
|
-
rootClassName6,
|
|
4634
|
-
getScrollableClassName(scrollable)
|
|
4635
|
-
].join(" ")
|
|
4971
|
+
className: join(className, rootClassName6, VirtualScrollContainerCls, getScrollableClassName(scrollable))
|
|
4636
4972
|
}, children);
|
|
4637
4973
|
});
|
|
4638
4974
|
|
|
@@ -4661,7 +4997,7 @@ function SpacePlaceholderFn(props) {
|
|
|
4661
4997
|
var SpacePlaceholder = memo8(SpacePlaceholderFn);
|
|
4662
4998
|
|
|
4663
4999
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
4664
|
-
import { useCallback as useCallback17, useEffect as
|
|
5000
|
+
import { useCallback as useCallback17, useEffect as useEffect20, useMemo as useMemo10, useRef as useRef15 } from "react";
|
|
4665
5001
|
|
|
4666
5002
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
4667
5003
|
import {
|
|
@@ -4680,13 +5016,19 @@ import {
|
|
|
4680
5016
|
Fragment as Fragment4,
|
|
4681
5017
|
createElement as createElement22
|
|
4682
5018
|
} from "react";
|
|
4683
|
-
import { useRef as
|
|
5019
|
+
import { useRef as useRef10, useEffect as useEffect15, useState as useState8 } from "react";
|
|
5020
|
+
|
|
5021
|
+
// src/components/VirtualList/VirtualList.css.ts
|
|
5022
|
+
var VirtualListCls = "mlx2t0 _16lm1iw0";
|
|
5023
|
+
var VirtualListClsOrientation = { horizontal: "mlx2t1", vertical: "mlx2t2" };
|
|
5024
|
+
var scrollTransformTargetCls = "mlx2t3";
|
|
5025
|
+
|
|
5026
|
+
// src/components/VirtualList/VirtualList.tsx
|
|
4684
5027
|
var UPDATE_SCROLL2 = (node, scrollPosition) => {
|
|
4685
5028
|
node.style.transform = `translate3d(${-scrollPosition.scrollLeft}px, ${-scrollPosition.scrollTop}px, 0px)`;
|
|
4686
5029
|
};
|
|
4687
|
-
var CLASSES = join(ICSS.height["0"], ICSS.width["0"], ICSS.willChange.transform);
|
|
4688
5030
|
var debug4 = dbg("VirtuaList");
|
|
4689
|
-
var rootClassName7 = "
|
|
5031
|
+
var rootClassName7 = "InfiniteList";
|
|
4690
5032
|
var VirtualList = (props) => {
|
|
4691
5033
|
const _a = props, {
|
|
4692
5034
|
scrollable,
|
|
@@ -4717,10 +5059,10 @@ var VirtualList = (props) => {
|
|
|
4717
5059
|
"onContainerScroll",
|
|
4718
5060
|
"children"
|
|
4719
5061
|
]);
|
|
4720
|
-
const domRef =
|
|
5062
|
+
const domRef = useRef10(null);
|
|
4721
5063
|
const [, rerender] = useRerender();
|
|
4722
5064
|
const [totalSize, setTotalSize] = useState8(0);
|
|
4723
|
-
const renderCountRef =
|
|
5065
|
+
const renderCountRef = useRef10(0);
|
|
4724
5066
|
useEffect15(() => {
|
|
4725
5067
|
const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
|
|
4726
5068
|
renderCountRef.current = renderCount;
|
|
@@ -4750,7 +5092,7 @@ var VirtualList = (props) => {
|
|
|
4750
5092
|
const width = mainAxis === "horizontal" ? totalSize : itemCrossAxisSize != null ? itemCrossAxisSize : 0;
|
|
4751
5093
|
const height = mainAxis === "vertical" ? totalSize : itemCrossAxisSize != null ? itemCrossAxisSize : 0;
|
|
4752
5094
|
const domProps = __spreadProps(__spreadValues({}, restDOMProps), {
|
|
4753
|
-
className: join(props.className, rootClassName7, `${rootClassName7}--${mainAxis}`,
|
|
5095
|
+
className: join(props.className, rootClassName7, `${rootClassName7}--${mainAxis}`, VirtualListCls, VirtualListClsOrientation[mainAxis])
|
|
4754
5096
|
});
|
|
4755
5097
|
if (false) {
|
|
4756
5098
|
domProps["data-cmp-name"] = `VirtualList`;
|
|
@@ -4760,7 +5102,7 @@ var VirtualList = (props) => {
|
|
|
4760
5102
|
onContainerScroll
|
|
4761
5103
|
}, /* @__PURE__ */ createElement22("div", {
|
|
4762
5104
|
ref: domRef,
|
|
4763
|
-
className:
|
|
5105
|
+
className: scrollTransformTargetCls,
|
|
4764
5106
|
"data-name": "scroll-transform-target"
|
|
4765
5107
|
}, /* @__PURE__ */ createElement22(RawList, {
|
|
4766
5108
|
brain: virtualBrain,
|
|
@@ -4798,7 +5140,7 @@ import {
|
|
|
4798
5140
|
memo as memo10,
|
|
4799
5141
|
useCallback as useCallback11
|
|
4800
5142
|
} from "react";
|
|
4801
|
-
import { useRef as
|
|
5143
|
+
import { useRef as useRef12 } from "react";
|
|
4802
5144
|
|
|
4803
5145
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
4804
5146
|
import {
|
|
@@ -4806,140 +5148,206 @@ import {
|
|
|
4806
5148
|
memo as memo9
|
|
4807
5149
|
} from "react";
|
|
4808
5150
|
var { rootClassName: rootClassName8 } = internalProps;
|
|
4809
|
-
var
|
|
5151
|
+
var InfiniteTableColumnCellClassName = `${rootClassName8}ColumnCell`;
|
|
4810
5152
|
function isColumnWithField(c) {
|
|
4811
5153
|
return typeof c.field === "string";
|
|
4812
5154
|
}
|
|
4813
|
-
function isColumnWithRender(c) {
|
|
4814
|
-
return c.render instanceof Function;
|
|
4815
|
-
}
|
|
4816
5155
|
function InfiniteTableColumnCellFn(props) {
|
|
4817
5156
|
var _a;
|
|
4818
5157
|
const {
|
|
4819
|
-
|
|
5158
|
+
rowInfo,
|
|
5159
|
+
getData,
|
|
4820
5160
|
column,
|
|
4821
5161
|
offsetProperty,
|
|
4822
5162
|
toggleGroupRow,
|
|
4823
5163
|
virtualized,
|
|
4824
5164
|
rowIndex,
|
|
4825
|
-
|
|
5165
|
+
rowHeight,
|
|
5166
|
+
domRef,
|
|
5167
|
+
hidden
|
|
4826
5168
|
} = props;
|
|
4827
|
-
|
|
4828
|
-
|
|
5169
|
+
if (!column) {
|
|
5170
|
+
return null;
|
|
5171
|
+
}
|
|
5172
|
+
const { data, isGroupRow, groupBy } = rowInfo;
|
|
5173
|
+
const groupRowInfo = null;
|
|
5174
|
+
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
4829
5175
|
if (column.valueGetter) {
|
|
4830
|
-
value = column.valueGetter({
|
|
5176
|
+
value = column.valueGetter({
|
|
5177
|
+
data,
|
|
5178
|
+
rowInfo,
|
|
5179
|
+
groupRowInfo
|
|
5180
|
+
});
|
|
4831
5181
|
}
|
|
4832
5182
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
4833
|
-
const
|
|
5183
|
+
const stylingRenderParam = {
|
|
4834
5184
|
value,
|
|
4835
5185
|
column,
|
|
4836
|
-
|
|
5186
|
+
rowInfo,
|
|
4837
5187
|
data
|
|
4838
5188
|
};
|
|
4839
|
-
let renderValue =
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
5189
|
+
let renderValue = value;
|
|
5190
|
+
if (column.render || column.renderValue) {
|
|
5191
|
+
const renderParam = {
|
|
5192
|
+
value,
|
|
5193
|
+
column,
|
|
5194
|
+
rowInfo,
|
|
5195
|
+
groupRowInfo,
|
|
5196
|
+
data,
|
|
5197
|
+
rowIndex,
|
|
5198
|
+
toggleGroupRow,
|
|
5199
|
+
toggleCurrentGroupRow: () => toggleGroupRow(rowInfo.groupKeys),
|
|
5200
|
+
groupRowsBy: computedDataSource.groupRowsBy
|
|
5201
|
+
};
|
|
5202
|
+
if (column.render) {
|
|
5203
|
+
renderValue = column.render(renderParam);
|
|
5204
|
+
} else if (column.renderValue) {
|
|
5205
|
+
renderValue = column.renderValue(renderParam);
|
|
5206
|
+
}
|
|
5207
|
+
}
|
|
5208
|
+
const colClassName = column.className ? typeof column.className === "function" ? column.className(stylingRenderParam) : column.className : void 0;
|
|
5209
|
+
const colStyle = column.style ? typeof column.style === "function" ? column.style(stylingRenderParam) : column.style : void 0;
|
|
4851
5210
|
const style = colStyle ? __spreadProps(__spreadValues({}, colStyle), {
|
|
4852
5211
|
width: column.computedWidth
|
|
4853
5212
|
}) : {
|
|
4854
5213
|
width: column.computedWidth
|
|
4855
5214
|
};
|
|
4856
|
-
|
|
4857
|
-
domRef,
|
|
4858
|
-
offsetProperty,
|
|
5215
|
+
const dataset = {
|
|
4859
5216
|
"data-name": `Cell`,
|
|
4860
5217
|
"data-column-id": column.id,
|
|
4861
|
-
"data-column-index": column.computedVisibleIndex
|
|
5218
|
+
"data-column-index": column.computedVisibleIndex
|
|
5219
|
+
};
|
|
5220
|
+
if (typeof column.rowspan === "function") {
|
|
5221
|
+
const rowspan = column.rowspan({
|
|
5222
|
+
dataArray: getData(),
|
|
5223
|
+
column,
|
|
5224
|
+
rowInfo,
|
|
5225
|
+
groupRowInfo,
|
|
5226
|
+
rowIndex,
|
|
5227
|
+
data: rowInfo.data
|
|
5228
|
+
});
|
|
5229
|
+
if (rowspan > 1) {
|
|
5230
|
+
style.height = rowspan * rowHeight;
|
|
5231
|
+
for (let i = 0; i < rowspan; i++) {
|
|
5232
|
+
dataset[`data-hover-${rowIndex + i}`] = true;
|
|
5233
|
+
}
|
|
5234
|
+
}
|
|
5235
|
+
}
|
|
5236
|
+
return /* @__PURE__ */ createElement24(InfiniteTableCell, __spreadProps(__spreadValues({
|
|
5237
|
+
domRef,
|
|
5238
|
+
offsetProperty
|
|
5239
|
+
}, dataset), {
|
|
4862
5240
|
column,
|
|
4863
5241
|
offset: virtualized ? 0 : column.computedPinningOffset,
|
|
4864
5242
|
style,
|
|
4865
5243
|
cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
|
|
4866
|
-
className: join(
|
|
4867
|
-
}, renderValue);
|
|
5244
|
+
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false }), colClassName)
|
|
5245
|
+
}), hidden ? null : renderValue);
|
|
4868
5246
|
}
|
|
4869
5247
|
var InfiniteTableColumnCell = memo9(InfiniteTableColumnCellFn);
|
|
4870
5248
|
|
|
4871
5249
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
4872
5250
|
import {
|
|
4873
5251
|
useCallback as useCallback10,
|
|
4874
|
-
useRef as
|
|
5252
|
+
useRef as useRef11
|
|
4875
5253
|
} from "react";
|
|
4876
5254
|
|
|
4877
5255
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
|
|
4878
5256
|
var { rootClassName: rootClassName9 } = internalProps;
|
|
4879
5257
|
var InfiniteTableRowClassName = `${rootClassName9}Row`;
|
|
4880
|
-
var InfiniteTableRowClassName__hover = `${
|
|
5258
|
+
var InfiniteTableRowClassName__hover = `${rootClassName9}Element--hover`;
|
|
5259
|
+
|
|
5260
|
+
// src/components/InfiniteTable/theme.css.ts
|
|
5261
|
+
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)", height: "var(--infinite-header-height)" }, HeaderCell: { draggingBackground: "var(--infinite-header-cell-dragging-background)", background: "var(--infinite-header-cell-background)", padding: "var(--infinite-header-cell-padding)", iconSize: "var(--infinite-header-cell-icon-size)" }, 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)" }, Row: { color: "var(--infinite-row-color)", background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", 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)" } } };
|
|
5262
|
+
|
|
5263
|
+
// src/utils/stripVar.ts
|
|
5264
|
+
function stripVar(cssVariableWithVarString) {
|
|
5265
|
+
return cssVariableWithVarString.slice(4, -1);
|
|
5266
|
+
}
|
|
4881
5267
|
|
|
4882
5268
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
4883
|
-
function useRowDOMProps(props, rowProps, rowStyle, rowClassName, tableDOMRef) {
|
|
5269
|
+
function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStrategy, tableDOMRef) {
|
|
4884
5270
|
const domProps = props.domProps;
|
|
4885
5271
|
const {
|
|
4886
5272
|
showZebraRows = false,
|
|
5273
|
+
showHoverRows = false,
|
|
4887
5274
|
rowIndex,
|
|
4888
5275
|
domRef: domRefFromProps,
|
|
4889
|
-
|
|
5276
|
+
rowInfo
|
|
4890
5277
|
} = props;
|
|
4891
|
-
const domRef =
|
|
5278
|
+
const domRef = useRef11(null);
|
|
4892
5279
|
const rowDOMRef = useCallback10((node) => {
|
|
4893
5280
|
domRefFromProps(node);
|
|
4894
5281
|
domRef.current = node;
|
|
4895
5282
|
}, []);
|
|
4896
5283
|
const rowPropsAndStyleArgs = {
|
|
4897
|
-
data:
|
|
4898
|
-
|
|
5284
|
+
data: rowInfo.data,
|
|
5285
|
+
rowInfo,
|
|
4899
5286
|
rowIndex,
|
|
4900
|
-
groupRowsBy:
|
|
5287
|
+
groupRowsBy: rowInfo.groupBy
|
|
4901
5288
|
};
|
|
4902
5289
|
if (typeof rowProps === "function") {
|
|
4903
5290
|
rowProps = rowProps(rowPropsAndStyleArgs);
|
|
4904
5291
|
}
|
|
4905
5292
|
let style = rowProps ? rowProps.style : void 0;
|
|
5293
|
+
const inlineGroupRoot = groupRenderStrategy === "inline" && rowInfo.indexInGroup === 0;
|
|
4906
5294
|
if (rowStyle) {
|
|
4907
5295
|
style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
|
|
4908
5296
|
}
|
|
4909
|
-
|
|
5297
|
+
if (inlineGroupRoot) {
|
|
5298
|
+
style = style || {};
|
|
5299
|
+
style.zIndex = 2e6 - rowInfo.indexInAll;
|
|
5300
|
+
}
|
|
5301
|
+
const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
|
|
4910
5302
|
let rowComputedClassName = typeof rowClassName === "function" ? rowClassName(rowPropsAndStyleArgs) : rowClassName;
|
|
4911
|
-
const className = join(
|
|
5303
|
+
const className = join(InfiniteTableRowClassName, RowClsRecipe({
|
|
5304
|
+
groupRow: rowInfo.isGroupRow,
|
|
5305
|
+
inlineGroupRow: inlineGroupRoot,
|
|
5306
|
+
zebra: showHoverRows ? odd ? "odd" : "even" : false,
|
|
5307
|
+
showHoverRows
|
|
5308
|
+
}), `${InfiniteTableRowClassName}--${rowInfo.isGroupRow ? "group" : "normal"}-row`, inlineGroupRoot ? `${InfiniteTableRowClassName}--inline-group-row` : "", showZebraRows ? `${InfiniteTableRowClassName}--${odd ? "odd" : "even"}` : null, showHoverRows ? `${InfiniteTableRowClassName}--show-hover` : null, domProps == null ? void 0 : domProps.className, rowProps == null ? void 0 : rowProps.className, rowComputedClassName);
|
|
4912
5309
|
const initialMouseEnter = rowProps == null ? void 0 : rowProps.onMouseEnter;
|
|
4913
5310
|
const initialMouseLeave = rowProps == null ? void 0 : rowProps.onMouseLeave;
|
|
4914
5311
|
const onMouseEnter = useCallback10((event) => {
|
|
4915
5312
|
var _a;
|
|
4916
5313
|
initialMouseEnter == null ? void 0 : initialMouseEnter(event);
|
|
4917
|
-
const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
|
|
5314
|
+
const rowIndex2 = ((_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex) * 1;
|
|
4918
5315
|
const parentNode = tableDOMRef.current;
|
|
4919
|
-
if (!parentNode) {
|
|
5316
|
+
if (!parentNode || !showHoverRows) {
|
|
4920
5317
|
return;
|
|
4921
5318
|
}
|
|
4922
|
-
const
|
|
4923
|
-
|
|
4924
|
-
|
|
5319
|
+
const hoverSelector = [
|
|
5320
|
+
`.${InfiniteTableRowClassName}[data-hover-index="${rowIndex2}"]`
|
|
5321
|
+
];
|
|
5322
|
+
const rows = parentNode.querySelectorAll(hoverSelector.join(","));
|
|
5323
|
+
rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover, RowHoverCls));
|
|
5324
|
+
}, [initialMouseEnter, showHoverRows]);
|
|
4925
5325
|
const onMouseLeave = useCallback10((event) => {
|
|
4926
5326
|
var _a;
|
|
4927
5327
|
initialMouseLeave == null ? void 0 : initialMouseLeave(event);
|
|
4928
5328
|
const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
|
|
4929
5329
|
const parentNode = tableDOMRef.current;
|
|
4930
|
-
if (!parentNode) {
|
|
5330
|
+
if (!parentNode || !showHoverRows) {
|
|
4931
5331
|
return;
|
|
4932
5332
|
}
|
|
4933
|
-
const
|
|
4934
|
-
|
|
4935
|
-
|
|
5333
|
+
const hoverSelector = [
|
|
5334
|
+
`.${InfiniteTableRowClassName}[data-hover-index="${rowIndex2}"]`
|
|
5335
|
+
];
|
|
5336
|
+
const rows = parentNode.querySelectorAll(hoverSelector.join(","));
|
|
5337
|
+
rows.forEach((row) => row.classList.remove(InfiniteTableRowClassName__hover, RowHoverCls));
|
|
5338
|
+
}, [initialMouseLeave, showHoverRows]);
|
|
5339
|
+
if (rowInfo.isGroupRow && groupRenderStrategy === "single-column") {
|
|
5340
|
+
style = style || {};
|
|
5341
|
+
style[stripVar(ThemeVars.components.Row.groupNesting)] = rowInfo.groupNesting - 1;
|
|
5342
|
+
}
|
|
4936
5343
|
return {
|
|
4937
5344
|
domRef,
|
|
4938
5345
|
domProps: __spreadProps(__spreadValues(__spreadValues({}, rowProps), domProps), {
|
|
4939
5346
|
style,
|
|
4940
5347
|
"data-virtualize-columns": props.virtualizeColumns ? "on" : "off",
|
|
4941
5348
|
"data-row-index": rowIndex,
|
|
4942
|
-
"data-
|
|
5349
|
+
"data-hover-index": rowIndex,
|
|
5350
|
+
"data-row-id": `${rowInfo.id}`,
|
|
4943
5351
|
className,
|
|
4944
5352
|
onMouseEnter,
|
|
4945
5353
|
onMouseLeave,
|
|
@@ -4953,34 +5361,50 @@ function InfiniteTableRowFn(props) {
|
|
|
4953
5361
|
const {
|
|
4954
5362
|
rowWidth,
|
|
4955
5363
|
rowHeight,
|
|
4956
|
-
|
|
5364
|
+
getData,
|
|
5365
|
+
rowInfo,
|
|
4957
5366
|
toggleGroupRow,
|
|
4958
5367
|
rowIndex,
|
|
4959
5368
|
brain,
|
|
5369
|
+
verticalBrain,
|
|
4960
5370
|
columns
|
|
4961
5371
|
} = props;
|
|
4962
5372
|
const tableContextValue = useInfiniteTable();
|
|
4963
5373
|
const { componentState } = tableContextValue;
|
|
4964
5374
|
const { domRef: tableDOMRef } = componentState;
|
|
4965
|
-
const {
|
|
5375
|
+
const { groupRenderStrategy } = componentState;
|
|
5376
|
+
const { domProps } = useRowDOMProps(props, componentState.rowProps, componentState.rowStyle, componentState.rowClassName, groupRenderStrategy, tableDOMRef);
|
|
4966
5377
|
const style = __spreadValues({
|
|
4967
5378
|
width: rowWidth,
|
|
4968
5379
|
height: rowHeight
|
|
4969
5380
|
}, domProps.style);
|
|
4970
|
-
const renderCellRef =
|
|
5381
|
+
const renderCellRef = useRef12(null);
|
|
4971
5382
|
const renderCell = useCallback11(({ domRef, itemIndex }) => {
|
|
4972
5383
|
const column = columns[itemIndex];
|
|
4973
5384
|
if (!column) {
|
|
4974
5385
|
}
|
|
5386
|
+
const hidden = false;
|
|
4975
5387
|
return /* @__PURE__ */ createElement25(InfiniteTableColumnCell, {
|
|
4976
|
-
|
|
5388
|
+
getData,
|
|
5389
|
+
rowInfo,
|
|
5390
|
+
groupRenderStrategy,
|
|
4977
5391
|
virtualized: true,
|
|
5392
|
+
hidden,
|
|
5393
|
+
rowHeight,
|
|
4978
5394
|
toggleGroupRow,
|
|
4979
5395
|
rowIndex,
|
|
4980
5396
|
domRef,
|
|
4981
5397
|
column
|
|
4982
5398
|
});
|
|
4983
|
-
}, [
|
|
5399
|
+
}, [
|
|
5400
|
+
columns,
|
|
5401
|
+
rowIndex,
|
|
5402
|
+
rowInfo,
|
|
5403
|
+
rowHeight,
|
|
5404
|
+
groupRenderStrategy,
|
|
5405
|
+
getData,
|
|
5406
|
+
verticalBrain
|
|
5407
|
+
]);
|
|
4984
5408
|
if (renderCellRef.current !== renderCell) {
|
|
4985
5409
|
renderCellRef.current = renderCell;
|
|
4986
5410
|
}
|
|
@@ -5006,7 +5430,8 @@ function TableRowUnvirtualizedFn(props) {
|
|
|
5006
5430
|
const {
|
|
5007
5431
|
rowHeight,
|
|
5008
5432
|
rowWidth,
|
|
5009
|
-
|
|
5433
|
+
getData,
|
|
5434
|
+
rowInfo,
|
|
5010
5435
|
rowIndex,
|
|
5011
5436
|
columns,
|
|
5012
5437
|
toggleGroupRow
|
|
@@ -5014,17 +5439,22 @@ function TableRowUnvirtualizedFn(props) {
|
|
|
5014
5439
|
const tableContextValue = useInfiniteTable();
|
|
5015
5440
|
const { componentState } = tableContextValue;
|
|
5016
5441
|
const { domRef: tableDOMRef } = componentState;
|
|
5017
|
-
const { domProps } = useRowDOMProps(props, componentState.rowProps, componentState.rowStyle, componentState.rowClassName, tableDOMRef);
|
|
5442
|
+
const { domProps } = useRowDOMProps(props, componentState.rowProps, componentState.rowStyle, componentState.rowClassName, componentState.groupRenderStrategy, tableDOMRef);
|
|
5018
5443
|
const style = __spreadValues({
|
|
5019
5444
|
width: rowWidth,
|
|
5020
5445
|
height: rowHeight
|
|
5021
5446
|
}, domProps.style);
|
|
5022
5447
|
const children = columns.map((col) => {
|
|
5448
|
+
const hidden = false;
|
|
5023
5449
|
return /* @__PURE__ */ createElement26(InfiniteTableColumnCell, {
|
|
5024
5450
|
key: col.id,
|
|
5025
5451
|
virtualized: false,
|
|
5452
|
+
rowHeight,
|
|
5453
|
+
getData,
|
|
5454
|
+
hidden,
|
|
5455
|
+
groupRenderStrategy: componentState.groupRenderStrategy,
|
|
5026
5456
|
toggleGroupRow,
|
|
5027
|
-
|
|
5457
|
+
rowInfo,
|
|
5028
5458
|
rowIndex,
|
|
5029
5459
|
column: col
|
|
5030
5460
|
});
|
|
@@ -5055,19 +5485,22 @@ function useUnpinnedRendering(params) {
|
|
|
5055
5485
|
} = params;
|
|
5056
5486
|
const { virtualizeColumns } = getState();
|
|
5057
5487
|
const shouldVirtualizeColumns = typeof virtualizeColumns === "function" ? virtualizeColumns(computedUnpinnedColumns) : virtualizeColumns != null ? virtualizeColumns : true;
|
|
5058
|
-
const renderRowUnpinned = useCallback12((
|
|
5488
|
+
const renderRowUnpinned = useCallback12((rowParams) => {
|
|
5059
5489
|
const dataArray = getData();
|
|
5060
|
-
const
|
|
5061
|
-
const { showZebraRows } = getState();
|
|
5490
|
+
const rowInfo = dataArray[rowParams.rowIndex];
|
|
5491
|
+
const { showZebraRows, showHoverRows } = getState();
|
|
5062
5492
|
const rowProps = __spreadValues({
|
|
5063
|
-
|
|
5493
|
+
rowInfo,
|
|
5064
5494
|
showZebraRows,
|
|
5495
|
+
showHoverRows,
|
|
5496
|
+
getData,
|
|
5065
5497
|
toggleGroupRow,
|
|
5066
5498
|
virtualizeColumns: shouldVirtualizeColumns,
|
|
5067
5499
|
brain: null,
|
|
5500
|
+
verticalBrain: verticalVirtualBrain,
|
|
5068
5501
|
columns: computedUnpinnedColumns,
|
|
5069
5502
|
rowWidth: computedUnpinnedColumnsWidth
|
|
5070
|
-
},
|
|
5503
|
+
}, rowParams);
|
|
5071
5504
|
if (shouldVirtualizeColumns) {
|
|
5072
5505
|
rowProps.brain = horizontalVirtualBrain;
|
|
5073
5506
|
rowProps.repaintId = repaintId;
|
|
@@ -5076,10 +5509,12 @@ function useUnpinnedRendering(params) {
|
|
|
5076
5509
|
return /* @__PURE__ */ createElement27(TableRowComponent, __spreadValues({}, rowProps));
|
|
5077
5510
|
}, [
|
|
5078
5511
|
repaintId,
|
|
5512
|
+
rowHeight,
|
|
5079
5513
|
computedUnpinnedColumns,
|
|
5080
5514
|
computedUnpinnedColumnsWidth,
|
|
5081
5515
|
shouldVirtualizeColumns,
|
|
5082
|
-
horizontalVirtualBrain
|
|
5516
|
+
horizontalVirtualBrain,
|
|
5517
|
+
verticalVirtualBrain
|
|
5083
5518
|
]);
|
|
5084
5519
|
const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */ createElement27("div", {
|
|
5085
5520
|
"data-name": "horizontal-scrollbar-placeholder--fake",
|
|
@@ -5116,17 +5551,44 @@ function useUnpinnedRendering(params) {
|
|
|
5116
5551
|
}
|
|
5117
5552
|
|
|
5118
5553
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5119
|
-
import { useCallback as useCallback13, useRef as
|
|
5554
|
+
import { useCallback as useCallback13, useEffect as useEffect16, useRef as useRef13 } from "react";
|
|
5555
|
+
|
|
5556
|
+
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5557
|
+
var FooterCls = "_16lm1iw1";
|
|
5558
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwh _16lm1iwx _16lm1iw0";
|
|
5559
|
+
var InfiniteClsRecipe = 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: [] });
|
|
5560
|
+
var InfiniteClsScrolling = "_1yeub2v1";
|
|
5561
|
+
var InfiniteClsShiftingColumns = "_16lm1iwk";
|
|
5562
|
+
var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
|
|
5563
|
+
var PinnedRowsContainerClsVariants = createRuntimeFn({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5564
|
+
|
|
5565
|
+
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5120
5566
|
var DELAY = 200;
|
|
5121
5567
|
var TableClassName = internalProps.rootClassName;
|
|
5122
5568
|
var TableClassName__Scrolling = `${TableClassName}--scrolling`;
|
|
5569
|
+
var SCROLL_BOTTOM_OFFSET = 0;
|
|
5123
5570
|
var useOnContainerScroll = ({
|
|
5124
5571
|
verticalVirtualBrain,
|
|
5125
5572
|
horizontalVirtualBrain,
|
|
5126
|
-
|
|
5573
|
+
reservedContentHeight
|
|
5127
5574
|
}) => {
|
|
5128
|
-
const
|
|
5129
|
-
|
|
5575
|
+
const {
|
|
5576
|
+
componentState: {
|
|
5577
|
+
scrollerDOMRef,
|
|
5578
|
+
domRef,
|
|
5579
|
+
scrollToBottomOffset,
|
|
5580
|
+
onScrollToBottom,
|
|
5581
|
+
onScrollToTop,
|
|
5582
|
+
bodySize
|
|
5583
|
+
}
|
|
5584
|
+
} = useInfiniteTable();
|
|
5585
|
+
const timeoutIdRef = useRef13(0);
|
|
5586
|
+
const scrollingRef = useRef13(false);
|
|
5587
|
+
const scrollTopMaxRef = useRef13(0);
|
|
5588
|
+
useEffect16(() => {
|
|
5589
|
+
const { current: node } = scrollerDOMRef;
|
|
5590
|
+
scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
|
|
5591
|
+
}, [reservedContentHeight, bodySize.height]);
|
|
5130
5592
|
const setScrolling = useCallback13((scrolling) => {
|
|
5131
5593
|
var _a;
|
|
5132
5594
|
const prevScrolling = scrollingRef.current;
|
|
@@ -5146,9 +5608,9 @@ var useOnContainerScroll = ({
|
|
|
5146
5608
|
return;
|
|
5147
5609
|
}
|
|
5148
5610
|
if (scrolling) {
|
|
5149
|
-
classList.add(TableClassName__Scrolling);
|
|
5611
|
+
classList.add(InfiniteClsScrolling, TableClassName__Scrolling);
|
|
5150
5612
|
} else {
|
|
5151
|
-
classList.remove(TableClassName__Scrolling);
|
|
5613
|
+
classList.remove(InfiniteClsScrolling, TableClassName__Scrolling);
|
|
5152
5614
|
}
|
|
5153
5615
|
}
|
|
5154
5616
|
}, []);
|
|
@@ -5162,7 +5624,7 @@ var useOnContainerScroll = ({
|
|
|
5162
5624
|
domRef.current,
|
|
5163
5625
|
setScrolling
|
|
5164
5626
|
]);
|
|
5165
|
-
const scrollPositionRef =
|
|
5627
|
+
const scrollPositionRef = useRef13({
|
|
5166
5628
|
scrollLeft: 0,
|
|
5167
5629
|
scrollTop: 0
|
|
5168
5630
|
});
|
|
@@ -5173,18 +5635,25 @@ var useOnContainerScroll = ({
|
|
|
5173
5635
|
const applyScrollVertical = useCallback13(({ scrollTop }) => {
|
|
5174
5636
|
scrollPositionRef.current.scrollTop = scrollTop;
|
|
5175
5637
|
onContainerScroll(scrollPositionRef.current);
|
|
5176
|
-
|
|
5638
|
+
if (scrollTop === 0) {
|
|
5639
|
+
onScrollToTop == null ? void 0 : onScrollToTop();
|
|
5640
|
+
}
|
|
5641
|
+
const offset = scrollToBottomOffset != null ? scrollToBottomOffset : SCROLL_BOTTOM_OFFSET;
|
|
5642
|
+
const isScrollBottom = scrollTop + offset >= scrollTopMaxRef.current;
|
|
5643
|
+
if (isScrollBottom) {
|
|
5644
|
+
onScrollToBottom == null ? void 0 : onScrollToBottom();
|
|
5645
|
+
}
|
|
5646
|
+
}, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
|
|
5177
5647
|
return {
|
|
5178
5648
|
applyScrollHorizontal,
|
|
5179
|
-
applyScrollVertical
|
|
5180
|
-
scrollPositionRef
|
|
5649
|
+
applyScrollVertical
|
|
5181
5650
|
};
|
|
5182
5651
|
};
|
|
5183
5652
|
|
|
5184
5653
|
// src/components/InfiniteTable/hooks/usePinnedRendering.tsx
|
|
5185
5654
|
import {
|
|
5186
5655
|
createElement as createElement29,
|
|
5187
|
-
useMemo as
|
|
5656
|
+
useMemo as useMemo9
|
|
5188
5657
|
} from "react";
|
|
5189
5658
|
import { useCallback as useCallback15 } from "react";
|
|
5190
5659
|
|
|
@@ -5192,12 +5661,12 @@ import { useCallback as useCallback15 } from "react";
|
|
|
5192
5661
|
import {
|
|
5193
5662
|
createElement as createElement28
|
|
5194
5663
|
} from "react";
|
|
5195
|
-
import { useEffect as
|
|
5664
|
+
import { useEffect as useEffect18, useCallback as useCallback14, useRef as useRef14 } from "react";
|
|
5196
5665
|
|
|
5197
5666
|
// src/components/hooks/useOnMount.ts
|
|
5198
|
-
import { useEffect as
|
|
5667
|
+
import { useEffect as useEffect17 } from "react";
|
|
5199
5668
|
function useOnMount(domRef, props) {
|
|
5200
|
-
|
|
5669
|
+
useEffect17(() => {
|
|
5201
5670
|
const { onMount, onUnmount } = props;
|
|
5202
5671
|
const node = domRef == null ? void 0 : domRef.current;
|
|
5203
5672
|
onMount == null ? void 0 : onMount(node);
|
|
@@ -5207,12 +5676,15 @@ function useOnMount(domRef, props) {
|
|
|
5207
5676
|
}, []);
|
|
5208
5677
|
}
|
|
5209
5678
|
|
|
5679
|
+
// src/components/VirtualList/InfiniteListRootClassName.ts
|
|
5680
|
+
var InfiniteListRootClassName = "InfiniteList";
|
|
5681
|
+
|
|
5210
5682
|
// src/components/VirtualList/RowListWithExternalScrolling.tsx
|
|
5211
|
-
var rootClassName10 =
|
|
5683
|
+
var rootClassName10 = InfiniteListRootClassName;
|
|
5212
5684
|
var defaultClasses = [
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5685
|
+
willChange.transform,
|
|
5686
|
+
position.relative,
|
|
5687
|
+
transformTranslateZero
|
|
5216
5688
|
];
|
|
5217
5689
|
var RowListWithExternalScrolling = (props) => {
|
|
5218
5690
|
const {
|
|
@@ -5225,7 +5697,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5225
5697
|
onMount,
|
|
5226
5698
|
onUnmount
|
|
5227
5699
|
} = props;
|
|
5228
|
-
const domRef =
|
|
5700
|
+
const domRef = useRef14(null);
|
|
5229
5701
|
const renderItem = useCallback14((renderProps) => renderRow({
|
|
5230
5702
|
domRef: renderProps.domRef,
|
|
5231
5703
|
rowHeight: renderProps.itemSize,
|
|
@@ -5235,7 +5707,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5235
5707
|
onMount,
|
|
5236
5708
|
onUnmount
|
|
5237
5709
|
});
|
|
5238
|
-
|
|
5710
|
+
useEffect18(() => {
|
|
5239
5711
|
const onScroll = (scrollPosition) => {
|
|
5240
5712
|
const node = domRef.current;
|
|
5241
5713
|
if (node) {
|
|
@@ -5259,7 +5731,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5259
5731
|
const domProps = {
|
|
5260
5732
|
ref: domRef,
|
|
5261
5733
|
style,
|
|
5262
|
-
className: join(className, rootClassName10, `${rootClassName10}--vertical`, ...defaultClasses)
|
|
5734
|
+
className: join(className, rootClassName10, `${rootClassName10}--vertical`, VirtualListCls, VirtualListClsOrientation.vertical, ...defaultClasses)
|
|
5263
5735
|
};
|
|
5264
5736
|
if (false) {
|
|
5265
5737
|
domProps["data-cmp-name"] = "RowListWithExternalScrolling";
|
|
@@ -5275,7 +5747,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5275
5747
|
var UPDATE_SCROLL3 = (node, brainScrollPosition, horizontalPinnedScrollPosition) => {
|
|
5276
5748
|
node.style.transform = `translate3d(${horizontalPinnedScrollPosition ? -horizontalPinnedScrollPosition.scrollLeft : 0}px, ${-brainScrollPosition.scrollTop}px, 0px)`;
|
|
5277
5749
|
};
|
|
5278
|
-
var PinnedRowsContainerClassName = `
|
|
5750
|
+
var PinnedRowsContainerClassName = `InfinitePinnedRows`;
|
|
5279
5751
|
function PinnedRowsContainer(props) {
|
|
5280
5752
|
const {
|
|
5281
5753
|
maxWidth,
|
|
@@ -5287,7 +5759,7 @@ function PinnedRowsContainer(props) {
|
|
|
5287
5759
|
brain,
|
|
5288
5760
|
renderRow
|
|
5289
5761
|
} = props;
|
|
5290
|
-
const style =
|
|
5762
|
+
const style = useMemo9(() => {
|
|
5291
5763
|
const result = pinning === "end" ? {
|
|
5292
5764
|
width: rowWidth,
|
|
5293
5765
|
height,
|
|
@@ -5310,7 +5782,7 @@ function PinnedRowsContainer(props) {
|
|
|
5310
5782
|
brain,
|
|
5311
5783
|
renderRow,
|
|
5312
5784
|
updateScroll,
|
|
5313
|
-
className: join(`${PinnedRowsContainerClassName}`, `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow
|
|
5785
|
+
className: join(`${PinnedRowsContainerClassName}`, PinnedRowsClsVariants[pinning === "start" ? "pinnedStart" : "pinnedEnd"], `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow`, PinnedRowsClsVariants.overflow)
|
|
5314
5786
|
};
|
|
5315
5787
|
if (hasOverflow) {
|
|
5316
5788
|
return /* @__PURE__ */ createElement29(VirtualScrollContainer, {
|
|
@@ -5326,7 +5798,9 @@ function PinnedRowsContainer(props) {
|
|
|
5326
5798
|
[pinning === "start" ? "right" : "left"]: "unset"
|
|
5327
5799
|
},
|
|
5328
5800
|
onContainerScroll: pinnedScrollListener == null ? void 0 : pinnedScrollListener.setScrollPosition,
|
|
5329
|
-
className: join(
|
|
5801
|
+
className: join(PinnedRowsContainerClsVariants({
|
|
5802
|
+
pinned: pinning
|
|
5803
|
+
}), `${PinnedRowsContainerClassName}Container`, `${PinnedRowsContainerClassName}Container--pinned-${pinning}`)
|
|
5330
5804
|
}, /* @__PURE__ */ createElement29(RowListWithExternalScrolling, __spreadProps(__spreadValues({}, rowListProps), {
|
|
5331
5805
|
onMount: (node) => {
|
|
5332
5806
|
pinnedScrollListener == null ? void 0 : pinnedScrollListener.onScroll((scrollPosition) => {
|
|
@@ -5341,22 +5815,25 @@ function PinnedRowsContainer(props) {
|
|
|
5341
5815
|
return /* @__PURE__ */ createElement29(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
|
|
5342
5816
|
}
|
|
5343
5817
|
function useRenderPinnedRow(params) {
|
|
5344
|
-
const { getData, getState, columnsWidth, columns } = params;
|
|
5345
|
-
const renderPinnedRow = useCallback15((
|
|
5818
|
+
const { getData, getState, columnsWidth, columns, verticalBrain } = params;
|
|
5819
|
+
const renderPinnedRow = useCallback15((rowParams) => {
|
|
5346
5820
|
const dataArray = getData();
|
|
5347
|
-
const
|
|
5348
|
-
const { showZebraRows } = getState();
|
|
5821
|
+
const rowInfo = dataArray[rowParams.rowIndex];
|
|
5822
|
+
const { showZebraRows, showHoverRows } = getState();
|
|
5349
5823
|
const rowProps = __spreadValues({
|
|
5350
|
-
|
|
5824
|
+
rowInfo,
|
|
5825
|
+
getData,
|
|
5351
5826
|
showZebraRows,
|
|
5827
|
+
showHoverRows,
|
|
5352
5828
|
toggleGroupRow: params.toggleGroupRow,
|
|
5353
5829
|
virtualizeColumns: false,
|
|
5830
|
+
verticalBrain,
|
|
5354
5831
|
brain: null,
|
|
5355
5832
|
rowWidth: columnsWidth,
|
|
5356
5833
|
columns
|
|
5357
|
-
},
|
|
5834
|
+
}, rowParams);
|
|
5358
5835
|
return /* @__PURE__ */ createElement29(TableRowUnvirtualized, __spreadValues({}, rowProps));
|
|
5359
|
-
}, [columnsWidth, columns]);
|
|
5836
|
+
}, [columnsWidth, columns, verticalBrain]);
|
|
5360
5837
|
return renderPinnedRow;
|
|
5361
5838
|
}
|
|
5362
5839
|
function usePinnedRenderingForSide(side, params) {
|
|
@@ -5394,6 +5871,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
5394
5871
|
getData,
|
|
5395
5872
|
getState,
|
|
5396
5873
|
toggleGroupRow,
|
|
5874
|
+
verticalBrain: verticalVirtualBrain,
|
|
5397
5875
|
columns,
|
|
5398
5876
|
columnsWidth
|
|
5399
5877
|
});
|
|
@@ -5452,7 +5930,7 @@ function usePinnedStartRendering(params) {
|
|
|
5452
5930
|
}
|
|
5453
5931
|
|
|
5454
5932
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
5455
|
-
import { useEffect as
|
|
5933
|
+
import { useEffect as useEffect19 } from "react";
|
|
5456
5934
|
|
|
5457
5935
|
// src/components/VirtualBrain/index.ts
|
|
5458
5936
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
@@ -5461,6 +5939,7 @@ var initialScrollPosition2 = {
|
|
|
5461
5939
|
scrollTop: 0
|
|
5462
5940
|
};
|
|
5463
5941
|
var raf = typeof window !== "undefined" ? requestAnimationFrame : (fn) => setTimeout(fn, 0);
|
|
5942
|
+
var ItemIndexBag = Object.seal({ itemIndex: 0 });
|
|
5464
5943
|
var SORT_ASC = (a, b) => a - b;
|
|
5465
5944
|
var VirtualBrain = class extends Logger {
|
|
5466
5945
|
constructor(options) {
|
|
@@ -5568,22 +6047,24 @@ var VirtualBrain = class extends Logger {
|
|
|
5568
6047
|
this.onRenderRangeChangeFns = this.onRenderRangeChangeFns.filter((f) => f !== fn);
|
|
5569
6048
|
};
|
|
5570
6049
|
};
|
|
5571
|
-
this.update = (newCount, newItemSize) => {
|
|
5572
|
-
const { itemSize, count } = this.options;
|
|
6050
|
+
this.update = (newCount, newItemSize, newItemSpan) => {
|
|
6051
|
+
const { itemSize, count, itemSpan } = this.options;
|
|
5573
6052
|
const countChange = count !== newCount;
|
|
5574
6053
|
const itemSizeChange = itemSize !== newItemSize;
|
|
5575
|
-
|
|
6054
|
+
const itemSpanChange = itemSpan !== newItemSpan;
|
|
6055
|
+
if (!countChange && !itemSizeChange && !itemSpanChange) {
|
|
5576
6056
|
return;
|
|
5577
6057
|
}
|
|
5578
6058
|
this.options.count = newCount;
|
|
5579
6059
|
this.options.itemSize = newItemSize;
|
|
6060
|
+
this.options.itemSpan = newItemSpan;
|
|
5580
6061
|
const size = this.availableSize[this.options.mainAxis === "vertical" ? "height" : "width"];
|
|
5581
6062
|
const newRenderCount = this.computeRenderCount({
|
|
5582
6063
|
itemSize: newItemSize,
|
|
5583
6064
|
count: newCount,
|
|
5584
6065
|
size
|
|
5585
6066
|
});
|
|
5586
|
-
if (!itemSizeChange && countChange && newCount > count) {
|
|
6067
|
+
if (!itemSizeChange && !itemSpanChange && countChange && newCount > count) {
|
|
5587
6068
|
const currentRenderCount = this.getRenderCount();
|
|
5588
6069
|
if (currentRenderCount > newRenderCount) {
|
|
5589
6070
|
return;
|
|
@@ -5608,11 +6089,43 @@ var VirtualBrain = class extends Logger {
|
|
|
5608
6089
|
this.updateRenderCount(newRenderCount);
|
|
5609
6090
|
};
|
|
5610
6091
|
this.reset = () => {
|
|
6092
|
+
this.itemSpanParent = [];
|
|
6093
|
+
this.itemSpanValue = [];
|
|
5611
6094
|
this.itemSizeCache = [];
|
|
5612
6095
|
this.itemOffsetCache = [0];
|
|
5613
6096
|
this.renderCount = -1;
|
|
5614
6097
|
this.totalSize = 0;
|
|
5615
6098
|
};
|
|
6099
|
+
this.computeItemSpanUpTo = (itemIndex) => {
|
|
6100
|
+
const { count, itemSpan } = this.options;
|
|
6101
|
+
if (!itemSpan) {
|
|
6102
|
+
return;
|
|
6103
|
+
}
|
|
6104
|
+
const cache = this.itemSpanParent;
|
|
6105
|
+
const spanResultArr = this.itemSpanValue;
|
|
6106
|
+
if (cache[itemIndex] === void 0) {
|
|
6107
|
+
let i = cache.length;
|
|
6108
|
+
let lastIndex = Math.min(itemIndex, count - 1);
|
|
6109
|
+
for (; i <= lastIndex; i++) {
|
|
6110
|
+
if (cache[i] === void 0) {
|
|
6111
|
+
ItemIndexBag.itemIndex = i;
|
|
6112
|
+
let spanValue = itemSpan(ItemIndexBag);
|
|
6113
|
+
if (false) {
|
|
6114
|
+
this.debug("itemSpan cannot be less than 1 - got %d for index %d", spanValue, i);
|
|
6115
|
+
}
|
|
6116
|
+
cache[i] = i;
|
|
6117
|
+
spanResultArr[i] = spanValue;
|
|
6118
|
+
let spannedItemIndex = i;
|
|
6119
|
+
while (spanValue > 1) {
|
|
6120
|
+
spannedItemIndex += 1;
|
|
6121
|
+
cache[spannedItemIndex] = i;
|
|
6122
|
+
spanResultArr[spannedItemIndex] = 0;
|
|
6123
|
+
spanValue -= 1;
|
|
6124
|
+
}
|
|
6125
|
+
}
|
|
6126
|
+
}
|
|
6127
|
+
}
|
|
6128
|
+
};
|
|
5616
6129
|
this.computeCacheFor = (itemIndex) => {
|
|
5617
6130
|
if (typeof this.options.itemSize !== "function") {
|
|
5618
6131
|
return;
|
|
@@ -5632,6 +6145,33 @@ var VirtualBrain = class extends Logger {
|
|
|
5632
6145
|
this.itemOffsetCache[itemIndex] = offset;
|
|
5633
6146
|
}
|
|
5634
6147
|
};
|
|
6148
|
+
this.getItemSpan = (itemIndex) => {
|
|
6149
|
+
if (!this.options.itemSpan) {
|
|
6150
|
+
return 1;
|
|
6151
|
+
}
|
|
6152
|
+
if (this.itemSpanValue[itemIndex] === void 0) {
|
|
6153
|
+
this.computeItemSpanUpTo(itemIndex);
|
|
6154
|
+
}
|
|
6155
|
+
return this.itemSpanValue[itemIndex] || 1;
|
|
6156
|
+
};
|
|
6157
|
+
this.getItemSpanParent = (itemIndex) => {
|
|
6158
|
+
if (!this.options.itemSpan) {
|
|
6159
|
+
return itemIndex;
|
|
6160
|
+
}
|
|
6161
|
+
if (this.itemSpanParent[itemIndex] === void 0) {
|
|
6162
|
+
this.computeItemSpanUpTo(itemIndex);
|
|
6163
|
+
}
|
|
6164
|
+
return this.itemSpanParent[itemIndex];
|
|
6165
|
+
};
|
|
6166
|
+
this.getItemSizeWithSpan = (itemIndex, itemSpan) => {
|
|
6167
|
+
let itemSize = this.getItemSize(itemIndex);
|
|
6168
|
+
while (itemSpan > 1) {
|
|
6169
|
+
itemIndex += 1;
|
|
6170
|
+
itemSpan -= 1;
|
|
6171
|
+
itemSize += this.getItemSize(itemIndex);
|
|
6172
|
+
}
|
|
6173
|
+
return itemSize;
|
|
6174
|
+
};
|
|
5635
6175
|
this.getItemSize = (itemIndex) => {
|
|
5636
6176
|
const { itemSize, count } = this.options;
|
|
5637
6177
|
if (typeof itemSize !== "function") {
|
|
@@ -5778,7 +6318,7 @@ var VirtualBrain = class extends Logger {
|
|
|
5778
6318
|
}
|
|
5779
6319
|
computeRenderRange() {
|
|
5780
6320
|
const count = this.getOptions().count;
|
|
5781
|
-
|
|
6321
|
+
let renderCount = this.getRenderCount();
|
|
5782
6322
|
if (renderCount === 0) {
|
|
5783
6323
|
return {
|
|
5784
6324
|
renderStartIndex: -1,
|
|
@@ -5791,6 +6331,12 @@ var VirtualBrain = class extends Logger {
|
|
|
5791
6331
|
renderEndIndex = count - 1;
|
|
5792
6332
|
renderStartIndex = renderEndIndex - renderCount + 1;
|
|
5793
6333
|
}
|
|
6334
|
+
if (this.options.itemSpan) {
|
|
6335
|
+
this.computeItemSpanUpTo(renderStartIndex);
|
|
6336
|
+
while (this.itemSpanParent[renderStartIndex] != renderStartIndex) {
|
|
6337
|
+
renderStartIndex--;
|
|
6338
|
+
}
|
|
6339
|
+
}
|
|
5794
6340
|
return {
|
|
5795
6341
|
renderStartIndex,
|
|
5796
6342
|
renderEndIndex
|
|
@@ -5822,7 +6368,8 @@ function useYourBrain(param) {
|
|
|
5822
6368
|
computedPinnedStartWidth,
|
|
5823
6369
|
computedPinnedEndWidth,
|
|
5824
6370
|
rowHeight,
|
|
5825
|
-
bodySize
|
|
6371
|
+
bodySize,
|
|
6372
|
+
rowSpan
|
|
5826
6373
|
} = param;
|
|
5827
6374
|
const columnSize = useColumnSizeFn(computedUnpinnedColumns);
|
|
5828
6375
|
const horizontalVirtualBrain = useOnce(() => {
|
|
@@ -5837,20 +6384,21 @@ function useYourBrain(param) {
|
|
|
5837
6384
|
const brain = new VirtualBrain({
|
|
5838
6385
|
count: dataArray.length,
|
|
5839
6386
|
itemSize: rowHeight,
|
|
5840
|
-
mainAxis: "vertical"
|
|
6387
|
+
mainAxis: "vertical",
|
|
6388
|
+
itemSpan: rowSpan
|
|
5841
6389
|
});
|
|
5842
6390
|
return brain;
|
|
5843
6391
|
});
|
|
5844
6392
|
horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
|
|
5845
|
-
verticalVirtualBrain.update(dataArray.length, rowHeight);
|
|
6393
|
+
verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
|
|
5846
6394
|
globalThis.verticalVirtualBrain = verticalVirtualBrain;
|
|
5847
|
-
|
|
6395
|
+
useEffect19(() => {
|
|
5848
6396
|
verticalVirtualBrain.setAvailableSize({
|
|
5849
6397
|
height: bodySize.height,
|
|
5850
6398
|
width: 0
|
|
5851
6399
|
});
|
|
5852
6400
|
}, [bodySize, verticalVirtualBrain]);
|
|
5853
|
-
|
|
6401
|
+
useEffect19(() => {
|
|
5854
6402
|
horizontalVirtualBrain.setAvailableSize({
|
|
5855
6403
|
height: 0,
|
|
5856
6404
|
width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
|
|
@@ -5884,7 +6432,7 @@ function shallowEqualObjects(objA, objB) {
|
|
|
5884
6432
|
|
|
5885
6433
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
5886
6434
|
function useListRendering(param) {
|
|
5887
|
-
const { computed,
|
|
6435
|
+
const { computed, bodySize, columnShifts } = param;
|
|
5888
6436
|
const { componentActions, componentState, getState } = useInfiniteTable();
|
|
5889
6437
|
const prevComputed = usePrevious(computed, null);
|
|
5890
6438
|
const {
|
|
@@ -5897,40 +6445,68 @@ function useListRendering(param) {
|
|
|
5897
6445
|
computedUnpinnedColumns,
|
|
5898
6446
|
computedUnpinnedColumnsWidth,
|
|
5899
6447
|
computedPinnedStartOverflow,
|
|
5900
|
-
computedPinnedEndOverflow
|
|
6448
|
+
computedPinnedEndOverflow,
|
|
6449
|
+
computedVisibleColumns
|
|
5901
6450
|
} = computed;
|
|
5902
6451
|
const { componentState: dataSourceState, getState: getDataSourceState } = useDataSourceContextValue();
|
|
5903
6452
|
const { dataArray } = dataSourceState;
|
|
5904
6453
|
const getData = useLatest(dataArray);
|
|
5905
6454
|
const {
|
|
5906
|
-
|
|
6455
|
+
rowHeight,
|
|
5907
6456
|
pinnedStartMaxWidth,
|
|
5908
6457
|
pinnedEndMaxWidth,
|
|
5909
6458
|
pinnedStartScrollListener,
|
|
5910
6459
|
pinnedEndScrollListener
|
|
5911
6460
|
} = componentState;
|
|
5912
6461
|
const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
|
|
5913
|
-
const repaintIdRef =
|
|
6462
|
+
const repaintIdRef = useRef15(0);
|
|
5914
6463
|
if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
|
|
5915
6464
|
repaintIdRef.current++;
|
|
5916
6465
|
}
|
|
5917
6466
|
const repaintId = repaintIdRef.current;
|
|
6467
|
+
const rowSpan = useMemo10(() => {
|
|
6468
|
+
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
6469
|
+
return colsWithRowspan.length ? ({ itemIndex }) => {
|
|
6470
|
+
let maxSpan = 1;
|
|
6471
|
+
const dataArray2 = getData();
|
|
6472
|
+
const rowInfo = dataArray2[itemIndex];
|
|
6473
|
+
const data = rowInfo.data;
|
|
6474
|
+
colsWithRowspan.forEach((column) => {
|
|
6475
|
+
if (!column.rowspan) {
|
|
6476
|
+
return;
|
|
6477
|
+
}
|
|
6478
|
+
const span = column.rowspan({
|
|
6479
|
+
column,
|
|
6480
|
+
data,
|
|
6481
|
+
dataArray: dataArray2,
|
|
6482
|
+
groupRowInfo: null,
|
|
6483
|
+
rowInfo,
|
|
6484
|
+
rowIndex: itemIndex
|
|
6485
|
+
});
|
|
6486
|
+
if (span > maxSpan) {
|
|
6487
|
+
maxSpan = span;
|
|
6488
|
+
}
|
|
6489
|
+
});
|
|
6490
|
+
return maxSpan;
|
|
6491
|
+
} : void 0;
|
|
6492
|
+
}, [computedVisibleColumns]);
|
|
5918
6493
|
const { horizontalVirtualBrain, verticalVirtualBrain } = useYourBrain({
|
|
5919
6494
|
computedPinnedStartWidth: computed.computedPinnedStartWidth,
|
|
5920
6495
|
computedPinnedEndWidth: computed.computedPinnedEndWidth,
|
|
5921
6496
|
computedUnpinnedColumns: computed.computedUnpinnedColumns,
|
|
5922
6497
|
rowHeight,
|
|
5923
6498
|
dataArray,
|
|
5924
|
-
bodySize
|
|
6499
|
+
bodySize,
|
|
6500
|
+
rowSpan
|
|
5925
6501
|
});
|
|
5926
6502
|
const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
|
|
5927
6503
|
const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
5928
6504
|
const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
|
|
5929
|
-
const scrollbars =
|
|
6505
|
+
const scrollbars = useMemo10(() => ({
|
|
5930
6506
|
vertical: hasVerticalScrollbar,
|
|
5931
6507
|
horizontal: hasHorizontalScrollbar
|
|
5932
6508
|
}), [hasVerticalScrollbar, hasHorizontalScrollbar]);
|
|
5933
|
-
|
|
6509
|
+
useEffect20(() => {
|
|
5934
6510
|
if (!bodySize.height) {
|
|
5935
6511
|
return;
|
|
5936
6512
|
}
|
|
@@ -5953,7 +6529,7 @@ function useListRendering(param) {
|
|
|
5953
6529
|
const { applyScrollHorizontal, applyScrollVertical } = useOnContainerScroll({
|
|
5954
6530
|
verticalVirtualBrain,
|
|
5955
6531
|
horizontalVirtualBrain,
|
|
5956
|
-
|
|
6532
|
+
reservedContentHeight
|
|
5957
6533
|
});
|
|
5958
6534
|
const { componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
5959
6535
|
const toggleGroupRow = useCallback17((groupKeys) => {
|
|
@@ -5991,7 +6567,7 @@ function useListRendering(param) {
|
|
|
5991
6567
|
computedUnpinnedColumns
|
|
5992
6568
|
});
|
|
5993
6569
|
const [, rerender] = useRerender();
|
|
5994
|
-
|
|
6570
|
+
useEffect20(() => {
|
|
5995
6571
|
rerender();
|
|
5996
6572
|
}, [dataSourceState]);
|
|
5997
6573
|
const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
|
|
@@ -6018,9 +6594,9 @@ import {
|
|
|
6018
6594
|
createElement as createElement30,
|
|
6019
6595
|
forwardRef as forwardRef3,
|
|
6020
6596
|
useCallback as useCallback18,
|
|
6021
|
-
useRef as
|
|
6597
|
+
useRef as useRef16
|
|
6022
6598
|
} from "react";
|
|
6023
|
-
import { useEffect as
|
|
6599
|
+
import { useEffect as useEffect21 } from "react";
|
|
6024
6600
|
|
|
6025
6601
|
// src/components/utils/decamelize.ts
|
|
6026
6602
|
var import_decamelize = __toModule(require_decamelize());
|
|
@@ -6031,7 +6607,7 @@ var decamelize = (input, options) => {
|
|
|
6031
6607
|
|
|
6032
6608
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
6033
6609
|
var defaultStyle2 = {
|
|
6034
|
-
padding:
|
|
6610
|
+
padding: ThemeVars.spacing[2],
|
|
6035
6611
|
textAlign: "end",
|
|
6036
6612
|
opacity: "1",
|
|
6037
6613
|
visibility: "visible",
|
|
@@ -6057,8 +6633,8 @@ var enforceStyle = (node, style) => {
|
|
|
6057
6633
|
}
|
|
6058
6634
|
};
|
|
6059
6635
|
var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter2(props, ref) {
|
|
6060
|
-
const { rootClassName:
|
|
6061
|
-
const domRef =
|
|
6636
|
+
const { rootClassName: rootClassName12 } = useInternalProps();
|
|
6637
|
+
const domRef = useRef16(null);
|
|
6062
6638
|
const domCallback = useCallback18((node) => {
|
|
6063
6639
|
domRef.current = node;
|
|
6064
6640
|
if (!ref) {
|
|
@@ -6070,7 +6646,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
6070
6646
|
ref.current = node;
|
|
6071
6647
|
}
|
|
6072
6648
|
}, []);
|
|
6073
|
-
|
|
6649
|
+
useEffect21(() => {
|
|
6074
6650
|
const forceStyle = () => {
|
|
6075
6651
|
requestAnimationFrame(() => {
|
|
6076
6652
|
var _a;
|
|
@@ -6087,7 +6663,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
6087
6663
|
return /* @__PURE__ */ createElement30("div", __spreadProps(__spreadValues({
|
|
6088
6664
|
ref: domCallback
|
|
6089
6665
|
}, props), {
|
|
6090
|
-
className: join(`${
|
|
6666
|
+
className: join(`${rootClassName12}-Footer`, FooterCls, props.className),
|
|
6091
6667
|
style: defaultStyle2
|
|
6092
6668
|
}), "Powered by", " ", /* @__PURE__ */ createElement30("a", {
|
|
6093
6669
|
href: "https://infinite-table.com",
|
|
@@ -6098,7 +6674,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
6098
6674
|
});
|
|
6099
6675
|
|
|
6100
6676
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
6101
|
-
import { useMemo as
|
|
6677
|
+
import { useMemo as useMemo11 } from "react";
|
|
6102
6678
|
|
|
6103
6679
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
6104
6680
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -6243,12 +6819,20 @@ var decode = (licenseKey) => {
|
|
|
6243
6819
|
};
|
|
6244
6820
|
|
|
6245
6821
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
6822
|
+
var SANDBOX_REGEX = /(https):\/\/\d+\-\d+\-\d\-(sandpack\.codesandbox\.io)/g;
|
|
6823
|
+
var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
6824
|
+
var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
|
|
6825
|
+
var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
|
|
6246
6826
|
var useLicense = (licenseKey) => {
|
|
6247
|
-
const valid =
|
|
6248
|
-
|
|
6827
|
+
const valid = useMemo11(() => {
|
|
6828
|
+
let valid2 = isValidLicense(licenseKey, {
|
|
6249
6829
|
publishedAt: 1624970570587,
|
|
6250
|
-
version: "0.0.2-canary.
|
|
6830
|
+
version: "0.0.2-canary.5"
|
|
6251
6831
|
});
|
|
6832
|
+
if (!valid2 && isInsideSandbox) {
|
|
6833
|
+
return true;
|
|
6834
|
+
}
|
|
6835
|
+
return valid2;
|
|
6252
6836
|
}, [licenseKey]);
|
|
6253
6837
|
return valid;
|
|
6254
6838
|
};
|
|
@@ -6259,8 +6843,8 @@ import {
|
|
|
6259
6843
|
useCallback as useCallback19,
|
|
6260
6844
|
useLayoutEffect as useLayoutEffect5
|
|
6261
6845
|
} from "react";
|
|
6262
|
-
import { useRef as
|
|
6263
|
-
var
|
|
6846
|
+
import { useRef as useRef17 } from "react";
|
|
6847
|
+
var error2 = err("CSSVariableWatch");
|
|
6264
6848
|
var debug5 = dbg("CSSVariableWatch");
|
|
6265
6849
|
var WRAPPER_STYLE = {
|
|
6266
6850
|
position: "absolute",
|
|
@@ -6272,7 +6856,7 @@ var WRAPPER_STYLE = {
|
|
|
6272
6856
|
overflow: "hidden"
|
|
6273
6857
|
};
|
|
6274
6858
|
var useCSSVariableWatch = (params) => {
|
|
6275
|
-
const lastValueRef =
|
|
6859
|
+
const lastValueRef = useRef17(0);
|
|
6276
6860
|
const onResize = useCallback19(({ height }) => {
|
|
6277
6861
|
if (height && height !== lastValueRef.current) {
|
|
6278
6862
|
lastValueRef.current = height;
|
|
@@ -6287,12 +6871,12 @@ var useCSSVariableWatch = (params) => {
|
|
|
6287
6871
|
debug5(`Variable ${params.varName} found and equals ${value}.`);
|
|
6288
6872
|
params.onChange(value);
|
|
6289
6873
|
} else {
|
|
6290
|
-
|
|
6874
|
+
error2(`Specified variable ${params.varName} not found or does not have a numeric value.`);
|
|
6291
6875
|
}
|
|
6292
6876
|
}, []);
|
|
6293
6877
|
};
|
|
6294
6878
|
var CSSVariableWatch = (props) => {
|
|
6295
|
-
const domRef =
|
|
6879
|
+
const domRef = useRef17(null);
|
|
6296
6880
|
useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
|
|
6297
6881
|
ref: domRef
|
|
6298
6882
|
}));
|
|
@@ -6303,11 +6887,121 @@ var CSSVariableWatch = (props) => {
|
|
|
6303
6887
|
}, /* @__PURE__ */ createElement31("div", {
|
|
6304
6888
|
ref: domRef,
|
|
6305
6889
|
style: {
|
|
6306
|
-
height: `var(${props.varName})`
|
|
6890
|
+
height: props.varName.startsWith("var(") ? props.varName : `var(${props.varName})`
|
|
6307
6891
|
}
|
|
6308
6892
|
}));
|
|
6309
6893
|
};
|
|
6310
6894
|
|
|
6895
|
+
// src/components/InfiniteTable/hooks/useDOMProps.ts
|
|
6896
|
+
function useDOMProps(initialDOMProps) {
|
|
6897
|
+
const { computed, componentState, componentActions } = useInfiniteTable();
|
|
6898
|
+
const {
|
|
6899
|
+
columnShifts,
|
|
6900
|
+
focused,
|
|
6901
|
+
focusedWithin,
|
|
6902
|
+
domRef,
|
|
6903
|
+
onBlurWithin,
|
|
6904
|
+
onFocusWithin,
|
|
6905
|
+
onSelfFocus,
|
|
6906
|
+
onSelfBlur
|
|
6907
|
+
} = componentState;
|
|
6908
|
+
const { computedPinnedStartColumnsWidth, computedPinnedEndColumnsWidth } = computed;
|
|
6909
|
+
const setFocused = rafFn((focused2) => {
|
|
6910
|
+
componentActions.focused = focused2;
|
|
6911
|
+
});
|
|
6912
|
+
const setFocusedWithin = rafFn((focused2) => {
|
|
6913
|
+
componentActions.focusedWithin = focused2;
|
|
6914
|
+
});
|
|
6915
|
+
const onFocus = (event) => {
|
|
6916
|
+
var _a;
|
|
6917
|
+
(_a = initialDOMProps == null ? void 0 : initialDOMProps.onFocus) == null ? void 0 : _a.call(initialDOMProps, event);
|
|
6918
|
+
if (event.target === domRef.current) {
|
|
6919
|
+
setFocused(true);
|
|
6920
|
+
onSelfFocus == null ? void 0 : onSelfFocus(event);
|
|
6921
|
+
if (focusedWithin) {
|
|
6922
|
+
setFocusedWithin(false);
|
|
6923
|
+
onBlurWithin == null ? void 0 : onBlurWithin(event);
|
|
6924
|
+
}
|
|
6925
|
+
} else {
|
|
6926
|
+
if (!focusedWithin) {
|
|
6927
|
+
setFocusedWithin(true);
|
|
6928
|
+
onFocusWithin == null ? void 0 : onFocusWithin(event);
|
|
6929
|
+
}
|
|
6930
|
+
}
|
|
6931
|
+
};
|
|
6932
|
+
const onBlur = (event) => {
|
|
6933
|
+
var _a, _b;
|
|
6934
|
+
(_a = initialDOMProps == null ? void 0 : initialDOMProps.onBlur) == null ? void 0 : _a.call(initialDOMProps, event);
|
|
6935
|
+
if (event.target === domRef.current) {
|
|
6936
|
+
setFocused(false);
|
|
6937
|
+
onSelfBlur == null ? void 0 : onSelfBlur(event);
|
|
6938
|
+
if (focusedWithin) {
|
|
6939
|
+
setFocusedWithin(false);
|
|
6940
|
+
onBlurWithin == null ? void 0 : onBlurWithin(event);
|
|
6941
|
+
}
|
|
6942
|
+
} else {
|
|
6943
|
+
const contained = (_b = domRef.current) == null ? void 0 : _b.contains(event.relatedTarget);
|
|
6944
|
+
if (!contained) {
|
|
6945
|
+
setFocusedWithin(false);
|
|
6946
|
+
onBlurWithin == null ? void 0 : onBlurWithin(event);
|
|
6947
|
+
}
|
|
6948
|
+
}
|
|
6949
|
+
};
|
|
6950
|
+
const domProps = __spreadProps(__spreadValues({
|
|
6951
|
+
tabIndex: 0
|
|
6952
|
+
}, initialDOMProps), {
|
|
6953
|
+
onFocus,
|
|
6954
|
+
onBlur
|
|
6955
|
+
});
|
|
6956
|
+
const className = join(InfiniteTableClassName, InfiniteCls, columnShifts ? `${InfiniteClsShiftingColumns} ${InfiniteTableClassName}--shifting` : "", domProps == null ? void 0 : domProps.className, computedPinnedStartColumnsWidth ? `${InfiniteTableClassName}--has-pinned-start` : null, computedPinnedEndColumnsWidth ? `${InfiniteTableClassName}--has-pinned-end` : null, focused ? `${InfiniteTableClassName}--focused` : null, focusedWithin ? `${InfiniteTableClassName}--focused-within` : null, focused && componentState.focusedClassName ? componentState.focusedClassName : null, focusedWithin && componentState.focusedWithinClassName ? componentState.focusedWithinClassName : null, computed.computedPinnedStartOverflow ? `${InfiniteTableClassName}--has-pinned-start-overflow` : null, computed.computedPinnedEndOverflow ? `${InfiniteTableClassName}--has-pinned-end-overflow` : null, InfiniteClsRecipe({
|
|
6957
|
+
hasPinnedStart: !!computedPinnedStartColumnsWidth,
|
|
6958
|
+
hasPinnedEnd: !!computedPinnedEndColumnsWidth,
|
|
6959
|
+
hasPinnedStartOverflow: !!computed.computedPinnedStartOverflow,
|
|
6960
|
+
hasPinnedEndOverflow: !!computed.computedPinnedEndOverflow,
|
|
6961
|
+
focused,
|
|
6962
|
+
focusedWithin
|
|
6963
|
+
}));
|
|
6964
|
+
domProps.className = className;
|
|
6965
|
+
domProps.style = __spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style);
|
|
6966
|
+
if (focused) {
|
|
6967
|
+
if (componentState.focusedStyle) {
|
|
6968
|
+
Object.assign(domProps.style, componentState.focusedStyle);
|
|
6969
|
+
}
|
|
6970
|
+
}
|
|
6971
|
+
if (focusedWithin) {
|
|
6972
|
+
if (componentState.focusedWithinStyle) {
|
|
6973
|
+
Object.assign(domProps.style, componentState.focusedWithinStyle);
|
|
6974
|
+
}
|
|
6975
|
+
}
|
|
6976
|
+
return domProps;
|
|
6977
|
+
}
|
|
6978
|
+
|
|
6979
|
+
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
6980
|
+
import {
|
|
6981
|
+
createElement as createElement32,
|
|
6982
|
+
memo as memo12
|
|
6983
|
+
} from "react";
|
|
6984
|
+
|
|
6985
|
+
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
6986
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwp _16lm1iwr _16lm1iwv _16lm1iwt", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwp _16lm1iwr _16lm1iwv _16lm1iwt" };
|
|
6987
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwp _16lm1iwr _16lm1iwv _16lm1iwt";
|
|
6988
|
+
var LoadMaskTextCls = "qy58ya4";
|
|
6989
|
+
|
|
6990
|
+
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
6991
|
+
var { rootClassName: rootClassName11 } = internalProps;
|
|
6992
|
+
var baseCls2 = `${rootClassName11}-LoadMask`;
|
|
6993
|
+
function LoadMaskFn(props) {
|
|
6994
|
+
const { visible, children = "Loading" } = props;
|
|
6995
|
+
return /* @__PURE__ */ createElement32("div", {
|
|
6996
|
+
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls2}`
|
|
6997
|
+
}, /* @__PURE__ */ createElement32("div", {
|
|
6998
|
+
className: `${LoadMaskOverlayCls} ${baseCls2}-Overlay`
|
|
6999
|
+
}), /* @__PURE__ */ createElement32("div", {
|
|
7000
|
+
className: `${LoadMaskTextCls} ${baseCls2}-Text`
|
|
7001
|
+
}, children));
|
|
7002
|
+
}
|
|
7003
|
+
var LoadMask = memo12(LoadMaskFn);
|
|
7004
|
+
|
|
6311
7005
|
// src/components/InfiniteTable/index.tsx
|
|
6312
7006
|
var InfiniteTableClassName = internalProps.rootClassName;
|
|
6313
7007
|
var ONLY_VERTICAL_SCROLLBAR = {
|
|
@@ -6315,26 +7009,33 @@ var ONLY_VERTICAL_SCROLLBAR = {
|
|
|
6315
7009
|
vertical: true
|
|
6316
7010
|
};
|
|
6317
7011
|
var InfiniteTableRoot = getComponentStateRoot({
|
|
6318
|
-
|
|
6319
|
-
|
|
7012
|
+
initSetupState,
|
|
7013
|
+
forwardProps,
|
|
7014
|
+
mapPropsToState,
|
|
7015
|
+
allowedControlledPropOverrides: {
|
|
7016
|
+
rowHeight: true,
|
|
7017
|
+
headerHeight: true
|
|
7018
|
+
},
|
|
6320
7019
|
getParentState: () => useDataSource()
|
|
6321
7020
|
});
|
|
6322
|
-
var InfiniteTableComponent =
|
|
7021
|
+
var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
7022
|
+
var _a;
|
|
6323
7023
|
const { componentState, getComputed, computed } = useInfiniteTable();
|
|
6324
7024
|
const {
|
|
6325
|
-
componentState: { dataArray }
|
|
7025
|
+
componentState: { dataArray, loading }
|
|
6326
7026
|
} = useDataSourceContextValue();
|
|
6327
7027
|
const {
|
|
6328
7028
|
domRef,
|
|
6329
|
-
|
|
7029
|
+
scrollerDOMRef,
|
|
6330
7030
|
portalDOMRef,
|
|
6331
|
-
domProps,
|
|
6332
7031
|
licenseKey,
|
|
7032
|
+
loadingText,
|
|
6333
7033
|
header,
|
|
6334
|
-
|
|
6335
|
-
|
|
7034
|
+
onRowHeightCSSVarChange,
|
|
7035
|
+
onHeaderHeightCSSVarChange,
|
|
6336
7036
|
rowHeightCSSVar,
|
|
6337
|
-
headerHeightCSSVar
|
|
7037
|
+
headerHeightCSSVar,
|
|
7038
|
+
components
|
|
6338
7039
|
} = componentState;
|
|
6339
7040
|
const { columnShifts, bodySize } = componentState;
|
|
6340
7041
|
const {
|
|
@@ -6356,39 +7057,40 @@ var InfiniteTableComponent = memo12(function InfiniteTableComponent2() {
|
|
|
6356
7057
|
computed
|
|
6357
7058
|
});
|
|
6358
7059
|
const licenseValid = useLicense(licenseKey);
|
|
6359
|
-
const
|
|
6360
|
-
|
|
7060
|
+
const domProps = useDOMProps(componentState.domProps);
|
|
7061
|
+
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
7062
|
+
return /* @__PURE__ */ createElement33("div", __spreadValues({
|
|
6361
7063
|
ref: domRef
|
|
6362
|
-
}, domProps), {
|
|
6363
|
-
className
|
|
6364
|
-
}), header ? /* @__PURE__ */ createElement32(TableHeaderWrapper, {
|
|
7064
|
+
}, domProps), header ? /* @__PURE__ */ createElement33(TableHeaderWrapper, {
|
|
6365
7065
|
brain: horizontalVirtualBrain,
|
|
6366
7066
|
repaintId,
|
|
6367
7067
|
scrollbars
|
|
6368
|
-
}) : null, /* @__PURE__ */
|
|
6369
|
-
ref:
|
|
7068
|
+
}) : null, /* @__PURE__ */ createElement33(InfiniteTableBody, null, /* @__PURE__ */ createElement33(VirtualScrollContainer, {
|
|
7069
|
+
ref: scrollerDOMRef,
|
|
6370
7070
|
onContainerScroll: applyScrollVertical,
|
|
6371
7071
|
scrollable: ONLY_VERTICAL_SCROLLBAR
|
|
6372
|
-
}, /* @__PURE__ */
|
|
6373
|
-
className:
|
|
6374
|
-
}, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */
|
|
7072
|
+
}, /* @__PURE__ */ createElement33("div", {
|
|
7073
|
+
className: display.flex
|
|
7074
|
+
}, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ createElement33(SpacePlaceholder, {
|
|
6375
7075
|
count: dataArray.length,
|
|
6376
7076
|
width: 0,
|
|
6377
7077
|
height: reservedContentHeight
|
|
6378
|
-
})), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder
|
|
7078
|
+
})), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder, /* @__PURE__ */ createElement33(LoadMaskCmp, {
|
|
7079
|
+
visible: loading
|
|
7080
|
+
}, loadingText)), licenseValid ? null : /* @__PURE__ */ createElement33(InfiniteTableLicenseFooter, null), /* @__PURE__ */ createElement33("div", {
|
|
6379
7081
|
ref: portalDOMRef,
|
|
6380
|
-
className:
|
|
6381
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
7082
|
+
className: join(`${rootClassName}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
7083
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ createElement33(CSSVariableWatch, {
|
|
6382
7084
|
varName: rowHeightCSSVar,
|
|
6383
|
-
onChange:
|
|
6384
|
-
}) : null, headerHeightCSSVar ? /* @__PURE__ */
|
|
7085
|
+
onChange: onRowHeightCSSVarChange
|
|
7086
|
+
}) : null, headerHeightCSSVar ? /* @__PURE__ */ createElement33(CSSVariableWatch, {
|
|
6385
7087
|
varName: headerHeightCSSVar,
|
|
6386
|
-
onChange:
|
|
7088
|
+
onChange: onHeaderHeightCSSVarChange
|
|
6387
7089
|
}) : null);
|
|
6388
7090
|
});
|
|
6389
7091
|
function InfiniteTableContextProvider() {
|
|
6390
7092
|
const { componentActions, componentState } = useComponentState();
|
|
6391
|
-
const {
|
|
7093
|
+
const { scrollerDOMRef } = componentState;
|
|
6392
7094
|
const computed = useComputed();
|
|
6393
7095
|
const getComputed = useLatest(computed);
|
|
6394
7096
|
const getState = useLatest(componentState);
|
|
@@ -6403,14 +7105,13 @@ function InfiniteTableContextProvider() {
|
|
|
6403
7105
|
getComputed,
|
|
6404
7106
|
getState
|
|
6405
7107
|
};
|
|
6406
|
-
useResizeObserver(
|
|
7108
|
+
useResizeObserver(scrollerDOMRef, (size) => {
|
|
6407
7109
|
var _a, _b;
|
|
6408
7110
|
const bodySize = {
|
|
6409
7111
|
width: size.width,
|
|
6410
7112
|
height: size.height
|
|
6411
7113
|
};
|
|
6412
|
-
bodySize.width = (_b = (_a =
|
|
6413
|
-
bodySizeRef.current = bodySize;
|
|
7114
|
+
bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
|
|
6414
7115
|
const state = getState();
|
|
6415
7116
|
if (!state.virtualizeHeader) {
|
|
6416
7117
|
componentActions.bodySize = bodySize;
|
|
@@ -6418,23 +7119,24 @@ function InfiniteTableContextProvider() {
|
|
|
6418
7119
|
}
|
|
6419
7120
|
componentActions.bodySize = bodySize;
|
|
6420
7121
|
}, { earlyAttach: true });
|
|
6421
|
-
|
|
7122
|
+
useEffect22(() => {
|
|
6422
7123
|
return () => {
|
|
6423
|
-
componentState.
|
|
6424
|
-
componentState.
|
|
7124
|
+
componentState.onRowHeightCSSVarChange.destroy();
|
|
7125
|
+
componentState.onHeaderHeightCSSVarChange.destroy();
|
|
6425
7126
|
};
|
|
6426
7127
|
}, []);
|
|
6427
7128
|
const TableContext2 = getInfiniteTableContext();
|
|
6428
|
-
return /* @__PURE__ */
|
|
7129
|
+
return /* @__PURE__ */ createElement33(TableContext2.Provider, {
|
|
6429
7130
|
value: contextValue
|
|
6430
|
-
}, /* @__PURE__ */
|
|
7131
|
+
}, /* @__PURE__ */ createElement33(InfiniteTableComponent, null));
|
|
6431
7132
|
}
|
|
6432
7133
|
function InfiniteTable(props) {
|
|
6433
|
-
|
|
7134
|
+
const table = /* @__PURE__ */ createElement33(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ createElement33(InfiniteTableContextProvider, null));
|
|
7135
|
+
return /* @__PURE__ */ createElement33(StrictMode, null, table);
|
|
6434
7136
|
}
|
|
6435
7137
|
InfiniteTable.defaultProps = {
|
|
6436
7138
|
rowHeight: 40,
|
|
6437
|
-
headerHeight:
|
|
7139
|
+
headerHeight: ThemeVars.components.Header.height
|
|
6438
7140
|
};
|
|
6439
7141
|
export {
|
|
6440
7142
|
DataSource,
|
|
@@ -6446,6 +7148,7 @@ export {
|
|
|
6446
7148
|
flatten,
|
|
6447
7149
|
getComponentStateRoot,
|
|
6448
7150
|
group,
|
|
7151
|
+
interceptMap,
|
|
6449
7152
|
useComponentState,
|
|
6450
7153
|
useDataSource
|
|
6451
7154
|
};
|