@infinite-table/infinite-react 0.0.2-canary.2 → 0.0.2-canary.3
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 +388 -354
- package/index.d.ts +1149 -293
- package/index.esm.css +498 -0
- package/index.esm.js +1635 -936
- package/index.js +1661 -972
- package/package.json +2 -2
- package/tmp.css.map +1 -0
- package/index.css.map +0 -1
package/index.js
CHANGED
|
@@ -470,14 +470,14 @@ var require_browser = __commonJS({
|
|
|
470
470
|
} else {
|
|
471
471
|
exports.storage.removeItem("debug");
|
|
472
472
|
}
|
|
473
|
-
} catch (
|
|
473
|
+
} catch (error3) {
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
476
|
function load() {
|
|
477
477
|
let r;
|
|
478
478
|
try {
|
|
479
479
|
r = exports.storage.getItem("debug");
|
|
480
|
-
} catch (
|
|
480
|
+
} catch (error3) {
|
|
481
481
|
}
|
|
482
482
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
483
483
|
r = process.env.DEBUG;
|
|
@@ -487,7 +487,7 @@ var require_browser = __commonJS({
|
|
|
487
487
|
function localstorage() {
|
|
488
488
|
try {
|
|
489
489
|
return localStorage;
|
|
490
|
-
} catch (
|
|
490
|
+
} catch (error3) {
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
module2.exports = require_common()(exports);
|
|
@@ -495,8 +495,8 @@ var require_browser = __commonJS({
|
|
|
495
495
|
formatters.j = function(v) {
|
|
496
496
|
try {
|
|
497
497
|
return JSON.stringify(v);
|
|
498
|
-
} catch (
|
|
499
|
-
return "[UnexpectedJSONParseError]: " +
|
|
498
|
+
} catch (error3) {
|
|
499
|
+
return "[UnexpectedJSONParseError]: " + error3.message;
|
|
500
500
|
}
|
|
501
501
|
};
|
|
502
502
|
}
|
|
@@ -585,13 +585,10 @@ __export(exports, {
|
|
|
585
585
|
});
|
|
586
586
|
|
|
587
587
|
// src/components/InfiniteTable/index.tsx
|
|
588
|
-
var
|
|
589
|
-
|
|
590
|
-
// src/utils/join.ts
|
|
591
|
-
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
588
|
+
var React36 = __toModule(require("react"));
|
|
592
589
|
|
|
593
590
|
// src/components/InfiniteTable/internalProps.ts
|
|
594
|
-
var rootClassName = "
|
|
591
|
+
var rootClassName = "Infinite";
|
|
595
592
|
var internalProps = {
|
|
596
593
|
rootClassName
|
|
597
594
|
};
|
|
@@ -633,19 +630,6 @@ function buildSubscriptionCallback() {
|
|
|
633
630
|
return updater;
|
|
634
631
|
}
|
|
635
632
|
|
|
636
|
-
// src/components/utils/isControlledValue.ts
|
|
637
|
-
function isControlledValue(value) {
|
|
638
|
-
const controlled = value !== void 0;
|
|
639
|
-
return controlled;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
// src/components/utils/isControlled.ts
|
|
643
|
-
function isControlled(propName, props) {
|
|
644
|
-
const propValue = props[propName];
|
|
645
|
-
const controlled = isControlledValue(propValue);
|
|
646
|
-
return controlled;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
633
|
// src/components/VirtualBrain/ScrollListener.ts
|
|
650
634
|
var initialScrollPosition = {
|
|
651
635
|
scrollLeft: 0,
|
|
@@ -704,25 +688,15 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
704
688
|
}
|
|
705
689
|
|
|
706
690
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
707
|
-
function
|
|
708
|
-
|
|
709
|
-
const { props } = params;
|
|
710
|
-
const columnGroups = (_a = isControlled("columnGroups", props) ? props.columnGroups : props.defaultColumnGroups) != null ? _a : new Map();
|
|
711
|
-
const pivotColumnGroups = props.pivotColumnGroups;
|
|
712
|
-
const collapsedColumnGroups = (_b = isControlled("collapsedColumnGroups", props) ? props.collapsedColumnGroups : props.defaultCollapsedColumnGroups) != null ? _b : new Map();
|
|
713
|
-
const computedColumnGroups = pivotColumnGroups || columnGroups;
|
|
714
|
-
const columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
715
|
-
const generatedColumns = new Map();
|
|
716
|
-
const pivotColumns = props.pivotColumns;
|
|
691
|
+
function initSetupState() {
|
|
692
|
+
const columnsGeneratedForGrouping = new Map();
|
|
717
693
|
return {
|
|
718
|
-
|
|
719
|
-
headerHeight: typeof props.headerHeight === "number" ? props.headerHeight : 0,
|
|
694
|
+
columnShifts: null,
|
|
720
695
|
domRef: (0, import_react2.createRef)(),
|
|
721
|
-
|
|
696
|
+
scrollerDOMRef: (0, import_react2.createRef)(),
|
|
722
697
|
portalDOMRef: (0, import_react2.createRef)(),
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
onHeaderHeightChange: buildSubscriptionCallback(),
|
|
698
|
+
onRowHeightCSSVarChange: buildSubscriptionCallback(),
|
|
699
|
+
onHeaderHeightCSSVarChange: buildSubscriptionCallback(),
|
|
726
700
|
bodySize: {
|
|
727
701
|
width: 0,
|
|
728
702
|
height: 0
|
|
@@ -731,65 +705,105 @@ function getInitialState(params) {
|
|
|
731
705
|
scrollTop: 0,
|
|
732
706
|
scrollLeft: 0
|
|
733
707
|
},
|
|
708
|
+
focused: false,
|
|
709
|
+
focusedWithin: false,
|
|
710
|
+
columnsWhenGrouping: columnsGeneratedForGrouping,
|
|
734
711
|
draggingColumnId: null,
|
|
735
|
-
columns: props.columns,
|
|
736
|
-
pivotColumns,
|
|
737
|
-
pivotColumnGroups,
|
|
738
|
-
generatedColumns,
|
|
739
|
-
columnOrder: (_c = isControlled("columnOrder", props) ? props.columnOrder : props.defaultColumnOrder) != null ? _c : true,
|
|
740
|
-
computedColumnGroups,
|
|
741
712
|
pinnedStartScrollListener: new ScrollListener(),
|
|
742
713
|
pinnedEndScrollListener: new ScrollListener(),
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
714
|
+
computedPivotColumns: void 0,
|
|
715
|
+
columnsWhenInlineGroupRenderStrategy: void 0
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
var forwardProps = () => {
|
|
719
|
+
return {
|
|
720
|
+
columns: 1,
|
|
721
|
+
components: 1,
|
|
722
|
+
loadingText: 1,
|
|
723
|
+
pivotColumns: 1,
|
|
724
|
+
groupColumn: 1,
|
|
725
|
+
onReady: 1,
|
|
726
|
+
domProps: 1,
|
|
727
|
+
focusedClassName: 1,
|
|
728
|
+
focusedWithinClassName: 1,
|
|
729
|
+
focusedStyle: 1,
|
|
730
|
+
focusedWithinStyle: 1,
|
|
731
|
+
onSelfFocus: 1,
|
|
732
|
+
onFocusWithin: 1,
|
|
733
|
+
onSelfBlur: 1,
|
|
734
|
+
onBlurWithin: 1,
|
|
735
|
+
onScrollToTop: 1,
|
|
736
|
+
onScrollToBottom: 1,
|
|
737
|
+
scrollToBottomOffset: 1,
|
|
738
|
+
rowStyle: 1,
|
|
739
|
+
rowProps: 1,
|
|
740
|
+
rowClassName: 1,
|
|
741
|
+
pinnedStartMaxWidth: 1,
|
|
742
|
+
pinnedEndMaxWidth: 1,
|
|
743
|
+
pivotColumn: 1,
|
|
744
|
+
pivotRowLabelsColumn: 1,
|
|
745
|
+
pivotColumnGroups: 1,
|
|
746
|
+
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
747
|
+
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
748
|
+
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
749
|
+
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 300,
|
|
750
|
+
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
751
|
+
sortable: (sortable) => sortable != null ? sortable : true,
|
|
752
|
+
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
753
|
+
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
754
|
+
licenseKey: (licenseKey) => licenseKey || globalThis.InfiniteTableLicenseKey || "",
|
|
755
|
+
columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
|
|
756
|
+
header: (header) => header != null ? header : true,
|
|
757
|
+
showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
|
|
758
|
+
showHoverRows: (showHoverRows) => showHoverRows != null ? showHoverRows : true,
|
|
759
|
+
virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
|
|
760
|
+
rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
|
|
761
|
+
headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
|
|
762
|
+
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : new Map(),
|
|
763
|
+
columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
|
|
764
|
+
columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
|
|
765
|
+
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
766
|
+
columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
|
|
752
767
|
};
|
|
768
|
+
};
|
|
769
|
+
function getGroupRenderStrategy(options) {
|
|
770
|
+
const { groupRowsBy, groupColumn, groupRenderStrategy } = options;
|
|
771
|
+
if (groupRenderStrategy) {
|
|
772
|
+
return groupRenderStrategy;
|
|
773
|
+
}
|
|
774
|
+
if (groupColumn != null && typeof groupColumn === "object") {
|
|
775
|
+
return "single-column";
|
|
776
|
+
}
|
|
777
|
+
const columnsInGroupRowsBy = groupRowsBy.filter((g) => g.column);
|
|
778
|
+
if (columnsInGroupRowsBy.length) {
|
|
779
|
+
return "multi-column";
|
|
780
|
+
}
|
|
781
|
+
return "multi-column";
|
|
753
782
|
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
const {
|
|
757
|
-
const virtualizeColumns = (_a = props.virtualizeColumns) != null ? _a : true;
|
|
758
|
-
const header = (_b = props.header) != null ? _b : true;
|
|
783
|
+
var mapPropsToState = (params) => {
|
|
784
|
+
const { props, state, oldState, parentState } = params;
|
|
785
|
+
const { virtualizeColumns, header } = state;
|
|
759
786
|
const computedColumnGroups = state.pivotColumnGroups || state.columnGroups;
|
|
760
787
|
const virtualizeHeader = header && virtualizeColumns && (!computedColumnGroups || (computedColumnGroups == null ? void 0 : computedColumnGroups.size) === 0);
|
|
761
|
-
const columnGroupsDepthsMap = (
|
|
762
|
-
const
|
|
788
|
+
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;
|
|
789
|
+
const groupRowsBy = parentState == null ? void 0 : parentState.groupRowsBy;
|
|
790
|
+
const groupRenderStrategy = getGroupRenderStrategy({
|
|
791
|
+
groupRenderStrategy: props.groupRenderStrategy,
|
|
792
|
+
groupRowsBy,
|
|
793
|
+
groupColumn: props.groupColumn
|
|
794
|
+
});
|
|
763
795
|
return {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
showZebraRows: (_d = props.showZebraRows) != null ? _d : true,
|
|
768
|
-
virtualizeColumns,
|
|
796
|
+
groupRenderStrategy,
|
|
797
|
+
groupRowsBy,
|
|
798
|
+
computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || props.columns,
|
|
769
799
|
virtualizeHeader,
|
|
770
|
-
header,
|
|
771
|
-
rowStyle: props.rowStyle,
|
|
772
|
-
rowProps: props.rowProps,
|
|
773
|
-
rowClassName: props.rowClassName,
|
|
774
|
-
pinnedStartMaxWidth: props.pinnedStartMaxWidth,
|
|
775
|
-
pinnedEndMaxWidth: props.pinnedEndMaxWidth,
|
|
776
|
-
groupRenderStrategy: (_e = props.groupRenderStrategy) != null ? _e : "multi-column",
|
|
777
|
-
pivotTotalColumnPosition,
|
|
778
|
-
columnMinWidth: (_f = props.columnMinWidth) != null ? _f : 30,
|
|
779
|
-
columnMaxWidth: (_g = props.columnMaxWidth) != null ? _g : 2e3,
|
|
780
|
-
columnDefaultWidth: (_h = props.columnDefaultWidth) != null ? _h : 300,
|
|
781
|
-
draggableColumns: (_i = props.draggableColumns) != null ? _i : true,
|
|
782
|
-
pivotColumn: props.pivotColumn,
|
|
783
|
-
pivotRowLabelsColumn: props.pivotRowLabelsColumn,
|
|
784
|
-
sortable: (_j = props.sortable) != null ? _j : true,
|
|
785
800
|
columnGroupsDepthsMap,
|
|
786
|
-
columnGroupsMaxDepth: Math.max(...columnGroupsDepthsMap.values(), 0),
|
|
801
|
+
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
787
802
|
computedColumnGroups,
|
|
788
|
-
licenseKey: props.licenseKey || globalThis.InfiniteTableLicenseKey || "",
|
|
789
803
|
rowHeightCSSVar: typeof props.rowHeight === "string" ? props.rowHeight : "",
|
|
790
|
-
headerHeightCSSVar: typeof props.headerHeight === "string" ? props.headerHeight : ""
|
|
804
|
+
headerHeightCSSVar: typeof props.headerHeight === "string" ? props.headerHeight || "--ITableHeader__height" : ""
|
|
791
805
|
};
|
|
792
|
-
}
|
|
806
|
+
};
|
|
793
807
|
|
|
794
808
|
// src/components/ResizeObserver/index.tsx
|
|
795
809
|
var React = __toModule(require("react"));
|
|
@@ -1050,10 +1064,34 @@ var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
|
|
|
1050
1064
|
return columnOrder;
|
|
1051
1065
|
};
|
|
1052
1066
|
|
|
1053
|
-
// src/
|
|
1054
|
-
var
|
|
1055
|
-
|
|
1067
|
+
// src/utils/debug.ts
|
|
1068
|
+
var debug = require_browser();
|
|
1069
|
+
var debugTable = debug(`InfiniteTable`);
|
|
1070
|
+
var dbg = (channelName) => {
|
|
1071
|
+
const result = debugTable.extend(channelName);
|
|
1072
|
+
result.log = console.log.bind(console);
|
|
1073
|
+
return result;
|
|
1074
|
+
};
|
|
1075
|
+
var err = (channelName) => {
|
|
1076
|
+
const result = debugTable.extend(`${channelName}:error`);
|
|
1077
|
+
result.log = console.error.bind(console);
|
|
1078
|
+
return result;
|
|
1079
|
+
};
|
|
1080
|
+
var emptyLogFn = () => emptyLogFn;
|
|
1081
|
+
emptyLogFn.extend = () => emptyLogFn;
|
|
1082
|
+
var Logger = class {
|
|
1083
|
+
constructor(channelName) {
|
|
1084
|
+
this.debug = emptyLogFn;
|
|
1085
|
+
this.error = emptyLogFn;
|
|
1086
|
+
if (false) {
|
|
1087
|
+
this.debug = dbg(channelName);
|
|
1088
|
+
this.error = err(channelName);
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1056
1091
|
};
|
|
1092
|
+
|
|
1093
|
+
// src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
|
|
1094
|
+
var error = err("getComputedVisibleColumns");
|
|
1057
1095
|
var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
|
|
1058
1096
|
return !columnVisibility.has(colId) || columnVisibility.get(colId) !== false;
|
|
1059
1097
|
};
|
|
@@ -1064,7 +1102,6 @@ var getComputedPinned = (colId, columnPinning) => {
|
|
|
1064
1102
|
};
|
|
1065
1103
|
var getComputedVisibleColumns = ({
|
|
1066
1104
|
columns,
|
|
1067
|
-
generatedColumns,
|
|
1068
1105
|
bodySize,
|
|
1069
1106
|
columnMinWidth,
|
|
1070
1107
|
columnMaxWidth,
|
|
@@ -1082,15 +1119,12 @@ var getComputedVisibleColumns = ({
|
|
|
1082
1119
|
columnVisibilityAssumeVisible
|
|
1083
1120
|
}) => {
|
|
1084
1121
|
let computedOffset = 0;
|
|
1085
|
-
const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ?
|
|
1122
|
+
const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
|
|
1086
1123
|
const visibleColumnOrder = normalizedColumnOrder.filter(isColumnVisible.bind(null, columnVisibility, columnVisibilityAssumeVisible));
|
|
1087
1124
|
const columnsArray = visibleColumnOrder.map((columnId) => {
|
|
1088
1125
|
let col = columns.get(columnId);
|
|
1089
1126
|
if (!col) {
|
|
1090
|
-
|
|
1091
|
-
if (!col && !IS_GROUP_COLUMN_ID(columnId)) {
|
|
1092
|
-
throw `Column with id "${columnId}" specified in columnOrder array cannot be found in the columns map.`;
|
|
1093
|
-
}
|
|
1127
|
+
error(`Column with id "${columnId}" specified in columnOrder array cannot be found in the columns map.`);
|
|
1094
1128
|
}
|
|
1095
1129
|
return col;
|
|
1096
1130
|
}).filter(Boolean);
|
|
@@ -1334,13 +1368,13 @@ function interceptMap(map, fns) {
|
|
|
1334
1368
|
// src/components/InfiniteTable/utils/rafFn.ts
|
|
1335
1369
|
var rafFn = (fn) => {
|
|
1336
1370
|
let rafId = 0;
|
|
1337
|
-
return () => {
|
|
1371
|
+
return (...args) => {
|
|
1338
1372
|
if (rafId) {
|
|
1339
1373
|
cancelAnimationFrame(rafId);
|
|
1340
1374
|
}
|
|
1341
1375
|
rafId = requestAnimationFrame(() => {
|
|
1342
1376
|
rafId = 0;
|
|
1343
|
-
fn();
|
|
1377
|
+
fn(...args);
|
|
1344
1378
|
});
|
|
1345
1379
|
};
|
|
1346
1380
|
};
|
|
@@ -1362,7 +1396,6 @@ var useRerenderOnKeyChange = (map) => {
|
|
|
1362
1396
|
// src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
|
|
1363
1397
|
var useComputedVisibleColumns = ({
|
|
1364
1398
|
columns,
|
|
1365
|
-
generatedColumns,
|
|
1366
1399
|
bodySize,
|
|
1367
1400
|
columnMinWidth,
|
|
1368
1401
|
columnMaxWidth,
|
|
@@ -1400,7 +1433,6 @@ var useComputedVisibleColumns = ({
|
|
|
1400
1433
|
} = (0, import_react8.useMemo)(() => {
|
|
1401
1434
|
return getComputedVisibleColumns({
|
|
1402
1435
|
columns,
|
|
1403
|
-
generatedColumns,
|
|
1404
1436
|
bodySize,
|
|
1405
1437
|
columnMinWidth,
|
|
1406
1438
|
columnMaxWidth,
|
|
@@ -1419,7 +1451,6 @@ var useComputedVisibleColumns = ({
|
|
|
1419
1451
|
});
|
|
1420
1452
|
}, [
|
|
1421
1453
|
columns,
|
|
1422
|
-
generatedColumns,
|
|
1423
1454
|
bodySize.width,
|
|
1424
1455
|
columnMinWidth,
|
|
1425
1456
|
columnMaxWidth,
|
|
@@ -1462,7 +1493,7 @@ var useComputedVisibleColumns = ({
|
|
|
1462
1493
|
var sortAscending = (a, b) => a - b;
|
|
1463
1494
|
|
|
1464
1495
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
1465
|
-
var
|
|
1496
|
+
var import_react19 = __toModule(require("react"));
|
|
1466
1497
|
|
|
1467
1498
|
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
1468
1499
|
var import_react12 = __toModule(require("react"));
|
|
@@ -1495,44 +1526,53 @@ function useDataSourceActions() {
|
|
|
1495
1526
|
var React4 = __toModule(require("react"));
|
|
1496
1527
|
var import_react11 = __toModule(require("react"));
|
|
1497
1528
|
|
|
1498
|
-
// src/utils/
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
var Logger = class {
|
|
1514
|
-
constructor(channelName) {
|
|
1515
|
-
this.debug = emptyLogFn;
|
|
1516
|
-
this.error = emptyLogFn;
|
|
1517
|
-
if (false) {
|
|
1518
|
-
this.debug = dbg(channelName);
|
|
1519
|
-
this.error = err(channelName);
|
|
1520
|
-
}
|
|
1529
|
+
// src/utils/proxyFnCall.ts
|
|
1530
|
+
function proxyFn(fn, config) {
|
|
1531
|
+
const propertyReads = new Set();
|
|
1532
|
+
function proxiedFn(...params) {
|
|
1533
|
+
const paramToProxy = config ? config.getProxyTargetFromArgs(...params) : params[0];
|
|
1534
|
+
propertyReads.clear();
|
|
1535
|
+
const handler = {
|
|
1536
|
+
get: function(obj, prop) {
|
|
1537
|
+
propertyReads.add(prop);
|
|
1538
|
+
return obj[prop];
|
|
1539
|
+
}
|
|
1540
|
+
};
|
|
1541
|
+
const proxy = new Proxy(paramToProxy, handler);
|
|
1542
|
+
const newParams = config ? config.putProxyToArgs(proxy, ...params) : [proxy];
|
|
1543
|
+
return fn.apply(this, newParams);
|
|
1521
1544
|
}
|
|
1522
|
-
|
|
1545
|
+
return {
|
|
1546
|
+
fn: proxiedFn,
|
|
1547
|
+
propertyReads
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1523
1550
|
|
|
1524
1551
|
// src/utils/toUpperFirst.ts
|
|
1525
1552
|
var toUpperFirst = (s) => {
|
|
1526
1553
|
return s ? s.substr(0, 1).toUpperCase() + s.substr(1) : s;
|
|
1527
1554
|
};
|
|
1528
1555
|
|
|
1529
|
-
// src/components/
|
|
1556
|
+
// src/components/utils/isControlledValue.ts
|
|
1557
|
+
function isControlledValue(value) {
|
|
1558
|
+
const controlled = value !== void 0;
|
|
1559
|
+
return controlled;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
// src/components/utils/isControlled.ts
|
|
1563
|
+
function isControlled(propName, props) {
|
|
1564
|
+
const propValue = props[propName];
|
|
1565
|
+
const controlled = isControlledValue(propValue);
|
|
1566
|
+
return controlled;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
// src/components/hooks/useLatest.tsx
|
|
1530
1570
|
var import_react9 = __toModule(require("react"));
|
|
1531
|
-
|
|
1571
|
+
function useLatest(value) {
|
|
1532
1572
|
const ref = (0, import_react9.useRef)(value);
|
|
1533
1573
|
ref.current = value;
|
|
1534
1574
|
return (0, import_react9.useCallback)(() => ref.current, []);
|
|
1535
|
-
}
|
|
1575
|
+
}
|
|
1536
1576
|
|
|
1537
1577
|
// src/components/hooks/usePrevious.ts
|
|
1538
1578
|
var import_react10 = __toModule(require("react"));
|
|
@@ -1561,18 +1601,33 @@ function getComponentStateContext() {
|
|
|
1561
1601
|
}
|
|
1562
1602
|
return ComponentContext = (0, import_react11.createContext)(null);
|
|
1563
1603
|
}
|
|
1564
|
-
function getReducerActions(dispatch,
|
|
1604
|
+
function getReducerActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides) {
|
|
1605
|
+
const state = getState();
|
|
1565
1606
|
return Object.keys(state).reduce((actions, stateKey) => {
|
|
1566
1607
|
const key = stateKey;
|
|
1567
1608
|
const setter = (value) => {
|
|
1568
1609
|
const props = getProps();
|
|
1610
|
+
const state2 = getState();
|
|
1611
|
+
const currentValue = state2[key];
|
|
1612
|
+
if (currentValue === value) {
|
|
1613
|
+
return;
|
|
1614
|
+
}
|
|
1569
1615
|
notifyChange(props, stateKey, value);
|
|
1570
|
-
|
|
1616
|
+
const forwardFn = propsToForward[key];
|
|
1617
|
+
if (typeof forwardFn === "function") {
|
|
1618
|
+
value = forwardFn(value);
|
|
1619
|
+
}
|
|
1620
|
+
const allowControlled = !!(allowedControlledPropOverrides == null ? void 0 : allowedControlledPropOverrides[key]);
|
|
1621
|
+
if (isControlled(stateKey, props) && !allowControlled) {
|
|
1571
1622
|
return;
|
|
1572
1623
|
}
|
|
1573
1624
|
dispatch({
|
|
1574
|
-
|
|
1575
|
-
|
|
1625
|
+
payload: {
|
|
1626
|
+
updatedProps: null,
|
|
1627
|
+
mappedState: {
|
|
1628
|
+
[stateKey]: value
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1576
1631
|
});
|
|
1577
1632
|
};
|
|
1578
1633
|
Object.defineProperty(actions, stateKey, {
|
|
@@ -1581,116 +1636,152 @@ function getReducerActions(dispatch, state, getProps) {
|
|
|
1581
1636
|
return actions;
|
|
1582
1637
|
}, {});
|
|
1583
1638
|
}
|
|
1639
|
+
function forwardProps2(propsToForward, props) {
|
|
1640
|
+
const mappedState = {};
|
|
1641
|
+
for (let k in propsToForward)
|
|
1642
|
+
if (propsToForward.hasOwnProperty(k)) {
|
|
1643
|
+
const forwardFn = propsToForward[k];
|
|
1644
|
+
let propValue = isControlled(k, props) ? props[k] : props[`default${toUpperFirst(k)}`];
|
|
1645
|
+
if (typeof forwardFn === "function") {
|
|
1646
|
+
propValue = forwardFn(propValue);
|
|
1647
|
+
}
|
|
1648
|
+
mappedState[k] = propValue;
|
|
1649
|
+
}
|
|
1650
|
+
return mappedState;
|
|
1651
|
+
}
|
|
1584
1652
|
function getComponentStateRoot(config) {
|
|
1585
1653
|
return React4.memo(function ComponentStateRoot(props) {
|
|
1586
|
-
var _a;
|
|
1587
|
-
const
|
|
1588
|
-
const
|
|
1589
|
-
const
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
}
|
|
1594
|
-
if (
|
|
1595
|
-
|
|
1654
|
+
var _a, _b;
|
|
1655
|
+
const propsToStateSetRef = (0, import_react11.useRef)(new Set());
|
|
1656
|
+
const propsToForward = (0, import_react11.useMemo)(() => config.forwardProps ? config.forwardProps() : {}, []);
|
|
1657
|
+
const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
|
|
1658
|
+
const getParentState = useLatest(parentState);
|
|
1659
|
+
const [wholeState] = (0, import_react11.useState)(() => {
|
|
1660
|
+
const initialSetupState = config.initSetupState ? config.initSetupState() : {};
|
|
1661
|
+
let mappedState = {};
|
|
1662
|
+
if (propsToForward) {
|
|
1663
|
+
mappedState = forwardProps2(propsToForward, props);
|
|
1664
|
+
}
|
|
1665
|
+
const state2 = __spreadValues(__spreadValues({}, initialSetupState), mappedState);
|
|
1666
|
+
if (config.mapPropsToState) {
|
|
1667
|
+
const { fn: mapPropsToState3, propertyReads } = proxyFn(config.mapPropsToState, {
|
|
1668
|
+
getProxyTargetFromArgs: (initialArg) => initialArg.props,
|
|
1669
|
+
putProxyToArgs: (props2, initialArg) => {
|
|
1670
|
+
return [__spreadProps(__spreadValues({}, initialArg), { props: props2 })];
|
|
1671
|
+
}
|
|
1672
|
+
});
|
|
1673
|
+
propsToStateSetRef.current = new Set([
|
|
1674
|
+
...propsToStateSetRef.current,
|
|
1675
|
+
...propertyReads
|
|
1676
|
+
]);
|
|
1677
|
+
const stateFromProps = mapPropsToState3({
|
|
1596
1678
|
props,
|
|
1597
|
-
state:
|
|
1598
|
-
|
|
1679
|
+
state: state2,
|
|
1680
|
+
oldState: null,
|
|
1599
1681
|
parentState
|
|
1600
1682
|
});
|
|
1601
|
-
return {
|
|
1602
|
-
state: __spreadValues(__spreadValues({}, initialState2), readOnlyState),
|
|
1603
|
-
initialState: initialState2,
|
|
1604
|
-
readOnlyState
|
|
1605
|
-
};
|
|
1683
|
+
return __spreadValues(__spreadValues({}, state2), stateFromProps);
|
|
1606
1684
|
}
|
|
1607
|
-
return
|
|
1608
|
-
initialState: initialState2,
|
|
1609
|
-
readOnlyState: {},
|
|
1610
|
-
state: initialState2
|
|
1611
|
-
};
|
|
1685
|
+
return state2;
|
|
1612
1686
|
});
|
|
1613
1687
|
const getProps = useLatest(props);
|
|
1614
|
-
const theReducer = (
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1688
|
+
const theReducer = (previousState, action) => {
|
|
1689
|
+
var _a2;
|
|
1690
|
+
const parentState2 = (_a2 = getParentState == null ? void 0 : getParentState()) != null ? _a2 : null;
|
|
1691
|
+
const mappedState = action.payload.mappedState;
|
|
1692
|
+
const updatedProps = action.payload.updatedProps;
|
|
1693
|
+
const newState = Object.assign({}, previousState);
|
|
1694
|
+
if (mappedState) {
|
|
1695
|
+
Object.assign(newState, mappedState);
|
|
1696
|
+
}
|
|
1697
|
+
if (config.mapPropsToState) {
|
|
1698
|
+
const { fn: mapPropsToState3, propertyReads } = proxyFn(config.mapPropsToState, {
|
|
1699
|
+
getProxyTargetFromArgs: (initialArg) => initialArg.props,
|
|
1700
|
+
putProxyToArgs: (props2, initialArg) => {
|
|
1701
|
+
return [__spreadProps(__spreadValues({}, initialArg), { props: props2 })];
|
|
1702
|
+
}
|
|
1703
|
+
});
|
|
1704
|
+
propsToStateSetRef.current = new Set([
|
|
1705
|
+
...propsToStateSetRef.current,
|
|
1706
|
+
...propertyReads
|
|
1707
|
+
]);
|
|
1708
|
+
const stateFromProps = mapPropsToState3({
|
|
1630
1709
|
props: getProps(),
|
|
1631
|
-
state:
|
|
1632
|
-
|
|
1633
|
-
parentState
|
|
1710
|
+
state: newState,
|
|
1711
|
+
oldState: previousState,
|
|
1712
|
+
parentState: parentState2
|
|
1634
1713
|
});
|
|
1635
|
-
|
|
1714
|
+
Object.assign(newState, stateFromProps);
|
|
1636
1715
|
}
|
|
1637
1716
|
const result = config.concludeReducer ? config.concludeReducer({
|
|
1638
1717
|
previousState,
|
|
1639
|
-
state:
|
|
1640
|
-
|
|
1641
|
-
parentState
|
|
1642
|
-
}) :
|
|
1718
|
+
state: newState,
|
|
1719
|
+
updatedProps,
|
|
1720
|
+
parentState: parentState2
|
|
1721
|
+
}) : newState;
|
|
1643
1722
|
return result;
|
|
1644
1723
|
};
|
|
1645
1724
|
const [state, dispatch] = (0, import_react11.useReducer)(theReducer, wholeState);
|
|
1646
|
-
const
|
|
1647
|
-
|
|
1648
|
-
return (_b = (_a2 = config.getReducerActions) == null ? void 0 : _a2.call(config, dispatch)) != null ? _b : {};
|
|
1649
|
-
}, [dispatch]);
|
|
1725
|
+
const getComponentState = useLatest(state);
|
|
1726
|
+
const { allowedControlledPropOverrides } = config;
|
|
1650
1727
|
const actions = (0, import_react11.useMemo)(() => {
|
|
1651
|
-
const generatedActions = getReducerActions(dispatch,
|
|
1652
|
-
return
|
|
1653
|
-
}, [
|
|
1728
|
+
const generatedActions = getReducerActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides);
|
|
1729
|
+
return generatedActions;
|
|
1730
|
+
}, [
|
|
1731
|
+
dispatch,
|
|
1732
|
+
propsToForward,
|
|
1733
|
+
allowedControlledPropOverrides
|
|
1734
|
+
]);
|
|
1654
1735
|
const Context = getComponentStateContext();
|
|
1655
|
-
const getComponentState = useLatest(state);
|
|
1656
1736
|
const contextValue = (0, import_react11.useMemo)(() => ({
|
|
1657
1737
|
componentState: state,
|
|
1658
1738
|
componentActions: actions,
|
|
1659
|
-
getComponentState
|
|
1660
|
-
updateStateProperty: (propertyName, propertyValue) => {
|
|
1661
|
-
dispatch({
|
|
1662
|
-
propertyName,
|
|
1663
|
-
payload: propertyValue
|
|
1664
|
-
});
|
|
1665
|
-
}
|
|
1739
|
+
getComponentState
|
|
1666
1740
|
}), [state, actions, getComponentState]);
|
|
1667
1741
|
const prevProps = usePrevious(props);
|
|
1668
1742
|
(0, import_react11.useEffect)(() => {
|
|
1669
1743
|
const currentProps = props;
|
|
1670
|
-
const
|
|
1671
|
-
let
|
|
1672
|
-
|
|
1744
|
+
const newMappedState = {};
|
|
1745
|
+
let newMappedStateCount = 0;
|
|
1746
|
+
const updatedProps = {};
|
|
1747
|
+
let updatedPropsCount = 0;
|
|
1748
|
+
for (var k in props) {
|
|
1673
1749
|
const key = k;
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1750
|
+
const oldValue = prevProps[key];
|
|
1751
|
+
const newValue = currentProps[key];
|
|
1752
|
+
if (key === "children") {
|
|
1753
|
+
continue;
|
|
1754
|
+
}
|
|
1755
|
+
if (oldValue === newValue) {
|
|
1756
|
+
continue;
|
|
1757
|
+
}
|
|
1758
|
+
if (isControlled(key, props)) {
|
|
1759
|
+
if (propsToForward.hasOwnProperty(k)) {
|
|
1760
|
+
let valueToSet = newValue;
|
|
1761
|
+
const forwardFn = propsToForward[k];
|
|
1762
|
+
if (typeof forwardFn === "function") {
|
|
1763
|
+
valueToSet = forwardFn(newValue);
|
|
1683
1764
|
}
|
|
1684
|
-
|
|
1685
|
-
|
|
1765
|
+
if (state[key] !== valueToSet) {
|
|
1766
|
+
newMappedState[key] = valueToSet;
|
|
1767
|
+
newMappedStateCount++;
|
|
1768
|
+
}
|
|
1769
|
+
} else if (propsToStateSetRef.current.has(k)) {
|
|
1770
|
+
updatedProps[key] = currentProps[key];
|
|
1771
|
+
updatedPropsCount++;
|
|
1686
1772
|
}
|
|
1687
1773
|
}
|
|
1688
1774
|
}
|
|
1689
|
-
if (
|
|
1690
|
-
debug2("Triggered by new values for the following props",
|
|
1775
|
+
if (updatedPropsCount > 0 || newMappedStateCount > 0) {
|
|
1776
|
+
debug2("Triggered by new values for the following props", ...[
|
|
1777
|
+
...Object.keys(newMappedState != null ? newMappedState : {}),
|
|
1778
|
+
...Object.keys(updatedProps != null ? updatedProps : {})
|
|
1779
|
+
]);
|
|
1691
1780
|
dispatch({
|
|
1692
|
-
|
|
1693
|
-
|
|
1781
|
+
payload: {
|
|
1782
|
+
mappedState: newMappedStateCount ? newMappedState : null,
|
|
1783
|
+
updatedProps: updatedPropsCount ? updatedProps : null
|
|
1784
|
+
}
|
|
1694
1785
|
});
|
|
1695
1786
|
}
|
|
1696
1787
|
});
|
|
@@ -1717,7 +1808,7 @@ function useColumnAggregations() {
|
|
|
1717
1808
|
const componentState = getComponentState();
|
|
1718
1809
|
columnAggregations.forEach((aggregator, key) => {
|
|
1719
1810
|
var _a;
|
|
1720
|
-
const colField = (_a = componentState.
|
|
1811
|
+
const colField = (_a = componentState.computedColumns.get(key)) == null ? void 0 : _a.field;
|
|
1721
1812
|
const newAggregator = __spreadValues({
|
|
1722
1813
|
getter: (data) => colField ? data[colField] : data
|
|
1723
1814
|
}, aggregator);
|
|
@@ -1800,66 +1891,349 @@ function useColumnGroups() {
|
|
|
1800
1891
|
}, [collapsedColumnGroups]);
|
|
1801
1892
|
}
|
|
1802
1893
|
|
|
1803
|
-
// src/components/InfiniteTable/hooks/
|
|
1804
|
-
var
|
|
1894
|
+
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
1895
|
+
var import_react18 = __toModule(require("react"));
|
|
1805
1896
|
|
|
1806
|
-
// src/components/
|
|
1807
|
-
var
|
|
1897
|
+
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
1898
|
+
var React7 = __toModule(require("react"));
|
|
1808
1899
|
|
|
1809
|
-
// src/
|
|
1900
|
+
// src/utils/join.ts
|
|
1901
|
+
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
1902
|
+
|
|
1903
|
+
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
1904
|
+
var React6 = __toModule(require("react"));
|
|
1810
1905
|
var import_react14 = __toModule(require("react"));
|
|
1811
1906
|
|
|
1812
|
-
// src/components/
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1907
|
+
// src/components/InfiniteTable/utilities.css.ts
|
|
1908
|
+
var alignItems = { center: "_16lm1iwz", stretch: "_16lm1iw10" };
|
|
1909
|
+
var cssEllipsisClassName = "_16lm1iw18 _16lm1iw19 _16lm1iw14";
|
|
1910
|
+
var cursor = { pointer: "_16lm1iw9" };
|
|
1911
|
+
var display = { flex: "_16lm1iwh", block: "_16lm1iwi", inlineBlock: "_16lm1iwj" };
|
|
1912
|
+
var fill = { currentColor: "_16lm1iw5", accentColor: "_16lm1iw6" };
|
|
1913
|
+
var flex = { "1": "_16lm1iwa", none: "_16lm1iwb" };
|
|
1914
|
+
var flexFlow = { column: "_16lm1iwx", row: "_16lm1iwy" };
|
|
1915
|
+
var justifyContent = { center: "_16lm1iw11", start: "_16lm1iw12", end: "_16lm1iw13" };
|
|
1916
|
+
var left = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
1917
|
+
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
1918
|
+
var top = { "0": "_16lm1iwp", "100%": "_16lm1iwq" };
|
|
1919
|
+
var transformTranslateZero = "_16lm1iw8";
|
|
1920
|
+
var userSelect = { none: "_16lm1iwk" };
|
|
1921
|
+
var willChange = { transform: "_16lm1iw17" };
|
|
1922
|
+
var zIndex = { "1": "_16lm1iwc", "10": "_16lm1iwd", "1000": "_16lm1iwe", "10000": "_16lm1iwf", "100000": "_16lm1iwg" };
|
|
1923
|
+
|
|
1924
|
+
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
1925
|
+
function ExpanderIcon(props) {
|
|
1926
|
+
var _a;
|
|
1927
|
+
const { size = 24 } = props;
|
|
1928
|
+
const style = __spreadValues({}, props.style);
|
|
1929
|
+
const [expanded, setExpanded] = (0, import_react14.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
1930
|
+
if (expanded) {
|
|
1931
|
+
style.transform = `rotate(90deg)`;
|
|
1819
1932
|
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1933
|
+
const onClick = () => {
|
|
1934
|
+
var _a2;
|
|
1935
|
+
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
1936
|
+
if (!isControlled("expanded", props)) {
|
|
1937
|
+
setExpanded(!expanded);
|
|
1938
|
+
}
|
|
1822
1939
|
};
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
function loadDataAsync(data) {
|
|
1827
|
-
return __async(this, null, function* () {
|
|
1828
|
-
if (typeof data === "function") {
|
|
1829
|
-
data = data();
|
|
1940
|
+
React6.useEffect(() => {
|
|
1941
|
+
if (isControlled("expanded", props)) {
|
|
1942
|
+
setExpanded(props.expanded);
|
|
1830
1943
|
}
|
|
1831
|
-
|
|
1832
|
-
|
|
1944
|
+
}, [props.expanded]);
|
|
1945
|
+
return /* @__PURE__ */ React6.createElement("svg", {
|
|
1946
|
+
"data-name": "expander-icon",
|
|
1947
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1948
|
+
height: `${size}px`,
|
|
1949
|
+
viewBox: "0 0 24 24",
|
|
1950
|
+
width: `${size}px`,
|
|
1951
|
+
style,
|
|
1952
|
+
onClick,
|
|
1953
|
+
className: join(props.className, fill.currentColor, flex.none, cursor.pointer, expanded ? fill.accentColor : "", "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
1954
|
+
}, /* @__PURE__ */ React6.createElement("path", {
|
|
1955
|
+
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
1956
|
+
}));
|
|
1833
1957
|
}
|
|
1834
1958
|
|
|
1835
|
-
// src/components/
|
|
1836
|
-
function
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1959
|
+
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
1960
|
+
function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
|
|
1961
|
+
if (!pivotColumns) {
|
|
1962
|
+
return void 0;
|
|
1963
|
+
}
|
|
1840
1964
|
const {
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1965
|
+
pivotColumn,
|
|
1966
|
+
pivotRowLabelsColumn,
|
|
1967
|
+
pivotBy,
|
|
1968
|
+
groupRowsBy,
|
|
1969
|
+
pivotTotalColumnPosition,
|
|
1970
|
+
toggleGroupRow
|
|
1971
|
+
} = params;
|
|
1972
|
+
const computedPivotColumns = new Map();
|
|
1973
|
+
pivotColumns.forEach((col, key) => {
|
|
1974
|
+
if (col.pivotTotalColumn && pivotTotalColumnPosition === false) {
|
|
1975
|
+
return;
|
|
1850
1976
|
}
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1977
|
+
let column = __spreadValues({}, col);
|
|
1978
|
+
if (pivotColumn) {
|
|
1979
|
+
if (typeof pivotColumn === "function") {
|
|
1980
|
+
column = __spreadValues(__spreadValues({}, column), pivotColumn({
|
|
1981
|
+
column,
|
|
1982
|
+
pivotBy,
|
|
1983
|
+
groupRowsBy
|
|
1984
|
+
}));
|
|
1985
|
+
} else {
|
|
1986
|
+
column = __spreadValues(__spreadValues({}, column), pivotColumn);
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
const isPivotRowLabelsColumn = !column.pivotColumn && !column.pivotTotalColumn;
|
|
1990
|
+
if (pivotRowLabelsColumn && isPivotRowLabelsColumn) {
|
|
1991
|
+
if (typeof pivotRowLabelsColumn === "function") {
|
|
1992
|
+
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
|
|
1993
|
+
column,
|
|
1994
|
+
pivotBy,
|
|
1995
|
+
groupRowsBy
|
|
1996
|
+
}));
|
|
1997
|
+
} else {
|
|
1998
|
+
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
if (isPivotRowLabelsColumn && !column.render) {
|
|
2002
|
+
column.render = (renderOptions) => {
|
|
2003
|
+
var _a;
|
|
2004
|
+
let { value, rowInfo, column: column2, groupRowsBy: groupRowsBy2 } = renderOptions;
|
|
2005
|
+
if (column2.renderValue) {
|
|
2006
|
+
value = column2.renderValue(renderOptions);
|
|
2007
|
+
}
|
|
2008
|
+
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < groupRowsBy2.length;
|
|
2009
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
2010
|
+
className: join(display.flex, alignItems.center),
|
|
2011
|
+
style: {
|
|
2012
|
+
paddingInlineStart: `calc(${rowInfo.groupNesting - 1} * var(--ITableRow-group-column-nesting))`
|
|
2013
|
+
}
|
|
2014
|
+
}, showExpanderIcon ? /* @__PURE__ */ React7.createElement(ExpanderIcon, {
|
|
2015
|
+
expanded: !rowInfo.collapsed,
|
|
2016
|
+
onChange: () => {
|
|
2017
|
+
toggleGroupRow(rowInfo.groupKeys);
|
|
2018
|
+
}
|
|
2019
|
+
}) : null, /* @__PURE__ */ React7.createElement("div", {
|
|
2020
|
+
className: cssEllipsisClassName
|
|
2021
|
+
}, value != null ? value : null));
|
|
2022
|
+
};
|
|
2023
|
+
}
|
|
2024
|
+
if (!column.render && column.renderValue) {
|
|
2025
|
+
column.render = (renderOptions) => {
|
|
2026
|
+
return column.renderValue(renderOptions);
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
2029
|
+
computedPivotColumns.set(key, column);
|
|
2030
|
+
});
|
|
2031
|
+
return computedPivotColumns;
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
2035
|
+
var React8 = __toModule(require("react"));
|
|
2036
|
+
|
|
2037
|
+
// node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.esm.js
|
|
2038
|
+
var shouldApplyCompound = (compoundCheck, selections) => {
|
|
2039
|
+
for (const key of Object.keys(compoundCheck)) {
|
|
2040
|
+
if (compoundCheck[key] !== selections[key]) {
|
|
2041
|
+
return false;
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
return true;
|
|
2045
|
+
};
|
|
2046
|
+
var createRuntimeFn = (config) => (options) => {
|
|
2047
|
+
let className = config.defaultClassName;
|
|
2048
|
+
const selections = {
|
|
2049
|
+
...config.defaultVariants,
|
|
2050
|
+
...options
|
|
2051
|
+
};
|
|
2052
|
+
for (const variantName in selections) {
|
|
2053
|
+
var _selections$variantNa;
|
|
2054
|
+
const variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
2055
|
+
if (variantSelection != null) {
|
|
2056
|
+
let selection = variantSelection;
|
|
2057
|
+
if (typeof selection === "boolean") {
|
|
2058
|
+
selection = selection === true ? "true" : "false";
|
|
2059
|
+
}
|
|
2060
|
+
className += " " + config.variantClassNames[variantName][selection];
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
for (const [compoundCheck, compoundClassName] of config.compoundVariants) {
|
|
2064
|
+
if (shouldApplyCompound(compoundCheck, selections)) {
|
|
2065
|
+
className += " " + compoundClassName;
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
return className;
|
|
2069
|
+
};
|
|
2070
|
+
|
|
2071
|
+
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
2072
|
+
var GroupRowExpanderCls = "_7pupv0b";
|
|
2073
|
+
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: [] });
|
|
2074
|
+
var RowHoverCls = "_7pupv01";
|
|
2075
|
+
|
|
2076
|
+
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
2077
|
+
function getGroupColumnRender({
|
|
2078
|
+
groupIndex,
|
|
2079
|
+
groupRenderStrategy,
|
|
2080
|
+
toggleGroupRow
|
|
2081
|
+
}) {
|
|
2082
|
+
return (renderOptions) => {
|
|
2083
|
+
var _a;
|
|
2084
|
+
let { value, rowInfo, column } = renderOptions;
|
|
2085
|
+
if (column.renderValue) {
|
|
2086
|
+
value = column.renderValue(renderOptions);
|
|
2087
|
+
}
|
|
2088
|
+
let groupRowInfo = groupRenderStrategy !== "inline" ? rowInfo : ((_a = rowInfo.parents) == null ? void 0 : _a[groupIndex]) || rowInfo;
|
|
2089
|
+
if (!groupRowInfo) {
|
|
2090
|
+
return null;
|
|
2091
|
+
}
|
|
2092
|
+
const collapsed = groupRowInfo.collapsed;
|
|
2093
|
+
const groupKeys = groupRowInfo.groupKeys;
|
|
2094
|
+
if (groupRenderStrategy === "inline") {
|
|
2095
|
+
if (groupRowInfo.groupCount === 1) {
|
|
2096
|
+
return value;
|
|
2097
|
+
}
|
|
2098
|
+
if (groupRowInfo.groupNesting === groupIndex && collapsed) {
|
|
2099
|
+
return null;
|
|
2100
|
+
}
|
|
2101
|
+
} else {
|
|
2102
|
+
if (!groupRowInfo.isGroupRow) {
|
|
2103
|
+
return null;
|
|
2104
|
+
}
|
|
2105
|
+
if (groupIndex + 1 !== groupRowInfo.groupNesting) {
|
|
2106
|
+
return null;
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
return /* @__PURE__ */ React8.createElement("div", {
|
|
2110
|
+
className: join(display.flex, alignItems.center)
|
|
2111
|
+
}, /* @__PURE__ */ React8.createElement(ExpanderIcon, {
|
|
2112
|
+
expanded: !collapsed,
|
|
2113
|
+
onChange: () => {
|
|
2114
|
+
toggleGroupRow(groupKeys);
|
|
2115
|
+
}
|
|
2116
|
+
}), /* @__PURE__ */ React8.createElement("div", {
|
|
2117
|
+
className: cssEllipsisClassName
|
|
2118
|
+
}, value != null ? value : null));
|
|
2119
|
+
};
|
|
2120
|
+
}
|
|
2121
|
+
function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
2122
|
+
const { groupBy, groupIndex, groupRenderStrategy } = options;
|
|
2123
|
+
let generatedGroupColumn = __spreadValues({
|
|
2124
|
+
header: `Group by ${groupBy.field}`,
|
|
2125
|
+
groupByField: groupBy.field,
|
|
2126
|
+
sortable: false,
|
|
2127
|
+
render: getGroupColumnRender({
|
|
2128
|
+
groupIndex,
|
|
2129
|
+
toggleGroupRow,
|
|
2130
|
+
groupRenderStrategy
|
|
2131
|
+
})
|
|
2132
|
+
}, groupBy.column);
|
|
2133
|
+
if (groupColumnFromProps) {
|
|
2134
|
+
if (typeof groupColumnFromProps === "function") {
|
|
2135
|
+
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
|
|
2136
|
+
} else {
|
|
2137
|
+
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
return generatedGroupColumn;
|
|
2141
|
+
}
|
|
2142
|
+
function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
2143
|
+
let generatedGroupColumn = {
|
|
2144
|
+
header: `Group`,
|
|
2145
|
+
groupByField: options.groupRowsBy.map((g) => g.field),
|
|
2146
|
+
sortable: false,
|
|
2147
|
+
render: (renderOptions) => {
|
|
2148
|
+
let { value, rowInfo, column } = renderOptions;
|
|
2149
|
+
if (!rowInfo.isGroupRow) {
|
|
2150
|
+
return null;
|
|
2151
|
+
}
|
|
2152
|
+
if (column.renderValue) {
|
|
2153
|
+
value = column.renderValue(renderOptions);
|
|
2154
|
+
}
|
|
2155
|
+
return /* @__PURE__ */ React8.createElement("div", {
|
|
2156
|
+
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
2157
|
+
}, /* @__PURE__ */ React8.createElement(ExpanderIcon, {
|
|
2158
|
+
expanded: !rowInfo.collapsed,
|
|
2159
|
+
onChange: () => {
|
|
2160
|
+
toggleGroupRow(rowInfo.groupKeys);
|
|
2161
|
+
}
|
|
2162
|
+
}), /* @__PURE__ */ React8.createElement("div", {
|
|
2163
|
+
className: cssEllipsisClassName
|
|
2164
|
+
}, value != null ? value : null));
|
|
2165
|
+
}
|
|
2166
|
+
};
|
|
2167
|
+
if (groupColumnFromProps) {
|
|
2168
|
+
if (typeof groupColumnFromProps === "function") {
|
|
2169
|
+
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
|
|
2170
|
+
} else {
|
|
2171
|
+
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
return generatedGroupColumn;
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
2178
|
+
var import_react17 = __toModule(require("react"));
|
|
2179
|
+
|
|
2180
|
+
// src/components/DataSource/index.tsx
|
|
2181
|
+
var React9 = __toModule(require("react"));
|
|
2182
|
+
|
|
2183
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2184
|
+
var import_react15 = __toModule(require("react"));
|
|
2185
|
+
|
|
2186
|
+
// src/components/DataSource/privateHooks/buildDataSourceDataInfo.ts
|
|
2187
|
+
function buildDataSourceDataInfo(dataParam) {
|
|
2188
|
+
let dataArray = [];
|
|
2189
|
+
if (Array.isArray(dataParam.data)) {
|
|
2190
|
+
dataArray = dataParam.data;
|
|
2191
|
+
} else {
|
|
2192
|
+
dataArray = dataParam;
|
|
2193
|
+
}
|
|
2194
|
+
return {
|
|
2195
|
+
originalDataArray: dataArray
|
|
2196
|
+
};
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
// src/components/DataSource/privateHooks/loadDataAsync.ts
|
|
2200
|
+
function loadDataAsync(data) {
|
|
2201
|
+
return __async(this, null, function* () {
|
|
2202
|
+
if (typeof data === "function") {
|
|
2203
|
+
data = data();
|
|
2204
|
+
}
|
|
2205
|
+
return buildDataSourceDataInfo(yield data);
|
|
2206
|
+
});
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2210
|
+
function buildDataSourceInfo(data) {
|
|
2211
|
+
return { originalDataArray: data };
|
|
2212
|
+
}
|
|
2213
|
+
function useLoadData() {
|
|
2214
|
+
const {
|
|
2215
|
+
componentActions: actions,
|
|
2216
|
+
componentState: { data }
|
|
2217
|
+
} = useComponentState();
|
|
2218
|
+
const loadData = (data2) => {
|
|
2219
|
+
let dataSourceInfo = {
|
|
2220
|
+
originalDataArray: []
|
|
2221
|
+
};
|
|
2222
|
+
if (typeof data2 === "function") {
|
|
2223
|
+
data2 = data2();
|
|
2224
|
+
}
|
|
2225
|
+
if (Array.isArray(data2)) {
|
|
2226
|
+
dataSourceInfo = buildDataSourceInfo(data2);
|
|
2227
|
+
actions.originalDataArray = dataSourceInfo.originalDataArray;
|
|
2228
|
+
} else {
|
|
2229
|
+
actions.loading = true;
|
|
2230
|
+
loadDataAsync(data2).then((dataSourceInfo2) => {
|
|
2231
|
+
actions.originalDataArray = dataSourceInfo2.originalDataArray;
|
|
2232
|
+
actions.loading = false;
|
|
1859
2233
|
});
|
|
1860
2234
|
}
|
|
1861
2235
|
};
|
|
1862
|
-
(0,
|
|
2236
|
+
(0, import_react15.useLayoutEffect)(() => {
|
|
1863
2237
|
loadData(data);
|
|
1864
2238
|
}, [data]);
|
|
1865
2239
|
}
|
|
@@ -1871,7 +2245,7 @@ var normalizeSortInfo = (sortInfo) => {
|
|
|
1871
2245
|
};
|
|
1872
2246
|
|
|
1873
2247
|
// src/components/hooks/useOnce.ts
|
|
1874
|
-
var
|
|
2248
|
+
var import_react16 = __toModule(require("react"));
|
|
1875
2249
|
function once(fn) {
|
|
1876
2250
|
let called = false;
|
|
1877
2251
|
let result = null;
|
|
@@ -1886,7 +2260,7 @@ function once(fn) {
|
|
|
1886
2260
|
return onceFn;
|
|
1887
2261
|
}
|
|
1888
2262
|
function useOnce(fn) {
|
|
1889
|
-
const onceFn = (0,
|
|
2263
|
+
const onceFn = (0, import_react16.useMemo)(() => {
|
|
1890
2264
|
return once(fn);
|
|
1891
2265
|
}, []);
|
|
1892
2266
|
return onceFn();
|
|
@@ -2248,47 +2622,51 @@ var GroupRowsState = class {
|
|
|
2248
2622
|
};
|
|
2249
2623
|
|
|
2250
2624
|
// src/components/DataSource/state/getInitialState.ts
|
|
2251
|
-
function
|
|
2252
|
-
var _a, _b, _c, _d, _e;
|
|
2253
|
-
const { props: initialProps } = params;
|
|
2254
|
-
const dataArray = [];
|
|
2255
|
-
const originalDataArray = [];
|
|
2256
|
-
const sortInfo = normalizeSortInfo(isControlled("sortInfo", initialProps) ? initialProps.sortInfo : initialProps.defaultSortInfo);
|
|
2257
|
-
const groupRowsState = initialProps.groupRowsState || initialProps.defaultGroupRowsState || new GroupRowsState({
|
|
2258
|
-
expandedRows: true,
|
|
2259
|
-
collapsedRows: []
|
|
2260
|
-
});
|
|
2625
|
+
function initSetupState2() {
|
|
2261
2626
|
const now = Date.now();
|
|
2627
|
+
const originalDataArray = [];
|
|
2628
|
+
const dataArray = [];
|
|
2262
2629
|
return {
|
|
2263
|
-
|
|
2264
|
-
loading: (_b = (_a = initialProps.loading) != null ? _a : initialProps.defaultLoading) != null ? _b : false,
|
|
2265
|
-
dataArray,
|
|
2630
|
+
pivotTotalColumnPosition: "end",
|
|
2266
2631
|
originalDataArray,
|
|
2267
|
-
|
|
2268
|
-
|
|
2632
|
+
pivotColumns: void 0,
|
|
2633
|
+
pivotColumnGroups: void 0,
|
|
2634
|
+
dataArray,
|
|
2269
2635
|
updatedAt: now,
|
|
2270
2636
|
groupedAt: 0,
|
|
2271
2637
|
sortedAt: 0,
|
|
2272
2638
|
reducedAt: now,
|
|
2273
|
-
|
|
2274
|
-
pivotColumnGroups: void 0,
|
|
2275
|
-
groupRowsBy: isControlled("groupRowsBy", initialProps) ? (_c = initialProps.groupRowsBy) != null ? _c : [] : (_d = initialProps.defaultGroupRowsBy) != null ? _d : [],
|
|
2276
|
-
pivotBy: isControlled("pivotBy", initialProps) ? (_e = initialProps.pivotBy) != null ? _e : [] : initialProps.defaultPivotBy,
|
|
2639
|
+
generateGroupRows: true,
|
|
2277
2640
|
aggregationReducers: void 0,
|
|
2278
|
-
|
|
2641
|
+
groupDeepMap: void 0,
|
|
2642
|
+
postSortDataArray: void 0,
|
|
2643
|
+
postGroupDataArray: void 0,
|
|
2644
|
+
lastSortDataArray: void 0,
|
|
2645
|
+
lastGroupDataArray: void 0
|
|
2279
2646
|
};
|
|
2280
2647
|
}
|
|
2281
|
-
|
|
2648
|
+
var forwardProps3 = () => {
|
|
2649
|
+
return {
|
|
2650
|
+
remoteCount: 1,
|
|
2651
|
+
data: 1,
|
|
2652
|
+
pivotBy: 1,
|
|
2653
|
+
primaryKey: 1,
|
|
2654
|
+
loading: (loading) => loading != null ? loading : false,
|
|
2655
|
+
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
|
|
2656
|
+
groupRowsBy: (groupRowsBy) => groupRowsBy != null ? groupRowsBy : [],
|
|
2657
|
+
groupRowsState: (groupRowsState) => {
|
|
2658
|
+
return groupRowsState || new GroupRowsState({
|
|
2659
|
+
expandedRows: true,
|
|
2660
|
+
collapsedRows: []
|
|
2661
|
+
});
|
|
2662
|
+
}
|
|
2663
|
+
};
|
|
2664
|
+
};
|
|
2665
|
+
function mapPropsToState2(params) {
|
|
2282
2666
|
var _a;
|
|
2283
|
-
const { props
|
|
2284
|
-
const sortInfo = isControlled("sortInfo", props) ? props.sortInfo : (_a = props.defaultSortInfo) != null ? _a : null;
|
|
2667
|
+
const { props } = params;
|
|
2285
2668
|
return {
|
|
2286
|
-
multiSort: Array.isArray(sortInfo)
|
|
2287
|
-
sortInfo: normalizeSortInfo(state.sortInfo),
|
|
2288
|
-
primaryKey: props.primaryKey,
|
|
2289
|
-
groupDeepMap: void 0,
|
|
2290
|
-
postSortDataArray: void 0,
|
|
2291
|
-
postGroupDataArray: void 0
|
|
2669
|
+
multiSort: Array.isArray((_a = props.sortInfo) != null ? _a : props.defaultSortInfo)
|
|
2292
2670
|
};
|
|
2293
2671
|
}
|
|
2294
2672
|
|
|
@@ -2492,7 +2870,7 @@ function flatten(groupResult) {
|
|
|
2492
2870
|
return result;
|
|
2493
2871
|
}
|
|
2494
2872
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
2495
|
-
const { groupBy, groupKeys, collapsed } = options;
|
|
2873
|
+
const { groupBy, groupKeys, collapsed, parents } = options;
|
|
2496
2874
|
const groupNesting = groupKeys.length;
|
|
2497
2875
|
const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
|
|
2498
2876
|
const enhancedGroupData = {
|
|
@@ -2502,6 +2880,10 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
2502
2880
|
groupKeys,
|
|
2503
2881
|
id: groupKeys,
|
|
2504
2882
|
collapsed,
|
|
2883
|
+
parents,
|
|
2884
|
+
collapsedChildrenCount: 0,
|
|
2885
|
+
collapsedGroupsCount: 0,
|
|
2886
|
+
indexInParentGroups: options.indexInParentGroups,
|
|
2505
2887
|
indexInGroup: options.indexInGroup,
|
|
2506
2888
|
indexInAll: options.indexInAll,
|
|
2507
2889
|
value: groupKeys[groupKeys.length - 1],
|
|
@@ -2523,12 +2905,14 @@ function completeReducers(reducers, reducerResults, items) {
|
|
|
2523
2905
|
}
|
|
2524
2906
|
return reducerResults;
|
|
2525
2907
|
}
|
|
2526
|
-
function enhancedFlatten(
|
|
2908
|
+
function enhancedFlatten(param) {
|
|
2909
|
+
const { groupResult, toPrimaryKey, groupRowsState, generateGroupRows } = param;
|
|
2527
2910
|
const { groupParams, deepMap, pivot } = groupResult;
|
|
2528
2911
|
const { groupBy } = groupParams;
|
|
2529
2912
|
const groupByStrings = groupBy.map((g) => g.field);
|
|
2530
2913
|
const result = [];
|
|
2531
2914
|
const parents = [];
|
|
2915
|
+
const indexInParentGroups = [];
|
|
2532
2916
|
deepMap.visitDepthFirst((deepMapValue, groupKeys, indexInGroup, next) => {
|
|
2533
2917
|
var _a;
|
|
2534
2918
|
const items = deepMapValue.items;
|
|
@@ -2536,12 +2920,24 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
|
|
|
2536
2920
|
const collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
|
|
2537
2921
|
const enhancedGroupData = getEnhancedGroupData({
|
|
2538
2922
|
groupBy: groupByStrings,
|
|
2923
|
+
parents: Array.from(parents),
|
|
2539
2924
|
indexInGroup,
|
|
2925
|
+
indexInParentGroups: Array.from(indexInParentGroups),
|
|
2540
2926
|
indexInAll: result.length,
|
|
2541
2927
|
groupKeys,
|
|
2542
2928
|
collapsed
|
|
2543
2929
|
}, deepMapValue);
|
|
2544
|
-
|
|
2930
|
+
const include = generateGroupRows || collapsed;
|
|
2931
|
+
if (include) {
|
|
2932
|
+
result.push(enhancedGroupData);
|
|
2933
|
+
}
|
|
2934
|
+
if (collapsed) {
|
|
2935
|
+
parents.forEach((parent) => {
|
|
2936
|
+
parent.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
2937
|
+
parent.collapsedGroupsCount += 1;
|
|
2938
|
+
});
|
|
2939
|
+
}
|
|
2940
|
+
indexInParentGroups.push(indexInGroup);
|
|
2545
2941
|
parents.push(enhancedGroupData);
|
|
2546
2942
|
if (!collapsed) {
|
|
2547
2943
|
if (!next) {
|
|
@@ -2553,11 +2949,14 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
|
|
|
2553
2949
|
data: item,
|
|
2554
2950
|
isGroupRow: false,
|
|
2555
2951
|
collapsed: false,
|
|
2556
|
-
|
|
2952
|
+
groupKeys,
|
|
2953
|
+
parents: Array.from(parents),
|
|
2954
|
+
indexInParentGroups: [...indexInParentGroups, index],
|
|
2557
2955
|
indexInGroup: index,
|
|
2558
2956
|
indexInAll: startIndex + index,
|
|
2559
2957
|
groupBy: groupByStrings,
|
|
2560
|
-
groupNesting
|
|
2958
|
+
groupNesting,
|
|
2959
|
+
groupCount: enhancedGroupData.groupCount
|
|
2561
2960
|
};
|
|
2562
2961
|
}));
|
|
2563
2962
|
}
|
|
@@ -2566,6 +2965,7 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
|
|
|
2566
2965
|
}
|
|
2567
2966
|
}
|
|
2568
2967
|
parents.pop();
|
|
2968
|
+
indexInParentGroups.pop();
|
|
2569
2969
|
});
|
|
2570
2970
|
return {
|
|
2571
2971
|
data: result
|
|
@@ -2580,8 +2980,8 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
2580
2980
|
header: "Row labels",
|
|
2581
2981
|
valueGetter: (params) => {
|
|
2582
2982
|
var _a;
|
|
2583
|
-
const {
|
|
2584
|
-
return
|
|
2983
|
+
const { rowInfo } = params;
|
|
2984
|
+
return rowInfo.groupKeys ? rowInfo.groupKeys[((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) - 1] : null;
|
|
2585
2985
|
}
|
|
2586
2986
|
}
|
|
2587
2987
|
]
|
|
@@ -2602,9 +3002,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
2602
3002
|
sortable: false,
|
|
2603
3003
|
columnGroup: parentKeys.length ? `${columnGroupId}` : void 0,
|
|
2604
3004
|
header: keys[keys.length - 1],
|
|
2605
|
-
valueGetter: ({
|
|
3005
|
+
valueGetter: ({ rowInfo }) => {
|
|
2606
3006
|
var _a, _b, _c;
|
|
2607
|
-
const value = (_c = (_b = (_a =
|
|
3007
|
+
const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
|
|
2608
3008
|
return value;
|
|
2609
3009
|
}
|
|
2610
3010
|
});
|
|
@@ -2623,9 +3023,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
2623
3023
|
pivotGroupKeys: keys,
|
|
2624
3024
|
pivotBy,
|
|
2625
3025
|
sortable: false,
|
|
2626
|
-
valueGetter: ({
|
|
3026
|
+
valueGetter: ({ rowInfo }) => {
|
|
2627
3027
|
var _a, _b, _c;
|
|
2628
|
-
const value = (_c = (_b = (_a =
|
|
3028
|
+
const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
|
|
2629
3029
|
return value;
|
|
2630
3030
|
}
|
|
2631
3031
|
});
|
|
@@ -2638,9 +3038,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
2638
3038
|
if (columns.size === 1) {
|
|
2639
3039
|
columns.set("single", {
|
|
2640
3040
|
header: "Reduced",
|
|
2641
|
-
valueGetter: ({
|
|
3041
|
+
valueGetter: ({ rowInfo }) => {
|
|
2642
3042
|
var _a;
|
|
2643
|
-
return (_a =
|
|
3043
|
+
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[0];
|
|
2644
3044
|
}
|
|
2645
3045
|
});
|
|
2646
3046
|
}
|
|
@@ -2652,26 +3052,26 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
2652
3052
|
}
|
|
2653
3053
|
|
|
2654
3054
|
// src/components/DataSource/state/reducer.ts
|
|
2655
|
-
var haveDepsChanged = (
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
if (
|
|
3055
|
+
var haveDepsChanged = (state1, state2, deps) => {
|
|
3056
|
+
for (let i = 0, len = deps.length; i < len; i++) {
|
|
3057
|
+
const k = deps[i];
|
|
3058
|
+
const oldValue = state1[k];
|
|
3059
|
+
const newValue = state2[k];
|
|
3060
|
+
if (oldValue !== newValue) {
|
|
2661
3061
|
return true;
|
|
2662
3062
|
}
|
|
2663
3063
|
}
|
|
2664
3064
|
return false;
|
|
2665
3065
|
};
|
|
2666
|
-
function
|
|
3066
|
+
function toRowInfo(data, id, index) {
|
|
2667
3067
|
return { data, collapsed: true, id, indexInAll: index, indexInGroup: index };
|
|
2668
3068
|
}
|
|
2669
3069
|
function concludeReducer(params) {
|
|
2670
3070
|
var _a;
|
|
2671
|
-
const { state, previousState
|
|
3071
|
+
const { state, previousState } = params;
|
|
2672
3072
|
const sortInfo = state.sortInfo;
|
|
2673
|
-
const shouldSort = sortInfo == null ? void 0 : sortInfo.length;
|
|
2674
|
-
const sortDepsChanged = haveDepsChanged(
|
|
3073
|
+
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length);
|
|
3074
|
+
const sortDepsChanged = haveDepsChanged(previousState, state, [
|
|
2675
3075
|
"originalDataArray",
|
|
2676
3076
|
"sortInfo"
|
|
2677
3077
|
]);
|
|
@@ -2679,7 +3079,8 @@ function concludeReducer(params) {
|
|
|
2679
3079
|
const groupBy = state.groupRowsBy;
|
|
2680
3080
|
const pivotBy = state.pivotBy;
|
|
2681
3081
|
const shouldGroup = groupBy.length || pivotBy;
|
|
2682
|
-
const groupsDepsChanged = haveDepsChanged(
|
|
3082
|
+
const groupsDepsChanged = haveDepsChanged(previousState, state, [
|
|
3083
|
+
"generateGroupRows",
|
|
2683
3084
|
"originalDataArray",
|
|
2684
3085
|
"groupRowsBy",
|
|
2685
3086
|
"groupRowsState",
|
|
@@ -2691,7 +3092,7 @@ function concludeReducer(params) {
|
|
|
2691
3092
|
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
|
|
2692
3093
|
const now = Date.now();
|
|
2693
3094
|
let dataArray = state.originalDataArray;
|
|
2694
|
-
let
|
|
3095
|
+
let rowInfoDataArray = state.dataArray;
|
|
2695
3096
|
if (shouldSort) {
|
|
2696
3097
|
dataArray = shouldSortAgain ? multisort(sortInfo, [...dataArray]) : state.lastSortDataArray;
|
|
2697
3098
|
state.lastSortDataArray = dataArray;
|
|
@@ -2709,30 +3110,35 @@ function concludeReducer(params) {
|
|
|
2709
3110
|
pivot: pivotBy,
|
|
2710
3111
|
reducers: state.aggregationReducers
|
|
2711
3112
|
}, dataArray);
|
|
2712
|
-
const flattenResult = enhancedFlatten(
|
|
2713
|
-
|
|
3113
|
+
const flattenResult = enhancedFlatten({
|
|
3114
|
+
groupResult,
|
|
3115
|
+
toPrimaryKey,
|
|
3116
|
+
groupRowsState: state.groupRowsState,
|
|
3117
|
+
generateGroupRows: state.generateGroupRows
|
|
3118
|
+
});
|
|
3119
|
+
rowInfoDataArray = flattenResult.data;
|
|
2714
3120
|
state.groupDeepMap = groupResult.deepMap;
|
|
2715
3121
|
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups(groupResult.topLevelPivotColumns, pivotBy, (_a = state.pivotTotalColumnPosition) != null ? _a : "end") : void 0;
|
|
2716
3122
|
state.pivotColumns = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columns;
|
|
2717
3123
|
state.pivotColumnGroups = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columnGroups;
|
|
2718
3124
|
} else {
|
|
2719
|
-
|
|
3125
|
+
rowInfoDataArray = state.lastGroupDataArray;
|
|
2720
3126
|
}
|
|
2721
|
-
state.lastGroupDataArray =
|
|
3127
|
+
state.lastGroupDataArray = rowInfoDataArray;
|
|
2722
3128
|
state.groupedAt = now;
|
|
2723
3129
|
} else {
|
|
2724
3130
|
state.groupDeepMap = void 0;
|
|
2725
3131
|
state.pivotColumns = void 0;
|
|
2726
3132
|
const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
|
|
2727
3133
|
if (arrayDifferentAfterSortStep) {
|
|
2728
|
-
|
|
3134
|
+
rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, toPrimaryKey(data), index));
|
|
2729
3135
|
}
|
|
2730
3136
|
}
|
|
2731
|
-
state.postGroupDataArray =
|
|
2732
|
-
if (
|
|
3137
|
+
state.postGroupDataArray = rowInfoDataArray;
|
|
3138
|
+
if (rowInfoDataArray !== state.dataArray) {
|
|
2733
3139
|
state.updatedAt = now;
|
|
2734
3140
|
}
|
|
2735
|
-
state.dataArray =
|
|
3141
|
+
state.dataArray = rowInfoDataArray;
|
|
2736
3142
|
state.reducedAt = now;
|
|
2737
3143
|
globalThis.state = state;
|
|
2738
3144
|
return state;
|
|
@@ -2751,12 +3157,13 @@ function DataSourceWithContext(props) {
|
|
|
2751
3157
|
if (typeof children === "function") {
|
|
2752
3158
|
children = children(computedValues);
|
|
2753
3159
|
}
|
|
2754
|
-
return /* @__PURE__ */
|
|
3160
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, children);
|
|
2755
3161
|
}
|
|
2756
3162
|
var DataSourceRoot = getComponentStateRoot({
|
|
2757
|
-
|
|
3163
|
+
initSetupState: initSetupState2,
|
|
3164
|
+
forwardProps: forwardProps3,
|
|
2758
3165
|
concludeReducer,
|
|
2759
|
-
|
|
3166
|
+
mapPropsToState: mapPropsToState2
|
|
2760
3167
|
});
|
|
2761
3168
|
function DataSourceCmp({ children }) {
|
|
2762
3169
|
const DataSourceContext = getDataSourceContext();
|
|
@@ -2767,445 +3174,319 @@ function DataSourceCmp({ children }) {
|
|
|
2767
3174
|
componentActions,
|
|
2768
3175
|
getState
|
|
2769
3176
|
};
|
|
3177
|
+
if (false) {
|
|
3178
|
+
globalThis.getDataSourceState = getState;
|
|
3179
|
+
}
|
|
2770
3180
|
useLoadData();
|
|
2771
|
-
return /* @__PURE__ */
|
|
3181
|
+
return /* @__PURE__ */ React9.createElement(DataSourceContext.Provider, {
|
|
2772
3182
|
value: contextValue
|
|
2773
|
-
}, /* @__PURE__ */
|
|
3183
|
+
}, /* @__PURE__ */ React9.createElement(DataSourceWithContext, {
|
|
2774
3184
|
children
|
|
2775
3185
|
}));
|
|
2776
3186
|
}
|
|
2777
3187
|
function DataSource(props) {
|
|
2778
|
-
return /* @__PURE__ */
|
|
3188
|
+
return /* @__PURE__ */ React9.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React9.createElement(DataSourceCmp, {
|
|
2779
3189
|
children: props.children
|
|
2780
3190
|
}));
|
|
2781
3191
|
}
|
|
2782
3192
|
|
|
2783
|
-
// src/components/InfiniteTable/
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
"--it-space-1",
|
|
2793
|
-
"--it-space-2",
|
|
2794
|
-
"--it-space-3",
|
|
2795
|
-
"--it-space-4",
|
|
2796
|
-
"--it-space-5",
|
|
2797
|
-
"--it-space-6",
|
|
2798
|
-
"--it-space-7",
|
|
2799
|
-
"--it-space-8",
|
|
2800
|
-
"--it-space-9",
|
|
2801
|
-
"--it-space-10"
|
|
2802
|
-
],
|
|
2803
|
-
borderRadius: "--it__border-radius",
|
|
2804
|
-
fontSize: [
|
|
2805
|
-
"--it-font-size-0",
|
|
2806
|
-
"--it-font-size-1",
|
|
2807
|
-
"--it-font-size-2",
|
|
2808
|
-
"--it-font-size-3",
|
|
2809
|
-
"--it-font-size-4",
|
|
2810
|
-
"--it-font-size-5",
|
|
2811
|
-
"--it-font-size-6",
|
|
2812
|
-
"--it-font-size-7"
|
|
2813
|
-
]
|
|
2814
|
-
},
|
|
2815
|
-
alignItems: {
|
|
2816
|
-
center: rule("align-items", "center"),
|
|
2817
|
-
stretch: rule("align-items", "stretch")
|
|
2818
|
-
},
|
|
2819
|
-
justifyContent: {
|
|
2820
|
-
center: rule("justify-content", "center"),
|
|
2821
|
-
"flex-start": rule("justify-content", "flex-start"),
|
|
2822
|
-
flexStart: rule("justify-content", "flex-start"),
|
|
2823
|
-
"flex-end": rule("justify-content", "flex-end"),
|
|
2824
|
-
flexEnd: rule("justify-content", "flex-end")
|
|
2825
|
-
},
|
|
2826
|
-
overflow: {
|
|
2827
|
-
hidden: rule("overflow", "hidden"),
|
|
2828
|
-
visible: rule("overflow", "visible"),
|
|
2829
|
-
auto: rule("overflow", "auto")
|
|
2830
|
-
},
|
|
2831
|
-
overflowX: {
|
|
2832
|
-
hidden: rule("overflow-x", "hidden"),
|
|
2833
|
-
visible: rule("overflow-x", "visible"),
|
|
2834
|
-
auto: rule("overflow-x", "auto")
|
|
2835
|
-
},
|
|
2836
|
-
overflowY: {
|
|
2837
|
-
hidden: rule("overflow-y", "hidden"),
|
|
2838
|
-
visible: rule("overflow-y", "visible"),
|
|
2839
|
-
auto: rule("overflow-y", "auto")
|
|
2840
|
-
},
|
|
2841
|
-
cursor: {
|
|
2842
|
-
pointer: rule("cursor", "pointer")
|
|
2843
|
-
},
|
|
2844
|
-
height: {
|
|
2845
|
-
0: rule("height", "0"),
|
|
2846
|
-
"100%": rule("height", "100%")
|
|
2847
|
-
},
|
|
2848
|
-
width: {
|
|
2849
|
-
0: rule("width", "0"),
|
|
2850
|
-
"100%": rule("width", "100%")
|
|
2851
|
-
},
|
|
2852
|
-
top: {
|
|
2853
|
-
0: rule("top", "0"),
|
|
2854
|
-
"100%": rule("top", "100%")
|
|
2855
|
-
},
|
|
2856
|
-
left: {
|
|
2857
|
-
0: rule("left", "0"),
|
|
2858
|
-
"100%": rule("left", "100%")
|
|
2859
|
-
},
|
|
2860
|
-
transform: {
|
|
2861
|
-
translate3D000: rule("transform", "translate3D000")
|
|
2862
|
-
},
|
|
2863
|
-
willChange: {
|
|
2864
|
-
transform: rule("will-change", "transform")
|
|
2865
|
-
},
|
|
2866
|
-
position: {
|
|
2867
|
-
relative: rule("position", "relative"),
|
|
2868
|
-
absolute: rule("position", "absolute"),
|
|
2869
|
-
fixed: rule("position", "fixed")
|
|
2870
|
-
},
|
|
2871
|
-
display: {
|
|
2872
|
-
flex: rule("display", "flex")
|
|
2873
|
-
},
|
|
2874
|
-
flexFlow: {
|
|
2875
|
-
row: rule("flex-flow", "row"),
|
|
2876
|
-
column: rule("flex-flow", "column")
|
|
2877
|
-
},
|
|
2878
|
-
whiteSpace: {
|
|
2879
|
-
nowrap: rule("white-space", "nowrap")
|
|
2880
|
-
},
|
|
2881
|
-
textOverflow: {
|
|
2882
|
-
ellipsis: rule("text-overflow", "ellipsis")
|
|
2883
|
-
},
|
|
2884
|
-
userSelect: {
|
|
2885
|
-
none: rule("user-select", "none")
|
|
2886
|
-
}
|
|
2887
|
-
};
|
|
2888
|
-
|
|
2889
|
-
// src/style/css.ts
|
|
2890
|
-
var cssEllipsisClassName = `${ICSS.whiteSpace.nowrap} ${ICSS.textOverflow.ellipsis} ${ICSS.overflow.hidden}`;
|
|
2891
|
-
|
|
2892
|
-
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2893
|
-
var React7 = __toModule(require("react"));
|
|
2894
|
-
var import_react16 = __toModule(require("react"));
|
|
2895
|
-
function ExpanderIcon(props) {
|
|
2896
|
-
var _a;
|
|
2897
|
-
const { size = 24 } = props;
|
|
2898
|
-
const style = __spreadValues({}, props.style);
|
|
2899
|
-
const [expanded, setExpanded] = (0, import_react16.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
2900
|
-
if (expanded) {
|
|
2901
|
-
style.transform = `rotate(90deg)`;
|
|
2902
|
-
}
|
|
2903
|
-
const onClick = () => {
|
|
2904
|
-
var _a2;
|
|
2905
|
-
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
2906
|
-
if (!isControlled("expanded", props)) {
|
|
2907
|
-
setExpanded(!expanded);
|
|
2908
|
-
}
|
|
2909
|
-
};
|
|
2910
|
-
React7.useEffect(() => {
|
|
2911
|
-
if (isControlled("expanded", props)) {
|
|
2912
|
-
setExpanded(props.expanded);
|
|
2913
|
-
}
|
|
2914
|
-
}, [props.expanded]);
|
|
2915
|
-
return /* @__PURE__ */ React7.createElement("svg", {
|
|
2916
|
-
"data-name": "expander-icon",
|
|
2917
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2918
|
-
height: `${size}px`,
|
|
2919
|
-
viewBox: "0 0 24 24",
|
|
2920
|
-
width: `${size}px`,
|
|
2921
|
-
style,
|
|
2922
|
-
onClick,
|
|
2923
|
-
className: join(props.className, "ITableIcon", "ITableIcon-expander", `ITableIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
2924
|
-
}, /* @__PURE__ */ React7.createElement("path", {
|
|
2925
|
-
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
2926
|
-
}));
|
|
3193
|
+
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
3194
|
+
function useToggleGroupRow() {
|
|
3195
|
+
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
3196
|
+
const toggleGroupRow = (0, import_react17.useCallback)((groupKeys) => {
|
|
3197
|
+
const newState = new GroupRowsState(getDataSourceState().groupRowsState);
|
|
3198
|
+
newState.toggleGroupRow(groupKeys);
|
|
3199
|
+
dataSourceActions.groupRowsState = newState;
|
|
3200
|
+
}, []);
|
|
3201
|
+
return toggleGroupRow;
|
|
2927
3202
|
}
|
|
2928
3203
|
|
|
2929
|
-
// src/components/InfiniteTable/
|
|
2930
|
-
function
|
|
2931
|
-
|
|
2932
|
-
return
|
|
2933
|
-
|
|
3204
|
+
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
3205
|
+
function useGroupRowsMap(groupRowsBy) {
|
|
3206
|
+
const groupRowsMap = (0, import_react18.useMemo)(() => {
|
|
3207
|
+
return groupRowsBy.reduce((acc, groupBy, index) => {
|
|
3208
|
+
acc.set(groupBy.field, {
|
|
3209
|
+
groupBy,
|
|
3210
|
+
groupIndex: index
|
|
3211
|
+
});
|
|
3212
|
+
return acc;
|
|
3213
|
+
}, new Map());
|
|
3214
|
+
}, [groupRowsBy]);
|
|
3215
|
+
return groupRowsMap;
|
|
3216
|
+
}
|
|
3217
|
+
function useColumnsWhen() {
|
|
2934
3218
|
const {
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
pivotTotalColumnPosition
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
pivotBy,
|
|
2953
|
-
groupRowsBy
|
|
2954
|
-
}));
|
|
2955
|
-
} else {
|
|
2956
|
-
column = __spreadValues(__spreadValues({}, column), pivotColumn);
|
|
2957
|
-
}
|
|
2958
|
-
}
|
|
2959
|
-
const isPivotRowLabelsColumn = !column.pivotColumn && !column.pivotTotalColumn;
|
|
2960
|
-
if (pivotRowLabelsColumn && isPivotRowLabelsColumn) {
|
|
2961
|
-
if (typeof pivotRowLabelsColumn === "function") {
|
|
2962
|
-
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
|
|
2963
|
-
column,
|
|
2964
|
-
pivotBy,
|
|
2965
|
-
groupRowsBy
|
|
2966
|
-
}));
|
|
2967
|
-
} else {
|
|
2968
|
-
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
if (isPivotRowLabelsColumn && !column.render) {
|
|
2972
|
-
column.render = (renderOptions) => {
|
|
2973
|
-
var _a;
|
|
2974
|
-
let { value, enhancedData, column: column2, groupRowsBy: groupRowsBy2 } = renderOptions;
|
|
2975
|
-
if (column2.renderValue) {
|
|
2976
|
-
value = column2.renderValue(renderOptions);
|
|
2977
|
-
}
|
|
2978
|
-
const showExpanderIcon = (((_a = enhancedData.groupKeys) == null ? void 0 : _a.length) || 0) < groupRowsBy2.length;
|
|
2979
|
-
return /* @__PURE__ */ React8.createElement("div", {
|
|
2980
|
-
className: join(ICSS.display.flex, ICSS.alignItems.center),
|
|
2981
|
-
style: {
|
|
2982
|
-
paddingInlineStart: `calc(${enhancedData.groupNesting - 1} * var(--ITableRow-group-column-nesting))`
|
|
2983
|
-
}
|
|
2984
|
-
}, showExpanderIcon ? /* @__PURE__ */ React8.createElement(ExpanderIcon, {
|
|
2985
|
-
expanded: !enhancedData.collapsed,
|
|
2986
|
-
onChange: () => {
|
|
2987
|
-
toggleGroupRow(enhancedData.groupKeys);
|
|
2988
|
-
}
|
|
2989
|
-
}) : null, /* @__PURE__ */ React8.createElement("div", {
|
|
2990
|
-
className: cssEllipsisClassName
|
|
2991
|
-
}, value != null ? value : null));
|
|
2992
|
-
};
|
|
2993
|
-
}
|
|
2994
|
-
if (!column.render && column.renderValue) {
|
|
2995
|
-
column.render = (renderOptions) => {
|
|
2996
|
-
return column.renderValue(renderOptions);
|
|
2997
|
-
};
|
|
2998
|
-
}
|
|
2999
|
-
computedPivotColumns.set(key, column);
|
|
3000
|
-
});
|
|
3001
|
-
return computedPivotColumns;
|
|
3219
|
+
componentState: { groupRowsBy },
|
|
3220
|
+
componentActions: dataSourceActions
|
|
3221
|
+
} = useDataSourceContextValue();
|
|
3222
|
+
const {
|
|
3223
|
+
componentState: { groupRenderStrategy, pivotTotalColumnPosition }
|
|
3224
|
+
} = useComponentState();
|
|
3225
|
+
const groupRowsMap = useGroupRowsMap(groupRowsBy);
|
|
3226
|
+
(0, import_react18.useEffect)(() => {
|
|
3227
|
+
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
3228
|
+
}, [groupRenderStrategy]);
|
|
3229
|
+
(0, import_react18.useEffect)(() => {
|
|
3230
|
+
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3231
|
+
}, [pivotTotalColumnPosition]);
|
|
3232
|
+
useColumnsWhenInlineGroupRenderStrategy(groupRowsMap);
|
|
3233
|
+
useColumnsWhenPivoting();
|
|
3234
|
+
useColumnsWhenGrouping();
|
|
3235
|
+
useHideEmptyGroupColumns(groupRowsMap);
|
|
3002
3236
|
}
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
if (
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3237
|
+
function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
3238
|
+
const toggleGroupRow = useToggleGroupRow();
|
|
3239
|
+
const {
|
|
3240
|
+
componentActions,
|
|
3241
|
+
componentState: { columns, groupRenderStrategy }
|
|
3242
|
+
} = useComponentState();
|
|
3243
|
+
function computeColumnsWhenInlineGroupRenderStrategy(columns2, groupRowsMap2, groupRenderStrategy2, toggleGroupRow2) {
|
|
3244
|
+
const computedColumns = new Map();
|
|
3245
|
+
columns2.forEach((column, id) => {
|
|
3246
|
+
let base = {};
|
|
3247
|
+
const groupByForColumn = groupRowsMap2.get(column.field);
|
|
3248
|
+
if (groupByForColumn && groupRenderStrategy2 === "inline") {
|
|
3249
|
+
const { groupIndex } = groupByForColumn;
|
|
3250
|
+
const field = groupByForColumn.groupBy.field;
|
|
3251
|
+
base = {
|
|
3252
|
+
groupByField: field,
|
|
3253
|
+
field,
|
|
3254
|
+
valueGetter: ({ rowInfo }) => {
|
|
3255
|
+
var _a;
|
|
3256
|
+
return (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex];
|
|
3257
|
+
},
|
|
3258
|
+
rowspan: ({ rowInfo, dataArray }) => {
|
|
3259
|
+
const prevRowInfo = dataArray[rowInfo.indexInAll - 1] || {
|
|
3260
|
+
indexInParentGroups: []
|
|
3261
|
+
};
|
|
3262
|
+
const prevIndexes = prevRowInfo.indexInParentGroups || [];
|
|
3263
|
+
const currentIndexes = rowInfo.indexInParentGroups || [];
|
|
3264
|
+
let computeSpan = false;
|
|
3265
|
+
for (let i = 0; i <= groupIndex; i++) {
|
|
3266
|
+
const prev = prevIndexes[i];
|
|
3267
|
+
const current = currentIndexes[i];
|
|
3268
|
+
if (current !== prev) {
|
|
3269
|
+
computeSpan = true;
|
|
3270
|
+
break;
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
if (!computeSpan) {
|
|
3274
|
+
return 1;
|
|
3275
|
+
}
|
|
3276
|
+
const parentGroup = rowInfo.parents[groupIndex];
|
|
3277
|
+
const rowspan = parentGroup ? parentGroup.groupCount - (parentGroup.collapsedChildrenCount || 0) + (parentGroup.collapsedGroupsCount || 0) : 1;
|
|
3278
|
+
return rowspan;
|
|
3279
|
+
},
|
|
3280
|
+
render: getGroupColumnRender({
|
|
3281
|
+
groupIndex,
|
|
3282
|
+
groupRenderStrategy: groupRenderStrategy2,
|
|
3283
|
+
toggleGroupRow: toggleGroupRow2
|
|
3284
|
+
})
|
|
3285
|
+
};
|
|
3022
3286
|
}
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
onChange: () => {
|
|
3028
|
-
toggleGroupRow(enhancedData.groupKeys);
|
|
3029
|
-
}
|
|
3030
|
-
}), /* @__PURE__ */ React9.createElement("div", {
|
|
3031
|
-
className: cssEllipsisClassName
|
|
3032
|
-
}, value != null ? value : null));
|
|
3033
|
-
}
|
|
3034
|
-
}, groupBy.column);
|
|
3035
|
-
if (groupColumnFromProps) {
|
|
3036
|
-
if (typeof groupColumnFromProps === "function") {
|
|
3037
|
-
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
|
|
3038
|
-
} else {
|
|
3039
|
-
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
|
|
3040
|
-
}
|
|
3287
|
+
const clone = __spreadValues(__spreadValues({}, base), column);
|
|
3288
|
+
computedColumns.set(id, clone);
|
|
3289
|
+
});
|
|
3290
|
+
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
3041
3291
|
}
|
|
3042
|
-
|
|
3292
|
+
(0, import_react18.useEffect)(() => {
|
|
3293
|
+
const update = () => {
|
|
3294
|
+
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupRowsMap, groupRenderStrategy, toggleGroupRow);
|
|
3295
|
+
};
|
|
3296
|
+
update();
|
|
3297
|
+
return interceptMap(columns, {
|
|
3298
|
+
set: update,
|
|
3299
|
+
delete: update,
|
|
3300
|
+
clear: update
|
|
3301
|
+
});
|
|
3302
|
+
}, [columns, groupRowsMap, groupRenderStrategy, toggleGroupRow]);
|
|
3043
3303
|
}
|
|
3044
|
-
function
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
value = column.renderValue(renderOptions);
|
|
3056
|
-
}
|
|
3057
|
-
return /* @__PURE__ */ React9.createElement("div", {
|
|
3058
|
-
className: join(ICSS.display.flex, ICSS.alignItems.center),
|
|
3059
|
-
style: {
|
|
3060
|
-
paddingInlineStart: `calc(${enhancedData.groupNesting - 1} * var(--ITableRow-group-column-nesting))`
|
|
3061
|
-
}
|
|
3062
|
-
}, /* @__PURE__ */ React9.createElement(ExpanderIcon, {
|
|
3063
|
-
expanded: !enhancedData.collapsed,
|
|
3064
|
-
onChange: () => {
|
|
3065
|
-
toggleGroupRow(enhancedData.groupKeys);
|
|
3066
|
-
}
|
|
3067
|
-
}), /* @__PURE__ */ React9.createElement("div", {
|
|
3068
|
-
className: cssEllipsisClassName
|
|
3069
|
-
}, value != null ? value : null));
|
|
3070
|
-
}
|
|
3071
|
-
};
|
|
3072
|
-
if (groupColumnFromProps) {
|
|
3073
|
-
if (typeof groupColumnFromProps === "function") {
|
|
3074
|
-
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
|
|
3075
|
-
} else {
|
|
3076
|
-
generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
|
|
3304
|
+
function useColumnsWhenPivoting() {
|
|
3305
|
+
const {
|
|
3306
|
+
componentState: { groupRowsBy, pivotBy }
|
|
3307
|
+
} = useDataSourceContextValue();
|
|
3308
|
+
const {
|
|
3309
|
+
componentActions,
|
|
3310
|
+
componentState: {
|
|
3311
|
+
pivotColumns,
|
|
3312
|
+
pivotColumn,
|
|
3313
|
+
pivotRowLabelsColumn,
|
|
3314
|
+
pivotTotalColumnPosition
|
|
3077
3315
|
}
|
|
3078
|
-
}
|
|
3079
|
-
|
|
3316
|
+
} = useComponentState();
|
|
3317
|
+
const toggleGroupRow = useToggleGroupRow();
|
|
3318
|
+
(0, import_react18.useEffect)(() => {
|
|
3319
|
+
const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
|
|
3320
|
+
pivotColumn,
|
|
3321
|
+
pivotRowLabelsColumn,
|
|
3322
|
+
pivotTotalColumnPosition,
|
|
3323
|
+
pivotBy,
|
|
3324
|
+
groupRowsBy,
|
|
3325
|
+
toggleGroupRow
|
|
3326
|
+
});
|
|
3327
|
+
componentActions.computedPivotColumns = computedPivotColumns;
|
|
3328
|
+
}, [pivotColumns, pivotColumn, pivotRowLabelsColumn]);
|
|
3080
3329
|
}
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3330
|
+
function useColumnsWhenGrouping() {
|
|
3331
|
+
const {
|
|
3332
|
+
componentState: { groupRowsBy }
|
|
3333
|
+
} = useDataSourceContextValue();
|
|
3334
|
+
const {
|
|
3335
|
+
componentActions,
|
|
3336
|
+
componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
|
|
3337
|
+
} = useComponentState();
|
|
3338
|
+
const toggleGroupRow = useToggleGroupRow();
|
|
3339
|
+
(0, import_react18.useEffect)(() => {
|
|
3340
|
+
if (pivotColumns) {
|
|
3341
|
+
return;
|
|
3342
|
+
}
|
|
3343
|
+
const update = () => {
|
|
3344
|
+
componentActions.columnsWhenGrouping = getColumnsWhenGrouping({
|
|
3345
|
+
columns,
|
|
3346
|
+
groupColumn,
|
|
3347
|
+
groupRenderStrategy,
|
|
3348
|
+
groupRowsBy,
|
|
3349
|
+
pivotColumns,
|
|
3350
|
+
toggleGroupRow
|
|
3351
|
+
});
|
|
3352
|
+
};
|
|
3353
|
+
update();
|
|
3354
|
+
return interceptMap(columns, {
|
|
3355
|
+
set: update,
|
|
3356
|
+
delete: update,
|
|
3357
|
+
clear: update
|
|
3358
|
+
});
|
|
3359
|
+
}, [groupRowsBy, groupColumn, groupRenderStrategy, pivotColumns]);
|
|
3096
3360
|
}
|
|
3097
|
-
function
|
|
3361
|
+
function useHideEmptyGroupColumns(groupRowsMap) {
|
|
3098
3362
|
const {
|
|
3099
|
-
componentState: { groupRowsBy,
|
|
3100
|
-
getState: getDataSourceState
|
|
3101
|
-
componentActions: dataSourceActions
|
|
3363
|
+
componentState: { groupRowsBy, groupRowsState },
|
|
3364
|
+
getState: getDataSourceState
|
|
3102
3365
|
} = useDataSourceContextValue();
|
|
3103
3366
|
const {
|
|
3104
3367
|
getComponentState,
|
|
3105
3368
|
componentActions,
|
|
3106
3369
|
componentState: {
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
pivotRowLabelsColumn,
|
|
3111
|
-
pivotColumns,
|
|
3112
|
-
pivotTotalColumnPosition
|
|
3370
|
+
columnsWhenGrouping: generatedColumns,
|
|
3371
|
+
hideEmptyGroupColumns,
|
|
3372
|
+
groupRenderStrategy
|
|
3113
3373
|
}
|
|
3114
3374
|
} = useComponentState();
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3375
|
+
(0, import_react18.useEffect)(() => {
|
|
3376
|
+
if (groupRenderStrategy === "single-column") {
|
|
3377
|
+
return;
|
|
3378
|
+
}
|
|
3379
|
+
const groupsLength = groupRowsBy.length;
|
|
3380
|
+
let expandedGroupsLevel = 0;
|
|
3381
|
+
const { dataArray } = getDataSourceState();
|
|
3382
|
+
const len = dataArray.length;
|
|
3383
|
+
for (let i = 0; i < len; i++) {
|
|
3384
|
+
const data = dataArray[i];
|
|
3385
|
+
expandedGroupsLevel = Math.max(expandedGroupsLevel, data.groupNesting - 1);
|
|
3386
|
+
if (expandedGroupsLevel === groupsLength - 1) {
|
|
3387
|
+
break;
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3121
3390
|
const currentState = getComponentState();
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3391
|
+
const { computedColumns } = currentState;
|
|
3392
|
+
let updated = false;
|
|
3393
|
+
const columnVisibility = new Map(currentState.columnVisibility);
|
|
3394
|
+
const cols = computedColumns;
|
|
3395
|
+
groupRowsBy.forEach(({ field }, index) => {
|
|
3396
|
+
const colId = groupRenderStrategy === "multi-column" ? `group-by-${field}` : field;
|
|
3397
|
+
const col = cols.get(colId);
|
|
3398
|
+
if (!col) {
|
|
3399
|
+
return;
|
|
3400
|
+
}
|
|
3401
|
+
const shouldBeHidden = index > expandedGroupsLevel;
|
|
3402
|
+
updated = true;
|
|
3403
|
+
if (shouldBeHidden && hideEmptyGroupColumns) {
|
|
3404
|
+
columnVisibility.set(colId, false);
|
|
3405
|
+
} else {
|
|
3406
|
+
columnVisibility.delete(colId);
|
|
3125
3407
|
}
|
|
3126
|
-
return;
|
|
3127
|
-
}
|
|
3128
|
-
componentActions.generatedColumns = getGeneratedGroupColumns({
|
|
3129
|
-
groupColumn,
|
|
3130
|
-
groupRenderStrategy,
|
|
3131
|
-
groupRowsBy,
|
|
3132
|
-
pivotColumns,
|
|
3133
|
-
toggleGroupRow
|
|
3134
|
-
});
|
|
3135
|
-
}, [groupRowsBy, groupColumn, groupRenderStrategy, pivotColumns]);
|
|
3136
|
-
(0, import_react17.useEffect)(() => {
|
|
3137
|
-
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3138
|
-
}, [pivotTotalColumnPosition]);
|
|
3139
|
-
(0, import_react17.useEffect)(() => {
|
|
3140
|
-
const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
|
|
3141
|
-
pivotColumn,
|
|
3142
|
-
pivotRowLabelsColumn,
|
|
3143
|
-
pivotTotalColumnPosition,
|
|
3144
|
-
pivotBy,
|
|
3145
|
-
groupRowsBy,
|
|
3146
|
-
toggleGroupRow
|
|
3147
3408
|
});
|
|
3148
|
-
|
|
3149
|
-
|
|
3409
|
+
if (updated) {
|
|
3410
|
+
componentActions.columnVisibility = columnVisibility;
|
|
3411
|
+
}
|
|
3412
|
+
}, [
|
|
3413
|
+
getDataSourceState,
|
|
3414
|
+
groupRenderStrategy,
|
|
3415
|
+
generatedColumns,
|
|
3416
|
+
groupRowsBy,
|
|
3417
|
+
groupRowsMap,
|
|
3418
|
+
hideEmptyGroupColumns ? groupRowsState : null,
|
|
3419
|
+
hideEmptyGroupColumns
|
|
3420
|
+
]);
|
|
3150
3421
|
}
|
|
3151
|
-
function
|
|
3422
|
+
function getColumnsWhenGrouping(params) {
|
|
3152
3423
|
const {
|
|
3153
3424
|
pivotColumns,
|
|
3154
3425
|
groupRowsBy,
|
|
3155
3426
|
groupColumn,
|
|
3156
3427
|
groupRenderStrategy,
|
|
3157
|
-
toggleGroupRow
|
|
3428
|
+
toggleGroupRow,
|
|
3429
|
+
columns
|
|
3158
3430
|
} = params;
|
|
3159
|
-
const generatedColumns = new Map();
|
|
3160
3431
|
if (pivotColumns) {
|
|
3161
|
-
return
|
|
3432
|
+
return void 0;
|
|
3162
3433
|
}
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
});
|
|
3434
|
+
if (groupRenderStrategy === "inline") {
|
|
3435
|
+
return void 0;
|
|
3436
|
+
}
|
|
3437
|
+
const computedColumns = new Map();
|
|
3168
3438
|
if (groupRenderStrategy === "multi-column") {
|
|
3169
3439
|
groupRowsBy.forEach((groupBy, index, arr) => {
|
|
3170
|
-
|
|
3440
|
+
computedColumns.set(`group-by-${groupBy.field}`, getColumnForGroupBy({
|
|
3441
|
+
groupBy,
|
|
3442
|
+
groupRowsBy,
|
|
3443
|
+
groupIndex: index,
|
|
3444
|
+
groupCount: arr.length,
|
|
3445
|
+
groupRenderStrategy
|
|
3446
|
+
}, toggleGroupRow, groupColumn));
|
|
3171
3447
|
});
|
|
3172
|
-
} else if (
|
|
3173
|
-
|
|
3448
|
+
} else if (groupRenderStrategy === "single-column") {
|
|
3449
|
+
computedColumns.set("group-by", getSingleGroupColumn({
|
|
3174
3450
|
groupCount: groupRowsBy.length,
|
|
3175
3451
|
groupRowsBy
|
|
3176
3452
|
}, toggleGroupRow, groupColumn));
|
|
3177
3453
|
}
|
|
3178
|
-
|
|
3454
|
+
columns.forEach((col, colId) => {
|
|
3455
|
+
computedColumns.set(colId, col);
|
|
3456
|
+
});
|
|
3457
|
+
return computedColumns;
|
|
3179
3458
|
}
|
|
3180
3459
|
|
|
3181
3460
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
3182
3461
|
function useComputed() {
|
|
3183
|
-
|
|
3462
|
+
var _a;
|
|
3463
|
+
const { componentActions, componentState } = useComponentState();
|
|
3184
3464
|
const {
|
|
3185
3465
|
componentActions: dataSourceActions,
|
|
3186
3466
|
componentState: dataSourceState
|
|
3187
3467
|
} = useDataSourceContextValue();
|
|
3188
3468
|
const { columnOrder, columnVisibility, columnPinning, bodySize } = componentState;
|
|
3189
|
-
(0,
|
|
3190
|
-
componentState.
|
|
3469
|
+
(0, import_react19.useState)(() => {
|
|
3470
|
+
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
3191
3471
|
if (rowHeight) {
|
|
3192
|
-
componentActions.
|
|
3472
|
+
componentActions.rowHeight = rowHeight;
|
|
3193
3473
|
}
|
|
3194
3474
|
});
|
|
3195
|
-
componentState.
|
|
3475
|
+
componentState.onHeaderHeightCSSVarChange.onChange((headerHeight) => {
|
|
3196
3476
|
if (headerHeight) {
|
|
3197
|
-
|
|
3477
|
+
componentActions.headerHeight = headerHeight;
|
|
3198
3478
|
}
|
|
3199
3479
|
});
|
|
3200
3480
|
});
|
|
3201
3481
|
useColumnAggregations();
|
|
3202
3482
|
const { multiSort } = dataSourceState;
|
|
3203
3483
|
useColumnGroups();
|
|
3204
|
-
|
|
3205
|
-
const setSortInfo = (0,
|
|
3206
|
-
var
|
|
3207
|
-
dataSourceActions.sortInfo = multiSort ? sortInfo : (
|
|
3208
|
-
}, [
|
|
3484
|
+
useColumnsWhen();
|
|
3485
|
+
const setSortInfo = (0, import_react19.useCallback)((sortInfo) => {
|
|
3486
|
+
var _a2;
|
|
3487
|
+
dataSourceActions.sortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
3488
|
+
}, []);
|
|
3489
|
+
const columns = componentState.computedColumns;
|
|
3209
3490
|
const {
|
|
3210
3491
|
computedColumnOrder,
|
|
3211
3492
|
computedVisibleColumns,
|
|
@@ -3222,8 +3503,7 @@ function useComputed() {
|
|
|
3222
3503
|
computedPinnedStartWidth,
|
|
3223
3504
|
computedPinnedEndWidth
|
|
3224
3505
|
} = useComputedVisibleColumns({
|
|
3225
|
-
columns
|
|
3226
|
-
generatedColumns: componentState.generatedColumns,
|
|
3506
|
+
columns,
|
|
3227
3507
|
columnMinWidth: componentState.columnMinWidth,
|
|
3228
3508
|
columnMaxWidth: componentState.columnMaxWidth,
|
|
3229
3509
|
columnDefaultWidth: componentState.columnDefaultWidth,
|
|
@@ -3232,7 +3512,7 @@ function useComputed() {
|
|
|
3232
3512
|
bodySize,
|
|
3233
3513
|
sortable: componentState.sortable,
|
|
3234
3514
|
draggableColumns: componentState.draggableColumns,
|
|
3235
|
-
sortInfo: dataSourceState.sortInfo,
|
|
3515
|
+
sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
|
|
3236
3516
|
multiSort,
|
|
3237
3517
|
setSortInfo,
|
|
3238
3518
|
columnOrder,
|
|
@@ -3298,11 +3578,11 @@ var useInternalProps = () => {
|
|
|
3298
3578
|
|
|
3299
3579
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3300
3580
|
var InfiniteTableBody = React10.forwardRef(function InfiniteTableBody2(props, ref) {
|
|
3301
|
-
const { rootClassName:
|
|
3581
|
+
const { rootClassName: rootClassName12 } = useInternalProps();
|
|
3302
3582
|
return /* @__PURE__ */ React10.createElement("div", __spreadProps(__spreadValues({
|
|
3303
3583
|
ref
|
|
3304
3584
|
}, props), {
|
|
3305
|
-
className: join(`${
|
|
3585
|
+
className: join(`${rootClassName12}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
|
|
3306
3586
|
}));
|
|
3307
3587
|
});
|
|
3308
3588
|
|
|
@@ -3371,29 +3651,47 @@ function VerticalScrollbarPlaceholderFn(props) {
|
|
|
3371
3651
|
}
|
|
3372
3652
|
var VerticalScrollbarPlaceholder = React11.memo(VerticalScrollbarPlaceholderFn);
|
|
3373
3653
|
|
|
3654
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
3655
|
+
var CellCls = "_1eexc2a5 _16lm1iwh _16lm1iwy _16lm1iwz _16lm1iw2 _16lm1iw17 _16lm1iw18";
|
|
3656
|
+
var HeaderCellProxy = "_12zfob10";
|
|
3657
|
+
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"]] });
|
|
3658
|
+
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"]] });
|
|
3659
|
+
var HeaderGroupCls = "_16lm1iwx _16lm1iwh";
|
|
3660
|
+
var HeaderGroup_Children = "_16lm1iwh _16lm1iwy _16lm1iw10 _16lm1iwa";
|
|
3661
|
+
var HeaderGroup_Header = "_12zfob1x _16lm1iwh _16lm1iwy _16lm1iwz";
|
|
3662
|
+
var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
|
|
3663
|
+
var HeaderWrapperCls = "_12zfob1v _16lm1iw14 _16lm1iw1 _16lm1iwh _16lm1iwy";
|
|
3664
|
+
|
|
3374
3665
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
3375
3666
|
var React18 = __toModule(require("react"));
|
|
3376
|
-
var
|
|
3667
|
+
var import_react26 = __toModule(require("react"));
|
|
3377
3668
|
|
|
3378
3669
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3379
3670
|
var React14 = __toModule(require("react"));
|
|
3380
|
-
var
|
|
3671
|
+
var import_react23 = __toModule(require("react"));
|
|
3381
3672
|
|
|
3382
3673
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
3383
3674
|
var React12 = __toModule(require("react"));
|
|
3384
3675
|
|
|
3385
3676
|
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
3386
|
-
var
|
|
3677
|
+
var import_react20 = __toModule(require("react"));
|
|
3387
3678
|
var useInfiniteTableState = () => {
|
|
3388
3679
|
const TableContext2 = getInfiniteTableContext();
|
|
3389
|
-
const { componentState } = (0,
|
|
3680
|
+
const { componentState } = (0, import_react20.useContext)(TableContext2);
|
|
3390
3681
|
return componentState;
|
|
3391
3682
|
};
|
|
3392
3683
|
|
|
3684
|
+
// src/components/InfiniteTable/components/cell.css.ts
|
|
3685
|
+
var CellCls2 = "_1eexc2a5 _16lm1iwh _16lm1iwy _16lm1iwz _16lm1iw2 _16lm1iw17 _16lm1iw18";
|
|
3686
|
+
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
3687
|
+
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"]] });
|
|
3688
|
+
var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
|
|
3689
|
+
|
|
3393
3690
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
3394
3691
|
var { rootClassName: rootClassName2 } = internalProps;
|
|
3395
3692
|
var InfiniteTableCellClassName = `${rootClassName2}Cell`;
|
|
3396
3693
|
function InfiniteTableCellFn(props) {
|
|
3694
|
+
var _b, _c;
|
|
3397
3695
|
const _a = props, {
|
|
3398
3696
|
cssEllipsis = true,
|
|
3399
3697
|
virtualized = true,
|
|
@@ -3435,7 +3733,7 @@ function InfiniteTableCellFn(props) {
|
|
|
3435
3733
|
ref: domRef,
|
|
3436
3734
|
style,
|
|
3437
3735
|
"data-name": `Cell`,
|
|
3438
|
-
className: join(domProps.className,
|
|
3736
|
+
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}` : "")
|
|
3439
3737
|
}), beforeChildren, cssEllipsis ? /* @__PURE__ */ React12.createElement("div", {
|
|
3440
3738
|
className: `${rootClassName2}Cell_content ${cssEllipsisClassName}`
|
|
3441
3739
|
}, children) : children, afterChildren);
|
|
@@ -3444,7 +3742,7 @@ var InfiniteTableCell = React12.memo(InfiniteTableCellFn);
|
|
|
3444
3742
|
|
|
3445
3743
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3446
3744
|
var import_binary_search = __toModule(require_binary_search());
|
|
3447
|
-
var
|
|
3745
|
+
var import_react21 = __toModule(require("react"));
|
|
3448
3746
|
|
|
3449
3747
|
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
3450
3748
|
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
@@ -3478,18 +3776,18 @@ var useColumnPointerEvents = ({
|
|
|
3478
3776
|
columns,
|
|
3479
3777
|
computedRemainingSpace
|
|
3480
3778
|
}) => {
|
|
3481
|
-
const [draggingDiff, setDraggingDiff] = (0,
|
|
3482
|
-
const [proxyOffset, setProxyOffset] = (0,
|
|
3483
|
-
const breakpointsRef = (0,
|
|
3484
|
-
const pointerMoveRef = (0,
|
|
3485
|
-
const didDragRef = (0,
|
|
3486
|
-
const initialClientPos = (0,
|
|
3487
|
-
const currentDropIndexRef = (0,
|
|
3779
|
+
const [draggingDiff, setDraggingDiff] = (0, import_react21.useState)(null);
|
|
3780
|
+
const [proxyOffset, setProxyOffset] = (0, import_react21.useState)(null);
|
|
3781
|
+
const breakpointsRef = (0, import_react21.useRef)([]);
|
|
3782
|
+
const pointerMoveRef = (0, import_react21.useRef)(null);
|
|
3783
|
+
const didDragRef = (0, import_react21.useRef)(false);
|
|
3784
|
+
const initialClientPos = (0, import_react21.useRef)(null);
|
|
3785
|
+
const currentDropIndexRef = (0, import_react21.useRef)(null);
|
|
3488
3786
|
const dragging = draggingDiff != null;
|
|
3489
3787
|
const { componentActions, computed } = useInfiniteTable();
|
|
3490
3788
|
const { computedColumnOrder } = computed;
|
|
3491
|
-
const column = (0,
|
|
3492
|
-
const { columnIndex, columnWidth, columnsArray } = (0,
|
|
3789
|
+
const column = (0, import_react21.useMemo)(() => columns.get(columnId), [columnId, columns]);
|
|
3790
|
+
const { columnIndex, columnWidth, columnsArray } = (0, import_react21.useMemo)(() => {
|
|
3493
3791
|
const columnsArray2 = Array.from(columns.values());
|
|
3494
3792
|
return {
|
|
3495
3793
|
columnsArray: columnsArray2,
|
|
@@ -3497,8 +3795,8 @@ var useColumnPointerEvents = ({
|
|
|
3497
3795
|
columnWidth: column.computedWidth
|
|
3498
3796
|
};
|
|
3499
3797
|
}, [columns, columnId, column]);
|
|
3500
|
-
let cursorRef = (0,
|
|
3501
|
-
const onPointerDown = (0,
|
|
3798
|
+
let cursorRef = (0, import_react21.useRef)("auto");
|
|
3799
|
+
const onPointerDown = (0, import_react21.useCallback)((e) => {
|
|
3502
3800
|
const target = domRef.current;
|
|
3503
3801
|
cursorRef.current = target.style.cursor;
|
|
3504
3802
|
didDragRef.current = false;
|
|
@@ -3561,7 +3859,7 @@ var useColumnPointerEvents = ({
|
|
|
3561
3859
|
target.addEventListener("pointermove", onPointerMove);
|
|
3562
3860
|
target.setPointerCapture(e.pointerId);
|
|
3563
3861
|
}, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
|
|
3564
|
-
const onPointerUp = (0,
|
|
3862
|
+
const onPointerUp = (0, import_react21.useCallback)((e) => {
|
|
3565
3863
|
const target = domRef.current;
|
|
3566
3864
|
target.style.cursor = cursorRef.current;
|
|
3567
3865
|
target.releasePointerCapture(e.pointerId);
|
|
@@ -3595,11 +3893,25 @@ var useColumnPointerEvents = ({
|
|
|
3595
3893
|
};
|
|
3596
3894
|
|
|
3597
3895
|
// src/components/InfiniteTable/hooks/useCellClassName.ts
|
|
3598
|
-
function useCellClassName(column, baseClasses) {
|
|
3896
|
+
function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
3599
3897
|
const result = [...baseClasses];
|
|
3898
|
+
const variantObject = {
|
|
3899
|
+
first: column.computedFirst,
|
|
3900
|
+
last: column.computedLast,
|
|
3901
|
+
groupByField: !!column.groupByField,
|
|
3902
|
+
firstInCategory: column.computedFirstInCategory,
|
|
3903
|
+
lastInCategory: column.computedLastInCategory,
|
|
3904
|
+
pinned: column.computedPinned || false,
|
|
3905
|
+
dragging: extraFlags.dragging
|
|
3906
|
+
};
|
|
3907
|
+
const theVariant = variants(variantObject);
|
|
3908
|
+
result.push(theVariant);
|
|
3600
3909
|
if (column.computedFirst) {
|
|
3601
3910
|
result.push(...baseClasses.map((c) => `${c}--first`));
|
|
3602
3911
|
}
|
|
3912
|
+
if (column.groupByField) {
|
|
3913
|
+
result.push(...baseClasses.map((c) => `${c}--group-column`));
|
|
3914
|
+
}
|
|
3603
3915
|
if (column.computedLast) {
|
|
3604
3916
|
result.push(...baseClasses.map((c) => `${c}--last`));
|
|
3605
3917
|
}
|
|
@@ -3614,7 +3926,7 @@ function useCellClassName(column, baseClasses) {
|
|
|
3614
3926
|
} else {
|
|
3615
3927
|
result.push(...baseClasses.map((c) => `${c}--unpinned`));
|
|
3616
3928
|
}
|
|
3617
|
-
return result.join(" ");
|
|
3929
|
+
return result.filter(Boolean).join(" ");
|
|
3618
3930
|
}
|
|
3619
3931
|
|
|
3620
3932
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
@@ -3622,7 +3934,7 @@ var import_react_dom = __toModule(require("react-dom"));
|
|
|
3622
3934
|
|
|
3623
3935
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
3624
3936
|
var React13 = __toModule(require("react"));
|
|
3625
|
-
var
|
|
3937
|
+
var import_react22 = __toModule(require("react"));
|
|
3626
3938
|
var defaultLineStyle = {
|
|
3627
3939
|
marginTop: 2,
|
|
3628
3940
|
marginBottom: 2,
|
|
@@ -3630,8 +3942,8 @@ var defaultLineStyle = {
|
|
|
3630
3942
|
};
|
|
3631
3943
|
function SortIcon(props) {
|
|
3632
3944
|
var _a;
|
|
3633
|
-
const [rendered, setRendered] = (0,
|
|
3634
|
-
const [opacity, setOpacity] = (0,
|
|
3945
|
+
const [rendered, setRendered] = (0, import_react22.useState)(true);
|
|
3946
|
+
const [opacity, setOpacity] = (0, import_react22.useState)(0);
|
|
3635
3947
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
3636
3948
|
const showIndex = index != null && index > 0;
|
|
3637
3949
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -3645,7 +3957,7 @@ function SortIcon(props) {
|
|
|
3645
3957
|
}), props.lineStyle), {
|
|
3646
3958
|
opacity
|
|
3647
3959
|
});
|
|
3648
|
-
(0,
|
|
3960
|
+
(0, import_react22.useEffect)(() => {
|
|
3649
3961
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
3650
3962
|
if (!rendered && newOpacity) {
|
|
3651
3963
|
setRendered(true);
|
|
@@ -3719,11 +4031,11 @@ function InfiniteTableHeaderCell(props) {
|
|
|
3719
4031
|
header = header != null ? header : column.name;
|
|
3720
4032
|
const sortTool = /* @__PURE__ */ React14.createElement(SortIcon, {
|
|
3721
4033
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
3722
|
-
className: `${baseCls}__sort-icon`,
|
|
4034
|
+
className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
|
|
3723
4035
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
3724
4036
|
});
|
|
3725
|
-
const domRef = (0,
|
|
3726
|
-
const ref = (0,
|
|
4037
|
+
const domRef = (0, import_react23.useRef)(null);
|
|
4038
|
+
const ref = (0, import_react23.useCallback)((node) => {
|
|
3727
4039
|
var _a2;
|
|
3728
4040
|
domRef.current = node;
|
|
3729
4041
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
@@ -3732,7 +4044,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
3732
4044
|
computed: { computedRemainingSpace },
|
|
3733
4045
|
componentState: { portalDOMRef }
|
|
3734
4046
|
} = useInfiniteTable();
|
|
3735
|
-
(0,
|
|
4047
|
+
(0, import_react23.useEffect)(() => {
|
|
3736
4048
|
let clearOnResize = null;
|
|
3737
4049
|
const node = domRef.current;
|
|
3738
4050
|
if (onResize && node) {
|
|
@@ -3756,7 +4068,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
3756
4068
|
let draggingProxy = null;
|
|
3757
4069
|
if (dragging) {
|
|
3758
4070
|
draggingProxy = /* @__PURE__ */ React14.createElement("div", {
|
|
3759
|
-
className: `${baseCls}Proxy`,
|
|
4071
|
+
className: `${baseCls}Proxy ${HeaderCellProxy}`,
|
|
3760
4072
|
style: {
|
|
3761
4073
|
position: "absolute",
|
|
3762
4074
|
height: headerHeight,
|
|
@@ -3777,7 +4089,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
3777
4089
|
offset,
|
|
3778
4090
|
onPointerDown,
|
|
3779
4091
|
onPointerUp,
|
|
3780
|
-
className: join(baseCls,
|
|
4092
|
+
className: join(baseCls, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [baseCls, InfiniteTableCellClassName], HeaderCellRecipe, { dragging }), CellCls),
|
|
3781
4093
|
cssEllipsis: (_d = (_c = column.headerCssEllipsis) != null ? _c : column.cssEllipsis) != null ? _d : true,
|
|
3782
4094
|
afterChildren: sortTool
|
|
3783
4095
|
}, header), draggingProxy);
|
|
@@ -3785,7 +4097,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
3785
4097
|
|
|
3786
4098
|
// src/components/RawList/index.tsx
|
|
3787
4099
|
var React17 = __toModule(require("react"));
|
|
3788
|
-
var
|
|
4100
|
+
var import_react25 = __toModule(require("react"));
|
|
3789
4101
|
|
|
3790
4102
|
// src/components/RawList/ReactVirtualRenderer.tsx
|
|
3791
4103
|
var React16 = __toModule(require("react"));
|
|
@@ -3904,10 +4216,10 @@ var MappedItems = class extends Logger {
|
|
|
3904
4216
|
|
|
3905
4217
|
// src/components/RawList/AvoidReactDiff.tsx
|
|
3906
4218
|
var React15 = __toModule(require("react"));
|
|
3907
|
-
var
|
|
4219
|
+
var import_react24 = __toModule(require("react"));
|
|
3908
4220
|
function AvoidReactDiffFn(props) {
|
|
3909
|
-
const [children, setChildren] = (0,
|
|
3910
|
-
(0,
|
|
4221
|
+
const [children, setChildren] = (0, import_react24.useState)(props.updater.get());
|
|
4222
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
3911
4223
|
const remove = props.updater.onChange((children2) => {
|
|
3912
4224
|
setChildren(children2);
|
|
3913
4225
|
});
|
|
@@ -4059,9 +4371,21 @@ var ReactVirtualRenderer = class extends Logger {
|
|
|
4059
4371
|
if (this.destroyed) {
|
|
4060
4372
|
return;
|
|
4061
4373
|
}
|
|
4374
|
+
const spanParent = this.brain.getItemSpanParent(itemIndex);
|
|
4375
|
+
let covered = false;
|
|
4376
|
+
if (spanParent !== itemIndex) {
|
|
4377
|
+
covered = true;
|
|
4378
|
+
}
|
|
4379
|
+
const itemSize = this.brain.getItemSize(itemIndex);
|
|
4380
|
+
const itemSpan = this.brain.getItemSpan(itemIndex);
|
|
4381
|
+
const itemSizeWithSpan = itemSpan === 1 ? itemSize : this.brain.getItemSizeWithSpan(itemIndex, itemSpan);
|
|
4062
4382
|
const renderedNode = renderItem({
|
|
4383
|
+
spanParent,
|
|
4063
4384
|
itemIndex,
|
|
4064
|
-
itemSize
|
|
4385
|
+
itemSize,
|
|
4386
|
+
itemSizeWithSpan,
|
|
4387
|
+
itemSpan,
|
|
4388
|
+
covered,
|
|
4065
4389
|
domRef: this.itemDOMRefs[elementIndex]
|
|
4066
4390
|
});
|
|
4067
4391
|
const itemUpdater = this.updaters[elementIndex];
|
|
@@ -4081,7 +4405,7 @@ var ReactVirtualRenderer = class extends Logger {
|
|
|
4081
4405
|
// src/components/RawList/index.tsx
|
|
4082
4406
|
function RawListFn(props) {
|
|
4083
4407
|
const { renderItem, brain, debugChannel } = props;
|
|
4084
|
-
const { onRenderUpdater, renderer } = (0,
|
|
4408
|
+
const { onRenderUpdater, renderer } = (0, import_react25.useMemo)(() => {
|
|
4085
4409
|
const onRenderUpdater2 = buildSubscriptionCallback();
|
|
4086
4410
|
const renderer2 = new ReactVirtualRenderer(brain, {
|
|
4087
4411
|
channel: debugChannel
|
|
@@ -4089,7 +4413,7 @@ function RawListFn(props) {
|
|
|
4089
4413
|
return { onRenderUpdater: onRenderUpdater2, renderer: renderer2 };
|
|
4090
4414
|
}, []);
|
|
4091
4415
|
const getRenderItem = useLatest(renderItem);
|
|
4092
|
-
(0,
|
|
4416
|
+
(0, import_react25.useEffect)(() => {
|
|
4093
4417
|
const renderRange = brain.getRenderRange();
|
|
4094
4418
|
renderer.renderRange(renderRange, {
|
|
4095
4419
|
renderItem,
|
|
@@ -4097,7 +4421,7 @@ function RawListFn(props) {
|
|
|
4097
4421
|
onRender: onRenderUpdater
|
|
4098
4422
|
});
|
|
4099
4423
|
}, [renderItem, onRenderUpdater]);
|
|
4100
|
-
(0,
|
|
4424
|
+
(0, import_react25.useEffect)(() => {
|
|
4101
4425
|
const remove = brain.onRenderRangeChange((renderRange) => {
|
|
4102
4426
|
renderer.renderRange(renderRange, {
|
|
4103
4427
|
force: false,
|
|
@@ -4107,7 +4431,7 @@ function RawListFn(props) {
|
|
|
4107
4431
|
});
|
|
4108
4432
|
return remove;
|
|
4109
4433
|
}, [brain, onRenderUpdater]);
|
|
4110
|
-
(0,
|
|
4434
|
+
(0, import_react25.useEffect)(() => {
|
|
4111
4435
|
return () => {
|
|
4112
4436
|
renderer.destroy();
|
|
4113
4437
|
onRenderUpdater.destroy();
|
|
@@ -4124,13 +4448,13 @@ var debug3 = dbg("Header");
|
|
|
4124
4448
|
var { rootClassName: rootClassName4 } = internalProps;
|
|
4125
4449
|
var TableHeaderClassName = `${rootClassName4}Header`;
|
|
4126
4450
|
function InfiniteTableHeaderFn(props) {
|
|
4127
|
-
const { repaintId, brain, columns, style, className } = props;
|
|
4451
|
+
const { repaintId, brain, columns, style, className, pinning } = props;
|
|
4128
4452
|
const {
|
|
4129
4453
|
computed,
|
|
4130
4454
|
componentState: { headerHeight }
|
|
4131
4455
|
} = useInfiniteTable();
|
|
4132
4456
|
const { computedVisibleColumnsMap } = computed;
|
|
4133
|
-
const renderColumn = (0,
|
|
4457
|
+
const renderColumn = (0, import_react26.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
|
|
4134
4458
|
const column = columns[columnIndex];
|
|
4135
4459
|
if (!column) {
|
|
4136
4460
|
if (false) {
|
|
@@ -4145,17 +4469,22 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4145
4469
|
columns: computedVisibleColumnsMap
|
|
4146
4470
|
});
|
|
4147
4471
|
}, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
|
|
4148
|
-
(0,
|
|
4472
|
+
(0, import_react26.useEffect)(() => {
|
|
4149
4473
|
const onScroll = (scrollPosition) => {
|
|
4150
4474
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
4151
4475
|
};
|
|
4152
4476
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4153
4477
|
return removeOnScroll;
|
|
4154
4478
|
}, [brain]);
|
|
4155
|
-
const domRef = (0,
|
|
4479
|
+
const domRef = (0, import_react26.useRef)(null);
|
|
4480
|
+
const headerCls = HeaderClsRecipe({
|
|
4481
|
+
pinned: pinning,
|
|
4482
|
+
overflow: false,
|
|
4483
|
+
virtualized: true
|
|
4484
|
+
});
|
|
4156
4485
|
const domProps = {
|
|
4157
4486
|
ref: domRef,
|
|
4158
|
-
className: join(
|
|
4487
|
+
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4159
4488
|
style
|
|
4160
4489
|
};
|
|
4161
4490
|
return /* @__PURE__ */ React18.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React18.createElement(RawList, {
|
|
@@ -4275,15 +4604,15 @@ function InfiniteTableHeaderGroup(props) {
|
|
|
4275
4604
|
};
|
|
4276
4605
|
return /* @__PURE__ */ React19.createElement("div", {
|
|
4277
4606
|
"data-group-id": columnGroup.id,
|
|
4278
|
-
className: join(
|
|
4607
|
+
className: join(HeaderGroupCls, TableHeaderGroupClassName, `${TableHeaderGroupClassName}--unvirtualized`),
|
|
4279
4608
|
style
|
|
4280
4609
|
}, /* @__PURE__ */ React19.createElement("div", {
|
|
4281
|
-
className: join(`${TableHeaderGroupClassName}__header`,
|
|
4610
|
+
className: join(`${TableHeaderGroupClassName}__header`, HeaderGroup_Header),
|
|
4282
4611
|
style: { height: headerHeight }
|
|
4283
4612
|
}, /* @__PURE__ */ React19.createElement("div", {
|
|
4284
4613
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4285
4614
|
}, header)), /* @__PURE__ */ React19.createElement("div", {
|
|
4286
|
-
className: join(`${TableHeaderGroupClassName}__children`,
|
|
4615
|
+
className: join(`${TableHeaderGroupClassName}__children`, HeaderGroup_Children)
|
|
4287
4616
|
}, props.children));
|
|
4288
4617
|
}
|
|
4289
4618
|
|
|
@@ -4339,7 +4668,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
4339
4668
|
}
|
|
4340
4669
|
|
|
4341
4670
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
|
|
4342
|
-
var
|
|
4671
|
+
var import_react27 = __toModule(require("react"));
|
|
4343
4672
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
4344
4673
|
var TableHeaderClassName2 = `${rootClassName5}Header`;
|
|
4345
4674
|
var UPDATE_SCROLL = (node, scrollPosition) => {
|
|
@@ -4349,17 +4678,17 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4349
4678
|
const _a = props, {
|
|
4350
4679
|
columns,
|
|
4351
4680
|
scrollable,
|
|
4352
|
-
classNameModifiers,
|
|
4353
4681
|
brain,
|
|
4354
4682
|
scrollListener,
|
|
4683
|
+
pinning,
|
|
4355
4684
|
totalWidth,
|
|
4356
4685
|
availableWidth
|
|
4357
4686
|
} = _a, domProps = __objRest(_a, [
|
|
4358
4687
|
"columns",
|
|
4359
4688
|
"scrollable",
|
|
4360
|
-
"classNameModifiers",
|
|
4361
4689
|
"brain",
|
|
4362
4690
|
"scrollListener",
|
|
4691
|
+
"pinning",
|
|
4363
4692
|
"totalWidth",
|
|
4364
4693
|
"availableWidth"
|
|
4365
4694
|
]);
|
|
@@ -4405,7 +4734,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4405
4734
|
if (totalWidth != null) {
|
|
4406
4735
|
style.width = availableWidth;
|
|
4407
4736
|
}
|
|
4408
|
-
(0,
|
|
4737
|
+
(0, import_react27.useEffect)(() => {
|
|
4409
4738
|
const scroller = brain || scrollListener;
|
|
4410
4739
|
if (!scroller || !scrollable) {
|
|
4411
4740
|
return;
|
|
@@ -4417,11 +4746,15 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4417
4746
|
return removeOnScroll;
|
|
4418
4747
|
}, [brain, scrollListener]);
|
|
4419
4748
|
return /* @__PURE__ */ React21.createElement("div", __spreadProps(__spreadValues({}, domProps), {
|
|
4420
|
-
className: join(TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`,
|
|
4749
|
+
className: join(TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`, pinning ? `${TableHeaderClassName2}--pinned ${TableHeaderClassName2}-${pinning}` : "", scrollable ? `${TableHeaderClassName2}--overflow` : "", domProps.className, HeaderClsRecipe({
|
|
4750
|
+
pinned: pinning,
|
|
4751
|
+
virtualized: false,
|
|
4752
|
+
overflow: scrollable
|
|
4753
|
+
})),
|
|
4421
4754
|
style
|
|
4422
4755
|
}), /* @__PURE__ */ React21.createElement("div", {
|
|
4423
4756
|
style: { width: totalWidth },
|
|
4424
|
-
className: join(
|
|
4757
|
+
className: join(flexFlow.row, display.flex),
|
|
4425
4758
|
ref: domRef
|
|
4426
4759
|
}, children));
|
|
4427
4760
|
}
|
|
@@ -4459,6 +4792,7 @@ function TableHeaderWrapper(props) {
|
|
|
4459
4792
|
columns: computedUnpinnedColumns,
|
|
4460
4793
|
repaintId: virtualizeHeader ? repaintId : void 0,
|
|
4461
4794
|
brain,
|
|
4795
|
+
pinning: false,
|
|
4462
4796
|
style: {
|
|
4463
4797
|
position: "absolute",
|
|
4464
4798
|
left: computedPinnedStartWidth,
|
|
@@ -4470,14 +4804,14 @@ function TableHeaderWrapper(props) {
|
|
|
4470
4804
|
}) : /* @__PURE__ */ React22.createElement(InfiniteTableHeaderUnvirtualized, {
|
|
4471
4805
|
brain,
|
|
4472
4806
|
scrollable: true,
|
|
4807
|
+
pinning: false,
|
|
4473
4808
|
columns: computedUnpinnedColumns,
|
|
4474
4809
|
availableWidth: computedUnpinnedColumnsWidth,
|
|
4475
4810
|
totalWidth: computedUnpinnedColumnsWidth
|
|
4476
4811
|
});
|
|
4477
4812
|
return /* @__PURE__ */ React22.createElement("div", {
|
|
4478
|
-
className:
|
|
4813
|
+
className: HeaderWrapperCls,
|
|
4479
4814
|
style: {
|
|
4480
|
-
background: "var(--ITableHeader__background)",
|
|
4481
4815
|
height: virtualizeHeader ? height : void 0
|
|
4482
4816
|
}
|
|
4483
4817
|
}, hasPinnedStart ? /* @__PURE__ */ React22.createElement(InfiniteTableHeaderUnvirtualized, {
|
|
@@ -4490,11 +4824,7 @@ function TableHeaderWrapper(props) {
|
|
|
4490
4824
|
totalWidth: computedPinnedStartColumnsWidth,
|
|
4491
4825
|
columns: computedPinnedStartColumns,
|
|
4492
4826
|
scrollable: computedPinnedStartOverflow,
|
|
4493
|
-
|
|
4494
|
-
"pinned",
|
|
4495
|
-
"pinned-start",
|
|
4496
|
-
computedPinnedStartOverflow ? "overflow" : ""
|
|
4497
|
-
],
|
|
4827
|
+
pinning: "start",
|
|
4498
4828
|
scrollListener: computedPinnedStartOverflow ? pinnedStartScrollListener : void 0
|
|
4499
4829
|
}) : null, header, hasPinnedEnd ? /* @__PURE__ */ React22.createElement(InfiniteTableHeaderUnvirtualized, {
|
|
4500
4830
|
style: {
|
|
@@ -4506,11 +4836,7 @@ function TableHeaderWrapper(props) {
|
|
|
4506
4836
|
availableWidth: computedPinnedEndWidth,
|
|
4507
4837
|
totalWidth: computedPinnedEndColumnsWidth,
|
|
4508
4838
|
scrollable: computedPinnedEndOverflow,
|
|
4509
|
-
|
|
4510
|
-
"pinned",
|
|
4511
|
-
"pinned-end",
|
|
4512
|
-
computedPinnedEndOverflow ? "overflow" : ""
|
|
4513
|
-
],
|
|
4839
|
+
pinning: "end",
|
|
4514
4840
|
scrollListener: computedPinnedEndOverflow ? pinnedEndScrollListener : void 0
|
|
4515
4841
|
}) : null, scrollbars.vertical ? /* @__PURE__ */ React22.createElement(VerticalScrollbarPlaceholder, {
|
|
4516
4842
|
style: {
|
|
@@ -4522,12 +4848,12 @@ function TableHeaderWrapper(props) {
|
|
|
4522
4848
|
|
|
4523
4849
|
// src/components/VirtualScrollContainer/index.tsx
|
|
4524
4850
|
var React23 = __toModule(require("react"));
|
|
4525
|
-
var
|
|
4851
|
+
var import_react29 = __toModule(require("react"));
|
|
4526
4852
|
|
|
4527
4853
|
// src/components/hooks/useOnScroll.ts
|
|
4528
|
-
var
|
|
4854
|
+
var import_react28 = __toModule(require("react"));
|
|
4529
4855
|
var useOnScroll = (domRef, onScroll) => {
|
|
4530
|
-
(0,
|
|
4856
|
+
(0, import_react28.useEffect)(() => {
|
|
4531
4857
|
const domNode = domRef == null ? void 0 : domRef.current;
|
|
4532
4858
|
const scrollFn = (event) => {
|
|
4533
4859
|
const node = event.target;
|
|
@@ -4546,21 +4872,25 @@ var useOnScroll = (domRef, onScroll) => {
|
|
|
4546
4872
|
}, [onScroll, domRef == null ? void 0 : domRef.current]);
|
|
4547
4873
|
};
|
|
4548
4874
|
|
|
4875
|
+
// src/components/VirtualScrollContainer/VirtualScrollContainer.css.ts
|
|
4876
|
+
var ScrollableCls = { true: "_1ueijco1", false: "_1ueijco2", visible: "_1ueijco3", auto: "_1ueijco4", hidden: "_1ueijco5" };
|
|
4877
|
+
var ScrollableHorizontalCls = { true: "_1ueijco6", false: "_1ueijco7", visible: "_1ueijco8", auto: "_1ueijco9", hidden: "_1ueijcoa" };
|
|
4878
|
+
var ScrollableVerticalCls = { true: "_1ueijcob", false: "_1ueijcoc", visible: "_1ueijcod", auto: "_1ueijcoe", hidden: "_1ueijcof" };
|
|
4879
|
+
var VirtualScrollContainerCls = "_1ueijco0 _16lm1iw0";
|
|
4880
|
+
|
|
4549
4881
|
// src/components/VirtualScrollContainer/getScrollableClassName.ts
|
|
4550
4882
|
var getScrollableClassName = (scrollable) => {
|
|
4551
4883
|
let scrollableClassName = "";
|
|
4552
|
-
if (typeof scrollable === "boolean") {
|
|
4553
|
-
scrollableClassName = scrollable
|
|
4554
|
-
} else if (typeof scrollable === "string") {
|
|
4555
|
-
scrollableClassName = ICSS.overflow[scrollable];
|
|
4884
|
+
if (typeof scrollable === "boolean" || typeof scrollable === "string") {
|
|
4885
|
+
scrollableClassName = ScrollableCls[`${scrollable}`];
|
|
4556
4886
|
} else {
|
|
4557
|
-
scrollableClassName = join(
|
|
4887
|
+
scrollableClassName = join(ScrollableHorizontalCls[`${scrollable.horizontal}`], ScrollableVerticalCls[`${scrollable.vertical}`]);
|
|
4558
4888
|
}
|
|
4559
4889
|
return scrollableClassName;
|
|
4560
4890
|
};
|
|
4561
4891
|
|
|
4562
4892
|
// src/components/VirtualScrollContainer/index.tsx
|
|
4563
|
-
var rootClassName6 = "
|
|
4893
|
+
var rootClassName6 = "Infinite-VirtualScrollContainer";
|
|
4564
4894
|
var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2(props, ref) {
|
|
4565
4895
|
const {
|
|
4566
4896
|
children,
|
|
@@ -4569,16 +4899,12 @@ var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2
|
|
|
4569
4899
|
className,
|
|
4570
4900
|
style
|
|
4571
4901
|
} = props;
|
|
4572
|
-
const domRef = ref != null ? ref : (0,
|
|
4902
|
+
const domRef = ref != null ? ref : (0, import_react29.useRef)(null);
|
|
4573
4903
|
useOnScroll(domRef, onContainerScroll);
|
|
4574
4904
|
return /* @__PURE__ */ React23.createElement("div", {
|
|
4575
4905
|
ref: domRef,
|
|
4576
4906
|
style,
|
|
4577
|
-
className:
|
|
4578
|
-
className,
|
|
4579
|
-
rootClassName6,
|
|
4580
|
-
getScrollableClassName(scrollable)
|
|
4581
|
-
].join(" ")
|
|
4907
|
+
className: join(className, rootClassName6, VirtualScrollContainerCls, getScrollableClassName(scrollable))
|
|
4582
4908
|
}, children);
|
|
4583
4909
|
});
|
|
4584
4910
|
|
|
@@ -4604,24 +4930,30 @@ function SpacePlaceholderFn(props) {
|
|
|
4604
4930
|
var SpacePlaceholder = React24.memo(SpacePlaceholderFn);
|
|
4605
4931
|
|
|
4606
4932
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
4607
|
-
var
|
|
4933
|
+
var import_react40 = __toModule(require("react"));
|
|
4608
4934
|
|
|
4609
4935
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
4610
4936
|
var React30 = __toModule(require("react"));
|
|
4611
|
-
var
|
|
4937
|
+
var import_react33 = __toModule(require("react"));
|
|
4612
4938
|
|
|
4613
4939
|
// src/components/VirtualList/VirtualRowList.tsx
|
|
4614
4940
|
var React26 = __toModule(require("react"));
|
|
4615
4941
|
|
|
4616
4942
|
// src/components/VirtualList/VirtualList.tsx
|
|
4617
4943
|
var React25 = __toModule(require("react"));
|
|
4618
|
-
var
|
|
4944
|
+
var import_react30 = __toModule(require("react"));
|
|
4945
|
+
|
|
4946
|
+
// src/components/VirtualList/VirtualList.css.ts
|
|
4947
|
+
var VirtualListCls = "mlx2t0 _16lm1iw0";
|
|
4948
|
+
var VirtualListClsOrientation = { horizontal: "mlx2t1", vertical: "mlx2t2" };
|
|
4949
|
+
var scrollTransformTargetCls = "mlx2t3";
|
|
4950
|
+
|
|
4951
|
+
// src/components/VirtualList/VirtualList.tsx
|
|
4619
4952
|
var UPDATE_SCROLL2 = (node, scrollPosition) => {
|
|
4620
4953
|
node.style.transform = `translate3d(${-scrollPosition.scrollLeft}px, ${-scrollPosition.scrollTop}px, 0px)`;
|
|
4621
4954
|
};
|
|
4622
|
-
var CLASSES = join(ICSS.height["0"], ICSS.width["0"], ICSS.willChange.transform);
|
|
4623
4955
|
var debug4 = dbg("VirtuaList");
|
|
4624
|
-
var rootClassName7 = "
|
|
4956
|
+
var rootClassName7 = "InfiniteList";
|
|
4625
4957
|
var VirtualList = (props) => {
|
|
4626
4958
|
const _a = props, {
|
|
4627
4959
|
scrollable,
|
|
@@ -4652,11 +4984,11 @@ var VirtualList = (props) => {
|
|
|
4652
4984
|
"onContainerScroll",
|
|
4653
4985
|
"children"
|
|
4654
4986
|
]);
|
|
4655
|
-
const domRef = (0,
|
|
4987
|
+
const domRef = (0, import_react30.useRef)(null);
|
|
4656
4988
|
const [, rerender] = useRerender();
|
|
4657
|
-
const [totalSize, setTotalSize] = (0,
|
|
4658
|
-
const renderCountRef = (0,
|
|
4659
|
-
(0,
|
|
4989
|
+
const [totalSize, setTotalSize] = (0, import_react30.useState)(0);
|
|
4990
|
+
const renderCountRef = (0, import_react30.useRef)(0);
|
|
4991
|
+
(0, import_react30.useEffect)(() => {
|
|
4660
4992
|
const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
|
|
4661
4993
|
renderCountRef.current = renderCount;
|
|
4662
4994
|
if (false) {
|
|
@@ -4675,7 +5007,7 @@ var VirtualList = (props) => {
|
|
|
4675
5007
|
removeOnTotalSizeChange();
|
|
4676
5008
|
};
|
|
4677
5009
|
}, [virtualBrain]);
|
|
4678
|
-
(0,
|
|
5010
|
+
(0, import_react30.useEffect)(() => {
|
|
4679
5011
|
const onScroll = (scrollPosition) => {
|
|
4680
5012
|
UPDATE_SCROLL2(domRef.current, scrollPosition);
|
|
4681
5013
|
};
|
|
@@ -4685,7 +5017,7 @@ var VirtualList = (props) => {
|
|
|
4685
5017
|
const width = mainAxis === "horizontal" ? totalSize : itemCrossAxisSize != null ? itemCrossAxisSize : 0;
|
|
4686
5018
|
const height = mainAxis === "vertical" ? totalSize : itemCrossAxisSize != null ? itemCrossAxisSize : 0;
|
|
4687
5019
|
const domProps = __spreadProps(__spreadValues({}, restDOMProps), {
|
|
4688
|
-
className: join(props.className, rootClassName7, `${rootClassName7}--${mainAxis}`,
|
|
5020
|
+
className: join(props.className, rootClassName7, `${rootClassName7}--${mainAxis}`, VirtualListCls, VirtualListClsOrientation[mainAxis])
|
|
4689
5021
|
});
|
|
4690
5022
|
if (false) {
|
|
4691
5023
|
domProps["data-cmp-name"] = `VirtualList`;
|
|
@@ -4695,7 +5027,7 @@ var VirtualList = (props) => {
|
|
|
4695
5027
|
onContainerScroll
|
|
4696
5028
|
}, /* @__PURE__ */ React25.createElement("div", {
|
|
4697
5029
|
ref: domRef,
|
|
4698
|
-
className:
|
|
5030
|
+
className: scrollTransformTargetCls,
|
|
4699
5031
|
"data-name": "scroll-transform-target"
|
|
4700
5032
|
}, /* @__PURE__ */ React25.createElement(RawList, {
|
|
4701
5033
|
brain: virtualBrain,
|
|
@@ -4729,142 +5061,208 @@ var VirtualRowList = (props) => {
|
|
|
4729
5061
|
|
|
4730
5062
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx
|
|
4731
5063
|
var React28 = __toModule(require("react"));
|
|
4732
|
-
var
|
|
5064
|
+
var import_react32 = __toModule(require("react"));
|
|
4733
5065
|
|
|
4734
5066
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
4735
5067
|
var React27 = __toModule(require("react"));
|
|
4736
5068
|
var { rootClassName: rootClassName8 } = internalProps;
|
|
4737
|
-
var
|
|
5069
|
+
var InfiniteTableColumnCellClassName = `${rootClassName8}ColumnCell`;
|
|
4738
5070
|
function isColumnWithField(c) {
|
|
4739
5071
|
return typeof c.field === "string";
|
|
4740
5072
|
}
|
|
4741
|
-
function isColumnWithRender(c) {
|
|
4742
|
-
return c.render instanceof Function;
|
|
4743
|
-
}
|
|
4744
5073
|
function InfiniteTableColumnCellFn(props) {
|
|
4745
5074
|
var _a;
|
|
4746
5075
|
const {
|
|
4747
|
-
|
|
5076
|
+
rowInfo,
|
|
5077
|
+
getData,
|
|
4748
5078
|
column,
|
|
4749
5079
|
offsetProperty,
|
|
4750
5080
|
toggleGroupRow,
|
|
4751
5081
|
virtualized,
|
|
4752
5082
|
rowIndex,
|
|
4753
|
-
|
|
5083
|
+
rowHeight,
|
|
5084
|
+
domRef,
|
|
5085
|
+
hidden
|
|
4754
5086
|
} = props;
|
|
4755
|
-
|
|
4756
|
-
|
|
5087
|
+
if (!column) {
|
|
5088
|
+
return null;
|
|
5089
|
+
}
|
|
5090
|
+
const { data, isGroupRow, groupBy } = rowInfo;
|
|
5091
|
+
const groupRowInfo = null;
|
|
5092
|
+
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
4757
5093
|
if (column.valueGetter) {
|
|
4758
|
-
value = column.valueGetter({
|
|
5094
|
+
value = column.valueGetter({
|
|
5095
|
+
data,
|
|
5096
|
+
rowInfo,
|
|
5097
|
+
groupRowInfo
|
|
5098
|
+
});
|
|
4759
5099
|
}
|
|
4760
5100
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
4761
|
-
const
|
|
5101
|
+
const stylingRenderParam = {
|
|
4762
5102
|
value,
|
|
4763
5103
|
column,
|
|
4764
|
-
|
|
5104
|
+
rowInfo,
|
|
4765
5105
|
data
|
|
4766
5106
|
};
|
|
4767
|
-
let renderValue =
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
5107
|
+
let renderValue = value;
|
|
5108
|
+
if (column.render || column.renderValue) {
|
|
5109
|
+
const renderParam = {
|
|
5110
|
+
value,
|
|
5111
|
+
column,
|
|
5112
|
+
rowInfo,
|
|
5113
|
+
groupRowInfo,
|
|
5114
|
+
data,
|
|
5115
|
+
rowIndex,
|
|
5116
|
+
toggleGroupRow,
|
|
5117
|
+
toggleCurrentGroupRow: () => toggleGroupRow(rowInfo.groupKeys),
|
|
5118
|
+
groupRowsBy: computedDataSource.groupRowsBy
|
|
5119
|
+
};
|
|
5120
|
+
if (column.render) {
|
|
5121
|
+
renderValue = column.render(renderParam);
|
|
5122
|
+
} else if (column.renderValue) {
|
|
5123
|
+
renderValue = column.renderValue(renderParam);
|
|
5124
|
+
}
|
|
5125
|
+
}
|
|
5126
|
+
const colClassName = column.className ? typeof column.className === "function" ? column.className(stylingRenderParam) : column.className : void 0;
|
|
5127
|
+
const colStyle = column.style ? typeof column.style === "function" ? column.style(stylingRenderParam) : column.style : void 0;
|
|
4779
5128
|
const style = colStyle ? __spreadProps(__spreadValues({}, colStyle), {
|
|
4780
5129
|
width: column.computedWidth
|
|
4781
5130
|
}) : {
|
|
4782
5131
|
width: column.computedWidth
|
|
4783
5132
|
};
|
|
4784
|
-
|
|
4785
|
-
domRef,
|
|
4786
|
-
offsetProperty,
|
|
5133
|
+
const dataset = {
|
|
4787
5134
|
"data-name": `Cell`,
|
|
4788
5135
|
"data-column-id": column.id,
|
|
4789
|
-
"data-column-index": column.computedVisibleIndex
|
|
5136
|
+
"data-column-index": column.computedVisibleIndex
|
|
5137
|
+
};
|
|
5138
|
+
if (typeof column.rowspan === "function") {
|
|
5139
|
+
const rowspan = column.rowspan({
|
|
5140
|
+
dataArray: getData(),
|
|
5141
|
+
column,
|
|
5142
|
+
rowInfo,
|
|
5143
|
+
groupRowInfo,
|
|
5144
|
+
rowIndex,
|
|
5145
|
+
data: rowInfo.data
|
|
5146
|
+
});
|
|
5147
|
+
if (rowspan > 1) {
|
|
5148
|
+
style.height = rowspan * rowHeight;
|
|
5149
|
+
for (let i = 0; i < rowspan; i++) {
|
|
5150
|
+
dataset[`data-hover-${rowIndex + i}`] = true;
|
|
5151
|
+
}
|
|
5152
|
+
}
|
|
5153
|
+
}
|
|
5154
|
+
return /* @__PURE__ */ React27.createElement(InfiniteTableCell, __spreadProps(__spreadValues({
|
|
5155
|
+
domRef,
|
|
5156
|
+
offsetProperty
|
|
5157
|
+
}, dataset), {
|
|
4790
5158
|
column,
|
|
4791
5159
|
offset: virtualized ? 0 : column.computedPinningOffset,
|
|
4792
5160
|
style,
|
|
4793
5161
|
cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
|
|
4794
|
-
className: join(
|
|
4795
|
-
}, renderValue);
|
|
5162
|
+
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false }), colClassName)
|
|
5163
|
+
}), hidden ? null : renderValue);
|
|
4796
5164
|
}
|
|
4797
5165
|
var InfiniteTableColumnCell = React27.memo(InfiniteTableColumnCellFn);
|
|
4798
5166
|
|
|
4799
5167
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
4800
|
-
var
|
|
5168
|
+
var import_react31 = __toModule(require("react"));
|
|
4801
5169
|
|
|
4802
5170
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
|
|
4803
5171
|
var { rootClassName: rootClassName9 } = internalProps;
|
|
4804
5172
|
var InfiniteTableRowClassName = `${rootClassName9}Row`;
|
|
4805
|
-
var InfiniteTableRowClassName__hover = `${
|
|
5173
|
+
var InfiniteTableRowClassName__hover = `${rootClassName9}Element--hover`;
|
|
5174
|
+
|
|
5175
|
+
// src/components/InfiniteTable/theme.css.ts
|
|
5176
|
+
var ThemeVars = { theme: "var(--infinite-theme)", 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)" } } };
|
|
5177
|
+
|
|
5178
|
+
// src/utils/stripVar.ts
|
|
5179
|
+
function stripVar(cssVariableWithVarString) {
|
|
5180
|
+
return cssVariableWithVarString.slice(4, -1);
|
|
5181
|
+
}
|
|
4806
5182
|
|
|
4807
5183
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
4808
|
-
function useRowDOMProps(props, rowProps, rowStyle, rowClassName, tableDOMRef) {
|
|
5184
|
+
function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStrategy, tableDOMRef) {
|
|
4809
5185
|
const domProps = props.domProps;
|
|
4810
5186
|
const {
|
|
4811
5187
|
showZebraRows = false,
|
|
5188
|
+
showHoverRows = false,
|
|
4812
5189
|
rowIndex,
|
|
4813
5190
|
domRef: domRefFromProps,
|
|
4814
|
-
|
|
5191
|
+
rowInfo
|
|
4815
5192
|
} = props;
|
|
4816
|
-
const domRef = (0,
|
|
4817
|
-
const rowDOMRef = (0,
|
|
5193
|
+
const domRef = (0, import_react31.useRef)(null);
|
|
5194
|
+
const rowDOMRef = (0, import_react31.useCallback)((node) => {
|
|
4818
5195
|
domRefFromProps(node);
|
|
4819
5196
|
domRef.current = node;
|
|
4820
5197
|
}, []);
|
|
4821
5198
|
const rowPropsAndStyleArgs = {
|
|
4822
|
-
data:
|
|
4823
|
-
|
|
5199
|
+
data: rowInfo.data,
|
|
5200
|
+
rowInfo,
|
|
4824
5201
|
rowIndex,
|
|
4825
|
-
groupRowsBy:
|
|
5202
|
+
groupRowsBy: rowInfo.groupBy
|
|
4826
5203
|
};
|
|
4827
5204
|
if (typeof rowProps === "function") {
|
|
4828
5205
|
rowProps = rowProps(rowPropsAndStyleArgs);
|
|
4829
5206
|
}
|
|
4830
5207
|
let style = rowProps ? rowProps.style : void 0;
|
|
5208
|
+
const inlineGroupRoot = groupRenderStrategy === "inline" && rowInfo.indexInGroup === 0;
|
|
4831
5209
|
if (rowStyle) {
|
|
4832
5210
|
style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
|
|
4833
5211
|
}
|
|
4834
|
-
|
|
5212
|
+
if (inlineGroupRoot) {
|
|
5213
|
+
style = style || {};
|
|
5214
|
+
style.zIndex = 2e6 - rowInfo.indexInAll;
|
|
5215
|
+
}
|
|
5216
|
+
const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
|
|
4835
5217
|
let rowComputedClassName = typeof rowClassName === "function" ? rowClassName(rowPropsAndStyleArgs) : rowClassName;
|
|
4836
|
-
const className = join(
|
|
5218
|
+
const className = join(InfiniteTableRowClassName, RowClsRecipe({
|
|
5219
|
+
groupRow: rowInfo.isGroupRow,
|
|
5220
|
+
inlineGroupRow: inlineGroupRoot,
|
|
5221
|
+
zebra: showHoverRows ? odd ? "odd" : "even" : false,
|
|
5222
|
+
showHoverRows
|
|
5223
|
+
}), `${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);
|
|
4837
5224
|
const initialMouseEnter = rowProps == null ? void 0 : rowProps.onMouseEnter;
|
|
4838
5225
|
const initialMouseLeave = rowProps == null ? void 0 : rowProps.onMouseLeave;
|
|
4839
|
-
const onMouseEnter = (0,
|
|
5226
|
+
const onMouseEnter = (0, import_react31.useCallback)((event) => {
|
|
4840
5227
|
var _a;
|
|
4841
5228
|
initialMouseEnter == null ? void 0 : initialMouseEnter(event);
|
|
4842
|
-
const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
|
|
5229
|
+
const rowIndex2 = ((_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex) * 1;
|
|
4843
5230
|
const parentNode = tableDOMRef.current;
|
|
4844
|
-
if (!parentNode) {
|
|
5231
|
+
if (!parentNode || !showHoverRows) {
|
|
4845
5232
|
return;
|
|
4846
5233
|
}
|
|
4847
|
-
const
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
5234
|
+
const hoverSelector = [
|
|
5235
|
+
`.${InfiniteTableRowClassName}[data-hover-index="${rowIndex2}"]`
|
|
5236
|
+
];
|
|
5237
|
+
const rows = parentNode.querySelectorAll(hoverSelector.join(","));
|
|
5238
|
+
rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover, RowHoverCls));
|
|
5239
|
+
}, [initialMouseEnter, showHoverRows]);
|
|
5240
|
+
const onMouseLeave = (0, import_react31.useCallback)((event) => {
|
|
4851
5241
|
var _a;
|
|
4852
5242
|
initialMouseLeave == null ? void 0 : initialMouseLeave(event);
|
|
4853
5243
|
const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
|
|
4854
5244
|
const parentNode = tableDOMRef.current;
|
|
4855
|
-
if (!parentNode) {
|
|
5245
|
+
if (!parentNode || !showHoverRows) {
|
|
4856
5246
|
return;
|
|
4857
5247
|
}
|
|
4858
|
-
const
|
|
4859
|
-
|
|
4860
|
-
|
|
5248
|
+
const hoverSelector = [
|
|
5249
|
+
`.${InfiniteTableRowClassName}[data-hover-index="${rowIndex2}"]`
|
|
5250
|
+
];
|
|
5251
|
+
const rows = parentNode.querySelectorAll(hoverSelector.join(","));
|
|
5252
|
+
rows.forEach((row) => row.classList.remove(InfiniteTableRowClassName__hover, RowHoverCls));
|
|
5253
|
+
}, [initialMouseLeave, showHoverRows]);
|
|
5254
|
+
if (rowInfo.isGroupRow && groupRenderStrategy === "single-column") {
|
|
5255
|
+
style = style || {};
|
|
5256
|
+
style[stripVar(ThemeVars.components.Row.groupNesting)] = rowInfo.groupNesting - 1;
|
|
5257
|
+
}
|
|
4861
5258
|
return {
|
|
4862
5259
|
domRef,
|
|
4863
5260
|
domProps: __spreadProps(__spreadValues(__spreadValues({}, rowProps), domProps), {
|
|
4864
5261
|
style,
|
|
4865
5262
|
"data-virtualize-columns": props.virtualizeColumns ? "on" : "off",
|
|
4866
5263
|
"data-row-index": rowIndex,
|
|
4867
|
-
"data-
|
|
5264
|
+
"data-hover-index": rowIndex,
|
|
5265
|
+
"data-row-id": `${rowInfo.id}`,
|
|
4868
5266
|
className,
|
|
4869
5267
|
onMouseEnter,
|
|
4870
5268
|
onMouseLeave,
|
|
@@ -4878,34 +5276,50 @@ function InfiniteTableRowFn(props) {
|
|
|
4878
5276
|
const {
|
|
4879
5277
|
rowWidth,
|
|
4880
5278
|
rowHeight,
|
|
4881
|
-
|
|
5279
|
+
getData,
|
|
5280
|
+
rowInfo,
|
|
4882
5281
|
toggleGroupRow,
|
|
4883
5282
|
rowIndex,
|
|
4884
5283
|
brain,
|
|
5284
|
+
verticalBrain,
|
|
4885
5285
|
columns
|
|
4886
5286
|
} = props;
|
|
4887
5287
|
const tableContextValue = useInfiniteTable();
|
|
4888
5288
|
const { componentState } = tableContextValue;
|
|
4889
5289
|
const { domRef: tableDOMRef } = componentState;
|
|
4890
|
-
const {
|
|
5290
|
+
const { groupRenderStrategy } = componentState;
|
|
5291
|
+
const { domProps } = useRowDOMProps(props, componentState.rowProps, componentState.rowStyle, componentState.rowClassName, groupRenderStrategy, tableDOMRef);
|
|
4891
5292
|
const style = __spreadValues({
|
|
4892
5293
|
width: rowWidth,
|
|
4893
5294
|
height: rowHeight
|
|
4894
5295
|
}, domProps.style);
|
|
4895
|
-
const renderCellRef = (0,
|
|
5296
|
+
const renderCellRef = (0, import_react32.useRef)(null);
|
|
4896
5297
|
const renderCell = React28.useCallback(({ domRef, itemIndex }) => {
|
|
4897
5298
|
const column = columns[itemIndex];
|
|
4898
5299
|
if (!column) {
|
|
4899
5300
|
}
|
|
5301
|
+
const hidden = false;
|
|
4900
5302
|
return /* @__PURE__ */ React28.createElement(InfiniteTableColumnCell, {
|
|
4901
|
-
|
|
5303
|
+
getData,
|
|
5304
|
+
rowInfo,
|
|
5305
|
+
groupRenderStrategy,
|
|
4902
5306
|
virtualized: true,
|
|
5307
|
+
hidden,
|
|
5308
|
+
rowHeight,
|
|
4903
5309
|
toggleGroupRow,
|
|
4904
5310
|
rowIndex,
|
|
4905
5311
|
domRef,
|
|
4906
5312
|
column
|
|
4907
5313
|
});
|
|
4908
|
-
}, [
|
|
5314
|
+
}, [
|
|
5315
|
+
columns,
|
|
5316
|
+
rowIndex,
|
|
5317
|
+
rowInfo,
|
|
5318
|
+
rowHeight,
|
|
5319
|
+
groupRenderStrategy,
|
|
5320
|
+
getData,
|
|
5321
|
+
verticalBrain
|
|
5322
|
+
]);
|
|
4909
5323
|
if (renderCellRef.current !== renderCell) {
|
|
4910
5324
|
renderCellRef.current = renderCell;
|
|
4911
5325
|
}
|
|
@@ -4928,7 +5342,8 @@ function TableRowUnvirtualizedFn(props) {
|
|
|
4928
5342
|
const {
|
|
4929
5343
|
rowHeight,
|
|
4930
5344
|
rowWidth,
|
|
4931
|
-
|
|
5345
|
+
getData,
|
|
5346
|
+
rowInfo,
|
|
4932
5347
|
rowIndex,
|
|
4933
5348
|
columns,
|
|
4934
5349
|
toggleGroupRow
|
|
@@ -4936,17 +5351,22 @@ function TableRowUnvirtualizedFn(props) {
|
|
|
4936
5351
|
const tableContextValue = useInfiniteTable();
|
|
4937
5352
|
const { componentState } = tableContextValue;
|
|
4938
5353
|
const { domRef: tableDOMRef } = componentState;
|
|
4939
|
-
const { domProps } = useRowDOMProps(props, componentState.rowProps, componentState.rowStyle, componentState.rowClassName, tableDOMRef);
|
|
5354
|
+
const { domProps } = useRowDOMProps(props, componentState.rowProps, componentState.rowStyle, componentState.rowClassName, componentState.groupRenderStrategy, tableDOMRef);
|
|
4940
5355
|
const style = __spreadValues({
|
|
4941
5356
|
width: rowWidth,
|
|
4942
5357
|
height: rowHeight
|
|
4943
5358
|
}, domProps.style);
|
|
4944
5359
|
const children = columns.map((col) => {
|
|
5360
|
+
const hidden = false;
|
|
4945
5361
|
return /* @__PURE__ */ React29.createElement(InfiniteTableColumnCell, {
|
|
4946
5362
|
key: col.id,
|
|
4947
5363
|
virtualized: false,
|
|
5364
|
+
rowHeight,
|
|
5365
|
+
getData,
|
|
5366
|
+
hidden,
|
|
5367
|
+
groupRenderStrategy: componentState.groupRenderStrategy,
|
|
4948
5368
|
toggleGroupRow,
|
|
4949
|
-
|
|
5369
|
+
rowInfo,
|
|
4950
5370
|
rowIndex,
|
|
4951
5371
|
column: col
|
|
4952
5372
|
});
|
|
@@ -4977,19 +5397,22 @@ function useUnpinnedRendering(params) {
|
|
|
4977
5397
|
} = params;
|
|
4978
5398
|
const { virtualizeColumns } = getState();
|
|
4979
5399
|
const shouldVirtualizeColumns = typeof virtualizeColumns === "function" ? virtualizeColumns(computedUnpinnedColumns) : virtualizeColumns != null ? virtualizeColumns : true;
|
|
4980
|
-
const renderRowUnpinned = (0,
|
|
5400
|
+
const renderRowUnpinned = (0, import_react33.useCallback)((rowParams) => {
|
|
4981
5401
|
const dataArray = getData();
|
|
4982
|
-
const
|
|
4983
|
-
const { showZebraRows } = getState();
|
|
5402
|
+
const rowInfo = dataArray[rowParams.rowIndex];
|
|
5403
|
+
const { showZebraRows, showHoverRows } = getState();
|
|
4984
5404
|
const rowProps = __spreadValues({
|
|
4985
|
-
|
|
5405
|
+
rowInfo,
|
|
4986
5406
|
showZebraRows,
|
|
5407
|
+
showHoverRows,
|
|
5408
|
+
getData,
|
|
4987
5409
|
toggleGroupRow,
|
|
4988
5410
|
virtualizeColumns: shouldVirtualizeColumns,
|
|
4989
5411
|
brain: null,
|
|
5412
|
+
verticalBrain: verticalVirtualBrain,
|
|
4990
5413
|
columns: computedUnpinnedColumns,
|
|
4991
5414
|
rowWidth: computedUnpinnedColumnsWidth
|
|
4992
|
-
},
|
|
5415
|
+
}, rowParams);
|
|
4993
5416
|
if (shouldVirtualizeColumns) {
|
|
4994
5417
|
rowProps.brain = horizontalVirtualBrain;
|
|
4995
5418
|
rowProps.repaintId = repaintId;
|
|
@@ -4998,10 +5421,12 @@ function useUnpinnedRendering(params) {
|
|
|
4998
5421
|
return /* @__PURE__ */ React30.createElement(TableRowComponent, __spreadValues({}, rowProps));
|
|
4999
5422
|
}, [
|
|
5000
5423
|
repaintId,
|
|
5424
|
+
rowHeight,
|
|
5001
5425
|
computedUnpinnedColumns,
|
|
5002
5426
|
computedUnpinnedColumnsWidth,
|
|
5003
5427
|
shouldVirtualizeColumns,
|
|
5004
|
-
horizontalVirtualBrain
|
|
5428
|
+
horizontalVirtualBrain,
|
|
5429
|
+
verticalVirtualBrain
|
|
5005
5430
|
]);
|
|
5006
5431
|
const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */ React30.createElement("div", {
|
|
5007
5432
|
"data-name": "horizontal-scrollbar-placeholder--fake",
|
|
@@ -5038,18 +5463,45 @@ function useUnpinnedRendering(params) {
|
|
|
5038
5463
|
}
|
|
5039
5464
|
|
|
5040
5465
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5041
|
-
var
|
|
5466
|
+
var import_react34 = __toModule(require("react"));
|
|
5467
|
+
|
|
5468
|
+
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5469
|
+
var FooterCls = "_16lm1iw1";
|
|
5470
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwh _16lm1iwx _16lm1iw0";
|
|
5471
|
+
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: [] });
|
|
5472
|
+
var InfiniteClsScrolling = "_1yeub2v1";
|
|
5473
|
+
var InfiniteClsShiftingColumns = "_16lm1iwk";
|
|
5474
|
+
var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
|
|
5475
|
+
var PinnedRowsContainerClsVariants = createRuntimeFn({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5476
|
+
|
|
5477
|
+
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5042
5478
|
var DELAY = 200;
|
|
5043
5479
|
var TableClassName = internalProps.rootClassName;
|
|
5044
5480
|
var TableClassName__Scrolling = `${TableClassName}--scrolling`;
|
|
5481
|
+
var SCROLL_BOTTOM_OFFSET = 0;
|
|
5045
5482
|
var useOnContainerScroll = ({
|
|
5046
5483
|
verticalVirtualBrain,
|
|
5047
5484
|
horizontalVirtualBrain,
|
|
5048
|
-
|
|
5485
|
+
reservedContentHeight
|
|
5049
5486
|
}) => {
|
|
5050
|
-
const
|
|
5051
|
-
|
|
5052
|
-
|
|
5487
|
+
const {
|
|
5488
|
+
componentState: {
|
|
5489
|
+
scrollerDOMRef,
|
|
5490
|
+
domRef,
|
|
5491
|
+
scrollToBottomOffset,
|
|
5492
|
+
onScrollToBottom,
|
|
5493
|
+
onScrollToTop,
|
|
5494
|
+
bodySize
|
|
5495
|
+
}
|
|
5496
|
+
} = useInfiniteTable();
|
|
5497
|
+
const timeoutIdRef = (0, import_react34.useRef)(0);
|
|
5498
|
+
const scrollingRef = (0, import_react34.useRef)(false);
|
|
5499
|
+
const scrollTopMaxRef = (0, import_react34.useRef)(0);
|
|
5500
|
+
(0, import_react34.useEffect)(() => {
|
|
5501
|
+
const { current: node } = scrollerDOMRef;
|
|
5502
|
+
scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
|
|
5503
|
+
}, [reservedContentHeight, bodySize.height]);
|
|
5504
|
+
const setScrolling = (0, import_react34.useCallback)((scrolling) => {
|
|
5053
5505
|
var _a;
|
|
5054
5506
|
const prevScrolling = scrollingRef.current;
|
|
5055
5507
|
scrollingRef.current = scrolling;
|
|
@@ -5068,13 +5520,13 @@ var useOnContainerScroll = ({
|
|
|
5068
5520
|
return;
|
|
5069
5521
|
}
|
|
5070
5522
|
if (scrolling) {
|
|
5071
|
-
classList.add(TableClassName__Scrolling);
|
|
5523
|
+
classList.add(InfiniteClsScrolling, TableClassName__Scrolling);
|
|
5072
5524
|
} else {
|
|
5073
|
-
classList.remove(TableClassName__Scrolling);
|
|
5525
|
+
classList.remove(InfiniteClsScrolling, TableClassName__Scrolling);
|
|
5074
5526
|
}
|
|
5075
5527
|
}
|
|
5076
5528
|
}, []);
|
|
5077
|
-
const onContainerScroll = (0,
|
|
5529
|
+
const onContainerScroll = (0, import_react34.useCallback)((scrollInfo) => {
|
|
5078
5530
|
verticalVirtualBrain.setScrollPosition(scrollInfo);
|
|
5079
5531
|
horizontalVirtualBrain.setScrollPosition(scrollInfo);
|
|
5080
5532
|
setScrolling(true);
|
|
@@ -5084,37 +5536,44 @@ var useOnContainerScroll = ({
|
|
|
5084
5536
|
domRef.current,
|
|
5085
5537
|
setScrolling
|
|
5086
5538
|
]);
|
|
5087
|
-
const scrollPositionRef = (0,
|
|
5539
|
+
const scrollPositionRef = (0, import_react34.useRef)({
|
|
5088
5540
|
scrollLeft: 0,
|
|
5089
5541
|
scrollTop: 0
|
|
5090
5542
|
});
|
|
5091
|
-
const applyScrollHorizontal = (0,
|
|
5543
|
+
const applyScrollHorizontal = (0, import_react34.useCallback)(({ scrollLeft }) => {
|
|
5092
5544
|
scrollPositionRef.current.scrollLeft = scrollLeft;
|
|
5093
5545
|
onContainerScroll(scrollPositionRef.current);
|
|
5094
5546
|
}, [onContainerScroll]);
|
|
5095
|
-
const applyScrollVertical = (0,
|
|
5547
|
+
const applyScrollVertical = (0, import_react34.useCallback)(({ scrollTop }) => {
|
|
5096
5548
|
scrollPositionRef.current.scrollTop = scrollTop;
|
|
5097
5549
|
onContainerScroll(scrollPositionRef.current);
|
|
5098
|
-
|
|
5550
|
+
if (scrollTop === 0) {
|
|
5551
|
+
onScrollToTop == null ? void 0 : onScrollToTop();
|
|
5552
|
+
}
|
|
5553
|
+
const offset = scrollToBottomOffset != null ? scrollToBottomOffset : SCROLL_BOTTOM_OFFSET;
|
|
5554
|
+
const isScrollBottom = scrollTop + offset >= scrollTopMaxRef.current;
|
|
5555
|
+
if (isScrollBottom) {
|
|
5556
|
+
onScrollToBottom == null ? void 0 : onScrollToBottom();
|
|
5557
|
+
}
|
|
5558
|
+
}, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
|
|
5099
5559
|
return {
|
|
5100
5560
|
applyScrollHorizontal,
|
|
5101
|
-
applyScrollVertical
|
|
5102
|
-
scrollPositionRef
|
|
5561
|
+
applyScrollVertical
|
|
5103
5562
|
};
|
|
5104
5563
|
};
|
|
5105
5564
|
|
|
5106
5565
|
// src/components/InfiniteTable/hooks/usePinnedRendering.tsx
|
|
5107
5566
|
var React32 = __toModule(require("react"));
|
|
5108
|
-
var
|
|
5567
|
+
var import_react37 = __toModule(require("react"));
|
|
5109
5568
|
|
|
5110
5569
|
// src/components/VirtualList/RowListWithExternalScrolling.tsx
|
|
5111
5570
|
var React31 = __toModule(require("react"));
|
|
5112
|
-
var
|
|
5571
|
+
var import_react36 = __toModule(require("react"));
|
|
5113
5572
|
|
|
5114
5573
|
// src/components/hooks/useOnMount.ts
|
|
5115
|
-
var
|
|
5574
|
+
var import_react35 = __toModule(require("react"));
|
|
5116
5575
|
function useOnMount(domRef, props) {
|
|
5117
|
-
(0,
|
|
5576
|
+
(0, import_react35.useEffect)(() => {
|
|
5118
5577
|
const { onMount, onUnmount } = props;
|
|
5119
5578
|
const node = domRef == null ? void 0 : domRef.current;
|
|
5120
5579
|
onMount == null ? void 0 : onMount(node);
|
|
@@ -5124,12 +5583,15 @@ function useOnMount(domRef, props) {
|
|
|
5124
5583
|
}, []);
|
|
5125
5584
|
}
|
|
5126
5585
|
|
|
5586
|
+
// src/components/VirtualList/InfiniteListRootClassName.ts
|
|
5587
|
+
var InfiniteListRootClassName = "InfiniteList";
|
|
5588
|
+
|
|
5127
5589
|
// src/components/VirtualList/RowListWithExternalScrolling.tsx
|
|
5128
|
-
var rootClassName10 =
|
|
5590
|
+
var rootClassName10 = InfiniteListRootClassName;
|
|
5129
5591
|
var defaultClasses = [
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5592
|
+
willChange.transform,
|
|
5593
|
+
position.relative,
|
|
5594
|
+
transformTranslateZero
|
|
5133
5595
|
];
|
|
5134
5596
|
var RowListWithExternalScrolling = (props) => {
|
|
5135
5597
|
const {
|
|
@@ -5142,8 +5604,8 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5142
5604
|
onMount,
|
|
5143
5605
|
onUnmount
|
|
5144
5606
|
} = props;
|
|
5145
|
-
const domRef = (0,
|
|
5146
|
-
const renderItem = (0,
|
|
5607
|
+
const domRef = (0, import_react36.useRef)(null);
|
|
5608
|
+
const renderItem = (0, import_react36.useCallback)((renderProps) => renderRow({
|
|
5147
5609
|
domRef: renderProps.domRef,
|
|
5148
5610
|
rowHeight: renderProps.itemSize,
|
|
5149
5611
|
rowIndex: renderProps.itemIndex
|
|
@@ -5152,7 +5614,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5152
5614
|
onMount,
|
|
5153
5615
|
onUnmount
|
|
5154
5616
|
});
|
|
5155
|
-
(0,
|
|
5617
|
+
(0, import_react36.useEffect)(() => {
|
|
5156
5618
|
const onScroll = (scrollPosition) => {
|
|
5157
5619
|
const node = domRef.current;
|
|
5158
5620
|
if (node) {
|
|
@@ -5176,7 +5638,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5176
5638
|
const domProps = {
|
|
5177
5639
|
ref: domRef,
|
|
5178
5640
|
style,
|
|
5179
|
-
className: join(className, rootClassName10, `${rootClassName10}--vertical`, ...defaultClasses)
|
|
5641
|
+
className: join(className, rootClassName10, `${rootClassName10}--vertical`, VirtualListCls, VirtualListClsOrientation.vertical, ...defaultClasses)
|
|
5180
5642
|
};
|
|
5181
5643
|
if (false) {
|
|
5182
5644
|
domProps["data-cmp-name"] = "RowListWithExternalScrolling";
|
|
@@ -5192,7 +5654,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5192
5654
|
var UPDATE_SCROLL3 = (node, brainScrollPosition, horizontalPinnedScrollPosition) => {
|
|
5193
5655
|
node.style.transform = `translate3d(${horizontalPinnedScrollPosition ? -horizontalPinnedScrollPosition.scrollLeft : 0}px, ${-brainScrollPosition.scrollTop}px, 0px)`;
|
|
5194
5656
|
};
|
|
5195
|
-
var PinnedRowsContainerClassName = `
|
|
5657
|
+
var PinnedRowsContainerClassName = `InfinitePinnedRows`;
|
|
5196
5658
|
function PinnedRowsContainer(props) {
|
|
5197
5659
|
const {
|
|
5198
5660
|
maxWidth,
|
|
@@ -5219,7 +5681,7 @@ function PinnedRowsContainer(props) {
|
|
|
5219
5681
|
}
|
|
5220
5682
|
return result;
|
|
5221
5683
|
}, [height, rowWidth, pinning, hasOverflow]);
|
|
5222
|
-
const updateScroll = (0,
|
|
5684
|
+
const updateScroll = (0, import_react37.useCallback)((node, scrollPosition) => {
|
|
5223
5685
|
UPDATE_SCROLL3(node, scrollPosition, hasOverflow ? pinnedScrollListener.getScrollPosition() : void 0);
|
|
5224
5686
|
}, [hasOverflow, pinnedScrollListener]);
|
|
5225
5687
|
const rowListProps = {
|
|
@@ -5227,7 +5689,7 @@ function PinnedRowsContainer(props) {
|
|
|
5227
5689
|
brain,
|
|
5228
5690
|
renderRow,
|
|
5229
5691
|
updateScroll,
|
|
5230
|
-
className: join(`${PinnedRowsContainerClassName}`, `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow
|
|
5692
|
+
className: join(`${PinnedRowsContainerClassName}`, PinnedRowsClsVariants[pinning === "start" ? "pinnedStart" : "pinnedEnd"], `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow`, PinnedRowsClsVariants.overflow)
|
|
5231
5693
|
};
|
|
5232
5694
|
if (hasOverflow) {
|
|
5233
5695
|
return /* @__PURE__ */ React32.createElement(VirtualScrollContainer, {
|
|
@@ -5243,7 +5705,9 @@ function PinnedRowsContainer(props) {
|
|
|
5243
5705
|
[pinning === "start" ? "right" : "left"]: "unset"
|
|
5244
5706
|
},
|
|
5245
5707
|
onContainerScroll: pinnedScrollListener == null ? void 0 : pinnedScrollListener.setScrollPosition,
|
|
5246
|
-
className: join(
|
|
5708
|
+
className: join(PinnedRowsContainerClsVariants({
|
|
5709
|
+
pinned: pinning
|
|
5710
|
+
}), `${PinnedRowsContainerClassName}Container`, `${PinnedRowsContainerClassName}Container--pinned-${pinning}`)
|
|
5247
5711
|
}, /* @__PURE__ */ React32.createElement(RowListWithExternalScrolling, __spreadProps(__spreadValues({}, rowListProps), {
|
|
5248
5712
|
onMount: (node) => {
|
|
5249
5713
|
pinnedScrollListener == null ? void 0 : pinnedScrollListener.onScroll((scrollPosition) => {
|
|
@@ -5258,22 +5722,25 @@ function PinnedRowsContainer(props) {
|
|
|
5258
5722
|
return /* @__PURE__ */ React32.createElement(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
|
|
5259
5723
|
}
|
|
5260
5724
|
function useRenderPinnedRow(params) {
|
|
5261
|
-
const { getData, getState, columnsWidth, columns } = params;
|
|
5262
|
-
const renderPinnedRow = (0,
|
|
5725
|
+
const { getData, getState, columnsWidth, columns, verticalBrain } = params;
|
|
5726
|
+
const renderPinnedRow = (0, import_react37.useCallback)((rowParams) => {
|
|
5263
5727
|
const dataArray = getData();
|
|
5264
|
-
const
|
|
5265
|
-
const { showZebraRows } = getState();
|
|
5728
|
+
const rowInfo = dataArray[rowParams.rowIndex];
|
|
5729
|
+
const { showZebraRows, showHoverRows } = getState();
|
|
5266
5730
|
const rowProps = __spreadValues({
|
|
5267
|
-
|
|
5731
|
+
rowInfo,
|
|
5732
|
+
getData,
|
|
5268
5733
|
showZebraRows,
|
|
5734
|
+
showHoverRows,
|
|
5269
5735
|
toggleGroupRow: params.toggleGroupRow,
|
|
5270
5736
|
virtualizeColumns: false,
|
|
5737
|
+
verticalBrain,
|
|
5271
5738
|
brain: null,
|
|
5272
5739
|
rowWidth: columnsWidth,
|
|
5273
5740
|
columns
|
|
5274
|
-
},
|
|
5741
|
+
}, rowParams);
|
|
5275
5742
|
return /* @__PURE__ */ React32.createElement(TableRowUnvirtualized, __spreadValues({}, rowProps));
|
|
5276
|
-
}, [columnsWidth, columns]);
|
|
5743
|
+
}, [columnsWidth, columns, verticalBrain]);
|
|
5277
5744
|
return renderPinnedRow;
|
|
5278
5745
|
}
|
|
5279
5746
|
function usePinnedRenderingForSide(side, params) {
|
|
@@ -5311,6 +5778,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
5311
5778
|
getData,
|
|
5312
5779
|
getState,
|
|
5313
5780
|
toggleGroupRow,
|
|
5781
|
+
verticalBrain: verticalVirtualBrain,
|
|
5314
5782
|
columns,
|
|
5315
5783
|
columnsWidth
|
|
5316
5784
|
});
|
|
@@ -5369,7 +5837,7 @@ function usePinnedStartRendering(params) {
|
|
|
5369
5837
|
}
|
|
5370
5838
|
|
|
5371
5839
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
5372
|
-
var
|
|
5840
|
+
var import_react39 = __toModule(require("react"));
|
|
5373
5841
|
|
|
5374
5842
|
// src/components/VirtualBrain/index.ts
|
|
5375
5843
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
@@ -5378,6 +5846,7 @@ var initialScrollPosition2 = {
|
|
|
5378
5846
|
scrollTop: 0
|
|
5379
5847
|
};
|
|
5380
5848
|
var raf = typeof window !== "undefined" ? requestAnimationFrame : (fn) => setTimeout(fn, 0);
|
|
5849
|
+
var ItemIndexBag = Object.seal({ itemIndex: 0 });
|
|
5381
5850
|
var SORT_ASC = (a, b) => a - b;
|
|
5382
5851
|
var VirtualBrain = class extends Logger {
|
|
5383
5852
|
constructor(options) {
|
|
@@ -5485,22 +5954,24 @@ var VirtualBrain = class extends Logger {
|
|
|
5485
5954
|
this.onRenderRangeChangeFns = this.onRenderRangeChangeFns.filter((f) => f !== fn);
|
|
5486
5955
|
};
|
|
5487
5956
|
};
|
|
5488
|
-
this.update = (newCount, newItemSize) => {
|
|
5489
|
-
const { itemSize, count } = this.options;
|
|
5957
|
+
this.update = (newCount, newItemSize, newItemSpan) => {
|
|
5958
|
+
const { itemSize, count, itemSpan } = this.options;
|
|
5490
5959
|
const countChange = count !== newCount;
|
|
5491
5960
|
const itemSizeChange = itemSize !== newItemSize;
|
|
5492
|
-
|
|
5961
|
+
const itemSpanChange = itemSpan !== newItemSpan;
|
|
5962
|
+
if (!countChange && !itemSizeChange && !itemSpanChange) {
|
|
5493
5963
|
return;
|
|
5494
5964
|
}
|
|
5495
5965
|
this.options.count = newCount;
|
|
5496
5966
|
this.options.itemSize = newItemSize;
|
|
5967
|
+
this.options.itemSpan = newItemSpan;
|
|
5497
5968
|
const size = this.availableSize[this.options.mainAxis === "vertical" ? "height" : "width"];
|
|
5498
5969
|
const newRenderCount = this.computeRenderCount({
|
|
5499
5970
|
itemSize: newItemSize,
|
|
5500
5971
|
count: newCount,
|
|
5501
5972
|
size
|
|
5502
5973
|
});
|
|
5503
|
-
if (!itemSizeChange && countChange && newCount > count) {
|
|
5974
|
+
if (!itemSizeChange && !itemSpanChange && countChange && newCount > count) {
|
|
5504
5975
|
const currentRenderCount = this.getRenderCount();
|
|
5505
5976
|
if (currentRenderCount > newRenderCount) {
|
|
5506
5977
|
return;
|
|
@@ -5525,11 +5996,43 @@ var VirtualBrain = class extends Logger {
|
|
|
5525
5996
|
this.updateRenderCount(newRenderCount);
|
|
5526
5997
|
};
|
|
5527
5998
|
this.reset = () => {
|
|
5999
|
+
this.itemSpanParent = [];
|
|
6000
|
+
this.itemSpanValue = [];
|
|
5528
6001
|
this.itemSizeCache = [];
|
|
5529
6002
|
this.itemOffsetCache = [0];
|
|
5530
6003
|
this.renderCount = -1;
|
|
5531
6004
|
this.totalSize = 0;
|
|
5532
6005
|
};
|
|
6006
|
+
this.computeItemSpanUpTo = (itemIndex) => {
|
|
6007
|
+
const { count, itemSpan } = this.options;
|
|
6008
|
+
if (!itemSpan) {
|
|
6009
|
+
return;
|
|
6010
|
+
}
|
|
6011
|
+
const cache = this.itemSpanParent;
|
|
6012
|
+
const spanResultArr = this.itemSpanValue;
|
|
6013
|
+
if (cache[itemIndex] === void 0) {
|
|
6014
|
+
let i = cache.length;
|
|
6015
|
+
let lastIndex = Math.min(itemIndex, count - 1);
|
|
6016
|
+
for (; i <= lastIndex; i++) {
|
|
6017
|
+
if (cache[i] === void 0) {
|
|
6018
|
+
ItemIndexBag.itemIndex = i;
|
|
6019
|
+
let spanValue = itemSpan(ItemIndexBag);
|
|
6020
|
+
if (false) {
|
|
6021
|
+
this.debug("itemSpan cannot be less than 1 - got %d for index %d", spanValue, i);
|
|
6022
|
+
}
|
|
6023
|
+
cache[i] = i;
|
|
6024
|
+
spanResultArr[i] = spanValue;
|
|
6025
|
+
let spannedItemIndex = i;
|
|
6026
|
+
while (spanValue > 1) {
|
|
6027
|
+
spannedItemIndex += 1;
|
|
6028
|
+
cache[spannedItemIndex] = i;
|
|
6029
|
+
spanResultArr[spannedItemIndex] = 0;
|
|
6030
|
+
spanValue -= 1;
|
|
6031
|
+
}
|
|
6032
|
+
}
|
|
6033
|
+
}
|
|
6034
|
+
}
|
|
6035
|
+
};
|
|
5533
6036
|
this.computeCacheFor = (itemIndex) => {
|
|
5534
6037
|
if (typeof this.options.itemSize !== "function") {
|
|
5535
6038
|
return;
|
|
@@ -5549,6 +6052,33 @@ var VirtualBrain = class extends Logger {
|
|
|
5549
6052
|
this.itemOffsetCache[itemIndex] = offset;
|
|
5550
6053
|
}
|
|
5551
6054
|
};
|
|
6055
|
+
this.getItemSpan = (itemIndex) => {
|
|
6056
|
+
if (!this.options.itemSpan) {
|
|
6057
|
+
return 1;
|
|
6058
|
+
}
|
|
6059
|
+
if (this.itemSpanValue[itemIndex] === void 0) {
|
|
6060
|
+
this.computeItemSpanUpTo(itemIndex);
|
|
6061
|
+
}
|
|
6062
|
+
return this.itemSpanValue[itemIndex] || 1;
|
|
6063
|
+
};
|
|
6064
|
+
this.getItemSpanParent = (itemIndex) => {
|
|
6065
|
+
if (!this.options.itemSpan) {
|
|
6066
|
+
return itemIndex;
|
|
6067
|
+
}
|
|
6068
|
+
if (this.itemSpanParent[itemIndex] === void 0) {
|
|
6069
|
+
this.computeItemSpanUpTo(itemIndex);
|
|
6070
|
+
}
|
|
6071
|
+
return this.itemSpanParent[itemIndex];
|
|
6072
|
+
};
|
|
6073
|
+
this.getItemSizeWithSpan = (itemIndex, itemSpan) => {
|
|
6074
|
+
let itemSize = this.getItemSize(itemIndex);
|
|
6075
|
+
while (itemSpan > 1) {
|
|
6076
|
+
itemIndex += 1;
|
|
6077
|
+
itemSpan -= 1;
|
|
6078
|
+
itemSize += this.getItemSize(itemIndex);
|
|
6079
|
+
}
|
|
6080
|
+
return itemSize;
|
|
6081
|
+
};
|
|
5552
6082
|
this.getItemSize = (itemIndex) => {
|
|
5553
6083
|
const { itemSize, count } = this.options;
|
|
5554
6084
|
if (typeof itemSize !== "function") {
|
|
@@ -5695,7 +6225,7 @@ var VirtualBrain = class extends Logger {
|
|
|
5695
6225
|
}
|
|
5696
6226
|
computeRenderRange() {
|
|
5697
6227
|
const count = this.getOptions().count;
|
|
5698
|
-
|
|
6228
|
+
let renderCount = this.getRenderCount();
|
|
5699
6229
|
if (renderCount === 0) {
|
|
5700
6230
|
return {
|
|
5701
6231
|
renderStartIndex: -1,
|
|
@@ -5708,6 +6238,12 @@ var VirtualBrain = class extends Logger {
|
|
|
5708
6238
|
renderEndIndex = count - 1;
|
|
5709
6239
|
renderStartIndex = renderEndIndex - renderCount + 1;
|
|
5710
6240
|
}
|
|
6241
|
+
if (this.options.itemSpan) {
|
|
6242
|
+
this.computeItemSpanUpTo(renderStartIndex);
|
|
6243
|
+
while (this.itemSpanParent[renderStartIndex] != renderStartIndex) {
|
|
6244
|
+
renderStartIndex--;
|
|
6245
|
+
}
|
|
6246
|
+
}
|
|
5711
6247
|
return {
|
|
5712
6248
|
renderStartIndex,
|
|
5713
6249
|
renderEndIndex
|
|
@@ -5719,9 +6255,9 @@ var VirtualBrain = class extends Logger {
|
|
|
5719
6255
|
};
|
|
5720
6256
|
|
|
5721
6257
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
5722
|
-
var
|
|
6258
|
+
var import_react38 = __toModule(require("react"));
|
|
5723
6259
|
function useColumnSizeFn(computedUnpinnedColumns) {
|
|
5724
|
-
const columnSize = (0,
|
|
6260
|
+
const columnSize = (0, import_react38.useCallback)((index) => {
|
|
5725
6261
|
const column = computedUnpinnedColumns[index];
|
|
5726
6262
|
if (!column) {
|
|
5727
6263
|
console.log("cannot find column at index", index, computedUnpinnedColumns);
|
|
@@ -5739,7 +6275,8 @@ function useYourBrain(param) {
|
|
|
5739
6275
|
computedPinnedStartWidth,
|
|
5740
6276
|
computedPinnedEndWidth,
|
|
5741
6277
|
rowHeight,
|
|
5742
|
-
bodySize
|
|
6278
|
+
bodySize,
|
|
6279
|
+
rowSpan
|
|
5743
6280
|
} = param;
|
|
5744
6281
|
const columnSize = useColumnSizeFn(computedUnpinnedColumns);
|
|
5745
6282
|
const horizontalVirtualBrain = useOnce(() => {
|
|
@@ -5754,20 +6291,21 @@ function useYourBrain(param) {
|
|
|
5754
6291
|
const brain = new VirtualBrain({
|
|
5755
6292
|
count: dataArray.length,
|
|
5756
6293
|
itemSize: rowHeight,
|
|
5757
|
-
mainAxis: "vertical"
|
|
6294
|
+
mainAxis: "vertical",
|
|
6295
|
+
itemSpan: rowSpan
|
|
5758
6296
|
});
|
|
5759
6297
|
return brain;
|
|
5760
6298
|
});
|
|
5761
6299
|
horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
|
|
5762
|
-
verticalVirtualBrain.update(dataArray.length, rowHeight);
|
|
6300
|
+
verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
|
|
5763
6301
|
globalThis.verticalVirtualBrain = verticalVirtualBrain;
|
|
5764
|
-
(0,
|
|
6302
|
+
(0, import_react39.useEffect)(() => {
|
|
5765
6303
|
verticalVirtualBrain.setAvailableSize({
|
|
5766
6304
|
height: bodySize.height,
|
|
5767
6305
|
width: 0
|
|
5768
6306
|
});
|
|
5769
6307
|
}, [bodySize, verticalVirtualBrain]);
|
|
5770
|
-
(0,
|
|
6308
|
+
(0, import_react39.useEffect)(() => {
|
|
5771
6309
|
horizontalVirtualBrain.setAvailableSize({
|
|
5772
6310
|
height: 0,
|
|
5773
6311
|
width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
|
|
@@ -5801,7 +6339,7 @@ function shallowEqualObjects(objA, objB) {
|
|
|
5801
6339
|
|
|
5802
6340
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
5803
6341
|
function useListRendering(param) {
|
|
5804
|
-
const { computed,
|
|
6342
|
+
const { computed, bodySize, columnShifts } = param;
|
|
5805
6343
|
const { componentActions, componentState, getState } = useInfiniteTable();
|
|
5806
6344
|
const prevComputed = usePrevious(computed, null);
|
|
5807
6345
|
const {
|
|
@@ -5814,40 +6352,68 @@ function useListRendering(param) {
|
|
|
5814
6352
|
computedUnpinnedColumns,
|
|
5815
6353
|
computedUnpinnedColumnsWidth,
|
|
5816
6354
|
computedPinnedStartOverflow,
|
|
5817
|
-
computedPinnedEndOverflow
|
|
6355
|
+
computedPinnedEndOverflow,
|
|
6356
|
+
computedVisibleColumns
|
|
5818
6357
|
} = computed;
|
|
5819
6358
|
const { componentState: dataSourceState, getState: getDataSourceState } = useDataSourceContextValue();
|
|
5820
6359
|
const { dataArray } = dataSourceState;
|
|
5821
6360
|
const getData = useLatest(dataArray);
|
|
5822
6361
|
const {
|
|
5823
|
-
|
|
6362
|
+
rowHeight,
|
|
5824
6363
|
pinnedStartMaxWidth,
|
|
5825
6364
|
pinnedEndMaxWidth,
|
|
5826
6365
|
pinnedStartScrollListener,
|
|
5827
6366
|
pinnedEndScrollListener
|
|
5828
6367
|
} = componentState;
|
|
5829
6368
|
const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
|
|
5830
|
-
const repaintIdRef = (0,
|
|
6369
|
+
const repaintIdRef = (0, import_react40.useRef)(0);
|
|
5831
6370
|
if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
|
|
5832
6371
|
repaintIdRef.current++;
|
|
5833
6372
|
}
|
|
5834
6373
|
const repaintId = repaintIdRef.current;
|
|
6374
|
+
const rowSpan = (0, import_react40.useMemo)(() => {
|
|
6375
|
+
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
6376
|
+
return colsWithRowspan.length ? ({ itemIndex }) => {
|
|
6377
|
+
let maxSpan = 1;
|
|
6378
|
+
const dataArray2 = getData();
|
|
6379
|
+
const rowInfo = dataArray2[itemIndex];
|
|
6380
|
+
const data = rowInfo.data;
|
|
6381
|
+
colsWithRowspan.forEach((column) => {
|
|
6382
|
+
if (!column.rowspan) {
|
|
6383
|
+
return;
|
|
6384
|
+
}
|
|
6385
|
+
const span = column.rowspan({
|
|
6386
|
+
column,
|
|
6387
|
+
data,
|
|
6388
|
+
dataArray: dataArray2,
|
|
6389
|
+
groupRowInfo: null,
|
|
6390
|
+
rowInfo,
|
|
6391
|
+
rowIndex: itemIndex
|
|
6392
|
+
});
|
|
6393
|
+
if (span > maxSpan) {
|
|
6394
|
+
maxSpan = span;
|
|
6395
|
+
}
|
|
6396
|
+
});
|
|
6397
|
+
return maxSpan;
|
|
6398
|
+
} : void 0;
|
|
6399
|
+
}, [computedVisibleColumns]);
|
|
5835
6400
|
const { horizontalVirtualBrain, verticalVirtualBrain } = useYourBrain({
|
|
5836
6401
|
computedPinnedStartWidth: computed.computedPinnedStartWidth,
|
|
5837
6402
|
computedPinnedEndWidth: computed.computedPinnedEndWidth,
|
|
5838
6403
|
computedUnpinnedColumns: computed.computedUnpinnedColumns,
|
|
5839
6404
|
rowHeight,
|
|
5840
6405
|
dataArray,
|
|
5841
|
-
bodySize
|
|
6406
|
+
bodySize,
|
|
6407
|
+
rowSpan
|
|
5842
6408
|
});
|
|
5843
6409
|
const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
|
|
5844
6410
|
const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
5845
6411
|
const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
|
|
5846
|
-
const scrollbars = (0,
|
|
6412
|
+
const scrollbars = (0, import_react40.useMemo)(() => ({
|
|
5847
6413
|
vertical: hasVerticalScrollbar,
|
|
5848
6414
|
horizontal: hasHorizontalScrollbar
|
|
5849
6415
|
}), [hasVerticalScrollbar, hasHorizontalScrollbar]);
|
|
5850
|
-
(0,
|
|
6416
|
+
(0, import_react40.useEffect)(() => {
|
|
5851
6417
|
if (!bodySize.height) {
|
|
5852
6418
|
return;
|
|
5853
6419
|
}
|
|
@@ -5870,10 +6436,10 @@ function useListRendering(param) {
|
|
|
5870
6436
|
const { applyScrollHorizontal, applyScrollVertical } = useOnContainerScroll({
|
|
5871
6437
|
verticalVirtualBrain,
|
|
5872
6438
|
horizontalVirtualBrain,
|
|
5873
|
-
|
|
6439
|
+
reservedContentHeight
|
|
5874
6440
|
});
|
|
5875
6441
|
const { componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
5876
|
-
const toggleGroupRow = (0,
|
|
6442
|
+
const toggleGroupRow = (0, import_react40.useCallback)((groupKeys) => {
|
|
5877
6443
|
const newState = new GroupRowsState(getDataSourceState().groupRowsState);
|
|
5878
6444
|
newState.toggleGroupRow(groupKeys);
|
|
5879
6445
|
dataSourceActions.groupRowsState = newState;
|
|
@@ -5908,7 +6474,7 @@ function useListRendering(param) {
|
|
|
5908
6474
|
computedUnpinnedColumns
|
|
5909
6475
|
});
|
|
5910
6476
|
const [, rerender] = useRerender();
|
|
5911
|
-
(0,
|
|
6477
|
+
(0, import_react40.useEffect)(() => {
|
|
5912
6478
|
rerender();
|
|
5913
6479
|
}, [dataSourceState]);
|
|
5914
6480
|
const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
|
|
@@ -5932,7 +6498,7 @@ function useListRendering(param) {
|
|
|
5932
6498
|
|
|
5933
6499
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
5934
6500
|
var React33 = __toModule(require("react"));
|
|
5935
|
-
var
|
|
6501
|
+
var import_react41 = __toModule(require("react"));
|
|
5936
6502
|
|
|
5937
6503
|
// src/components/utils/decamelize.ts
|
|
5938
6504
|
var import_decamelize = __toModule(require_decamelize());
|
|
@@ -5943,7 +6509,7 @@ var decamelize = (input, options) => {
|
|
|
5943
6509
|
|
|
5944
6510
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
5945
6511
|
var defaultStyle2 = {
|
|
5946
|
-
padding:
|
|
6512
|
+
padding: ThemeVars.spacing[2],
|
|
5947
6513
|
textAlign: "end",
|
|
5948
6514
|
opacity: "1",
|
|
5949
6515
|
visibility: "visible",
|
|
@@ -5969,7 +6535,7 @@ var enforceStyle = (node, style) => {
|
|
|
5969
6535
|
}
|
|
5970
6536
|
};
|
|
5971
6537
|
var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
|
|
5972
|
-
const { rootClassName:
|
|
6538
|
+
const { rootClassName: rootClassName12 } = useInternalProps();
|
|
5973
6539
|
const domRef = React33.useRef(null);
|
|
5974
6540
|
const domCallback = React33.useCallback((node) => {
|
|
5975
6541
|
domRef.current = node;
|
|
@@ -5982,7 +6548,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
|
|
|
5982
6548
|
ref.current = node;
|
|
5983
6549
|
}
|
|
5984
6550
|
}, []);
|
|
5985
|
-
(0,
|
|
6551
|
+
(0, import_react41.useEffect)(() => {
|
|
5986
6552
|
const forceStyle = () => {
|
|
5987
6553
|
requestAnimationFrame(() => {
|
|
5988
6554
|
var _a;
|
|
@@ -5999,7 +6565,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
|
|
|
5999
6565
|
return /* @__PURE__ */ React33.createElement("div", __spreadProps(__spreadValues({
|
|
6000
6566
|
ref: domCallback
|
|
6001
6567
|
}, props), {
|
|
6002
|
-
className: join(`${
|
|
6568
|
+
className: join(`${rootClassName12}-Footer`, FooterCls, props.className),
|
|
6003
6569
|
style: defaultStyle2
|
|
6004
6570
|
}), "Powered by", " ", /* @__PURE__ */ React33.createElement("a", {
|
|
6005
6571
|
href: "https://infinite-table.com",
|
|
@@ -6010,7 +6576,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
|
|
|
6010
6576
|
});
|
|
6011
6577
|
|
|
6012
6578
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
6013
|
-
var
|
|
6579
|
+
var import_react42 = __toModule(require("react"));
|
|
6014
6580
|
|
|
6015
6581
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
6016
6582
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -6155,20 +6721,28 @@ var decode = (licenseKey) => {
|
|
|
6155
6721
|
};
|
|
6156
6722
|
|
|
6157
6723
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
6724
|
+
var SANDBOX_REGEX = /(https):\/\/\d+\-\d+\-\d\-(sandpack\.codesandbox\.io)/g;
|
|
6725
|
+
var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
6726
|
+
var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
|
|
6727
|
+
var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
|
|
6158
6728
|
var useLicense = (licenseKey) => {
|
|
6159
|
-
const valid = (0,
|
|
6160
|
-
|
|
6729
|
+
const valid = (0, import_react42.useMemo)(() => {
|
|
6730
|
+
let valid2 = isValidLicense(licenseKey, {
|
|
6161
6731
|
publishedAt: 1624970570587,
|
|
6162
|
-
version: "0.0.2-canary.
|
|
6732
|
+
version: "0.0.2-canary.3"
|
|
6163
6733
|
});
|
|
6734
|
+
if (!valid2 && isInsideSandbox) {
|
|
6735
|
+
return true;
|
|
6736
|
+
}
|
|
6737
|
+
return valid2;
|
|
6164
6738
|
}, [licenseKey]);
|
|
6165
6739
|
return valid;
|
|
6166
6740
|
};
|
|
6167
6741
|
|
|
6168
6742
|
// src/components/CSSVariableWatch.tsx
|
|
6169
6743
|
var React34 = __toModule(require("react"));
|
|
6170
|
-
var
|
|
6171
|
-
var
|
|
6744
|
+
var import_react43 = __toModule(require("react"));
|
|
6745
|
+
var error2 = err("CSSVariableWatch");
|
|
6172
6746
|
var debug5 = dbg("CSSVariableWatch");
|
|
6173
6747
|
var WRAPPER_STYLE = {
|
|
6174
6748
|
position: "absolute",
|
|
@@ -6180,7 +6754,7 @@ var WRAPPER_STYLE = {
|
|
|
6180
6754
|
overflow: "hidden"
|
|
6181
6755
|
};
|
|
6182
6756
|
var useCSSVariableWatch = (params) => {
|
|
6183
|
-
const lastValueRef = (0,
|
|
6757
|
+
const lastValueRef = (0, import_react43.useRef)(0);
|
|
6184
6758
|
const onResize = React34.useCallback(({ height }) => {
|
|
6185
6759
|
if (height && height !== lastValueRef.current) {
|
|
6186
6760
|
lastValueRef.current = height;
|
|
@@ -6195,12 +6769,12 @@ var useCSSVariableWatch = (params) => {
|
|
|
6195
6769
|
debug5(`Variable ${params.varName} found and equals ${value}.`);
|
|
6196
6770
|
params.onChange(value);
|
|
6197
6771
|
} else {
|
|
6198
|
-
|
|
6772
|
+
error2(`Specified variable ${params.varName} not found or does not have a numeric value.`);
|
|
6199
6773
|
}
|
|
6200
6774
|
}, []);
|
|
6201
6775
|
};
|
|
6202
6776
|
var CSSVariableWatch = (props) => {
|
|
6203
|
-
const domRef = (0,
|
|
6777
|
+
const domRef = (0, import_react43.useRef)(null);
|
|
6204
6778
|
useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
|
|
6205
6779
|
ref: domRef
|
|
6206
6780
|
}));
|
|
@@ -6211,11 +6785,118 @@ var CSSVariableWatch = (props) => {
|
|
|
6211
6785
|
}, /* @__PURE__ */ React34.createElement("div", {
|
|
6212
6786
|
ref: domRef,
|
|
6213
6787
|
style: {
|
|
6214
|
-
height: `var(${props.varName})`
|
|
6788
|
+
height: props.varName.startsWith("var(") ? props.varName : `var(${props.varName})`
|
|
6215
6789
|
}
|
|
6216
6790
|
}));
|
|
6217
6791
|
};
|
|
6218
6792
|
|
|
6793
|
+
// src/components/InfiniteTable/hooks/useDOMProps.ts
|
|
6794
|
+
function useDOMProps(initialDOMProps) {
|
|
6795
|
+
const { computed, componentState, componentActions } = useInfiniteTable();
|
|
6796
|
+
const {
|
|
6797
|
+
columnShifts,
|
|
6798
|
+
focused,
|
|
6799
|
+
focusedWithin,
|
|
6800
|
+
domRef,
|
|
6801
|
+
onBlurWithin,
|
|
6802
|
+
onFocusWithin,
|
|
6803
|
+
onSelfFocus,
|
|
6804
|
+
onSelfBlur
|
|
6805
|
+
} = componentState;
|
|
6806
|
+
const { computedPinnedStartColumnsWidth, computedPinnedEndColumnsWidth } = computed;
|
|
6807
|
+
const setFocused = rafFn((focused2) => {
|
|
6808
|
+
componentActions.focused = focused2;
|
|
6809
|
+
});
|
|
6810
|
+
const setFocusedWithin = rafFn((focused2) => {
|
|
6811
|
+
componentActions.focusedWithin = focused2;
|
|
6812
|
+
});
|
|
6813
|
+
const onFocus = (event) => {
|
|
6814
|
+
var _a;
|
|
6815
|
+
(_a = initialDOMProps == null ? void 0 : initialDOMProps.onFocus) == null ? void 0 : _a.call(initialDOMProps, event);
|
|
6816
|
+
if (event.target === domRef.current) {
|
|
6817
|
+
setFocused(true);
|
|
6818
|
+
onSelfFocus == null ? void 0 : onSelfFocus(event);
|
|
6819
|
+
if (focusedWithin) {
|
|
6820
|
+
setFocusedWithin(false);
|
|
6821
|
+
onBlurWithin == null ? void 0 : onBlurWithin(event);
|
|
6822
|
+
}
|
|
6823
|
+
} else {
|
|
6824
|
+
if (!focusedWithin) {
|
|
6825
|
+
setFocusedWithin(true);
|
|
6826
|
+
onFocusWithin == null ? void 0 : onFocusWithin(event);
|
|
6827
|
+
}
|
|
6828
|
+
}
|
|
6829
|
+
};
|
|
6830
|
+
const onBlur = (event) => {
|
|
6831
|
+
var _a, _b;
|
|
6832
|
+
(_a = initialDOMProps == null ? void 0 : initialDOMProps.onBlur) == null ? void 0 : _a.call(initialDOMProps, event);
|
|
6833
|
+
if (event.target === domRef.current) {
|
|
6834
|
+
setFocused(false);
|
|
6835
|
+
onSelfBlur == null ? void 0 : onSelfBlur(event);
|
|
6836
|
+
if (focusedWithin) {
|
|
6837
|
+
setFocusedWithin(false);
|
|
6838
|
+
onBlurWithin == null ? void 0 : onBlurWithin(event);
|
|
6839
|
+
}
|
|
6840
|
+
} else {
|
|
6841
|
+
const contained = (_b = domRef.current) == null ? void 0 : _b.contains(event.relatedTarget);
|
|
6842
|
+
if (!contained) {
|
|
6843
|
+
setFocusedWithin(false);
|
|
6844
|
+
onBlurWithin == null ? void 0 : onBlurWithin(event);
|
|
6845
|
+
}
|
|
6846
|
+
}
|
|
6847
|
+
};
|
|
6848
|
+
const domProps = __spreadProps(__spreadValues({
|
|
6849
|
+
tabIndex: 0
|
|
6850
|
+
}, initialDOMProps), {
|
|
6851
|
+
onFocus,
|
|
6852
|
+
onBlur
|
|
6853
|
+
});
|
|
6854
|
+
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({
|
|
6855
|
+
hasPinnedStart: !!computedPinnedStartColumnsWidth,
|
|
6856
|
+
hasPinnedEnd: !!computedPinnedEndColumnsWidth,
|
|
6857
|
+
hasPinnedStartOverflow: !!computed.computedPinnedStartOverflow,
|
|
6858
|
+
hasPinnedEndOverflow: !!computed.computedPinnedEndOverflow,
|
|
6859
|
+
focused,
|
|
6860
|
+
focusedWithin
|
|
6861
|
+
}));
|
|
6862
|
+
domProps.className = className;
|
|
6863
|
+
domProps.style = __spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style);
|
|
6864
|
+
if (focused) {
|
|
6865
|
+
if (componentState.focusedStyle) {
|
|
6866
|
+
Object.assign(domProps.style, componentState.focusedStyle);
|
|
6867
|
+
}
|
|
6868
|
+
}
|
|
6869
|
+
if (focusedWithin) {
|
|
6870
|
+
if (componentState.focusedWithinStyle) {
|
|
6871
|
+
Object.assign(domProps.style, componentState.focusedWithinStyle);
|
|
6872
|
+
}
|
|
6873
|
+
}
|
|
6874
|
+
return domProps;
|
|
6875
|
+
}
|
|
6876
|
+
|
|
6877
|
+
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
6878
|
+
var React35 = __toModule(require("react"));
|
|
6879
|
+
|
|
6880
|
+
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
6881
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwp _16lm1iwr _16lm1iwv _16lm1iwt", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwp _16lm1iwr _16lm1iwv _16lm1iwt" };
|
|
6882
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwp _16lm1iwr _16lm1iwv _16lm1iwt";
|
|
6883
|
+
var LoadMaskTextCls = "qy58ya4";
|
|
6884
|
+
|
|
6885
|
+
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
6886
|
+
var { rootClassName: rootClassName11 } = internalProps;
|
|
6887
|
+
var baseCls2 = `${rootClassName11}-LoadMask`;
|
|
6888
|
+
function LoadMaskFn(props) {
|
|
6889
|
+
const { visible, children = "Loading" } = props;
|
|
6890
|
+
return /* @__PURE__ */ React35.createElement("div", {
|
|
6891
|
+
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls2}`
|
|
6892
|
+
}, /* @__PURE__ */ React35.createElement("div", {
|
|
6893
|
+
className: `${LoadMaskOverlayCls} ${baseCls2}-Overlay`
|
|
6894
|
+
}), /* @__PURE__ */ React35.createElement("div", {
|
|
6895
|
+
className: `${LoadMaskTextCls} ${baseCls2}-Text`
|
|
6896
|
+
}, children));
|
|
6897
|
+
}
|
|
6898
|
+
var LoadMask = React35.memo(LoadMaskFn);
|
|
6899
|
+
|
|
6219
6900
|
// src/components/InfiniteTable/index.tsx
|
|
6220
6901
|
var InfiniteTableClassName = internalProps.rootClassName;
|
|
6221
6902
|
var ONLY_VERTICAL_SCROLLBAR = {
|
|
@@ -6223,26 +6904,33 @@ var ONLY_VERTICAL_SCROLLBAR = {
|
|
|
6223
6904
|
vertical: true
|
|
6224
6905
|
};
|
|
6225
6906
|
var InfiniteTableRoot = getComponentStateRoot({
|
|
6226
|
-
|
|
6227
|
-
|
|
6907
|
+
initSetupState,
|
|
6908
|
+
forwardProps,
|
|
6909
|
+
mapPropsToState,
|
|
6910
|
+
allowedControlledPropOverrides: {
|
|
6911
|
+
rowHeight: true,
|
|
6912
|
+
headerHeight: true
|
|
6913
|
+
},
|
|
6228
6914
|
getParentState: () => useDataSource()
|
|
6229
6915
|
});
|
|
6230
|
-
var InfiniteTableComponent =
|
|
6916
|
+
var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
6917
|
+
var _a;
|
|
6231
6918
|
const { componentState, getComputed, computed } = useInfiniteTable();
|
|
6232
6919
|
const {
|
|
6233
|
-
componentState: { dataArray }
|
|
6920
|
+
componentState: { dataArray, loading }
|
|
6234
6921
|
} = useDataSourceContextValue();
|
|
6235
6922
|
const {
|
|
6236
6923
|
domRef,
|
|
6237
|
-
|
|
6924
|
+
scrollerDOMRef,
|
|
6238
6925
|
portalDOMRef,
|
|
6239
|
-
domProps,
|
|
6240
6926
|
licenseKey,
|
|
6927
|
+
loadingText,
|
|
6241
6928
|
header,
|
|
6242
|
-
|
|
6243
|
-
|
|
6929
|
+
onRowHeightCSSVarChange,
|
|
6930
|
+
onHeaderHeightCSSVarChange,
|
|
6244
6931
|
rowHeightCSSVar,
|
|
6245
|
-
headerHeightCSSVar
|
|
6932
|
+
headerHeightCSSVar,
|
|
6933
|
+
components
|
|
6246
6934
|
} = componentState;
|
|
6247
6935
|
const { columnShifts, bodySize } = componentState;
|
|
6248
6936
|
const {
|
|
@@ -6264,39 +6952,40 @@ var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
|
|
|
6264
6952
|
computed
|
|
6265
6953
|
});
|
|
6266
6954
|
const licenseValid = useLicense(licenseKey);
|
|
6267
|
-
const
|
|
6268
|
-
|
|
6955
|
+
const domProps = useDOMProps(componentState.domProps);
|
|
6956
|
+
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
6957
|
+
return /* @__PURE__ */ React36.createElement("div", __spreadValues({
|
|
6269
6958
|
ref: domRef
|
|
6270
|
-
}, domProps), {
|
|
6271
|
-
className
|
|
6272
|
-
}), header ? /* @__PURE__ */ React35.createElement(TableHeaderWrapper, {
|
|
6959
|
+
}, domProps), header ? /* @__PURE__ */ React36.createElement(TableHeaderWrapper, {
|
|
6273
6960
|
brain: horizontalVirtualBrain,
|
|
6274
6961
|
repaintId,
|
|
6275
6962
|
scrollbars
|
|
6276
|
-
}) : null, /* @__PURE__ */
|
|
6277
|
-
ref:
|
|
6963
|
+
}) : null, /* @__PURE__ */ React36.createElement(InfiniteTableBody, null, /* @__PURE__ */ React36.createElement(VirtualScrollContainer, {
|
|
6964
|
+
ref: scrollerDOMRef,
|
|
6278
6965
|
onContainerScroll: applyScrollVertical,
|
|
6279
6966
|
scrollable: ONLY_VERTICAL_SCROLLBAR
|
|
6280
|
-
}, /* @__PURE__ */
|
|
6281
|
-
className:
|
|
6282
|
-
}, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */
|
|
6967
|
+
}, /* @__PURE__ */ React36.createElement("div", {
|
|
6968
|
+
className: display.flex
|
|
6969
|
+
}, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ React36.createElement(SpacePlaceholder, {
|
|
6283
6970
|
count: dataArray.length,
|
|
6284
6971
|
width: 0,
|
|
6285
6972
|
height: reservedContentHeight
|
|
6286
|
-
})), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder
|
|
6973
|
+
})), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder, /* @__PURE__ */ React36.createElement(LoadMaskCmp, {
|
|
6974
|
+
visible: loading
|
|
6975
|
+
}, loadingText)), licenseValid ? null : /* @__PURE__ */ React36.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React36.createElement("div", {
|
|
6287
6976
|
ref: portalDOMRef,
|
|
6288
|
-
className:
|
|
6289
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
6977
|
+
className: join(`${rootClassName}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
6978
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ React36.createElement(CSSVariableWatch, {
|
|
6290
6979
|
varName: rowHeightCSSVar,
|
|
6291
|
-
onChange:
|
|
6292
|
-
}) : null, headerHeightCSSVar ? /* @__PURE__ */
|
|
6980
|
+
onChange: onRowHeightCSSVarChange
|
|
6981
|
+
}) : null, headerHeightCSSVar ? /* @__PURE__ */ React36.createElement(CSSVariableWatch, {
|
|
6293
6982
|
varName: headerHeightCSSVar,
|
|
6294
|
-
onChange:
|
|
6983
|
+
onChange: onHeaderHeightCSSVarChange
|
|
6295
6984
|
}) : null);
|
|
6296
6985
|
});
|
|
6297
6986
|
function InfiniteTableContextProvider() {
|
|
6298
6987
|
const { componentActions, componentState } = useComponentState();
|
|
6299
|
-
const {
|
|
6988
|
+
const { scrollerDOMRef } = componentState;
|
|
6300
6989
|
const computed = useComputed();
|
|
6301
6990
|
const getComputed = useLatest(computed);
|
|
6302
6991
|
const getState = useLatest(componentState);
|
|
@@ -6311,14 +7000,13 @@ function InfiniteTableContextProvider() {
|
|
|
6311
7000
|
getComputed,
|
|
6312
7001
|
getState
|
|
6313
7002
|
};
|
|
6314
|
-
useResizeObserver(
|
|
7003
|
+
useResizeObserver(scrollerDOMRef, (size) => {
|
|
6315
7004
|
var _a, _b;
|
|
6316
7005
|
const bodySize = {
|
|
6317
7006
|
width: size.width,
|
|
6318
7007
|
height: size.height
|
|
6319
7008
|
};
|
|
6320
|
-
bodySize.width = (_b = (_a =
|
|
6321
|
-
bodySizeRef.current = bodySize;
|
|
7009
|
+
bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
|
|
6322
7010
|
const state = getState();
|
|
6323
7011
|
if (!state.virtualizeHeader) {
|
|
6324
7012
|
componentActions.bodySize = bodySize;
|
|
@@ -6326,21 +7014,22 @@ function InfiniteTableContextProvider() {
|
|
|
6326
7014
|
}
|
|
6327
7015
|
componentActions.bodySize = bodySize;
|
|
6328
7016
|
}, { earlyAttach: true });
|
|
6329
|
-
|
|
7017
|
+
React36.useEffect(() => {
|
|
6330
7018
|
return () => {
|
|
6331
|
-
componentState.
|
|
6332
|
-
componentState.
|
|
7019
|
+
componentState.onRowHeightCSSVarChange.destroy();
|
|
7020
|
+
componentState.onHeaderHeightCSSVarChange.destroy();
|
|
6333
7021
|
};
|
|
6334
7022
|
}, []);
|
|
6335
7023
|
const TableContext2 = getInfiniteTableContext();
|
|
6336
|
-
return /* @__PURE__ */
|
|
7024
|
+
return /* @__PURE__ */ React36.createElement(TableContext2.Provider, {
|
|
6337
7025
|
value: contextValue
|
|
6338
|
-
}, /* @__PURE__ */
|
|
7026
|
+
}, /* @__PURE__ */ React36.createElement(InfiniteTableComponent, null));
|
|
6339
7027
|
}
|
|
6340
7028
|
function InfiniteTable(props) {
|
|
6341
|
-
|
|
7029
|
+
const table = /* @__PURE__ */ React36.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React36.createElement(InfiniteTableContextProvider, null));
|
|
7030
|
+
return /* @__PURE__ */ React36.createElement(React36.StrictMode, null, table);
|
|
6342
7031
|
}
|
|
6343
7032
|
InfiniteTable.defaultProps = {
|
|
6344
7033
|
rowHeight: 40,
|
|
6345
|
-
headerHeight:
|
|
7034
|
+
headerHeight: ThemeVars.components.Header.height
|
|
6346
7035
|
};
|