@infinite-table/infinite-react 0.0.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -71
- package/index.css +3 -5
- package/index.d.ts +336 -203
- package/index.esm.css +3 -5
- package/index.esm.js +998 -686
- package/index.js +1057 -744
- package/package.json +3 -4
package/index.esm.js
CHANGED
|
@@ -48,26 +48,6 @@ var __reExport = (target, module, desc) => {
|
|
|
48
48
|
var __toModule = (module) => {
|
|
49
49
|
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
|
|
50
50
|
};
|
|
51
|
-
var __async = (__this, __arguments, generator) => {
|
|
52
|
-
return new Promise((resolve, reject) => {
|
|
53
|
-
var fulfilled = (value) => {
|
|
54
|
-
try {
|
|
55
|
-
step(generator.next(value));
|
|
56
|
-
} catch (e) {
|
|
57
|
-
reject(e);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
var rejected = (value) => {
|
|
61
|
-
try {
|
|
62
|
-
step(generator.throw(value));
|
|
63
|
-
} catch (e) {
|
|
64
|
-
reject(e);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
68
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
51
|
|
|
72
52
|
// node_modules/ms/index.js
|
|
73
53
|
var require_ms = __commonJS({
|
|
@@ -477,14 +457,14 @@ var require_browser = __commonJS({
|
|
|
477
457
|
} else {
|
|
478
458
|
exports.storage.removeItem("debug");
|
|
479
459
|
}
|
|
480
|
-
} catch (
|
|
460
|
+
} catch (error2) {
|
|
481
461
|
}
|
|
482
462
|
}
|
|
483
463
|
function load() {
|
|
484
464
|
let r;
|
|
485
465
|
try {
|
|
486
466
|
r = exports.storage.getItem("debug");
|
|
487
|
-
} catch (
|
|
467
|
+
} catch (error2) {
|
|
488
468
|
}
|
|
489
469
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
490
470
|
r = process.env.DEBUG;
|
|
@@ -494,7 +474,7 @@ var require_browser = __commonJS({
|
|
|
494
474
|
function localstorage() {
|
|
495
475
|
try {
|
|
496
476
|
return localStorage;
|
|
497
|
-
} catch (
|
|
477
|
+
} catch (error2) {
|
|
498
478
|
}
|
|
499
479
|
}
|
|
500
480
|
module.exports = require_common()(exports);
|
|
@@ -502,8 +482,8 @@ var require_browser = __commonJS({
|
|
|
502
482
|
formatters.j = function(v) {
|
|
503
483
|
try {
|
|
504
484
|
return JSON.stringify(v);
|
|
505
|
-
} catch (
|
|
506
|
-
return "[UnexpectedJSONParseError]: " +
|
|
485
|
+
} catch (error2) {
|
|
486
|
+
return "[UnexpectedJSONParseError]: " + error2.message;
|
|
507
487
|
}
|
|
508
488
|
};
|
|
509
489
|
}
|
|
@@ -636,44 +616,13 @@ var require_binary_search = __commonJS({
|
|
|
636
616
|
}
|
|
637
617
|
});
|
|
638
618
|
|
|
639
|
-
// node_modules/decamelize/index.js
|
|
640
|
-
var require_decamelize = __commonJS({
|
|
641
|
-
"node_modules/decamelize/index.js"(exports, module) {
|
|
642
|
-
"use strict";
|
|
643
|
-
var handlePreserveConsecutiveUppercase = (decamelized, separator) => {
|
|
644
|
-
decamelized = decamelized.replace(/((?<![\p{Uppercase_Letter}\d])[\p{Uppercase_Letter}\d](?![\p{Uppercase_Letter}\d]))/gu, ($0) => {
|
|
645
|
-
return $0.toLowerCase();
|
|
646
|
-
});
|
|
647
|
-
return decamelized.replace(/(\p{Uppercase_Letter}+)(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, (_, $1, $2) => {
|
|
648
|
-
return $1 + separator + $2.toLowerCase();
|
|
649
|
-
});
|
|
650
|
-
};
|
|
651
|
-
module.exports = (text, {
|
|
652
|
-
separator = "_",
|
|
653
|
-
preserveConsecutiveUppercase = false
|
|
654
|
-
} = {}) => {
|
|
655
|
-
if (!(typeof text === "string" && typeof separator === "string")) {
|
|
656
|
-
throw new TypeError("The `text` and `separator` arguments should be of type `string`");
|
|
657
|
-
}
|
|
658
|
-
if (text.length < 2) {
|
|
659
|
-
return preserveConsecutiveUppercase ? text : text.toLowerCase();
|
|
660
|
-
}
|
|
661
|
-
const replacement = `$1${separator}$2`;
|
|
662
|
-
const decamelized = text.replace(/([\p{Lowercase_Letter}\d])(\p{Uppercase_Letter})/gu, replacement);
|
|
663
|
-
if (preserveConsecutiveUppercase) {
|
|
664
|
-
return handlePreserveConsecutiveUppercase(decamelized, separator);
|
|
665
|
-
}
|
|
666
|
-
return decamelized.replace(/(\p{Uppercase_Letter})(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, replacement).toLowerCase();
|
|
667
|
-
};
|
|
668
|
-
}
|
|
669
|
-
});
|
|
670
|
-
|
|
671
619
|
// src/components/InfiniteTable/index.tsx
|
|
672
620
|
import {
|
|
673
621
|
StrictMode,
|
|
674
622
|
createElement as createElement33,
|
|
675
623
|
memo as memo13,
|
|
676
|
-
useEffect as
|
|
624
|
+
useEffect as useEffect24,
|
|
625
|
+
useLayoutEffect as useLayoutEffect6
|
|
677
626
|
} from "react";
|
|
678
627
|
|
|
679
628
|
// src/components/InfiniteTable/internalProps.ts
|
|
@@ -754,9 +703,20 @@ var ScrollListener = class {
|
|
|
754
703
|
}
|
|
755
704
|
};
|
|
756
705
|
|
|
706
|
+
// src/components/InfiniteTable/utils/toMap.ts
|
|
707
|
+
function toMap(mapOrObject) {
|
|
708
|
+
if (!mapOrObject) {
|
|
709
|
+
return new Map();
|
|
710
|
+
}
|
|
711
|
+
if (mapOrObject instanceof Map) {
|
|
712
|
+
return mapOrObject;
|
|
713
|
+
}
|
|
714
|
+
return new Map(Object.entries(mapOrObject));
|
|
715
|
+
}
|
|
716
|
+
|
|
757
717
|
// src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
|
|
758
718
|
function computeColumnGroupsDepths(columnGroups) {
|
|
759
|
-
const
|
|
719
|
+
const map2 = new Map();
|
|
760
720
|
columnGroups.forEach((colGroup, colGroupId) => {
|
|
761
721
|
let parentGroupId = colGroup.columnGroup;
|
|
762
722
|
let depth = 0;
|
|
@@ -771,12 +731,15 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
771
731
|
depth++;
|
|
772
732
|
parentGroupId = parent.columnGroup;
|
|
773
733
|
}
|
|
774
|
-
|
|
734
|
+
map2.set(colGroupId, depth);
|
|
775
735
|
});
|
|
776
|
-
return
|
|
736
|
+
return map2;
|
|
777
737
|
}
|
|
778
738
|
|
|
779
739
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
740
|
+
function toColumnTypesMap(mapOrObject) {
|
|
741
|
+
return toMap(mapOrObject);
|
|
742
|
+
}
|
|
780
743
|
function initSetupState() {
|
|
781
744
|
const columnsGeneratedForGrouping = new Map();
|
|
782
745
|
return {
|
|
@@ -806,7 +769,11 @@ function initSetupState() {
|
|
|
806
769
|
}
|
|
807
770
|
var forwardProps = () => {
|
|
808
771
|
return {
|
|
809
|
-
columns:
|
|
772
|
+
columns: (columns) => {
|
|
773
|
+
var _a;
|
|
774
|
+
return (_a = toMap(columns)) != null ? _a : new Map();
|
|
775
|
+
},
|
|
776
|
+
scrollTopId: 1,
|
|
810
777
|
components: 1,
|
|
811
778
|
loadingText: 1,
|
|
812
779
|
pivotColumns: 1,
|
|
@@ -832,15 +799,18 @@ var forwardProps = () => {
|
|
|
832
799
|
pivotColumn: 1,
|
|
833
800
|
pivotRowLabelsColumn: 1,
|
|
834
801
|
pivotColumnGroups: 1,
|
|
802
|
+
onScrollbarsChange: 1,
|
|
803
|
+
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
835
804
|
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
836
805
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
837
806
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
838
|
-
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth :
|
|
807
|
+
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
839
808
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
809
|
+
showSeparatePivotColumnForSingleAggregation: (showSeparatePivotColumnForSingleAggregation) => showSeparatePivotColumnForSingleAggregation != null ? showSeparatePivotColumnForSingleAggregation : false,
|
|
840
810
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
841
811
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
842
812
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
843
|
-
licenseKey: (licenseKey) => licenseKey ||
|
|
813
|
+
licenseKey: (licenseKey) => licenseKey || "",
|
|
844
814
|
columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
|
|
845
815
|
header: (header) => header != null ? header : true,
|
|
846
816
|
showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
|
|
@@ -848,23 +818,33 @@ var forwardProps = () => {
|
|
|
848
818
|
virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
|
|
849
819
|
rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
|
|
850
820
|
headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
|
|
851
|
-
columnVisibility: (columnVisibility) =>
|
|
821
|
+
columnVisibility: (columnVisibility) => {
|
|
822
|
+
var _a;
|
|
823
|
+
return (_a = toMap(columnVisibility)) != null ? _a : new Map();
|
|
824
|
+
},
|
|
852
825
|
columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
|
|
853
|
-
|
|
826
|
+
columnSizing: (columnSizing) => {
|
|
827
|
+
var _a;
|
|
828
|
+
return (_a = toMap(columnSizing)) != null ? _a : new Map();
|
|
829
|
+
},
|
|
830
|
+
columnTypes: (columnTypes) => {
|
|
831
|
+
var _a;
|
|
832
|
+
return (_a = toColumnTypesMap(columnTypes)) != null ? _a : new Map();
|
|
833
|
+
},
|
|
854
834
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
855
835
|
columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
|
|
856
836
|
};
|
|
857
837
|
};
|
|
858
838
|
function getGroupRenderStrategy(options) {
|
|
859
|
-
const {
|
|
839
|
+
const { groupBy, groupColumn, groupRenderStrategy } = options;
|
|
860
840
|
if (groupRenderStrategy) {
|
|
861
841
|
return groupRenderStrategy;
|
|
862
842
|
}
|
|
863
843
|
if (groupColumn != null && typeof groupColumn === "object") {
|
|
864
844
|
return "single-column";
|
|
865
845
|
}
|
|
866
|
-
const
|
|
867
|
-
if (
|
|
846
|
+
const columnsInGroupBy = groupBy.filter((g) => g.column);
|
|
847
|
+
if (columnsInGroupBy.length) {
|
|
868
848
|
return "multi-column";
|
|
869
849
|
}
|
|
870
850
|
return "multi-column";
|
|
@@ -875,16 +855,17 @@ var mapPropsToState = (params) => {
|
|
|
875
855
|
const computedColumnGroups = state.pivotColumnGroups || state.columnGroups;
|
|
876
856
|
const virtualizeHeader = header && virtualizeColumns && (!computedColumnGroups || (computedColumnGroups == null ? void 0 : computedColumnGroups.size) === 0);
|
|
877
857
|
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;
|
|
878
|
-
const
|
|
858
|
+
const groupBy = parentState == null ? void 0 : parentState.groupBy;
|
|
879
859
|
const groupRenderStrategy = getGroupRenderStrategy({
|
|
880
860
|
groupRenderStrategy: props.groupRenderStrategy,
|
|
881
|
-
|
|
861
|
+
groupBy,
|
|
882
862
|
groupColumn: props.groupColumn
|
|
883
863
|
});
|
|
864
|
+
const computedColumns = state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
|
|
884
865
|
return {
|
|
885
866
|
groupRenderStrategy,
|
|
886
|
-
|
|
887
|
-
computedColumns
|
|
867
|
+
groupBy,
|
|
868
|
+
computedColumns,
|
|
888
869
|
virtualizeHeader,
|
|
889
870
|
columnGroupsDepthsMap,
|
|
890
871
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
@@ -1024,7 +1005,7 @@ var computeFlex = (params) => {
|
|
|
1024
1005
|
items.forEach((item, i) => {
|
|
1025
1006
|
var _a, _b, _c, _d, _e, _f;
|
|
1026
1007
|
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
1027
|
-
let minSize = (_d = (_c = item.
|
|
1008
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
1028
1009
|
if (item.size != null) {
|
|
1029
1010
|
if (maxSize != null && item.size > maxSize) {
|
|
1030
1011
|
item.size = maxSize;
|
|
@@ -1052,7 +1033,7 @@ var computeFlex = (params) => {
|
|
|
1052
1033
|
if (item.flex != null) {
|
|
1053
1034
|
const approxFlexSize = sizePerFlex * item.flex;
|
|
1054
1035
|
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
1055
|
-
let minSize = (_d = (_c = item.
|
|
1036
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
1056
1037
|
let constrained = false;
|
|
1057
1038
|
let substractSize = 0;
|
|
1058
1039
|
if (maxSize != null && approxFlexSize > maxSize) {
|
|
@@ -1187,8 +1168,52 @@ var Logger = class {
|
|
|
1187
1168
|
}
|
|
1188
1169
|
};
|
|
1189
1170
|
|
|
1171
|
+
// src/utils/getGlobal.ts
|
|
1172
|
+
function getGlobal() {
|
|
1173
|
+
return globalThis;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
// src/components/utils/getScrollbarWidth.ts
|
|
1177
|
+
var scrollbarWidth;
|
|
1178
|
+
function getScrollbarWidth() {
|
|
1179
|
+
var _a, _b;
|
|
1180
|
+
if (scrollbarWidth != null) {
|
|
1181
|
+
return scrollbarWidth;
|
|
1182
|
+
}
|
|
1183
|
+
const doc = (_a = getGlobal().document) != null ? _a : null;
|
|
1184
|
+
if (!doc) {
|
|
1185
|
+
return 0;
|
|
1186
|
+
}
|
|
1187
|
+
const outer = doc.createElement("div");
|
|
1188
|
+
outer.style.visibility = "hidden";
|
|
1189
|
+
outer.style.overflow = "scroll";
|
|
1190
|
+
doc.body.appendChild(outer);
|
|
1191
|
+
const inner = doc.createElement("div");
|
|
1192
|
+
outer.appendChild(inner);
|
|
1193
|
+
scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
|
1194
|
+
(_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
|
|
1195
|
+
return scrollbarWidth;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
// src/components/InfiniteTable/utils/getColumnComputedType.ts
|
|
1199
|
+
var emptyType = Object.freeze({});
|
|
1200
|
+
function getColumnComputedType(column, columnTypes) {
|
|
1201
|
+
const defaultType = columnTypes.get("default") || emptyType;
|
|
1202
|
+
if (column.type === void 0) {
|
|
1203
|
+
return defaultType;
|
|
1204
|
+
}
|
|
1205
|
+
if (column.type === null) {
|
|
1206
|
+
return emptyType;
|
|
1207
|
+
}
|
|
1208
|
+
if (typeof column.type === "string") {
|
|
1209
|
+
const type = columnTypes.get(column.type) || emptyType;
|
|
1210
|
+
return type;
|
|
1211
|
+
}
|
|
1212
|
+
return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes.get(columnType)), {});
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1190
1215
|
// src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
|
|
1191
|
-
var
|
|
1216
|
+
var logError = err("getComputedVisibleColumns");
|
|
1192
1217
|
var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
|
|
1193
1218
|
return !columnVisibility.has(colId) || columnVisibility.get(colId) !== false;
|
|
1194
1219
|
};
|
|
@@ -1209,22 +1234,26 @@ var getComputedVisibleColumns = ({
|
|
|
1209
1234
|
sortInfo,
|
|
1210
1235
|
setSortInfo,
|
|
1211
1236
|
multiSort,
|
|
1237
|
+
viewportReservedWidth,
|
|
1212
1238
|
draggableColumns,
|
|
1213
1239
|
columnOrder,
|
|
1214
1240
|
columnPinning,
|
|
1241
|
+
columnSizing,
|
|
1242
|
+
columnTypes,
|
|
1215
1243
|
columnVisibility,
|
|
1216
1244
|
columnVisibilityAssumeVisible
|
|
1217
1245
|
}) => {
|
|
1218
1246
|
let computedOffset = 0;
|
|
1219
1247
|
const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
|
|
1220
|
-
const visibleColumnOrder = normalizedColumnOrder.filter(
|
|
1221
|
-
|
|
1222
|
-
let col = columns.get(columnId);
|
|
1248
|
+
const visibleColumnOrder = normalizedColumnOrder.filter((colId) => {
|
|
1249
|
+
let col = columns.get(colId);
|
|
1223
1250
|
if (!col) {
|
|
1224
|
-
|
|
1251
|
+
logError(`Column with id "${colId}" specified in columnOrder array cannot be found in the columns map.`);
|
|
1252
|
+
return false;
|
|
1225
1253
|
}
|
|
1226
|
-
return
|
|
1227
|
-
})
|
|
1254
|
+
return isColumnVisible(columnVisibility, columnVisibilityAssumeVisible, colId);
|
|
1255
|
+
});
|
|
1256
|
+
const columnsArray = visibleColumnOrder.map((columnId) => columns.get(columnId)).filter(Boolean);
|
|
1228
1257
|
const sortedMap = (sortInfo != null ? sortInfo : []).reduce((acc, info, index) => {
|
|
1229
1258
|
if (info.id) {
|
|
1230
1259
|
acc[info.id] = { sortInfo: info, index };
|
|
@@ -1238,20 +1267,39 @@ var getComputedVisibleColumns = ({
|
|
|
1238
1267
|
return acc;
|
|
1239
1268
|
}, {});
|
|
1240
1269
|
const flexResult = computeFlex({
|
|
1241
|
-
availableSize: bodySize.width,
|
|
1270
|
+
availableSize: Math.max(bodySize.width - (viewportReservedWidth != null ? viewportReservedWidth : 0) - getScrollbarWidth(), 0),
|
|
1242
1271
|
maxSize: columnMaxWidth,
|
|
1243
1272
|
minSize: columnMinWidth,
|
|
1244
|
-
items:
|
|
1245
|
-
var _a, _b;
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1273
|
+
items: visibleColumnOrder.map((colId) => {
|
|
1274
|
+
var _a, _b, _c, _d;
|
|
1275
|
+
const column = columns.get(colId);
|
|
1276
|
+
const colType = getColumnComputedType(column, columnTypes);
|
|
1277
|
+
const colTypeSizing = {
|
|
1278
|
+
minWidth: colType == null ? void 0 : colType.minWidth,
|
|
1279
|
+
maxWidth: colType == null ? void 0 : colType.maxWidth,
|
|
1280
|
+
width: colType == null ? void 0 : colType.width,
|
|
1281
|
+
flex: colType == null ? void 0 : colType.flex
|
|
1282
|
+
};
|
|
1283
|
+
let colSizing = columnSizing.get(colId) || {};
|
|
1284
|
+
if (colSizing.width != null) {
|
|
1285
|
+
delete colTypeSizing.flex;
|
|
1286
|
+
}
|
|
1287
|
+
if (colSizing.flex != null) {
|
|
1288
|
+
delete colTypeSizing.width;
|
|
1289
|
+
}
|
|
1290
|
+
colSizing = Object.assign(colTypeSizing, colSizing);
|
|
1291
|
+
let colFlex = (_a = colSizing.flex) != null ? _a : void 0;
|
|
1292
|
+
const colMinWidth = (_b = colSizing.minWidth) != null ? _b : columnMinWidth;
|
|
1293
|
+
const colMaxWidth = (_c = colSizing.maxWidth) != null ? _c : columnMaxWidth;
|
|
1294
|
+
let size = colFlex != void 0 ? void 0 : (_d = colSizing.width) != null ? _d : columnDefaultWidth;
|
|
1295
|
+
if (!size && colFlex == void 0) {
|
|
1296
|
+
size = colMinWidth;
|
|
1249
1297
|
}
|
|
1250
1298
|
return {
|
|
1251
1299
|
size,
|
|
1252
|
-
flex:
|
|
1253
|
-
minSize:
|
|
1254
|
-
maxSize:
|
|
1300
|
+
flex: colFlex,
|
|
1301
|
+
minSize: colMinWidth,
|
|
1302
|
+
maxSize: colMaxWidth
|
|
1255
1303
|
};
|
|
1256
1304
|
})
|
|
1257
1305
|
});
|
|
@@ -1286,6 +1334,7 @@ var getComputedVisibleColumns = ({
|
|
|
1286
1334
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1287
1335
|
const id = visibleColumnOrder[i];
|
|
1288
1336
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
1337
|
+
const colType = getColumnComputedType(c, columnTypes);
|
|
1289
1338
|
const sortingInfo = sortedMap[id] ? sortedMap[id] : c.field ? (_a = sortedMap[c.field]) != null ? _a : null : null;
|
|
1290
1339
|
const computedSortInfo = (_b = sortingInfo == null ? void 0 : sortingInfo.sortInfo) != null ? _b : null;
|
|
1291
1340
|
const computedSorted = !!computedSortInfo;
|
|
@@ -1341,8 +1390,10 @@ var getComputedVisibleColumns = ({
|
|
|
1341
1390
|
const computedFirstInCategory = computedPinned !== prevPinned;
|
|
1342
1391
|
const computedLastInCategory = computedLast || computedPinned !== getComputedPinned(nextColumnId, columnPinning);
|
|
1343
1392
|
const result2 = __spreadProps(__spreadValues({
|
|
1344
|
-
align:
|
|
1345
|
-
verticalAlign:
|
|
1393
|
+
align: colType.align,
|
|
1394
|
+
verticalAlign: colType.verticalAlign,
|
|
1395
|
+
renderValue: colType.renderValue,
|
|
1396
|
+
render: colType.render
|
|
1346
1397
|
}, c), {
|
|
1347
1398
|
computedWidth,
|
|
1348
1399
|
computedAbsoluteOffset,
|
|
@@ -1421,28 +1472,28 @@ var useRerender = () => {
|
|
|
1421
1472
|
|
|
1422
1473
|
// src/components/hooks/useInterceptedMap.ts
|
|
1423
1474
|
import { useEffect as useEffect2 } from "react";
|
|
1424
|
-
function interceptMap(
|
|
1425
|
-
const { set, delete: deleteKey, clear } =
|
|
1475
|
+
function interceptMap(map2, fns) {
|
|
1476
|
+
const { set, delete: deleteKey, clear } = map2;
|
|
1426
1477
|
if (fns.set) {
|
|
1427
|
-
|
|
1428
|
-
set.call(
|
|
1478
|
+
map2.set = (key, value) => {
|
|
1479
|
+
set.call(map2, key, value);
|
|
1429
1480
|
fns.set(key, value);
|
|
1430
|
-
return
|
|
1481
|
+
return map2;
|
|
1431
1482
|
};
|
|
1432
1483
|
}
|
|
1433
1484
|
if (fns.delete) {
|
|
1434
|
-
|
|
1435
|
-
const removed = deleteKey.call(
|
|
1485
|
+
map2.delete = (key) => {
|
|
1486
|
+
const removed = deleteKey.call(map2, key);
|
|
1436
1487
|
fns.delete(key);
|
|
1437
1488
|
return removed;
|
|
1438
1489
|
};
|
|
1439
1490
|
}
|
|
1440
1491
|
if (fns.clear || fns.beforeClear) {
|
|
1441
|
-
|
|
1492
|
+
map2.clear = () => {
|
|
1442
1493
|
if (fns.beforeClear) {
|
|
1443
|
-
fns.beforeClear(
|
|
1494
|
+
fns.beforeClear(map2);
|
|
1444
1495
|
}
|
|
1445
|
-
const result = clear.call(
|
|
1496
|
+
const result = clear.call(map2);
|
|
1446
1497
|
if (fns.clear) {
|
|
1447
1498
|
fns.clear();
|
|
1448
1499
|
}
|
|
@@ -1451,13 +1502,13 @@ function interceptMap(map, fns) {
|
|
|
1451
1502
|
}
|
|
1452
1503
|
return () => {
|
|
1453
1504
|
if (set) {
|
|
1454
|
-
|
|
1505
|
+
map2.set = set;
|
|
1455
1506
|
}
|
|
1456
1507
|
if (deleteKey) {
|
|
1457
|
-
|
|
1508
|
+
map2.delete = deleteKey;
|
|
1458
1509
|
}
|
|
1459
1510
|
if (clear) {
|
|
1460
|
-
|
|
1511
|
+
map2.clear = clear;
|
|
1461
1512
|
}
|
|
1462
1513
|
};
|
|
1463
1514
|
}
|
|
@@ -1477,16 +1528,16 @@ var rafFn = (fn) => {
|
|
|
1477
1528
|
};
|
|
1478
1529
|
|
|
1479
1530
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
1480
|
-
var useRerenderOnKeyChange = (
|
|
1531
|
+
var useRerenderOnKeyChange = (map2) => {
|
|
1481
1532
|
const [renderId, rerender] = useRerender();
|
|
1482
1533
|
useEffect3(() => {
|
|
1483
1534
|
const update = rafFn(rerender);
|
|
1484
|
-
return interceptMap(
|
|
1535
|
+
return interceptMap(map2, {
|
|
1485
1536
|
set: update,
|
|
1486
1537
|
clear: update,
|
|
1487
1538
|
delete: update
|
|
1488
1539
|
});
|
|
1489
|
-
}, [
|
|
1540
|
+
}, [map2]);
|
|
1490
1541
|
return renderId;
|
|
1491
1542
|
};
|
|
1492
1543
|
|
|
@@ -1504,11 +1555,16 @@ var useComputedVisibleColumns = ({
|
|
|
1504
1555
|
setSortInfo,
|
|
1505
1556
|
columnOrder,
|
|
1506
1557
|
columnPinning,
|
|
1558
|
+
columnTypes,
|
|
1507
1559
|
pinnedEndMaxWidth,
|
|
1508
1560
|
pinnedStartMaxWidth,
|
|
1561
|
+
viewportReservedWidth,
|
|
1509
1562
|
columnVisibility,
|
|
1510
|
-
columnVisibilityAssumeVisible
|
|
1563
|
+
columnVisibilityAssumeVisible,
|
|
1564
|
+
columnSizing
|
|
1511
1565
|
}) => {
|
|
1566
|
+
const columnsSizingRenderId = useRerenderOnKeyChange(columnSizing);
|
|
1567
|
+
const columnTypesRenderId = useRerenderOnKeyChange(columnTypes);
|
|
1512
1568
|
const columnsRenderId = useRerenderOnKeyChange(columns);
|
|
1513
1569
|
const visibilityRenderId = useRerenderOnKeyChange(columnVisibility);
|
|
1514
1570
|
const pinningRenderId = useRerenderOnKeyChange(columnPinning);
|
|
@@ -1534,6 +1590,7 @@ var useComputedVisibleColumns = ({
|
|
|
1534
1590
|
columnMinWidth,
|
|
1535
1591
|
columnMaxWidth,
|
|
1536
1592
|
columnDefaultWidth,
|
|
1593
|
+
viewportReservedWidth,
|
|
1537
1594
|
sortable,
|
|
1538
1595
|
sortInfo,
|
|
1539
1596
|
setSortInfo,
|
|
@@ -1543,6 +1600,8 @@ var useComputedVisibleColumns = ({
|
|
|
1543
1600
|
draggableColumns,
|
|
1544
1601
|
columnOrder,
|
|
1545
1602
|
columnPinning,
|
|
1603
|
+
columnSizing,
|
|
1604
|
+
columnTypes,
|
|
1546
1605
|
columnVisibility,
|
|
1547
1606
|
columnVisibilityAssumeVisible: columnVisibilityAssumeVisible != null ? columnVisibilityAssumeVisible : true
|
|
1548
1607
|
});
|
|
@@ -1564,7 +1623,9 @@ var useComputedVisibleColumns = ({
|
|
|
1564
1623
|
columnPinning,
|
|
1565
1624
|
columnsRenderId,
|
|
1566
1625
|
visibilityRenderId,
|
|
1567
|
-
|
|
1626
|
+
columnsSizingRenderId,
|
|
1627
|
+
pinningRenderId,
|
|
1628
|
+
columnTypesRenderId
|
|
1568
1629
|
]);
|
|
1569
1630
|
const result = {
|
|
1570
1631
|
columns,
|
|
@@ -1590,48 +1651,17 @@ var useComputedVisibleColumns = ({
|
|
|
1590
1651
|
var sortAscending = (a, b) => a - b;
|
|
1591
1652
|
|
|
1592
1653
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
1593
|
-
import { useCallback as useCallback5, useState as
|
|
1594
|
-
|
|
1595
|
-
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
1596
|
-
import { useEffect as useEffect5 } from "react";
|
|
1597
|
-
|
|
1598
|
-
// src/components/DataSource/publicHooks/useDataSourceActions.ts
|
|
1599
|
-
import {
|
|
1600
|
-
useContext as useContext2
|
|
1601
|
-
} from "react";
|
|
1602
|
-
|
|
1603
|
-
// src/components/DataSource/DataSourceContext.ts
|
|
1604
|
-
import {
|
|
1605
|
-
createContext as createContext2
|
|
1606
|
-
} from "react";
|
|
1607
|
-
var DSContext;
|
|
1608
|
-
function getDataSourceContext() {
|
|
1609
|
-
if (DSContext) {
|
|
1610
|
-
return DSContext;
|
|
1611
|
-
}
|
|
1612
|
-
return DSContext = createContext2({
|
|
1613
|
-
getState: () => null,
|
|
1614
|
-
componentState: null,
|
|
1615
|
-
componentActions: null
|
|
1616
|
-
});
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
// src/components/DataSource/publicHooks/useDataSourceActions.ts
|
|
1620
|
-
function useDataSourceActions() {
|
|
1621
|
-
const DataSourceContext = getDataSourceContext();
|
|
1622
|
-
const contextValue = useContext2(DataSourceContext);
|
|
1623
|
-
return contextValue.componentActions;
|
|
1624
|
-
}
|
|
1654
|
+
import { useCallback as useCallback5, useEffect as useEffect10, useState as useState5 } from "react";
|
|
1625
1655
|
|
|
1626
1656
|
// src/components/hooks/useComponentState.tsx
|
|
1627
1657
|
import {
|
|
1628
1658
|
createElement as createElement2,
|
|
1629
1659
|
memo,
|
|
1630
|
-
useContext as
|
|
1660
|
+
useContext as useContext2
|
|
1631
1661
|
} from "react";
|
|
1632
1662
|
import {
|
|
1633
1663
|
useReducer,
|
|
1634
|
-
createContext as
|
|
1664
|
+
createContext as createContext2,
|
|
1635
1665
|
useMemo as useMemo3,
|
|
1636
1666
|
useEffect as useEffect4,
|
|
1637
1667
|
useState as useState2,
|
|
@@ -1711,9 +1741,9 @@ function getComponentStateContext() {
|
|
|
1711
1741
|
if (ComponentContext) {
|
|
1712
1742
|
return ComponentContext;
|
|
1713
1743
|
}
|
|
1714
|
-
return ComponentContext =
|
|
1744
|
+
return ComponentContext = createContext2(null);
|
|
1715
1745
|
}
|
|
1716
|
-
function
|
|
1746
|
+
function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides, interceptedActions) {
|
|
1717
1747
|
const state = getState();
|
|
1718
1748
|
return Object.keys(state).reduce((actions, stateKey) => {
|
|
1719
1749
|
const key = stateKey;
|
|
@@ -1725,6 +1755,9 @@ function getReducerActions(dispatch, getState, getProps, propsToForward, allowed
|
|
|
1725
1755
|
return;
|
|
1726
1756
|
}
|
|
1727
1757
|
notifyChange(props, stateKey, value);
|
|
1758
|
+
if (interceptedActions && typeof interceptedActions[key] === "function") {
|
|
1759
|
+
interceptedActions[key](value, { actions, state: state2 });
|
|
1760
|
+
}
|
|
1728
1761
|
const forwardFn = propsToForward[key];
|
|
1729
1762
|
if (typeof forwardFn === "function") {
|
|
1730
1763
|
value = forwardFn(value);
|
|
@@ -1837,7 +1870,7 @@ function getComponentStateRoot(config) {
|
|
|
1837
1870
|
const getComponentState = useLatest(state);
|
|
1838
1871
|
const { allowedControlledPropOverrides } = config;
|
|
1839
1872
|
const actions = useMemo3(() => {
|
|
1840
|
-
const generatedActions =
|
|
1873
|
+
const generatedActions = getReducerGeneratedActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides, config.interceptActions);
|
|
1841
1874
|
return generatedActions;
|
|
1842
1875
|
}, [
|
|
1843
1876
|
dispatch,
|
|
@@ -1867,7 +1900,7 @@ function getComponentStateRoot(config) {
|
|
|
1867
1900
|
if (oldValue === newValue) {
|
|
1868
1901
|
continue;
|
|
1869
1902
|
}
|
|
1870
|
-
if (isControlled(key, props)) {
|
|
1903
|
+
if (isControlled(key, props) || isControlled(key, prevProps)) {
|
|
1871
1904
|
if (propsToForward.hasOwnProperty(k)) {
|
|
1872
1905
|
let valueToSet = newValue;
|
|
1873
1906
|
const forwardFn = propsToForward[k];
|
|
@@ -1904,56 +1937,44 @@ function getComponentStateRoot(config) {
|
|
|
1904
1937
|
}
|
|
1905
1938
|
function useComponentState() {
|
|
1906
1939
|
const Context = getComponentStateContext();
|
|
1907
|
-
return
|
|
1908
|
-
}
|
|
1909
|
-
|
|
1910
|
-
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
1911
|
-
function useColumnAggregations() {
|
|
1912
|
-
const {
|
|
1913
|
-
componentState: { columnAggregations },
|
|
1914
|
-
getComponentState
|
|
1915
|
-
} = useComponentState();
|
|
1916
|
-
const dataSourceActions = useDataSourceActions();
|
|
1917
|
-
useEffect5(() => {
|
|
1918
|
-
function updateDataSourceAggregations() {
|
|
1919
|
-
const reducers = [];
|
|
1920
|
-
const componentState = getComponentState();
|
|
1921
|
-
columnAggregations.forEach((aggregator, key) => {
|
|
1922
|
-
var _a;
|
|
1923
|
-
const colField = (_a = componentState.computedColumns.get(key)) == null ? void 0 : _a.field;
|
|
1924
|
-
const newAggregator = __spreadValues({
|
|
1925
|
-
getter: (data) => colField ? data[colField] : data
|
|
1926
|
-
}, aggregator);
|
|
1927
|
-
reducers.push(newAggregator);
|
|
1928
|
-
});
|
|
1929
|
-
dataSourceActions.aggregationReducers = reducers;
|
|
1930
|
-
}
|
|
1931
|
-
updateDataSourceAggregations();
|
|
1932
|
-
return interceptMap(columnAggregations, {
|
|
1933
|
-
clear: updateDataSourceAggregations,
|
|
1934
|
-
delete: updateDataSourceAggregations,
|
|
1935
|
-
set: updateDataSourceAggregations
|
|
1936
|
-
});
|
|
1937
|
-
}, [columnAggregations]);
|
|
1940
|
+
return useContext2(Context);
|
|
1938
1941
|
}
|
|
1939
1942
|
|
|
1940
1943
|
// src/components/DataSource/publicHooks/useDataSource.ts
|
|
1941
1944
|
import {
|
|
1942
|
-
useContext as
|
|
1945
|
+
useContext as useContext3
|
|
1946
|
+
} from "react";
|
|
1947
|
+
|
|
1948
|
+
// src/components/DataSource/DataSourceContext.ts
|
|
1949
|
+
import {
|
|
1950
|
+
createContext as createContext3
|
|
1943
1951
|
} from "react";
|
|
1952
|
+
var DSContext;
|
|
1953
|
+
function getDataSourceContext() {
|
|
1954
|
+
if (DSContext) {
|
|
1955
|
+
return DSContext;
|
|
1956
|
+
}
|
|
1957
|
+
return DSContext = createContext3({
|
|
1958
|
+
getState: () => null,
|
|
1959
|
+
componentState: null,
|
|
1960
|
+
componentActions: null
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
// src/components/DataSource/publicHooks/useDataSource.ts
|
|
1944
1965
|
function useDataSource() {
|
|
1945
1966
|
const DataSourceContext = getDataSourceContext();
|
|
1946
|
-
const contextValue =
|
|
1967
|
+
const contextValue = useContext3(DataSourceContext);
|
|
1947
1968
|
return contextValue.componentState;
|
|
1948
1969
|
}
|
|
1949
1970
|
function useDataSourceContextValue() {
|
|
1950
1971
|
const DataSourceContext = getDataSourceContext();
|
|
1951
|
-
const contextValue =
|
|
1972
|
+
const contextValue = useContext3(DataSourceContext);
|
|
1952
1973
|
return contextValue;
|
|
1953
1974
|
}
|
|
1954
1975
|
|
|
1955
1976
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
1956
|
-
import { useEffect as
|
|
1977
|
+
import { useEffect as useEffect5 } from "react";
|
|
1957
1978
|
function useColumnGroups() {
|
|
1958
1979
|
const {
|
|
1959
1980
|
componentState: {
|
|
@@ -1963,7 +1984,7 @@ function useColumnGroups() {
|
|
|
1963
1984
|
componentActions,
|
|
1964
1985
|
getComponentState
|
|
1965
1986
|
} = useComponentState();
|
|
1966
|
-
|
|
1987
|
+
useEffect5(() => {
|
|
1967
1988
|
const recompute = () => {
|
|
1968
1989
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
1969
1990
|
};
|
|
@@ -1974,7 +1995,7 @@ function useColumnGroups() {
|
|
|
1974
1995
|
set: update
|
|
1975
1996
|
});
|
|
1976
1997
|
}, [computedColumnGroups]);
|
|
1977
|
-
|
|
1998
|
+
useEffect5(() => {
|
|
1978
1999
|
return interceptMap(collapsedColumnGroups, {
|
|
1979
2000
|
set: (key, visibleCol) => {
|
|
1980
2001
|
const colIds = key.slice(1);
|
|
@@ -2006,7 +2027,7 @@ function useColumnGroups() {
|
|
|
2006
2027
|
}
|
|
2007
2028
|
|
|
2008
2029
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
2009
|
-
import { useEffect as
|
|
2030
|
+
import { useEffect as useEffect9, useMemo as useMemo5 } from "react";
|
|
2010
2031
|
|
|
2011
2032
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2012
2033
|
import {
|
|
@@ -2019,27 +2040,14 @@ var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
|
2019
2040
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2020
2041
|
import {
|
|
2021
2042
|
createElement as createElement3,
|
|
2022
|
-
useEffect as
|
|
2043
|
+
useEffect as useEffect6
|
|
2023
2044
|
} from "react";
|
|
2024
2045
|
import { useState as useState3 } from "react";
|
|
2025
2046
|
|
|
2026
|
-
// src/components/InfiniteTable/
|
|
2027
|
-
var
|
|
2028
|
-
var
|
|
2029
|
-
var
|
|
2030
|
-
var display = { flex: "_16lm1iwj", block: "_16lm1iwk", inlineBlock: "_16lm1iwl" };
|
|
2031
|
-
var fill = { currentColor: "_16lm1iw5", accentColor: "_16lm1iw6" };
|
|
2032
|
-
var flex = { "1": "_16lm1iwc", none: "_16lm1iwd" };
|
|
2033
|
-
var flexFlow = { column: "_16lm1iwz", row: "_16lm1iw10" };
|
|
2034
|
-
var justifyContent = { center: "_16lm1iw13", start: "_16lm1iw14", end: "_16lm1iw15" };
|
|
2035
|
-
var left = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
2036
|
-
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
2037
|
-
var top = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
2038
|
-
var transform = { translateZero: "_16lm1iw9", rotate90: "_16lm1iwa" };
|
|
2039
|
-
var transformTranslateZero = "_16lm1iw8";
|
|
2040
|
-
var userSelect = { none: "_16lm1iwm" };
|
|
2041
|
-
var willChange = { transform: "_16lm1iw19" };
|
|
2042
|
-
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2047
|
+
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
2048
|
+
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2049
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwd _16lm1iwb";
|
|
2050
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwa", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
2043
2051
|
|
|
2044
2052
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2045
2053
|
function ExpanderIcon(props) {
|
|
@@ -2053,7 +2061,7 @@ function ExpanderIcon(props) {
|
|
|
2053
2061
|
setExpanded(!expanded);
|
|
2054
2062
|
}
|
|
2055
2063
|
};
|
|
2056
|
-
|
|
2064
|
+
useEffect6(() => {
|
|
2057
2065
|
if (isControlled("expanded", props)) {
|
|
2058
2066
|
setExpanded(props.expanded);
|
|
2059
2067
|
}
|
|
@@ -2066,18 +2074,37 @@ function ExpanderIcon(props) {
|
|
|
2066
2074
|
width: `${size}px`,
|
|
2067
2075
|
style: props.style,
|
|
2068
2076
|
onClick,
|
|
2069
|
-
className: join(props.className,
|
|
2077
|
+
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
2078
|
+
expanded
|
|
2079
|
+
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
2070
2080
|
}, /* @__PURE__ */ createElement3("path", {
|
|
2071
2081
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
2072
2082
|
}));
|
|
2073
2083
|
}
|
|
2074
2084
|
|
|
2075
2085
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
2076
|
-
var
|
|
2086
|
+
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2077
2087
|
var GroupRowExpanderCls = "_7pupv0b";
|
|
2078
|
-
var RowClsRecipe = (0,
|
|
2088
|
+
var RowClsRecipe = (0, import_createRuntimeFn2.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: [] });
|
|
2079
2089
|
var RowHoverCls = "_7pupv01";
|
|
2080
2090
|
|
|
2091
|
+
// src/components/InfiniteTable/utilities.css.ts
|
|
2092
|
+
var alignItems = { center: "_16lm1iw11", stretch: "_16lm1iw12" };
|
|
2093
|
+
var cssEllipsisClassName = "_16lm1iw1a _16lm1iw1b _16lm1iw16";
|
|
2094
|
+
var cursor = { pointer: "_16lm1iwb" };
|
|
2095
|
+
var display = { flex: "_16lm1iwj", block: "_16lm1iwk", inlineBlock: "_16lm1iwl" };
|
|
2096
|
+
var flex = { "1": "_16lm1iwc", none: "_16lm1iwd" };
|
|
2097
|
+
var flexFlow = { column: "_16lm1iwz", row: "_16lm1iw10" };
|
|
2098
|
+
var justifyContent = { center: "_16lm1iw13", start: "_16lm1iw14", end: "_16lm1iw15" };
|
|
2099
|
+
var left = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
2100
|
+
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
2101
|
+
var top = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
2102
|
+
var transform = { translateZero: "_16lm1iw9", rotate90: "_16lm1iwa" };
|
|
2103
|
+
var transformTranslateZero = "_16lm1iw8";
|
|
2104
|
+
var userSelect = { none: "_16lm1iwm" };
|
|
2105
|
+
var willChange = { transform: "_16lm1iw19" };
|
|
2106
|
+
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2107
|
+
|
|
2081
2108
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2082
2109
|
function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
|
|
2083
2110
|
if (!pivotColumns) {
|
|
@@ -2087,7 +2114,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2087
2114
|
pivotColumn,
|
|
2088
2115
|
pivotRowLabelsColumn,
|
|
2089
2116
|
pivotBy,
|
|
2090
|
-
|
|
2117
|
+
groupBy,
|
|
2091
2118
|
pivotTotalColumnPosition,
|
|
2092
2119
|
toggleGroupRow
|
|
2093
2120
|
} = params;
|
|
@@ -2104,7 +2131,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2104
2131
|
column = __spreadValues(__spreadValues({}, column), pivotColumn({
|
|
2105
2132
|
column,
|
|
2106
2133
|
pivotBy,
|
|
2107
|
-
|
|
2134
|
+
groupBy
|
|
2108
2135
|
}));
|
|
2109
2136
|
} else {
|
|
2110
2137
|
column = __spreadValues(__spreadValues({}, column), pivotColumn);
|
|
@@ -2116,7 +2143,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2116
2143
|
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
|
|
2117
2144
|
column,
|
|
2118
2145
|
pivotBy,
|
|
2119
|
-
|
|
2146
|
+
groupBy
|
|
2120
2147
|
}));
|
|
2121
2148
|
} else {
|
|
2122
2149
|
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
|
|
@@ -2125,11 +2152,11 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2125
2152
|
if (!column.render) {
|
|
2126
2153
|
column.render = (renderOptions) => {
|
|
2127
2154
|
var _a;
|
|
2128
|
-
let { value, rowInfo, column: column2,
|
|
2155
|
+
let { value, rowInfo, column: column2, groupBy: groupBy2 } = renderOptions;
|
|
2129
2156
|
if (column2.renderValue) {
|
|
2130
2157
|
value = column2.renderValue(renderOptions);
|
|
2131
2158
|
}
|
|
2132
|
-
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) <
|
|
2159
|
+
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < groupBy2.length;
|
|
2133
2160
|
return /* @__PURE__ */ createElement4("div", {
|
|
2134
2161
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
2135
2162
|
}, showExpanderIcon ? /* @__PURE__ */ createElement4(ExpanderIcon, {
|
|
@@ -2229,7 +2256,7 @@ function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2229
2256
|
function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
2230
2257
|
let generatedGroupColumn = {
|
|
2231
2258
|
header: `Group`,
|
|
2232
|
-
groupByField: options.
|
|
2259
|
+
groupByField: options.groupBy.map((g) => g.field),
|
|
2233
2260
|
sortable: false,
|
|
2234
2261
|
render: (renderOptions) => {
|
|
2235
2262
|
let { value, rowInfo, column } = renderOptions;
|
|
@@ -2270,62 +2297,231 @@ import {
|
|
|
2270
2297
|
createElement as createElement6
|
|
2271
2298
|
} from "react";
|
|
2272
2299
|
|
|
2273
|
-
// src/
|
|
2274
|
-
|
|
2300
|
+
// src/utils/multisort/sortTypes.ts
|
|
2301
|
+
var numberComparator = function(first, second) {
|
|
2302
|
+
return first - second;
|
|
2303
|
+
};
|
|
2304
|
+
var stringComparator = function(first, second) {
|
|
2305
|
+
first = `${first}`;
|
|
2306
|
+
second = `${second}`;
|
|
2307
|
+
return first.localeCompare(second);
|
|
2308
|
+
};
|
|
2309
|
+
var sortTypes = {
|
|
2310
|
+
number: numberComparator,
|
|
2311
|
+
string: stringComparator
|
|
2312
|
+
};
|
|
2313
|
+
var sortTypes_default = sortTypes;
|
|
2275
2314
|
|
|
2276
|
-
// src/
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2315
|
+
// src/utils/multisort/index.ts
|
|
2316
|
+
var multisort = (sortInfo, array, get) => {
|
|
2317
|
+
array.sort(getMultisortFunction(sortInfo, get));
|
|
2318
|
+
return array;
|
|
2319
|
+
};
|
|
2320
|
+
multisort.knownTypes = sortTypes_default;
|
|
2321
|
+
var getSingleSortFunction = (info) => {
|
|
2322
|
+
if (!info) {
|
|
2323
|
+
return;
|
|
2283
2324
|
}
|
|
2284
|
-
|
|
2285
|
-
|
|
2325
|
+
const field = info.field;
|
|
2326
|
+
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
2327
|
+
if (!dir) {
|
|
2328
|
+
return;
|
|
2329
|
+
}
|
|
2330
|
+
let fn = info.fn;
|
|
2331
|
+
if (!fn && info.type) {
|
|
2332
|
+
fn = multisort.knownTypes[info.type];
|
|
2333
|
+
if (!fn) {
|
|
2334
|
+
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
if (!fn) {
|
|
2338
|
+
fn = sortTypes_default.string;
|
|
2339
|
+
}
|
|
2340
|
+
return (first, second) => {
|
|
2341
|
+
const a = field ? first[field] : first;
|
|
2342
|
+
const b = field ? second[field] : second;
|
|
2343
|
+
return dir * fn(a, b);
|
|
2286
2344
|
};
|
|
2287
|
-
}
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2345
|
+
};
|
|
2346
|
+
var getSortFunctions = (sortInfo) => {
|
|
2347
|
+
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
2348
|
+
};
|
|
2349
|
+
var getMultisortFunction = (sortInfo, get) => {
|
|
2350
|
+
const fns = getSortFunctions(sortInfo);
|
|
2351
|
+
return (first, second) => {
|
|
2352
|
+
if (get) {
|
|
2353
|
+
first = get(first);
|
|
2354
|
+
second = get(second);
|
|
2294
2355
|
}
|
|
2295
|
-
|
|
2296
|
-
|
|
2356
|
+
let result = 0;
|
|
2357
|
+
let i = 0;
|
|
2358
|
+
let fn;
|
|
2359
|
+
const len = fns.length;
|
|
2360
|
+
for (; i < len; i++) {
|
|
2361
|
+
fn = fns[i];
|
|
2362
|
+
if (!fn) {
|
|
2363
|
+
continue;
|
|
2364
|
+
}
|
|
2365
|
+
result = fn(first, second);
|
|
2366
|
+
if (result !== 0) {
|
|
2367
|
+
return result;
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
return result;
|
|
2371
|
+
};
|
|
2372
|
+
};
|
|
2373
|
+
|
|
2374
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2375
|
+
import { useEffect as useEffect8, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState4 } from "react";
|
|
2376
|
+
|
|
2377
|
+
// src/components/hooks/useEffectWithChanges.ts
|
|
2378
|
+
import { useEffect as useEffect7, useRef as useRef5 } from "react";
|
|
2379
|
+
function useEffectWithChanges(fn, deps) {
|
|
2380
|
+
const prevRef = useRef5({});
|
|
2381
|
+
const oldValuesRef = useRef5({});
|
|
2382
|
+
const oldValues = oldValuesRef.current;
|
|
2383
|
+
const changesRef = useRef5({});
|
|
2384
|
+
const changes = changesRef.current;
|
|
2385
|
+
const useEffectDeps = [];
|
|
2386
|
+
for (let k in deps) {
|
|
2387
|
+
if (deps.hasOwnProperty(k)) {
|
|
2388
|
+
if (deps[k] !== prevRef.current[k]) {
|
|
2389
|
+
changes[k] = deps[k];
|
|
2390
|
+
oldValues[k] = prevRef.current[k];
|
|
2391
|
+
}
|
|
2392
|
+
useEffectDeps.push(deps[k]);
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
prevRef.current = deps;
|
|
2396
|
+
useEffect7(() => {
|
|
2397
|
+
const changes2 = changesRef.current;
|
|
2398
|
+
const result = fn(changes2, oldValues);
|
|
2399
|
+
changesRef.current = {};
|
|
2400
|
+
oldValuesRef.current = {};
|
|
2401
|
+
return result;
|
|
2402
|
+
}, useEffectDeps);
|
|
2297
2403
|
}
|
|
2298
2404
|
|
|
2299
2405
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2300
|
-
function
|
|
2301
|
-
|
|
2406
|
+
function buildDataSourceDataParams(componentState) {
|
|
2407
|
+
var _a, _b;
|
|
2408
|
+
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
2409
|
+
const dataSourceParams = {
|
|
2410
|
+
originalDataArray: componentState.originalDataArray,
|
|
2411
|
+
sortInfo,
|
|
2412
|
+
groupBy: componentState.groupBy,
|
|
2413
|
+
pivotBy: componentState.pivotBy
|
|
2414
|
+
};
|
|
2415
|
+
if (componentState.livePagination !== void 0) {
|
|
2416
|
+
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
2417
|
+
}
|
|
2418
|
+
return dataSourceParams;
|
|
2419
|
+
}
|
|
2420
|
+
function notifyDataParamsChanged(componentState, actions) {
|
|
2421
|
+
var _a;
|
|
2422
|
+
if (typeof componentState.data === "function") {
|
|
2423
|
+
loadData(componentState.data, componentState, actions);
|
|
2424
|
+
}
|
|
2425
|
+
const dataParams = buildDataSourceDataParams(componentState);
|
|
2426
|
+
(_a = componentState.onDataParamsChange) == null ? void 0 : _a.call(componentState, dataParams);
|
|
2427
|
+
}
|
|
2428
|
+
function loadData(data, componentState, actions) {
|
|
2429
|
+
const dataParams = buildDataSourceDataParams(componentState);
|
|
2430
|
+
if (typeof data === "function") {
|
|
2431
|
+
data = data(dataParams);
|
|
2432
|
+
}
|
|
2433
|
+
const dataIsPromise = typeof data === "object" && typeof data.then === "function";
|
|
2434
|
+
if (dataIsPromise) {
|
|
2435
|
+
actions.loading = true;
|
|
2436
|
+
}
|
|
2437
|
+
Promise.resolve(data).then((dataParam) => {
|
|
2438
|
+
let dataArray = [];
|
|
2439
|
+
if (Array.isArray(dataParam.data)) {
|
|
2440
|
+
const remoteData = dataParam;
|
|
2441
|
+
dataArray = remoteData.data;
|
|
2442
|
+
if (remoteData.livePaginationCursor !== void 0) {
|
|
2443
|
+
actions.livePaginationCursor = remoteData.livePaginationCursor;
|
|
2444
|
+
}
|
|
2445
|
+
} else {
|
|
2446
|
+
dataArray = dataParam;
|
|
2447
|
+
}
|
|
2448
|
+
actions.originalDataArray = dataArray;
|
|
2449
|
+
if (dataIsPromise) {
|
|
2450
|
+
actions.loading = false;
|
|
2451
|
+
}
|
|
2452
|
+
});
|
|
2302
2453
|
}
|
|
2303
2454
|
function useLoadData() {
|
|
2304
2455
|
const {
|
|
2456
|
+
getComponentState,
|
|
2305
2457
|
componentActions: actions,
|
|
2306
2458
|
componentState: { data }
|
|
2307
2459
|
} = useComponentState();
|
|
2308
|
-
const loadData = (data2) => {
|
|
2309
|
-
let dataSourceInfo = {
|
|
2310
|
-
originalDataArray: []
|
|
2311
|
-
};
|
|
2312
|
-
if (typeof data2 === "function") {
|
|
2313
|
-
data2 = data2();
|
|
2314
|
-
}
|
|
2315
|
-
if (Array.isArray(data2)) {
|
|
2316
|
-
dataSourceInfo = buildDataSourceInfo(data2);
|
|
2317
|
-
actions.originalDataArray = dataSourceInfo.originalDataArray;
|
|
2318
|
-
} else {
|
|
2319
|
-
actions.loading = true;
|
|
2320
|
-
loadDataAsync(data2).then((dataSourceInfo2) => {
|
|
2321
|
-
actions.originalDataArray = dataSourceInfo2.originalDataArray;
|
|
2322
|
-
actions.loading = false;
|
|
2323
|
-
});
|
|
2324
|
-
}
|
|
2325
|
-
};
|
|
2326
2460
|
useLayoutEffect3(() => {
|
|
2327
|
-
loadData(data);
|
|
2461
|
+
loadData(data, getComponentState(), actions);
|
|
2328
2462
|
}, [data]);
|
|
2463
|
+
useLivePagination();
|
|
2464
|
+
}
|
|
2465
|
+
function useLivePagination() {
|
|
2466
|
+
const {
|
|
2467
|
+
getComponentState,
|
|
2468
|
+
componentActions: actions,
|
|
2469
|
+
componentState
|
|
2470
|
+
} = useComponentState();
|
|
2471
|
+
const {
|
|
2472
|
+
notifyScrollbarsChange,
|
|
2473
|
+
sortInfo,
|
|
2474
|
+
groupBy,
|
|
2475
|
+
pivotBy,
|
|
2476
|
+
livePaginationCursor,
|
|
2477
|
+
scrollBottomId
|
|
2478
|
+
} = componentState;
|
|
2479
|
+
const [scrollbars, setScrollbars] = useState4({
|
|
2480
|
+
vertical: false,
|
|
2481
|
+
horizontal: false
|
|
2482
|
+
});
|
|
2483
|
+
const scrollbarsRef = useRef6(scrollbars);
|
|
2484
|
+
useEffect8(() => {
|
|
2485
|
+
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
2486
|
+
if (!scrollbars2) {
|
|
2487
|
+
return;
|
|
2488
|
+
}
|
|
2489
|
+
scrollbarsRef.current = scrollbars2;
|
|
2490
|
+
setScrollbars(scrollbars2);
|
|
2491
|
+
});
|
|
2492
|
+
return () => notifyScrollbarsChange.destroy();
|
|
2493
|
+
}, [notifyScrollbarsChange]);
|
|
2494
|
+
const [cursorId, updateCursorId] = useState4(void 0);
|
|
2495
|
+
useEffect8(() => {
|
|
2496
|
+
const frameId = requestAnimationFrame(() => {
|
|
2497
|
+
var _a;
|
|
2498
|
+
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical)) {
|
|
2499
|
+
updateCursorId(livePaginationCursor);
|
|
2500
|
+
}
|
|
2501
|
+
});
|
|
2502
|
+
return () => cancelAnimationFrame(frameId);
|
|
2503
|
+
}, [livePaginationCursor]);
|
|
2504
|
+
useEffect8(() => {
|
|
2505
|
+
const { livePaginationCursor: livePaginationCursor2, livePagination } = getComponentState();
|
|
2506
|
+
if (!scrollbars.vertical && livePagination) {
|
|
2507
|
+
updateCursorId(livePaginationCursor2);
|
|
2508
|
+
}
|
|
2509
|
+
}, [scrollbars.vertical]);
|
|
2510
|
+
useEffect8(() => {
|
|
2511
|
+
updateCursorId(scrollBottomId);
|
|
2512
|
+
}, [scrollBottomId]);
|
|
2513
|
+
const depsObject = {
|
|
2514
|
+
sortInfo,
|
|
2515
|
+
groupBy,
|
|
2516
|
+
pivotBy,
|
|
2517
|
+
cursorId
|
|
2518
|
+
};
|
|
2519
|
+
useEffectWithChanges(() => {
|
|
2520
|
+
if (cursorId === void 0) {
|
|
2521
|
+
return;
|
|
2522
|
+
}
|
|
2523
|
+
notifyDataParamsChanged(getComponentState(), actions);
|
|
2524
|
+
}, depsObject);
|
|
2329
2525
|
}
|
|
2330
2526
|
|
|
2331
2527
|
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
@@ -2379,9 +2575,9 @@ var DeepMap = class {
|
|
|
2379
2575
|
if (!pair) {
|
|
2380
2576
|
return;
|
|
2381
2577
|
}
|
|
2382
|
-
const { map } = pair;
|
|
2578
|
+
const { map: map2 } = pair;
|
|
2383
2579
|
const keys = [...parentKeys, key];
|
|
2384
|
-
const next =
|
|
2580
|
+
const next = map2 ? () => this.visitWithNext(keys, fn, map2) : void 0;
|
|
2385
2581
|
if (pair.hasOwnProperty("value")) {
|
|
2386
2582
|
fn(pair.value, keys, i, next);
|
|
2387
2583
|
i++;
|
|
@@ -2397,6 +2593,13 @@ var DeepMap = class {
|
|
|
2397
2593
|
});
|
|
2398
2594
|
}
|
|
2399
2595
|
}
|
|
2596
|
+
static clone(map2) {
|
|
2597
|
+
const clone = new DeepMap();
|
|
2598
|
+
map2.visit((pair, keys) => {
|
|
2599
|
+
clone.set(keys, pair.value);
|
|
2600
|
+
});
|
|
2601
|
+
return clone;
|
|
2602
|
+
}
|
|
2400
2603
|
set(keys, value) {
|
|
2401
2604
|
let currentMap = this.map;
|
|
2402
2605
|
if (!keys.length) {
|
|
@@ -2447,14 +2650,14 @@ var DeepMap = class {
|
|
|
2447
2650
|
return this.length;
|
|
2448
2651
|
}
|
|
2449
2652
|
clear() {
|
|
2450
|
-
const clearMap = (
|
|
2451
|
-
|
|
2452
|
-
const { map:
|
|
2453
|
-
if (
|
|
2454
|
-
clearMap(
|
|
2653
|
+
const clearMap = (map2) => {
|
|
2654
|
+
map2.forEach((value, _key) => {
|
|
2655
|
+
const { map: map3 } = value;
|
|
2656
|
+
if (map3) {
|
|
2657
|
+
clearMap(map3);
|
|
2455
2658
|
}
|
|
2456
2659
|
});
|
|
2457
|
-
|
|
2660
|
+
map2.clear();
|
|
2458
2661
|
};
|
|
2459
2662
|
clearMap(this.map);
|
|
2460
2663
|
this.length = 0;
|
|
@@ -2499,9 +2702,9 @@ var DeepMap = class {
|
|
|
2499
2702
|
}
|
|
2500
2703
|
}
|
|
2501
2704
|
while (maps.length) {
|
|
2502
|
-
let
|
|
2705
|
+
let map2 = maps.pop();
|
|
2503
2706
|
let key = keys.pop();
|
|
2504
|
-
if (key && (
|
|
2707
|
+
if (key && (map2 == null ? void 0 : map2.size) === 0) {
|
|
2505
2708
|
let parentMap = maps[maps.length - 1];
|
|
2506
2709
|
let pair = parentMap == null ? void 0 : parentMap.get(key);
|
|
2507
2710
|
if (pair) {
|
|
@@ -2540,12 +2743,12 @@ var DeepMap = class {
|
|
|
2540
2743
|
if (!pair) {
|
|
2541
2744
|
return;
|
|
2542
2745
|
}
|
|
2543
|
-
const { map } = pair;
|
|
2746
|
+
const { map: map2 } = pair;
|
|
2544
2747
|
const keys = [...parentKeys, key];
|
|
2545
2748
|
const next = once(() => {
|
|
2546
|
-
if (
|
|
2547
|
-
|
|
2548
|
-
this.visitKey(k,
|
|
2749
|
+
if (map2) {
|
|
2750
|
+
map2.forEach((_, k) => {
|
|
2751
|
+
this.visitKey(k, map2, keys, fn);
|
|
2549
2752
|
});
|
|
2550
2753
|
}
|
|
2551
2754
|
});
|
|
@@ -2711,14 +2914,69 @@ var GroupRowsState = class {
|
|
|
2711
2914
|
}
|
|
2712
2915
|
};
|
|
2713
2916
|
|
|
2917
|
+
// src/utils/shallowEqualObjects.ts
|
|
2918
|
+
function shallowEqualObjects(objA, objB) {
|
|
2919
|
+
if (objA === objB) {
|
|
2920
|
+
return true;
|
|
2921
|
+
}
|
|
2922
|
+
if (!objA || !objB) {
|
|
2923
|
+
return false;
|
|
2924
|
+
}
|
|
2925
|
+
var aKeys = Object.keys(objA);
|
|
2926
|
+
var bKeys = Object.keys(objB);
|
|
2927
|
+
var len = aKeys.length;
|
|
2928
|
+
if (bKeys.length !== len) {
|
|
2929
|
+
return false;
|
|
2930
|
+
}
|
|
2931
|
+
for (var i = 0; i < len; i++) {
|
|
2932
|
+
var key = aKeys[i];
|
|
2933
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
2934
|
+
return false;
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
return true;
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
// src/components/utils/discardCallsWithEqualArg.ts
|
|
2941
|
+
var map = new WeakMap();
|
|
2942
|
+
var getCompareDefault = (a) => a;
|
|
2943
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject2) {
|
|
2944
|
+
map.set(fn, {
|
|
2945
|
+
lastCallTime: 0,
|
|
2946
|
+
lastCallArg: null
|
|
2947
|
+
});
|
|
2948
|
+
const getCompare = getCompareObject2 != null ? getCompareObject2 : getCompareDefault;
|
|
2949
|
+
return (arg) => {
|
|
2950
|
+
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
2951
|
+
lastCallTime: 0,
|
|
2952
|
+
lastCallArg: null
|
|
2953
|
+
};
|
|
2954
|
+
const now = Date.now();
|
|
2955
|
+
const diff = now - lastCallTime;
|
|
2956
|
+
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
2957
|
+
if (diff < timeframe && objectsEqual) {
|
|
2958
|
+
return;
|
|
2959
|
+
}
|
|
2960
|
+
map.set(fn, {
|
|
2961
|
+
lastCallTime: now,
|
|
2962
|
+
lastCallArg: arg
|
|
2963
|
+
});
|
|
2964
|
+
fn(arg);
|
|
2965
|
+
};
|
|
2966
|
+
}
|
|
2967
|
+
|
|
2714
2968
|
// src/components/DataSource/state/getInitialState.ts
|
|
2715
2969
|
function initSetupState2() {
|
|
2716
2970
|
const now = Date.now();
|
|
2717
2971
|
const originalDataArray = [];
|
|
2718
2972
|
const dataArray = [];
|
|
2719
2973
|
return {
|
|
2974
|
+
dataParams: void 0,
|
|
2975
|
+
notifyScrollbarsChange: buildSubscriptionCallback(),
|
|
2720
2976
|
pivotTotalColumnPosition: "end",
|
|
2721
2977
|
originalDataArray,
|
|
2978
|
+
scrollBottomId: Symbol("scrollBottomId"),
|
|
2979
|
+
showSeparatePivotColumnForSingleAggregation: false,
|
|
2722
2980
|
pivotColumns: void 0,
|
|
2723
2981
|
pivotColumnGroups: void 0,
|
|
2724
2982
|
dataArray,
|
|
@@ -2727,7 +2985,6 @@ function initSetupState2() {
|
|
|
2727
2985
|
sortedAt: 0,
|
|
2728
2986
|
reducedAt: now,
|
|
2729
2987
|
generateGroupRows: true,
|
|
2730
|
-
aggregationReducers: void 0,
|
|
2731
2988
|
groupDeepMap: void 0,
|
|
2732
2989
|
postSortDataArray: void 0,
|
|
2733
2990
|
postGroupDataArray: void 0,
|
|
@@ -2735,15 +2992,23 @@ function initSetupState2() {
|
|
|
2735
2992
|
lastGroupDataArray: void 0
|
|
2736
2993
|
};
|
|
2737
2994
|
}
|
|
2995
|
+
function getCompareObject(dataParams) {
|
|
2996
|
+
const obj = __spreadValues({}, dataParams);
|
|
2997
|
+
delete obj.originalDataArray;
|
|
2998
|
+
return obj;
|
|
2999
|
+
}
|
|
2738
3000
|
var forwardProps3 = () => {
|
|
2739
3001
|
return {
|
|
2740
|
-
|
|
3002
|
+
onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObject) : void 0,
|
|
2741
3003
|
data: 1,
|
|
2742
3004
|
pivotBy: 1,
|
|
2743
3005
|
primaryKey: 1,
|
|
3006
|
+
livePagination: 1,
|
|
3007
|
+
livePaginationCursor: 1,
|
|
3008
|
+
aggregationReducers: 1,
|
|
2744
3009
|
loading: (loading) => loading != null ? loading : false,
|
|
2745
3010
|
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
|
|
2746
|
-
|
|
3011
|
+
groupBy: (groupBy) => groupBy != null ? groupBy : [],
|
|
2747
3012
|
groupRowsState: (groupRowsState) => {
|
|
2748
3013
|
return groupRowsState || new GroupRowsState({
|
|
2749
3014
|
expandedRows: true,
|
|
@@ -2753,10 +3018,20 @@ var forwardProps3 = () => {
|
|
|
2753
3018
|
};
|
|
2754
3019
|
};
|
|
2755
3020
|
function mapPropsToState2(params) {
|
|
2756
|
-
var _a;
|
|
2757
3021
|
const { props } = params;
|
|
3022
|
+
const controlledSort = isControlledValue(props.sortInfo);
|
|
2758
3023
|
return {
|
|
2759
|
-
|
|
3024
|
+
controlledSort,
|
|
3025
|
+
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
|
|
3026
|
+
};
|
|
3027
|
+
}
|
|
3028
|
+
function getInterceptActions() {
|
|
3029
|
+
return {
|
|
3030
|
+
sortInfo: (sortInfo, { actions, state }) => {
|
|
3031
|
+
const dataParams = buildDataSourceDataParams(state);
|
|
3032
|
+
dataParams.sortInfo = sortInfo;
|
|
3033
|
+
actions.dataParams = dataParams;
|
|
3034
|
+
}
|
|
2760
3035
|
};
|
|
2761
3036
|
}
|
|
2762
3037
|
|
|
@@ -2765,19 +3040,28 @@ function DEFAULT_TO_KEY(value) {
|
|
|
2765
3040
|
return value;
|
|
2766
3041
|
}
|
|
2767
3042
|
function initReducers(reducers) {
|
|
2768
|
-
if (!reducers || !reducers.length) {
|
|
2769
|
-
return
|
|
3043
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
3044
|
+
return {};
|
|
2770
3045
|
}
|
|
2771
|
-
|
|
3046
|
+
const result = {};
|
|
3047
|
+
for (let key in reducers)
|
|
3048
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3049
|
+
result[key] = reducers[key].initialValue;
|
|
3050
|
+
}
|
|
3051
|
+
return result;
|
|
2772
3052
|
}
|
|
2773
3053
|
function computeReducersFor(data, reducers, reducerResults) {
|
|
2774
|
-
|
|
3054
|
+
var _a, _b;
|
|
3055
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
2775
3056
|
return;
|
|
2776
3057
|
}
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
3058
|
+
for (let key in reducers)
|
|
3059
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3060
|
+
const reducer = reducers[key];
|
|
3061
|
+
const currentValue = reducerResults[key];
|
|
3062
|
+
const value = reducer.field ? data[reducer.field] : (_b = (_a = reducer.getter) == null ? void 0 : _a.call(reducer, data)) != null ? _b : null;
|
|
3063
|
+
reducerResults[key] = reducer.reducer(currentValue, value, data);
|
|
3064
|
+
}
|
|
2781
3065
|
}
|
|
2782
3066
|
function group(groupParams, data) {
|
|
2783
3067
|
const {
|
|
@@ -2792,7 +3076,7 @@ function group(groupParams, data) {
|
|
|
2792
3076
|
let currentGroupKeys = [];
|
|
2793
3077
|
let currentPivotKeys = [];
|
|
2794
3078
|
const initialReducerValue = initReducers(reducers);
|
|
2795
|
-
const globalReducerResults =
|
|
3079
|
+
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
2796
3080
|
for (let i = 0, len = data.length; i < len; i++) {
|
|
2797
3081
|
let item = data[i];
|
|
2798
3082
|
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
@@ -2802,7 +3086,7 @@ function group(groupParams, data) {
|
|
|
2802
3086
|
if (!deepMap.has(currentGroupKeys)) {
|
|
2803
3087
|
const deepMapGroupValue = {
|
|
2804
3088
|
items: [],
|
|
2805
|
-
reducerResults:
|
|
3089
|
+
reducerResults: __spreadValues({}, initialReducerValue)
|
|
2806
3090
|
};
|
|
2807
3091
|
if (pivot) {
|
|
2808
3092
|
deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
@@ -2826,7 +3110,7 @@ function group(groupParams, data) {
|
|
|
2826
3110
|
if (!pivotDeepMap.has(currentPivotKeys)) {
|
|
2827
3111
|
topLevelPivotColumns.set(currentPivotKeys, true);
|
|
2828
3112
|
pivotDeepMap == null ? void 0 : pivotDeepMap.set(currentPivotKeys, {
|
|
2829
|
-
reducerResults:
|
|
3113
|
+
reducerResults: __spreadValues({}, initialReducerValue),
|
|
2830
3114
|
items: []
|
|
2831
3115
|
});
|
|
2832
3116
|
}
|
|
@@ -2888,11 +3172,23 @@ function flatten(groupResult) {
|
|
|
2888
3172
|
return result;
|
|
2889
3173
|
}
|
|
2890
3174
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
2891
|
-
const { groupBy, groupKeys, collapsed, parents } = options;
|
|
3175
|
+
const { groupBy, groupKeys, collapsed, parents, reducers } = options;
|
|
2892
3176
|
const groupNesting = groupKeys.length;
|
|
2893
3177
|
const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
|
|
3178
|
+
let data = null;
|
|
3179
|
+
if (Object.keys(reducerResults).length > 0) {
|
|
3180
|
+
data = {};
|
|
3181
|
+
for (let key in reducers)
|
|
3182
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3183
|
+
const reducer = reducers[key];
|
|
3184
|
+
const field = reducer.field;
|
|
3185
|
+
if (field) {
|
|
3186
|
+
data[field] = reducerResults[key];
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
2894
3190
|
const enhancedGroupData = {
|
|
2895
|
-
data
|
|
3191
|
+
data,
|
|
2896
3192
|
groupCount: groupItems.length,
|
|
2897
3193
|
groupData: groupItems,
|
|
2898
3194
|
groupKeys,
|
|
@@ -2914,17 +3210,25 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
2914
3210
|
return enhancedGroupData;
|
|
2915
3211
|
}
|
|
2916
3212
|
function completeReducers(reducers, reducerResults, items) {
|
|
2917
|
-
if (reducers
|
|
2918
|
-
|
|
2919
|
-
if (
|
|
2920
|
-
|
|
3213
|
+
if (reducers) {
|
|
3214
|
+
for (let key in reducers)
|
|
3215
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3216
|
+
const reducer = reducers[key];
|
|
3217
|
+
if (reducer.done) {
|
|
3218
|
+
reducerResults[key] = reducer.done(reducerResults[key], items);
|
|
3219
|
+
}
|
|
2921
3220
|
}
|
|
2922
|
-
});
|
|
2923
3221
|
}
|
|
2924
3222
|
return reducerResults;
|
|
2925
3223
|
}
|
|
2926
3224
|
function enhancedFlatten(param) {
|
|
2927
|
-
const {
|
|
3225
|
+
const {
|
|
3226
|
+
groupResult,
|
|
3227
|
+
toPrimaryKey,
|
|
3228
|
+
groupRowsState,
|
|
3229
|
+
generateGroupRows,
|
|
3230
|
+
reducers = {}
|
|
3231
|
+
} = param;
|
|
2928
3232
|
const { groupParams, deepMap, pivot } = groupResult;
|
|
2929
3233
|
const { groupBy } = groupParams;
|
|
2930
3234
|
const groupByStrings = groupBy.map((g) => g.field);
|
|
@@ -2939,6 +3243,7 @@ function enhancedFlatten(param) {
|
|
|
2939
3243
|
const enhancedGroupData = getEnhancedGroupData({
|
|
2940
3244
|
groupBy: groupByStrings,
|
|
2941
3245
|
parents: Array.from(parents),
|
|
3246
|
+
reducers,
|
|
2942
3247
|
indexInGroup,
|
|
2943
3248
|
indexInParentGroups: Array.from(indexInParentGroups),
|
|
2944
3249
|
indexInAll: result.length,
|
|
@@ -2949,127 +3254,87 @@ function enhancedFlatten(param) {
|
|
|
2949
3254
|
if (include) {
|
|
2950
3255
|
result.push(enhancedGroupData);
|
|
2951
3256
|
}
|
|
2952
|
-
if (collapsed) {
|
|
2953
|
-
parents.forEach((parent) => {
|
|
2954
|
-
parent.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
2955
|
-
parent.collapsedGroupsCount += 1;
|
|
2956
|
-
});
|
|
2957
|
-
}
|
|
2958
|
-
indexInParentGroups.push(indexInGroup);
|
|
2959
|
-
parents.push(enhancedGroupData);
|
|
2960
|
-
if (!collapsed) {
|
|
2961
|
-
if (!next) {
|
|
2962
|
-
if (!pivot) {
|
|
2963
|
-
const startIndex = result.length;
|
|
2964
|
-
result.push(...items.map((item, index) => {
|
|
2965
|
-
return {
|
|
2966
|
-
id: toPrimaryKey(item),
|
|
2967
|
-
data: item,
|
|
2968
|
-
isGroupRow: false,
|
|
2969
|
-
collapsed: false,
|
|
2970
|
-
groupKeys,
|
|
2971
|
-
parents: Array.from(parents),
|
|
2972
|
-
indexInParentGroups: [...indexInParentGroups, index],
|
|
2973
|
-
indexInGroup: index,
|
|
2974
|
-
indexInAll: startIndex + index,
|
|
2975
|
-
groupBy: groupByStrings,
|
|
2976
|
-
groupNesting,
|
|
2977
|
-
groupCount: enhancedGroupData.groupCount
|
|
2978
|
-
};
|
|
2979
|
-
}));
|
|
2980
|
-
}
|
|
2981
|
-
} else {
|
|
2982
|
-
next();
|
|
2983
|
-
}
|
|
2984
|
-
}
|
|
2985
|
-
parents.pop();
|
|
2986
|
-
indexInParentGroups.pop();
|
|
2987
|
-
});
|
|
2988
|
-
return {
|
|
2989
|
-
data: result
|
|
2990
|
-
};
|
|
2991
|
-
}
|
|
2992
|
-
|
|
2993
|
-
// src/utils/multisort/sortTypes.ts
|
|
2994
|
-
var sortTypes = {
|
|
2995
|
-
number: function(first, second) {
|
|
2996
|
-
return first - second;
|
|
2997
|
-
},
|
|
2998
|
-
string: function(first, second) {
|
|
2999
|
-
first = `${first}`;
|
|
3000
|
-
second = `${second}`;
|
|
3001
|
-
return first.localeCompare(second);
|
|
3002
|
-
}
|
|
3003
|
-
};
|
|
3004
|
-
var sortTypes_default = sortTypes;
|
|
3005
|
-
|
|
3006
|
-
// src/utils/multisort/index.ts
|
|
3007
|
-
var multisort = (sortInfo, array, get) => {
|
|
3008
|
-
array.sort(getMultisortFunction(sortInfo, get));
|
|
3009
|
-
return array;
|
|
3010
|
-
};
|
|
3011
|
-
multisort.knownTypes = sortTypes_default;
|
|
3012
|
-
var getSingleSortFunction = (info) => {
|
|
3013
|
-
if (!info) {
|
|
3014
|
-
return;
|
|
3015
|
-
}
|
|
3016
|
-
const field = info.field;
|
|
3017
|
-
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
3018
|
-
if (!dir) {
|
|
3019
|
-
return;
|
|
3020
|
-
}
|
|
3021
|
-
let fn = info.fn;
|
|
3022
|
-
if (!fn && info.type) {
|
|
3023
|
-
fn = multisort.knownTypes[info.type];
|
|
3024
|
-
if (!fn) {
|
|
3025
|
-
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
3026
|
-
}
|
|
3027
|
-
}
|
|
3028
|
-
if (!fn) {
|
|
3029
|
-
fn = sortTypes_default.string;
|
|
3030
|
-
}
|
|
3031
|
-
return (first, second) => {
|
|
3032
|
-
const a = field ? first[field] : first;
|
|
3033
|
-
const b = field ? second[field] : second;
|
|
3034
|
-
return dir * fn(a, b);
|
|
3035
|
-
};
|
|
3036
|
-
};
|
|
3037
|
-
var getSortFunctions = (sortInfo) => {
|
|
3038
|
-
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
3039
|
-
};
|
|
3040
|
-
var getMultisortFunction = (sortInfo, get) => {
|
|
3041
|
-
const fns = getSortFunctions(sortInfo);
|
|
3042
|
-
return (first, second) => {
|
|
3043
|
-
if (get) {
|
|
3044
|
-
first = get(first);
|
|
3045
|
-
second = get(second);
|
|
3257
|
+
if (collapsed) {
|
|
3258
|
+
parents.forEach((parent) => {
|
|
3259
|
+
parent.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
3260
|
+
parent.collapsedGroupsCount += 1;
|
|
3261
|
+
});
|
|
3046
3262
|
}
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3263
|
+
indexInParentGroups.push(indexInGroup);
|
|
3264
|
+
parents.push(enhancedGroupData);
|
|
3265
|
+
if (!collapsed) {
|
|
3266
|
+
if (!next) {
|
|
3267
|
+
if (!pivot) {
|
|
3268
|
+
const startIndex = result.length;
|
|
3269
|
+
result.push(...items.map((item, index) => {
|
|
3270
|
+
return {
|
|
3271
|
+
id: toPrimaryKey(item),
|
|
3272
|
+
data: item,
|
|
3273
|
+
isGroupRow: false,
|
|
3274
|
+
collapsed: false,
|
|
3275
|
+
groupKeys,
|
|
3276
|
+
parents: Array.from(parents),
|
|
3277
|
+
indexInParentGroups: [...indexInParentGroups, index],
|
|
3278
|
+
indexInGroup: index,
|
|
3279
|
+
indexInAll: startIndex + index,
|
|
3280
|
+
groupBy: groupByStrings,
|
|
3281
|
+
groupNesting,
|
|
3282
|
+
groupCount: enhancedGroupData.groupCount
|
|
3283
|
+
};
|
|
3284
|
+
}));
|
|
3285
|
+
}
|
|
3286
|
+
} else {
|
|
3287
|
+
next();
|
|
3059
3288
|
}
|
|
3060
3289
|
}
|
|
3061
|
-
|
|
3290
|
+
parents.pop();
|
|
3291
|
+
indexInParentGroups.pop();
|
|
3292
|
+
});
|
|
3293
|
+
return {
|
|
3294
|
+
data: result
|
|
3062
3295
|
};
|
|
3063
|
-
}
|
|
3296
|
+
}
|
|
3064
3297
|
|
|
3065
3298
|
// src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
|
|
3066
|
-
function
|
|
3299
|
+
function prepareColumn(column) {
|
|
3300
|
+
const { pivotByAtIndex: pivotByForColumn } = column;
|
|
3301
|
+
if (pivotByForColumn.column) {
|
|
3302
|
+
if (typeof pivotByForColumn.column === "function") {
|
|
3303
|
+
Object.assign(column, pivotByForColumn.column({ column }));
|
|
3304
|
+
} else {
|
|
3305
|
+
Object.assign(column, pivotByForColumn.column);
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
return column;
|
|
3309
|
+
}
|
|
3310
|
+
function prepareColumnGroup(columnGroup) {
|
|
3311
|
+
const { pivotByAtIndex: pivotByForColumnGroup } = columnGroup;
|
|
3312
|
+
if (pivotByForColumnGroup.columnGroup) {
|
|
3313
|
+
if (typeof pivotByForColumnGroup.columnGroup === "function") {
|
|
3314
|
+
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup({ columnGroup }));
|
|
3315
|
+
} else {
|
|
3316
|
+
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup);
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
return columnGroup;
|
|
3320
|
+
}
|
|
3321
|
+
function getPivotColumnsAndColumnGroups({
|
|
3322
|
+
deepMap,
|
|
3323
|
+
pivotBy,
|
|
3324
|
+
pivotTotalColumnPosition,
|
|
3325
|
+
reducers = {},
|
|
3326
|
+
showSeparatePivotColumnForSingleAggregation = false
|
|
3327
|
+
}) {
|
|
3067
3328
|
const pivotLength = pivotBy.length;
|
|
3329
|
+
const aggregationReducers = Object.keys(reducers).map((key) => {
|
|
3330
|
+
return __spreadProps(__spreadValues({}, reducers[key]), { id: key });
|
|
3331
|
+
});
|
|
3068
3332
|
const columns = new Map([
|
|
3069
3333
|
[
|
|
3070
3334
|
"labels",
|
|
3071
3335
|
{
|
|
3072
3336
|
header: "Row labels",
|
|
3337
|
+
pivotBy,
|
|
3073
3338
|
valueGetter: (params) => {
|
|
3074
3339
|
var _a;
|
|
3075
3340
|
const { rowInfo } = params;
|
|
@@ -3079,72 +3344,104 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
3079
3344
|
]
|
|
3080
3345
|
]);
|
|
3081
3346
|
const columnGroups = new Map();
|
|
3347
|
+
const isSingleAggregationColumn = !showSeparatePivotColumnForSingleAggregation && aggregationReducers.length === 1;
|
|
3082
3348
|
deepMap.visitDepthFirst((_value, keys, _indexInGroup, next) => {
|
|
3083
3349
|
keys = [...keys];
|
|
3084
3350
|
if (pivotTotalColumnPosition === "end") {
|
|
3085
3351
|
next == null ? void 0 : next();
|
|
3086
3352
|
}
|
|
3087
3353
|
if (keys.length === pivotLength) {
|
|
3088
|
-
const parentKeys = keys.slice(0, -1);
|
|
3089
|
-
let columnGroupId = parentKeys.join("/");
|
|
3090
3354
|
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
3091
|
-
let computedPivotColumn = __spreadValues({
|
|
3092
|
-
pivotBy,
|
|
3093
|
-
pivotColumn: true,
|
|
3094
|
-
pivotGroupKeys: keys,
|
|
3095
|
-
pivotGroupKeyForColumn: keys[keys.length - 1],
|
|
3096
|
-
pivotIndexForColumn: keys.length - 1,
|
|
3097
|
-
pivotByForColumn,
|
|
3098
|
-
sortable: false,
|
|
3099
|
-
columnGroup: parentKeys.length ? `${columnGroupId}` : void 0,
|
|
3100
|
-
header: keys[keys.length - 1],
|
|
3101
|
-
valueGetter: ({ rowInfo }) => {
|
|
3102
|
-
var _a, _b, _c;
|
|
3103
|
-
const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
|
|
3104
|
-
return value;
|
|
3105
|
-
}
|
|
3106
|
-
}, pivotByForColumn.column);
|
|
3107
|
-
if (pivotByForColumn.column) {
|
|
3108
|
-
if (typeof pivotByForColumn.column === "function") {
|
|
3109
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column({ column: computedPivotColumn }));
|
|
3110
|
-
} else {
|
|
3111
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column);
|
|
3112
|
-
}
|
|
3113
|
-
}
|
|
3114
|
-
columns.set(`${keys.join("/")}`, computedPivotColumn);
|
|
3115
|
-
} else {
|
|
3116
|
-
const colGroupId = keys.join("/");
|
|
3117
3355
|
const parentKeys = keys.slice(0, -1);
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
columnGroup:
|
|
3126
|
-
|
|
3127
|
-
pivotTotalColumn: true,
|
|
3356
|
+
let parentColumnGroupId = parentKeys.join("/");
|
|
3357
|
+
if (!isSingleAggregationColumn) {
|
|
3358
|
+
const columnGroupId = parentColumnGroupId;
|
|
3359
|
+
parentColumnGroupId = keys.join("/");
|
|
3360
|
+
const pivotGroupKey = keys[keys.length - 1];
|
|
3361
|
+
columnGroups.set(parentColumnGroupId, prepareColumnGroup({
|
|
3362
|
+
header: pivotGroupKey,
|
|
3363
|
+
columnGroup: columnGroupId,
|
|
3364
|
+
pivotBy,
|
|
3128
3365
|
pivotGroupKeys: keys,
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3366
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3367
|
+
pivotIndex: keys.length - 1,
|
|
3368
|
+
pivotGroupKey
|
|
3369
|
+
}));
|
|
3370
|
+
}
|
|
3371
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3372
|
+
const header = isSingleAggregationColumn ? keys[keys.length - 1] : reducer.id;
|
|
3373
|
+
const computedPivotColumn = prepareColumn({
|
|
3132
3374
|
pivotBy,
|
|
3375
|
+
pivotColumn: true,
|
|
3376
|
+
pivotTotalColumn: false,
|
|
3377
|
+
pivotAggregator: reducer,
|
|
3378
|
+
pivotAggregatorIndex: index,
|
|
3379
|
+
pivotGroupKeys: keys,
|
|
3380
|
+
pivotGroupKey: keys[keys.length - 1],
|
|
3381
|
+
pivotIndex: keys.length - 1,
|
|
3382
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3133
3383
|
sortable: false,
|
|
3384
|
+
columnGroup: parentColumnGroupId,
|
|
3385
|
+
header,
|
|
3134
3386
|
valueGetter: ({ rowInfo }) => {
|
|
3135
|
-
var _a, _b
|
|
3136
|
-
|
|
3137
|
-
return value;
|
|
3138
|
-
}
|
|
3139
|
-
}, pivotByForColumn.column);
|
|
3140
|
-
if (pivotByForColumn.column) {
|
|
3141
|
-
if (typeof pivotByForColumn.column === "function") {
|
|
3142
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column({ column: computedPivotColumn }));
|
|
3143
|
-
} else {
|
|
3144
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column);
|
|
3387
|
+
var _a, _b;
|
|
3388
|
+
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3145
3389
|
}
|
|
3390
|
+
});
|
|
3391
|
+
const columnId = `${keys.join("/")}-${reducer.id}`;
|
|
3392
|
+
columns.set(columnId, computedPivotColumn);
|
|
3393
|
+
});
|
|
3394
|
+
} else {
|
|
3395
|
+
const colGroupId = keys.join("/");
|
|
3396
|
+
const parentKeys = keys.slice(0, -1);
|
|
3397
|
+
columnGroups.set(colGroupId, prepareColumnGroup({
|
|
3398
|
+
columnGroup: parentKeys.length ? parentKeys.join("/") : void 0,
|
|
3399
|
+
header: keys[keys.length - 1],
|
|
3400
|
+
pivotBy,
|
|
3401
|
+
pivotGroupKeys: keys,
|
|
3402
|
+
pivotIndex: keys.length - 1,
|
|
3403
|
+
pivotByAtIndex: pivotBy[keys.length - 1],
|
|
3404
|
+
pivotGroupKey: keys[keys.length - 1]
|
|
3405
|
+
}));
|
|
3406
|
+
if (pivotTotalColumnPosition !== false) {
|
|
3407
|
+
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
3408
|
+
let columnGroupId = parentKeys.length ? parentKeys.join("/") : void 0;
|
|
3409
|
+
if (!isSingleAggregationColumn) {
|
|
3410
|
+
let parentGroupForTotalsGroup = columnGroupId;
|
|
3411
|
+
columnGroupId = `total:${keys.join("/")}`;
|
|
3412
|
+
columnGroups.set(columnGroupId, prepareColumnGroup({
|
|
3413
|
+
header: `${keys[keys.length - 1]} total`,
|
|
3414
|
+
columnGroup: parentGroupForTotalsGroup,
|
|
3415
|
+
pivotBy,
|
|
3416
|
+
pivotTotalColumnGroup: true,
|
|
3417
|
+
pivotGroupKeys: keys,
|
|
3418
|
+
pivotIndex: keys.length - 1,
|
|
3419
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3420
|
+
pivotGroupKey: keys[keys.length - 1]
|
|
3421
|
+
}));
|
|
3146
3422
|
}
|
|
3147
|
-
|
|
3423
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3424
|
+
const header = isSingleAggregationColumn ? `${keys[keys.length - 1]} total ` : `${reducer.id} total`;
|
|
3425
|
+
const computedPivotColumn = prepareColumn({
|
|
3426
|
+
columnGroup: columnGroupId,
|
|
3427
|
+
header,
|
|
3428
|
+
pivotAggregator: reducer,
|
|
3429
|
+
pivotAggregatorIndex: index,
|
|
3430
|
+
pivotColumn: true,
|
|
3431
|
+
pivotTotalColumn: true,
|
|
3432
|
+
pivotGroupKeys: keys,
|
|
3433
|
+
pivotGroupKey: keys[keys.length - 1],
|
|
3434
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3435
|
+
pivotIndex: keys.length - 1,
|
|
3436
|
+
pivotBy,
|
|
3437
|
+
sortable: false,
|
|
3438
|
+
valueGetter: ({ rowInfo }) => {
|
|
3439
|
+
var _a, _b;
|
|
3440
|
+
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3441
|
+
}
|
|
3442
|
+
});
|
|
3443
|
+
columns.set(`total:${keys.join("/")}-${reducer.id}`, computedPivotColumn);
|
|
3444
|
+
});
|
|
3148
3445
|
}
|
|
3149
3446
|
}
|
|
3150
3447
|
if (pivotTotalColumnPosition === "start" || pivotTotalColumnPosition === false) {
|
|
@@ -3154,9 +3451,12 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
3154
3451
|
if (columns.size === 1) {
|
|
3155
3452
|
columns.set("single", {
|
|
3156
3453
|
header: "Reduced",
|
|
3454
|
+
pivotBy,
|
|
3455
|
+
pivotColumn: true,
|
|
3157
3456
|
valueGetter: ({ rowInfo }) => {
|
|
3158
3457
|
var _a;
|
|
3159
|
-
|
|
3458
|
+
const key = Object.keys(rowInfo.reducerResults || {})[0];
|
|
3459
|
+
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[key];
|
|
3160
3460
|
}
|
|
3161
3461
|
});
|
|
3162
3462
|
}
|
|
@@ -3180,29 +3480,37 @@ var haveDepsChanged = (state1, state2, deps) => {
|
|
|
3180
3480
|
return false;
|
|
3181
3481
|
};
|
|
3182
3482
|
function toRowInfo(data, id, index) {
|
|
3183
|
-
return {
|
|
3483
|
+
return {
|
|
3484
|
+
data,
|
|
3485
|
+
collapsed: true,
|
|
3486
|
+
id,
|
|
3487
|
+
indexInAll: index,
|
|
3488
|
+
indexInGroup: index,
|
|
3489
|
+
isGroupRow: false
|
|
3490
|
+
};
|
|
3184
3491
|
}
|
|
3185
3492
|
function concludeReducer(params) {
|
|
3186
3493
|
var _a;
|
|
3187
3494
|
const { state, previousState } = params;
|
|
3188
3495
|
const sortInfo = state.sortInfo;
|
|
3189
|
-
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length);
|
|
3496
|
+
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
3190
3497
|
const sortDepsChanged = haveDepsChanged(previousState, state, [
|
|
3191
3498
|
"originalDataArray",
|
|
3192
3499
|
"sortInfo"
|
|
3193
3500
|
]);
|
|
3194
3501
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
3195
|
-
const groupBy = state.
|
|
3502
|
+
const groupBy = state.groupBy;
|
|
3196
3503
|
const pivotBy = state.pivotBy;
|
|
3197
3504
|
const shouldGroup = groupBy.length || pivotBy;
|
|
3198
3505
|
const groupsDepsChanged = haveDepsChanged(previousState, state, [
|
|
3199
3506
|
"generateGroupRows",
|
|
3200
3507
|
"originalDataArray",
|
|
3201
|
-
"
|
|
3508
|
+
"groupBy",
|
|
3202
3509
|
"groupRowsState",
|
|
3203
3510
|
"pivotBy",
|
|
3204
3511
|
"aggregationReducers",
|
|
3205
3512
|
"pivotTotalColumnPosition",
|
|
3513
|
+
"showSeparatePivotColumnForSingleAggregation",
|
|
3206
3514
|
"sortInfo"
|
|
3207
3515
|
]);
|
|
3208
3516
|
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
|
|
@@ -3228,13 +3536,20 @@ function concludeReducer(params) {
|
|
|
3228
3536
|
}, dataArray);
|
|
3229
3537
|
const flattenResult = enhancedFlatten({
|
|
3230
3538
|
groupResult,
|
|
3539
|
+
reducers: state.aggregationReducers,
|
|
3231
3540
|
toPrimaryKey,
|
|
3232
3541
|
groupRowsState: state.groupRowsState,
|
|
3233
3542
|
generateGroupRows: state.generateGroupRows
|
|
3234
3543
|
});
|
|
3235
3544
|
rowInfoDataArray = flattenResult.data;
|
|
3236
3545
|
state.groupDeepMap = groupResult.deepMap;
|
|
3237
|
-
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups(
|
|
3546
|
+
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups({
|
|
3547
|
+
deepMap: groupResult.topLevelPivotColumns,
|
|
3548
|
+
pivotBy,
|
|
3549
|
+
pivotTotalColumnPosition: (_a = state.pivotTotalColumnPosition) != null ? _a : "end",
|
|
3550
|
+
reducers: state.aggregationReducers,
|
|
3551
|
+
showSeparatePivotColumnForSingleAggregation: state.showSeparatePivotColumnForSingleAggregation
|
|
3552
|
+
}) : void 0;
|
|
3238
3553
|
state.pivotColumns = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columns;
|
|
3239
3554
|
state.pivotColumnGroups = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columnGroups;
|
|
3240
3555
|
} else {
|
|
@@ -3256,7 +3571,9 @@ function concludeReducer(params) {
|
|
|
3256
3571
|
}
|
|
3257
3572
|
state.dataArray = rowInfoDataArray;
|
|
3258
3573
|
state.reducedAt = now;
|
|
3259
|
-
|
|
3574
|
+
if (true) {
|
|
3575
|
+
globalThis.state = state;
|
|
3576
|
+
}
|
|
3260
3577
|
return state;
|
|
3261
3578
|
}
|
|
3262
3579
|
|
|
@@ -3279,7 +3596,8 @@ var DataSourceRoot = getComponentStateRoot({
|
|
|
3279
3596
|
initSetupState: initSetupState2,
|
|
3280
3597
|
forwardProps: forwardProps3,
|
|
3281
3598
|
concludeReducer,
|
|
3282
|
-
mapPropsToState: mapPropsToState2
|
|
3599
|
+
mapPropsToState: mapPropsToState2,
|
|
3600
|
+
interceptActions: getInterceptActions()
|
|
3283
3601
|
});
|
|
3284
3602
|
function DataSourceCmp({ children }) {
|
|
3285
3603
|
const DataSourceContext = getDataSourceContext();
|
|
@@ -3318,49 +3636,49 @@ function useToggleGroupRow() {
|
|
|
3318
3636
|
}
|
|
3319
3637
|
|
|
3320
3638
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
3321
|
-
function
|
|
3322
|
-
const
|
|
3323
|
-
return
|
|
3324
|
-
acc.set(
|
|
3325
|
-
groupBy,
|
|
3639
|
+
function useGroupByMap(groupBy) {
|
|
3640
|
+
const groupByMap = useMemo5(() => {
|
|
3641
|
+
return groupBy.reduce((acc, groupBy2, index) => {
|
|
3642
|
+
acc.set(groupBy2.field, {
|
|
3643
|
+
groupBy: groupBy2,
|
|
3326
3644
|
groupIndex: index
|
|
3327
3645
|
});
|
|
3328
3646
|
return acc;
|
|
3329
3647
|
}, new Map());
|
|
3330
|
-
}, [
|
|
3331
|
-
return
|
|
3648
|
+
}, [groupBy]);
|
|
3649
|
+
return groupByMap;
|
|
3332
3650
|
}
|
|
3333
3651
|
function useColumnsWhen() {
|
|
3334
3652
|
const {
|
|
3335
|
-
componentState: {
|
|
3653
|
+
componentState: { groupBy },
|
|
3336
3654
|
componentActions: dataSourceActions
|
|
3337
3655
|
} = useDataSourceContextValue();
|
|
3338
3656
|
const {
|
|
3339
3657
|
componentState: { groupRenderStrategy, pivotTotalColumnPosition }
|
|
3340
3658
|
} = useComponentState();
|
|
3341
|
-
const
|
|
3342
|
-
|
|
3659
|
+
const groupByMap = useGroupByMap(groupBy);
|
|
3660
|
+
useEffect9(() => {
|
|
3343
3661
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
3344
3662
|
}, [groupRenderStrategy]);
|
|
3345
|
-
|
|
3663
|
+
useEffect9(() => {
|
|
3346
3664
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3347
3665
|
}, [pivotTotalColumnPosition]);
|
|
3348
|
-
useColumnsWhenInlineGroupRenderStrategy(
|
|
3666
|
+
useColumnsWhenInlineGroupRenderStrategy(groupByMap);
|
|
3349
3667
|
useColumnsWhenPivoting();
|
|
3350
3668
|
useColumnsWhenGrouping();
|
|
3351
|
-
useHideEmptyGroupColumns(
|
|
3669
|
+
useHideEmptyGroupColumns(groupByMap);
|
|
3352
3670
|
}
|
|
3353
|
-
function useColumnsWhenInlineGroupRenderStrategy(
|
|
3671
|
+
function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
3354
3672
|
const toggleGroupRow = useToggleGroupRow();
|
|
3355
3673
|
const {
|
|
3356
3674
|
componentActions,
|
|
3357
3675
|
componentState: { columns, groupRenderStrategy }
|
|
3358
3676
|
} = useComponentState();
|
|
3359
|
-
function computeColumnsWhenInlineGroupRenderStrategy(columns2,
|
|
3677
|
+
function computeColumnsWhenInlineGroupRenderStrategy(columns2, groupByMap2, groupRenderStrategy2, toggleGroupRow2) {
|
|
3360
3678
|
const computedColumns = new Map();
|
|
3361
3679
|
columns2.forEach((column, id) => {
|
|
3362
3680
|
let base = {};
|
|
3363
|
-
const groupByForColumn =
|
|
3681
|
+
const groupByForColumn = groupByMap2.get(column.field);
|
|
3364
3682
|
if (groupByForColumn && groupRenderStrategy2 === "inline") {
|
|
3365
3683
|
const { groupIndex } = groupByForColumn;
|
|
3366
3684
|
const field = groupByForColumn.groupBy.field;
|
|
@@ -3405,9 +3723,9 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3405
3723
|
});
|
|
3406
3724
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
3407
3725
|
}
|
|
3408
|
-
|
|
3726
|
+
useEffect9(() => {
|
|
3409
3727
|
const update = () => {
|
|
3410
|
-
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns,
|
|
3728
|
+
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
3411
3729
|
};
|
|
3412
3730
|
update();
|
|
3413
3731
|
return interceptMap(columns, {
|
|
@@ -3415,11 +3733,11 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3415
3733
|
delete: update,
|
|
3416
3734
|
clear: update
|
|
3417
3735
|
});
|
|
3418
|
-
}, [columns,
|
|
3736
|
+
}, [columns, groupByMap, groupRenderStrategy, toggleGroupRow]);
|
|
3419
3737
|
}
|
|
3420
3738
|
function useColumnsWhenPivoting() {
|
|
3421
3739
|
const {
|
|
3422
|
-
componentState: {
|
|
3740
|
+
componentState: { groupBy, pivotBy }
|
|
3423
3741
|
} = useDataSourceContextValue();
|
|
3424
3742
|
const {
|
|
3425
3743
|
componentActions,
|
|
@@ -3431,13 +3749,13 @@ function useColumnsWhenPivoting() {
|
|
|
3431
3749
|
}
|
|
3432
3750
|
} = useComponentState();
|
|
3433
3751
|
const toggleGroupRow = useToggleGroupRow();
|
|
3434
|
-
|
|
3752
|
+
useEffect9(() => {
|
|
3435
3753
|
const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
|
|
3436
3754
|
pivotColumn,
|
|
3437
3755
|
pivotRowLabelsColumn,
|
|
3438
3756
|
pivotTotalColumnPosition,
|
|
3439
3757
|
pivotBy,
|
|
3440
|
-
|
|
3758
|
+
groupBy,
|
|
3441
3759
|
toggleGroupRow
|
|
3442
3760
|
});
|
|
3443
3761
|
componentActions.computedPivotColumns = computedPivotColumns;
|
|
@@ -3445,14 +3763,14 @@ function useColumnsWhenPivoting() {
|
|
|
3445
3763
|
}
|
|
3446
3764
|
function useColumnsWhenGrouping() {
|
|
3447
3765
|
const {
|
|
3448
|
-
componentState: {
|
|
3766
|
+
componentState: { groupBy }
|
|
3449
3767
|
} = useDataSourceContextValue();
|
|
3450
3768
|
const {
|
|
3451
3769
|
componentActions,
|
|
3452
3770
|
componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
|
|
3453
3771
|
} = useComponentState();
|
|
3454
3772
|
const toggleGroupRow = useToggleGroupRow();
|
|
3455
|
-
|
|
3773
|
+
useEffect9(() => {
|
|
3456
3774
|
if (pivotColumns) {
|
|
3457
3775
|
return;
|
|
3458
3776
|
}
|
|
@@ -3461,7 +3779,7 @@ function useColumnsWhenGrouping() {
|
|
|
3461
3779
|
columns,
|
|
3462
3780
|
groupColumn,
|
|
3463
3781
|
groupRenderStrategy,
|
|
3464
|
-
|
|
3782
|
+
groupBy,
|
|
3465
3783
|
pivotColumns,
|
|
3466
3784
|
toggleGroupRow
|
|
3467
3785
|
});
|
|
@@ -3473,11 +3791,11 @@ function useColumnsWhenGrouping() {
|
|
|
3473
3791
|
delete: update,
|
|
3474
3792
|
clear: update
|
|
3475
3793
|
});
|
|
3476
|
-
}, [
|
|
3794
|
+
}, [columns, groupBy, groupColumn, groupRenderStrategy, pivotColumns]);
|
|
3477
3795
|
}
|
|
3478
3796
|
function useHideEmptyGroupColumns(groupRowsMap) {
|
|
3479
3797
|
const {
|
|
3480
|
-
componentState: {
|
|
3798
|
+
componentState: { groupBy, groupRowsState },
|
|
3481
3799
|
getState: getDataSourceState
|
|
3482
3800
|
} = useDataSourceContextValue();
|
|
3483
3801
|
const {
|
|
@@ -3489,11 +3807,11 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3489
3807
|
groupRenderStrategy
|
|
3490
3808
|
}
|
|
3491
3809
|
} = useComponentState();
|
|
3492
|
-
|
|
3493
|
-
if (groupRenderStrategy
|
|
3810
|
+
useEffect9(() => {
|
|
3811
|
+
if (groupRenderStrategy !== "multi-column") {
|
|
3494
3812
|
return;
|
|
3495
3813
|
}
|
|
3496
|
-
const groupsLength =
|
|
3814
|
+
const groupsLength = groupBy.length;
|
|
3497
3815
|
let expandedGroupsLevel = 0;
|
|
3498
3816
|
const { dataArray } = getDataSourceState();
|
|
3499
3817
|
const len = dataArray.length;
|
|
@@ -3509,15 +3827,15 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3509
3827
|
let updated = false;
|
|
3510
3828
|
const columnVisibility = new Map(currentState.columnVisibility);
|
|
3511
3829
|
const cols = computedColumns;
|
|
3512
|
-
|
|
3513
|
-
const colId =
|
|
3514
|
-
|
|
3830
|
+
groupBy.forEach(({ field, column: groupColumn }, index) => {
|
|
3831
|
+
const colId = (groupColumn == null ? void 0 : groupColumn.id) || `group-by-${field}`;
|
|
3832
|
+
let col = cols.get(colId);
|
|
3515
3833
|
if (!col) {
|
|
3516
3834
|
return;
|
|
3517
3835
|
}
|
|
3518
|
-
const shouldBeHidden = index > expandedGroupsLevel;
|
|
3836
|
+
const shouldBeHidden = index > expandedGroupsLevel && hideEmptyGroupColumns;
|
|
3519
3837
|
updated = true;
|
|
3520
|
-
if (shouldBeHidden
|
|
3838
|
+
if (shouldBeHidden) {
|
|
3521
3839
|
columnVisibility.set(colId, false);
|
|
3522
3840
|
} else {
|
|
3523
3841
|
columnVisibility.delete(colId);
|
|
@@ -3530,7 +3848,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3530
3848
|
getDataSourceState,
|
|
3531
3849
|
groupRenderStrategy,
|
|
3532
3850
|
generatedColumns,
|
|
3533
|
-
|
|
3851
|
+
groupBy,
|
|
3534
3852
|
groupRowsMap,
|
|
3535
3853
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
3536
3854
|
hideEmptyGroupColumns
|
|
@@ -3539,7 +3857,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3539
3857
|
function getColumnsWhenGrouping(params) {
|
|
3540
3858
|
const {
|
|
3541
3859
|
pivotColumns,
|
|
3542
|
-
|
|
3860
|
+
groupBy,
|
|
3543
3861
|
groupColumn,
|
|
3544
3862
|
groupRenderStrategy,
|
|
3545
3863
|
toggleGroupRow,
|
|
@@ -3553,21 +3871,23 @@ function getColumnsWhenGrouping(params) {
|
|
|
3553
3871
|
}
|
|
3554
3872
|
const computedColumns = new Map();
|
|
3555
3873
|
if (groupRenderStrategy === "multi-column") {
|
|
3556
|
-
|
|
3557
|
-
|
|
3874
|
+
groupBy.forEach((groupByForColumn, groupIndexForColumn, arr) => {
|
|
3875
|
+
const generatedGroupColumn = getColumnForGroupBy({
|
|
3558
3876
|
groupByForColumn,
|
|
3559
|
-
|
|
3877
|
+
groupBy,
|
|
3560
3878
|
groupIndexForColumn,
|
|
3561
3879
|
groupCount: arr.length,
|
|
3562
3880
|
groupRenderStrategy
|
|
3563
|
-
}, toggleGroupRow, groupColumn)
|
|
3881
|
+
}, toggleGroupRow, groupColumn);
|
|
3882
|
+
computedColumns.set(generatedGroupColumn.id || `group-by-${groupByForColumn.field}`, generatedGroupColumn);
|
|
3564
3883
|
});
|
|
3565
3884
|
} else if (groupRenderStrategy === "single-column") {
|
|
3566
|
-
|
|
3567
|
-
groupCount:
|
|
3568
|
-
|
|
3885
|
+
const singleGroupColumn = getSingleGroupColumn({
|
|
3886
|
+
groupCount: groupBy.length,
|
|
3887
|
+
groupBy,
|
|
3569
3888
|
groupRenderStrategy
|
|
3570
|
-
}, toggleGroupRow, groupColumn)
|
|
3889
|
+
}, toggleGroupRow, groupColumn);
|
|
3890
|
+
computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
|
|
3571
3891
|
}
|
|
3572
3892
|
columns.forEach((col, colId) => {
|
|
3573
3893
|
computedColumns.set(colId, col);
|
|
@@ -3583,8 +3903,16 @@ function useComputed() {
|
|
|
3583
3903
|
componentActions: dataSourceActions,
|
|
3584
3904
|
componentState: dataSourceState
|
|
3585
3905
|
} = useDataSourceContextValue();
|
|
3586
|
-
const {
|
|
3587
|
-
|
|
3906
|
+
const {
|
|
3907
|
+
columnOrder,
|
|
3908
|
+
columnVisibility,
|
|
3909
|
+
columnPinning,
|
|
3910
|
+
columnSizing,
|
|
3911
|
+
columnTypes,
|
|
3912
|
+
bodySize,
|
|
3913
|
+
showSeparatePivotColumnForSingleAggregation
|
|
3914
|
+
} = componentState;
|
|
3915
|
+
useState5(() => {
|
|
3588
3916
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
3589
3917
|
if (rowHeight) {
|
|
3590
3918
|
componentActions.rowHeight = rowHeight;
|
|
@@ -3596,13 +3924,16 @@ function useComputed() {
|
|
|
3596
3924
|
}
|
|
3597
3925
|
});
|
|
3598
3926
|
});
|
|
3599
|
-
|
|
3927
|
+
useEffect10(() => {
|
|
3928
|
+
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
3929
|
+
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
3600
3930
|
const { multiSort } = dataSourceState;
|
|
3601
3931
|
useColumnGroups();
|
|
3602
3932
|
useColumnsWhen();
|
|
3603
3933
|
const setSortInfo = useCallback5((sortInfo) => {
|
|
3604
3934
|
var _a2;
|
|
3605
|
-
|
|
3935
|
+
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
3936
|
+
dataSourceActions.sortInfo = newSortInfo;
|
|
3606
3937
|
}, []);
|
|
3607
3938
|
const columns = componentState.computedColumns;
|
|
3608
3939
|
const {
|
|
@@ -3628,6 +3959,7 @@ function useComputed() {
|
|
|
3628
3959
|
pinnedStartMaxWidth: componentState.pinnedStartMaxWidth,
|
|
3629
3960
|
pinnedEndMaxWidth: componentState.pinnedEndMaxWidth,
|
|
3630
3961
|
bodySize,
|
|
3962
|
+
viewportReservedWidth: componentState.viewportReservedWidth,
|
|
3631
3963
|
sortable: componentState.sortable,
|
|
3632
3964
|
draggableColumns: componentState.draggableColumns,
|
|
3633
3965
|
sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
|
|
@@ -3636,7 +3968,9 @@ function useComputed() {
|
|
|
3636
3968
|
columnOrder,
|
|
3637
3969
|
columnVisibility,
|
|
3638
3970
|
columnVisibilityAssumeVisible: true,
|
|
3639
|
-
columnPinning
|
|
3971
|
+
columnPinning,
|
|
3972
|
+
columnSizing,
|
|
3973
|
+
columnTypes
|
|
3640
3974
|
});
|
|
3641
3975
|
const unpinnedColumnWidths = computedUnpinnedColumns.map((c) => c.computedWidth);
|
|
3642
3976
|
let sortedUnpinnedColumnWidths = [...unpinnedColumnWidths].sort(sortAscending);
|
|
@@ -3712,33 +4046,6 @@ import {
|
|
|
3712
4046
|
createElement as createElement19
|
|
3713
4047
|
} from "react";
|
|
3714
4048
|
|
|
3715
|
-
// src/utils/getGlobal.ts
|
|
3716
|
-
function getGlobal() {
|
|
3717
|
-
return globalThis;
|
|
3718
|
-
}
|
|
3719
|
-
|
|
3720
|
-
// src/components/utils/getScrollbarWidth.ts
|
|
3721
|
-
var scrollbarWidth;
|
|
3722
|
-
function getScrollbarWidth() {
|
|
3723
|
-
var _a, _b;
|
|
3724
|
-
if (scrollbarWidth != null) {
|
|
3725
|
-
return scrollbarWidth;
|
|
3726
|
-
}
|
|
3727
|
-
const doc = (_a = getGlobal().document) != null ? _a : null;
|
|
3728
|
-
if (!doc) {
|
|
3729
|
-
return 0;
|
|
3730
|
-
}
|
|
3731
|
-
const outer = doc.createElement("div");
|
|
3732
|
-
outer.style.visibility = "hidden";
|
|
3733
|
-
outer.style.overflow = "scroll";
|
|
3734
|
-
doc.body.appendChild(outer);
|
|
3735
|
-
const inner = doc.createElement("div");
|
|
3736
|
-
outer.appendChild(inner);
|
|
3737
|
-
scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
|
3738
|
-
(_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
|
|
3739
|
-
return scrollbarWidth;
|
|
3740
|
-
}
|
|
3741
|
-
|
|
3742
4049
|
// src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx
|
|
3743
4050
|
import {
|
|
3744
4051
|
createElement as createElement8,
|
|
@@ -3778,11 +4085,11 @@ function VerticalScrollbarPlaceholderFn(props) {
|
|
|
3778
4085
|
var VerticalScrollbarPlaceholder = memo2(VerticalScrollbarPlaceholderFn);
|
|
3779
4086
|
|
|
3780
4087
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
3781
|
-
var
|
|
4088
|
+
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3782
4089
|
var CellCls = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
3783
4090
|
var HeaderCellProxy = "_12zfob10";
|
|
3784
|
-
var HeaderCellRecipe = (0,
|
|
3785
|
-
var HeaderClsRecipe = (0,
|
|
4091
|
+
var HeaderCellRecipe = (0, import_createRuntimeFn3.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"]] });
|
|
4092
|
+
var HeaderClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_12zfob12 _16lm1iw10", 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"]] });
|
|
3786
4093
|
var HeaderGroupCls = "_16lm1iwz _16lm1iwj";
|
|
3787
4094
|
var HeaderGroup_Children = "_16lm1iwj _16lm1iw10 _16lm1iw12 _16lm1iwc";
|
|
3788
4095
|
var HeaderGroup_Header = "_12zfob1x _16lm1iwj _16lm1iw10 _16lm1iw11";
|
|
@@ -3794,14 +4101,14 @@ import {
|
|
|
3794
4101
|
createElement as createElement15,
|
|
3795
4102
|
memo as memo6
|
|
3796
4103
|
} from "react";
|
|
3797
|
-
import { useCallback as useCallback8, useEffect as
|
|
4104
|
+
import { useCallback as useCallback8, useEffect as useEffect14, useRef as useRef9 } from "react";
|
|
3798
4105
|
|
|
3799
4106
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3800
4107
|
import {
|
|
3801
4108
|
Fragment as Fragment2,
|
|
3802
4109
|
createElement as createElement11
|
|
3803
4110
|
} from "react";
|
|
3804
|
-
import { useCallback as useCallback7, useEffect as
|
|
4111
|
+
import { useCallback as useCallback7, useEffect as useEffect12, useRef as useRef8 } from "react";
|
|
3805
4112
|
|
|
3806
4113
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
3807
4114
|
import {
|
|
@@ -3810,18 +4117,18 @@ import {
|
|
|
3810
4117
|
} from "react";
|
|
3811
4118
|
|
|
3812
4119
|
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
3813
|
-
import { useContext as
|
|
4120
|
+
import { useContext as useContext4 } from "react";
|
|
3814
4121
|
var useInfiniteTableState = () => {
|
|
3815
4122
|
const TableContext2 = getInfiniteTableContext();
|
|
3816
|
-
const { componentState } =
|
|
4123
|
+
const { componentState } = useContext4(TableContext2);
|
|
3817
4124
|
return componentState;
|
|
3818
4125
|
};
|
|
3819
4126
|
|
|
3820
4127
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
3821
|
-
var
|
|
4128
|
+
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3822
4129
|
var CellCls2 = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
3823
4130
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
3824
|
-
var ColumnCellRecipe = (0,
|
|
4131
|
+
var ColumnCellRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "_16lm1iw2 _16lm1iwo _16lm1iw7 _16lm1iwr", 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"]] });
|
|
3825
4132
|
var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
|
|
3826
4133
|
|
|
3827
4134
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
@@ -3882,8 +4189,8 @@ var import_binary_search = __toModule(require_binary_search());
|
|
|
3882
4189
|
import {
|
|
3883
4190
|
useCallback as useCallback6,
|
|
3884
4191
|
useMemo as useMemo6,
|
|
3885
|
-
useRef as
|
|
3886
|
-
useState as
|
|
4192
|
+
useRef as useRef7,
|
|
4193
|
+
useState as useState6
|
|
3887
4194
|
} from "react";
|
|
3888
4195
|
|
|
3889
4196
|
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
@@ -3918,13 +4225,13 @@ var useColumnPointerEvents = ({
|
|
|
3918
4225
|
columns,
|
|
3919
4226
|
computedRemainingSpace
|
|
3920
4227
|
}) => {
|
|
3921
|
-
const [draggingDiff, setDraggingDiff] =
|
|
3922
|
-
const [proxyOffset, setProxyOffset] =
|
|
3923
|
-
const breakpointsRef =
|
|
3924
|
-
const pointerMoveRef =
|
|
3925
|
-
const didDragRef =
|
|
3926
|
-
const initialClientPos =
|
|
3927
|
-
const currentDropIndexRef =
|
|
4228
|
+
const [draggingDiff, setDraggingDiff] = useState6(null);
|
|
4229
|
+
const [proxyOffset, setProxyOffset] = useState6(null);
|
|
4230
|
+
const breakpointsRef = useRef7([]);
|
|
4231
|
+
const pointerMoveRef = useRef7(null);
|
|
4232
|
+
const didDragRef = useRef7(false);
|
|
4233
|
+
const initialClientPos = useRef7(null);
|
|
4234
|
+
const currentDropIndexRef = useRef7(null);
|
|
3928
4235
|
const dragging = draggingDiff != null;
|
|
3929
4236
|
const { componentActions, computed } = useInfiniteTable();
|
|
3930
4237
|
const { computedColumnOrder } = computed;
|
|
@@ -3937,7 +4244,7 @@ var useColumnPointerEvents = ({
|
|
|
3937
4244
|
columnWidth: column.computedWidth
|
|
3938
4245
|
};
|
|
3939
4246
|
}, [columns, columnId, column]);
|
|
3940
|
-
let cursorRef =
|
|
4247
|
+
let cursorRef = useRef7("auto");
|
|
3941
4248
|
const onPointerDown = useCallback6((e) => {
|
|
3942
4249
|
const target = domRef.current;
|
|
3943
4250
|
cursorRef.current = target.style.cursor;
|
|
@@ -4078,7 +4385,7 @@ import { createPortal } from "react-dom";
|
|
|
4078
4385
|
import {
|
|
4079
4386
|
createElement as createElement10
|
|
4080
4387
|
} from "react";
|
|
4081
|
-
import { useEffect as
|
|
4388
|
+
import { useEffect as useEffect11, useState as useState7 } from "react";
|
|
4082
4389
|
var defaultLineStyle = {
|
|
4083
4390
|
marginTop: 2,
|
|
4084
4391
|
marginBottom: 2,
|
|
@@ -4086,8 +4393,8 @@ var defaultLineStyle = {
|
|
|
4086
4393
|
};
|
|
4087
4394
|
function SortIcon(props) {
|
|
4088
4395
|
var _a;
|
|
4089
|
-
const [rendered, setRendered] =
|
|
4090
|
-
const [opacity, setOpacity] =
|
|
4396
|
+
const [rendered, setRendered] = useState7(true);
|
|
4397
|
+
const [opacity, setOpacity] = useState7(0);
|
|
4091
4398
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
4092
4399
|
const showIndex = index != null && index > 0;
|
|
4093
4400
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -4101,7 +4408,7 @@ function SortIcon(props) {
|
|
|
4101
4408
|
}), props.lineStyle), {
|
|
4102
4409
|
opacity
|
|
4103
4410
|
});
|
|
4104
|
-
|
|
4411
|
+
useEffect11(() => {
|
|
4105
4412
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
4106
4413
|
if (!rendered && newOpacity) {
|
|
4107
4414
|
setRendered(true);
|
|
@@ -4178,7 +4485,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4178
4485
|
className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
|
|
4179
4486
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
4180
4487
|
});
|
|
4181
|
-
const domRef =
|
|
4488
|
+
const domRef = useRef8(null);
|
|
4182
4489
|
const ref = useCallback7((node) => {
|
|
4183
4490
|
var _a2;
|
|
4184
4491
|
domRef.current = node;
|
|
@@ -4188,7 +4495,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4188
4495
|
computed: { computedRemainingSpace },
|
|
4189
4496
|
componentState: { portalDOMRef }
|
|
4190
4497
|
} = useInfiniteTable();
|
|
4191
|
-
|
|
4498
|
+
useEffect12(() => {
|
|
4192
4499
|
let clearOnResize = null;
|
|
4193
4500
|
const node = domRef.current;
|
|
4194
4501
|
if (onResize && node) {
|
|
@@ -4244,7 +4551,7 @@ import {
|
|
|
4244
4551
|
createElement as createElement14,
|
|
4245
4552
|
memo as memo5
|
|
4246
4553
|
} from "react";
|
|
4247
|
-
import { useEffect as
|
|
4554
|
+
import { useEffect as useEffect13 } from "react";
|
|
4248
4555
|
|
|
4249
4556
|
// src/components/RawList/AvoidReactDiff.tsx
|
|
4250
4557
|
import {
|
|
@@ -4252,9 +4559,9 @@ import {
|
|
|
4252
4559
|
createElement as createElement12,
|
|
4253
4560
|
memo as memo4
|
|
4254
4561
|
} from "react";
|
|
4255
|
-
import { useLayoutEffect as useLayoutEffect4, useState as
|
|
4562
|
+
import { useLayoutEffect as useLayoutEffect4, useState as useState8 } from "react";
|
|
4256
4563
|
function AvoidReactDiffFn(props) {
|
|
4257
|
-
const [children, setChildren] =
|
|
4564
|
+
const [children, setChildren] = useState8(props.updater.get());
|
|
4258
4565
|
useLayoutEffect4(() => {
|
|
4259
4566
|
const remove = props.updater.onChange((children2) => {
|
|
4260
4567
|
setChildren(children2);
|
|
@@ -4287,10 +4594,10 @@ var MappedItems = class extends Logger {
|
|
|
4287
4594
|
return result;
|
|
4288
4595
|
};
|
|
4289
4596
|
this.getElementsOutsideItemRange = (startIndex, endIndex) => {
|
|
4290
|
-
const
|
|
4597
|
+
const map2 = this.elementIndexToItemIndex;
|
|
4291
4598
|
const result = [];
|
|
4292
|
-
for (const elementIndex in
|
|
4293
|
-
const itemIndex =
|
|
4599
|
+
for (const elementIndex in map2) {
|
|
4600
|
+
const itemIndex = map2[elementIndex];
|
|
4294
4601
|
if (itemIndex < startIndex || itemIndex > endIndex) {
|
|
4295
4602
|
result.push(elementIndex >> 0);
|
|
4296
4603
|
}
|
|
@@ -4595,7 +4902,7 @@ function RawListFn(props) {
|
|
|
4595
4902
|
debugChannel
|
|
4596
4903
|
});
|
|
4597
4904
|
const getRenderItem = useLatest(renderItem);
|
|
4598
|
-
|
|
4905
|
+
useEffect13(() => {
|
|
4599
4906
|
const renderRange = brain.getRenderRange();
|
|
4600
4907
|
renderer.renderRange(renderRange, {
|
|
4601
4908
|
renderItem,
|
|
@@ -4603,7 +4910,7 @@ function RawListFn(props) {
|
|
|
4603
4910
|
onRender: onRenderUpdater
|
|
4604
4911
|
});
|
|
4605
4912
|
}, [brain, renderItem, onRenderUpdater]);
|
|
4606
|
-
|
|
4913
|
+
useEffect13(() => {
|
|
4607
4914
|
const remove = brain.onRenderRangeChange((renderRange) => {
|
|
4608
4915
|
renderer.renderRange(renderRange, {
|
|
4609
4916
|
force: false,
|
|
@@ -4645,14 +4952,14 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4645
4952
|
columns: computedVisibleColumnsMap
|
|
4646
4953
|
});
|
|
4647
4954
|
}, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
|
|
4648
|
-
|
|
4955
|
+
useEffect14(() => {
|
|
4649
4956
|
const onScroll = (scrollPosition) => {
|
|
4650
4957
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
4651
4958
|
};
|
|
4652
4959
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4653
4960
|
return removeOnScroll;
|
|
4654
4961
|
}, [brain]);
|
|
4655
|
-
const domRef =
|
|
4962
|
+
const domRef = useRef9(null);
|
|
4656
4963
|
const headerCls = HeaderClsRecipe({
|
|
4657
4964
|
pinned: pinning,
|
|
4658
4965
|
overflow: false,
|
|
@@ -4675,7 +4982,7 @@ import {
|
|
|
4675
4982
|
createElement as createElement18,
|
|
4676
4983
|
memo as memo7,
|
|
4677
4984
|
useMemo as useMemo8,
|
|
4678
|
-
useRef as
|
|
4985
|
+
useRef as useRef10
|
|
4679
4986
|
} from "react";
|
|
4680
4987
|
|
|
4681
4988
|
// src/components/InfiniteTable/components/InfiniteTableHeader/renderColumnHeaderGroups.tsx
|
|
@@ -4685,7 +4992,7 @@ import {
|
|
|
4685
4992
|
|
|
4686
4993
|
// src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
|
|
4687
4994
|
function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
4688
|
-
const
|
|
4995
|
+
const map2 = new Map();
|
|
4689
4996
|
const temporaryMap = new Map();
|
|
4690
4997
|
const mapOfAllParentGroupsForColumns = new Map();
|
|
4691
4998
|
columns.forEach((col, index) => {
|
|
@@ -4703,7 +5010,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4703
5010
|
computedWidth: col.computedWidth,
|
|
4704
5011
|
depth: col.columnGroup ? ((_d = columnGroupsDepthsMap.get(col.columnGroup)) != null ? _d : 0) + 1 : 0
|
|
4705
5012
|
};
|
|
4706
|
-
|
|
5013
|
+
map2.set([colId], colItem);
|
|
4707
5014
|
let groupId = col.columnGroup;
|
|
4708
5015
|
let colGroupItem;
|
|
4709
5016
|
let prevGroupItem = colItem;
|
|
@@ -4725,7 +5032,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4725
5032
|
computedWidth: 0,
|
|
4726
5033
|
depth: (_e = columnGroupsDepthsMap.get(groupId)) != null ? _e : 0
|
|
4727
5034
|
};
|
|
4728
|
-
|
|
5035
|
+
map2.set(groupAbsoluteId, colGroupItem);
|
|
4729
5036
|
temporaryMap.set(groupId, colGroupItem);
|
|
4730
5037
|
}
|
|
4731
5038
|
colGroupItem.columnItems.push(colItem);
|
|
@@ -4742,7 +5049,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4742
5049
|
});
|
|
4743
5050
|
const result = [];
|
|
4744
5051
|
let groupOffset = 0;
|
|
4745
|
-
|
|
5052
|
+
map2.forEach((item) => {
|
|
4746
5053
|
if (!item.ref.columnGroup) {
|
|
4747
5054
|
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum, col) => sum + col.ref.computedWidth, 0);
|
|
4748
5055
|
item.groupOffset = groupOffset;
|
|
@@ -4754,7 +5061,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4754
5061
|
groupOffset += itemWidth;
|
|
4755
5062
|
}
|
|
4756
5063
|
});
|
|
4757
|
-
|
|
5064
|
+
map2.clear();
|
|
4758
5065
|
temporaryMap.clear();
|
|
4759
5066
|
return result;
|
|
4760
5067
|
}
|
|
@@ -4853,7 +5160,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
4853
5160
|
}
|
|
4854
5161
|
|
|
4855
5162
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
|
|
4856
|
-
import { useEffect as
|
|
5163
|
+
import { useEffect as useEffect15 } from "react";
|
|
4857
5164
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
4858
5165
|
var TableHeaderClassName2 = `${rootClassName5}Header`;
|
|
4859
5166
|
var UPDATE_SCROLL = (node, scrollPosition) => {
|
|
@@ -4886,7 +5193,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4886
5193
|
},
|
|
4887
5194
|
computed: { computedVisibleColumnsMap: columnsMap }
|
|
4888
5195
|
} = useInfiniteTable();
|
|
4889
|
-
const domRef =
|
|
5196
|
+
const domRef = useRef10(null);
|
|
4890
5197
|
const hasColumnGroups = computedColumnGroups.size > 0;
|
|
4891
5198
|
const columnHeaderGroups = useMemo8(() => {
|
|
4892
5199
|
return hasColumnGroups ? renderColumnHeaderGroups({
|
|
@@ -4919,7 +5226,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4919
5226
|
if (totalWidth != null) {
|
|
4920
5227
|
style.width = availableWidth;
|
|
4921
5228
|
}
|
|
4922
|
-
|
|
5229
|
+
useEffect15(() => {
|
|
4923
5230
|
const scroller = brain || scrollListener;
|
|
4924
5231
|
if (!scroller || !scrollable) {
|
|
4925
5232
|
return;
|
|
@@ -5036,12 +5343,12 @@ import {
|
|
|
5036
5343
|
createElement as createElement20,
|
|
5037
5344
|
forwardRef as forwardRef2
|
|
5038
5345
|
} from "react";
|
|
5039
|
-
import { useRef as
|
|
5346
|
+
import { useRef as useRef11 } from "react";
|
|
5040
5347
|
|
|
5041
5348
|
// src/components/hooks/useOnScroll.ts
|
|
5042
|
-
import { useEffect as
|
|
5349
|
+
import { useEffect as useEffect16 } from "react";
|
|
5043
5350
|
var useOnScroll = (domRef, onScroll) => {
|
|
5044
|
-
|
|
5351
|
+
useEffect16(() => {
|
|
5045
5352
|
const domNode = domRef == null ? void 0 : domRef.current;
|
|
5046
5353
|
const scrollFn = (event) => {
|
|
5047
5354
|
const node = event.target;
|
|
@@ -5087,7 +5394,7 @@ var VirtualScrollContainer = forwardRef2(function VirtualScrollContainer2(props,
|
|
|
5087
5394
|
className,
|
|
5088
5395
|
style
|
|
5089
5396
|
} = props;
|
|
5090
|
-
const domRef = ref != null ? ref :
|
|
5397
|
+
const domRef = ref != null ? ref : useRef11(null);
|
|
5091
5398
|
useOnScroll(domRef, onContainerScroll);
|
|
5092
5399
|
return /* @__PURE__ */ createElement20("div", {
|
|
5093
5400
|
ref: domRef,
|
|
@@ -5121,7 +5428,7 @@ function SpacePlaceholderFn(props) {
|
|
|
5121
5428
|
var SpacePlaceholder = memo8(SpacePlaceholderFn);
|
|
5122
5429
|
|
|
5123
5430
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
5124
|
-
import { useCallback as useCallback17, useEffect as
|
|
5431
|
+
import { useCallback as useCallback17, useEffect as useEffect22, useMemo as useMemo10, useRef as useRef17 } from "react";
|
|
5125
5432
|
|
|
5126
5433
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
5127
5434
|
import {
|
|
@@ -5140,10 +5447,10 @@ import {
|
|
|
5140
5447
|
Fragment as Fragment4,
|
|
5141
5448
|
createElement as createElement22
|
|
5142
5449
|
} from "react";
|
|
5143
|
-
import { useRef as
|
|
5450
|
+
import { useRef as useRef12, useEffect as useEffect17, useState as useState9 } from "react";
|
|
5144
5451
|
|
|
5145
5452
|
// src/components/VirtualList/VirtualList.css.ts
|
|
5146
|
-
var VirtualListCls = "
|
|
5453
|
+
var VirtualListCls = "_16lm1iw1 _16lm1iw8 _16lm1iw0";
|
|
5147
5454
|
var VirtualListClsOrientation = { horizontal: "mlx2t1", vertical: "mlx2t2" };
|
|
5148
5455
|
var scrollTransformTargetCls = "mlx2t3";
|
|
5149
5456
|
|
|
@@ -5183,11 +5490,11 @@ var VirtualList = (props) => {
|
|
|
5183
5490
|
"onContainerScroll",
|
|
5184
5491
|
"children"
|
|
5185
5492
|
]);
|
|
5186
|
-
const domRef =
|
|
5493
|
+
const domRef = useRef12(null);
|
|
5187
5494
|
const [, rerender] = useRerender();
|
|
5188
|
-
const [totalSize, setTotalSize] =
|
|
5189
|
-
const renderCountRef =
|
|
5190
|
-
|
|
5495
|
+
const [totalSize, setTotalSize] = useState9(0);
|
|
5496
|
+
const renderCountRef = useRef12(0);
|
|
5497
|
+
useEffect17(() => {
|
|
5191
5498
|
const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
|
|
5192
5499
|
renderCountRef.current = renderCount;
|
|
5193
5500
|
if (true) {
|
|
@@ -5206,7 +5513,7 @@ var VirtualList = (props) => {
|
|
|
5206
5513
|
removeOnTotalSizeChange();
|
|
5207
5514
|
};
|
|
5208
5515
|
}, [virtualBrain]);
|
|
5209
|
-
|
|
5516
|
+
useEffect17(() => {
|
|
5210
5517
|
const onScroll = (scrollPosition) => {
|
|
5211
5518
|
UPDATE_SCROLL2(domRef.current, scrollPosition);
|
|
5212
5519
|
};
|
|
@@ -5264,7 +5571,7 @@ import {
|
|
|
5264
5571
|
memo as memo10,
|
|
5265
5572
|
useCallback as useCallback11
|
|
5266
5573
|
} from "react";
|
|
5267
|
-
import { useRef as
|
|
5574
|
+
import { useRef as useRef14 } from "react";
|
|
5268
5575
|
|
|
5269
5576
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5270
5577
|
import {
|
|
@@ -5297,32 +5604,38 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5297
5604
|
const groupRowInfo = null;
|
|
5298
5605
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
5299
5606
|
if (column.valueGetter) {
|
|
5300
|
-
value = column.valueGetter({
|
|
5301
|
-
data,
|
|
5302
|
-
rowInfo
|
|
5303
|
-
|
|
5607
|
+
value = column.valueGetter(isGroupRow ? {
|
|
5608
|
+
data: rowInfo.data,
|
|
5609
|
+
rowInfo
|
|
5610
|
+
} : {
|
|
5611
|
+
data: rowInfo.data,
|
|
5612
|
+
rowInfo
|
|
5304
5613
|
});
|
|
5305
5614
|
}
|
|
5306
5615
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
5307
|
-
const
|
|
5308
|
-
|
|
5309
|
-
|
|
5616
|
+
const rest = rowInfo.isGroupRow ? {
|
|
5617
|
+
rowInfo,
|
|
5618
|
+
data: rowInfo.data
|
|
5619
|
+
} : {
|
|
5310
5620
|
rowInfo,
|
|
5311
|
-
data
|
|
5621
|
+
data: rowInfo.data
|
|
5312
5622
|
};
|
|
5623
|
+
const stylingRenderParam = __spreadValues({
|
|
5624
|
+
value,
|
|
5625
|
+
column
|
|
5626
|
+
}, rest);
|
|
5313
5627
|
let renderValue = value;
|
|
5314
5628
|
if (column.render || column.renderValue) {
|
|
5315
|
-
const renderParam = {
|
|
5629
|
+
const renderParam = __spreadProps(__spreadValues({
|
|
5316
5630
|
value,
|
|
5317
5631
|
column,
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
data,
|
|
5632
|
+
groupRowInfo
|
|
5633
|
+
}, rest), {
|
|
5321
5634
|
rowIndex,
|
|
5322
5635
|
toggleGroupRow,
|
|
5323
5636
|
toggleCurrentGroupRow: () => toggleGroupRow(rowInfo.groupKeys),
|
|
5324
|
-
|
|
5325
|
-
};
|
|
5637
|
+
groupBy: computedDataSource.groupBy
|
|
5638
|
+
});
|
|
5326
5639
|
if (column.render) {
|
|
5327
5640
|
renderValue = column.render(renderParam);
|
|
5328
5641
|
} else if (column.renderValue) {
|
|
@@ -5373,7 +5686,7 @@ var InfiniteTableColumnCell = memo9(InfiniteTableColumnCellFn);
|
|
|
5373
5686
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
5374
5687
|
import {
|
|
5375
5688
|
useCallback as useCallback10,
|
|
5376
|
-
useRef as
|
|
5689
|
+
useRef as useRef13
|
|
5377
5690
|
} from "react";
|
|
5378
5691
|
|
|
5379
5692
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
|
|
@@ -5399,17 +5712,16 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5399
5712
|
domRef: domRefFromProps,
|
|
5400
5713
|
rowInfo
|
|
5401
5714
|
} = props;
|
|
5402
|
-
const domRef =
|
|
5715
|
+
const domRef = useRef13(null);
|
|
5403
5716
|
const rowDOMRef = useCallback10((node) => {
|
|
5404
5717
|
domRefFromProps(node);
|
|
5405
5718
|
domRef.current = node;
|
|
5406
5719
|
}, []);
|
|
5407
|
-
const
|
|
5408
|
-
|
|
5409
|
-
rowInfo,
|
|
5720
|
+
const rest = rowInfo.isGroupRow ? { data: rowInfo.data, rowInfo } : { data: rowInfo.data, rowInfo };
|
|
5721
|
+
const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
|
|
5410
5722
|
rowIndex,
|
|
5411
|
-
|
|
5412
|
-
};
|
|
5723
|
+
groupBy: rowInfo.groupBy
|
|
5724
|
+
});
|
|
5413
5725
|
if (typeof rowProps === "function") {
|
|
5414
5726
|
rowProps = rowProps(rowPropsAndStyleArgs);
|
|
5415
5727
|
}
|
|
@@ -5502,7 +5814,7 @@ function InfiniteTableRowFn(props) {
|
|
|
5502
5814
|
width: rowWidth,
|
|
5503
5815
|
height: rowHeight
|
|
5504
5816
|
}, domProps.style);
|
|
5505
|
-
const renderCellRef =
|
|
5817
|
+
const renderCellRef = useRef14(null);
|
|
5506
5818
|
const renderCell = useCallback11(({ domRef, itemIndex }) => {
|
|
5507
5819
|
const column = columns[itemIndex];
|
|
5508
5820
|
if (!column) {
|
|
@@ -5675,23 +5987,23 @@ function useUnpinnedRendering(params) {
|
|
|
5675
5987
|
}
|
|
5676
5988
|
|
|
5677
5989
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5678
|
-
import { useCallback as useCallback13, useEffect as
|
|
5990
|
+
import { useCallback as useCallback13, useEffect as useEffect18, useRef as useRef15 } from "react";
|
|
5679
5991
|
|
|
5680
5992
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5681
|
-
var
|
|
5993
|
+
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5682
5994
|
var FooterCls = "_16lm1iw1";
|
|
5683
5995
|
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwj _16lm1iwz _16lm1iw0";
|
|
5684
|
-
var InfiniteClsRecipe = (0,
|
|
5996
|
+
var InfiniteClsRecipe = (0, import_createRuntimeFn5.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: [] });
|
|
5685
5997
|
var InfiniteClsScrolling = "_1yeub2v1";
|
|
5686
5998
|
var InfiniteClsShiftingColumns = "_16lm1iwm";
|
|
5687
5999
|
var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
|
|
5688
|
-
var PinnedRowsContainerClsVariants = (0,
|
|
6000
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5689
6001
|
|
|
5690
6002
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5691
6003
|
var DELAY = 200;
|
|
5692
6004
|
var TableClassName = internalProps.rootClassName;
|
|
5693
6005
|
var TableClassName__Scrolling = `${TableClassName}--scrolling`;
|
|
5694
|
-
var SCROLL_BOTTOM_OFFSET =
|
|
6006
|
+
var SCROLL_BOTTOM_OFFSET = 1;
|
|
5695
6007
|
var useOnContainerScroll = ({
|
|
5696
6008
|
verticalVirtualBrain,
|
|
5697
6009
|
horizontalVirtualBrain,
|
|
@@ -5707,10 +6019,11 @@ var useOnContainerScroll = ({
|
|
|
5707
6019
|
bodySize
|
|
5708
6020
|
}
|
|
5709
6021
|
} = useInfiniteTable();
|
|
5710
|
-
const
|
|
5711
|
-
const
|
|
5712
|
-
const
|
|
5713
|
-
|
|
6022
|
+
const { componentActions: dataSourceActions, getState: getDataSourceState } = useDataSourceContextValue();
|
|
6023
|
+
const timeoutIdRef = useRef15(0);
|
|
6024
|
+
const scrollingRef = useRef15(false);
|
|
6025
|
+
const scrollTopMaxRef = useRef15(0);
|
|
6026
|
+
useEffect18(() => {
|
|
5714
6027
|
const { current: node } = scrollerDOMRef;
|
|
5715
6028
|
scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
|
|
5716
6029
|
}, [reservedContentHeight, bodySize.height]);
|
|
@@ -5749,7 +6062,7 @@ var useOnContainerScroll = ({
|
|
|
5749
6062
|
domRef.current,
|
|
5750
6063
|
setScrolling
|
|
5751
6064
|
]);
|
|
5752
|
-
const scrollPositionRef =
|
|
6065
|
+
const scrollPositionRef = useRef15({
|
|
5753
6066
|
scrollLeft: 0,
|
|
5754
6067
|
scrollTop: 0
|
|
5755
6068
|
});
|
|
@@ -5767,6 +6080,9 @@ var useOnContainerScroll = ({
|
|
|
5767
6080
|
const isScrollBottom = scrollTop + offset >= scrollTopMaxRef.current;
|
|
5768
6081
|
if (isScrollBottom) {
|
|
5769
6082
|
onScrollToBottom == null ? void 0 : onScrollToBottom();
|
|
6083
|
+
if (getDataSourceState().livePagination) {
|
|
6084
|
+
dataSourceActions.scrollBottomId = Date.now();
|
|
6085
|
+
}
|
|
5770
6086
|
}
|
|
5771
6087
|
}, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
|
|
5772
6088
|
return {
|
|
@@ -5786,12 +6102,12 @@ import { useCallback as useCallback15 } from "react";
|
|
|
5786
6102
|
import {
|
|
5787
6103
|
createElement as createElement28
|
|
5788
6104
|
} from "react";
|
|
5789
|
-
import { useEffect as
|
|
6105
|
+
import { useEffect as useEffect20, useCallback as useCallback14, useRef as useRef16 } from "react";
|
|
5790
6106
|
|
|
5791
6107
|
// src/components/hooks/useOnMount.ts
|
|
5792
|
-
import { useEffect as
|
|
6108
|
+
import { useEffect as useEffect19 } from "react";
|
|
5793
6109
|
function useOnMount(domRef, props) {
|
|
5794
|
-
|
|
6110
|
+
useEffect19(() => {
|
|
5795
6111
|
const { onMount, onUnmount } = props;
|
|
5796
6112
|
const node = domRef == null ? void 0 : domRef.current;
|
|
5797
6113
|
onMount == null ? void 0 : onMount(node);
|
|
@@ -5822,7 +6138,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5822
6138
|
onMount,
|
|
5823
6139
|
onUnmount
|
|
5824
6140
|
} = props;
|
|
5825
|
-
const domRef =
|
|
6141
|
+
const domRef = useRef16(null);
|
|
5826
6142
|
const renderItem = useCallback14((renderProps) => renderRow({
|
|
5827
6143
|
domRef: renderProps.domRef,
|
|
5828
6144
|
rowHeight: renderProps.itemSize,
|
|
@@ -5832,7 +6148,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5832
6148
|
onMount,
|
|
5833
6149
|
onUnmount
|
|
5834
6150
|
});
|
|
5835
|
-
|
|
6151
|
+
useEffect20(() => {
|
|
5836
6152
|
const onScroll = (scrollPosition) => {
|
|
5837
6153
|
const node = domRef.current;
|
|
5838
6154
|
if (node) {
|
|
@@ -6055,7 +6371,7 @@ function usePinnedStartRendering(params) {
|
|
|
6055
6371
|
}
|
|
6056
6372
|
|
|
6057
6373
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
6058
|
-
import { useEffect as
|
|
6374
|
+
import { useEffect as useEffect21 } from "react";
|
|
6059
6375
|
|
|
6060
6376
|
// src/components/VirtualBrain/index.ts
|
|
6061
6377
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
@@ -6534,7 +6850,7 @@ function useYourBrain(param) {
|
|
|
6534
6850
|
});
|
|
6535
6851
|
return brain;
|
|
6536
6852
|
});
|
|
6537
|
-
|
|
6853
|
+
useEffect21(() => {
|
|
6538
6854
|
return () => {
|
|
6539
6855
|
horizontalVirtualBrain.destroy();
|
|
6540
6856
|
verticalVirtualBrain.destroy();
|
|
@@ -6542,13 +6858,13 @@ function useYourBrain(param) {
|
|
|
6542
6858
|
}, []);
|
|
6543
6859
|
horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
|
|
6544
6860
|
verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
|
|
6545
|
-
|
|
6861
|
+
useEffect21(() => {
|
|
6546
6862
|
verticalVirtualBrain.setAvailableSize({
|
|
6547
6863
|
height: bodySize.height,
|
|
6548
6864
|
width: 0
|
|
6549
6865
|
});
|
|
6550
6866
|
}, [bodySize, verticalVirtualBrain]);
|
|
6551
|
-
|
|
6867
|
+
useEffect21(() => {
|
|
6552
6868
|
horizontalVirtualBrain.setAvailableSize({
|
|
6553
6869
|
height: 0,
|
|
6554
6870
|
width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
|
|
@@ -6557,29 +6873,6 @@ function useYourBrain(param) {
|
|
|
6557
6873
|
return { horizontalVirtualBrain, verticalVirtualBrain };
|
|
6558
6874
|
}
|
|
6559
6875
|
|
|
6560
|
-
// src/utils/shallowEqualObjects.ts
|
|
6561
|
-
function shallowEqualObjects(objA, objB) {
|
|
6562
|
-
if (objA === objB) {
|
|
6563
|
-
return true;
|
|
6564
|
-
}
|
|
6565
|
-
if (!objA || !objB) {
|
|
6566
|
-
return false;
|
|
6567
|
-
}
|
|
6568
|
-
var aKeys = Object.keys(objA);
|
|
6569
|
-
var bKeys = Object.keys(objB);
|
|
6570
|
-
var len = aKeys.length;
|
|
6571
|
-
if (bKeys.length !== len) {
|
|
6572
|
-
return false;
|
|
6573
|
-
}
|
|
6574
|
-
for (var i = 0; i < len; i++) {
|
|
6575
|
-
var key = aKeys[i];
|
|
6576
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
6577
|
-
return false;
|
|
6578
|
-
}
|
|
6579
|
-
}
|
|
6580
|
-
return true;
|
|
6581
|
-
}
|
|
6582
|
-
|
|
6583
6876
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
6584
6877
|
function useListRendering(param) {
|
|
6585
6878
|
const { computed, bodySize, columnShifts } = param;
|
|
@@ -6609,7 +6902,7 @@ function useListRendering(param) {
|
|
|
6609
6902
|
pinnedEndScrollListener
|
|
6610
6903
|
} = componentState;
|
|
6611
6904
|
const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
|
|
6612
|
-
const repaintIdRef =
|
|
6905
|
+
const repaintIdRef = useRef17(0);
|
|
6613
6906
|
if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
|
|
6614
6907
|
repaintIdRef.current++;
|
|
6615
6908
|
}
|
|
@@ -6651,12 +6944,12 @@ function useListRendering(param) {
|
|
|
6651
6944
|
});
|
|
6652
6945
|
const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
|
|
6653
6946
|
const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
6654
|
-
const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
|
|
6947
|
+
const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
|
|
6655
6948
|
const scrollbars = useMemo10(() => ({
|
|
6656
6949
|
vertical: hasVerticalScrollbar,
|
|
6657
6950
|
horizontal: hasHorizontalScrollbar
|
|
6658
6951
|
}), [hasVerticalScrollbar, hasHorizontalScrollbar]);
|
|
6659
|
-
|
|
6952
|
+
useEffect22(() => {
|
|
6660
6953
|
if (!bodySize.height) {
|
|
6661
6954
|
return;
|
|
6662
6955
|
}
|
|
@@ -6669,7 +6962,6 @@ function useListRendering(param) {
|
|
|
6669
6962
|
setColumnVisibility: (columnVisibility) => {
|
|
6670
6963
|
componentActions.columnVisibility = columnVisibility;
|
|
6671
6964
|
},
|
|
6672
|
-
setColumnAggregations: (columnAggregations) => componentActions.columnAggregations = columnAggregations,
|
|
6673
6965
|
getState,
|
|
6674
6966
|
getDataSourceState
|
|
6675
6967
|
};
|
|
@@ -6717,7 +7009,7 @@ function useListRendering(param) {
|
|
|
6717
7009
|
computedUnpinnedColumns
|
|
6718
7010
|
});
|
|
6719
7011
|
const [, rerender] = useRerender();
|
|
6720
|
-
|
|
7012
|
+
useEffect22(() => {
|
|
6721
7013
|
rerender();
|
|
6722
7014
|
}, [dataSourceState]);
|
|
6723
7015
|
const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
|
|
@@ -6744,16 +7036,15 @@ import {
|
|
|
6744
7036
|
createElement as createElement30,
|
|
6745
7037
|
forwardRef as forwardRef3,
|
|
6746
7038
|
useCallback as useCallback18,
|
|
6747
|
-
useRef as
|
|
7039
|
+
useRef as useRef18
|
|
6748
7040
|
} from "react";
|
|
6749
|
-
import { useEffect as
|
|
7041
|
+
import { useEffect as useEffect23 } from "react";
|
|
6750
7042
|
|
|
6751
7043
|
// src/components/utils/decamelize.ts
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
};
|
|
7044
|
+
function decamelize(str, options) {
|
|
7045
|
+
const { separator } = options != null ? options : { separator: "-" };
|
|
7046
|
+
return str.replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2").replace(new RegExp("(" + separator + "[A-Z])([A-Z])", "g"), "$1" + separator + "$2").toLowerCase();
|
|
7047
|
+
}
|
|
6757
7048
|
|
|
6758
7049
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
6759
7050
|
var defaultStyle2 = {
|
|
@@ -6784,7 +7075,7 @@ var enforceStyle = (node, style) => {
|
|
|
6784
7075
|
};
|
|
6785
7076
|
var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter2(props, ref) {
|
|
6786
7077
|
const { rootClassName: rootClassName12 } = useInternalProps();
|
|
6787
|
-
const domRef =
|
|
7078
|
+
const domRef = useRef18(null);
|
|
6788
7079
|
const domCallback = useCallback18((node) => {
|
|
6789
7080
|
domRef.current = node;
|
|
6790
7081
|
if (!ref) {
|
|
@@ -6796,7 +7087,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
6796
7087
|
ref.current = node;
|
|
6797
7088
|
}
|
|
6798
7089
|
}, []);
|
|
6799
|
-
|
|
7090
|
+
useEffect23(() => {
|
|
6800
7091
|
const forceStyle = () => {
|
|
6801
7092
|
requestAnimationFrame(() => {
|
|
6802
7093
|
var _a;
|
|
@@ -6973,11 +7264,11 @@ var SANDBOX_REGEX = /(https):\/\/\d+\-\d+\-\d\-(sandpack\.codesandbox\.io)/g;
|
|
|
6973
7264
|
var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
6974
7265
|
var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
|
|
6975
7266
|
var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
|
|
6976
|
-
var useLicense = (licenseKey) => {
|
|
7267
|
+
var useLicense = (licenseKey = "") => {
|
|
6977
7268
|
const valid = useMemo11(() => {
|
|
6978
7269
|
let valid2 = isValidLicense(licenseKey, {
|
|
6979
7270
|
publishedAt: 1624970570587,
|
|
6980
|
-
version: "0.0
|
|
7271
|
+
version: "0.1.0"
|
|
6981
7272
|
});
|
|
6982
7273
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
6983
7274
|
return true;
|
|
@@ -6993,8 +7284,8 @@ import {
|
|
|
6993
7284
|
useCallback as useCallback19,
|
|
6994
7285
|
useLayoutEffect as useLayoutEffect5
|
|
6995
7286
|
} from "react";
|
|
6996
|
-
import { useRef as
|
|
6997
|
-
var
|
|
7287
|
+
import { useRef as useRef19 } from "react";
|
|
7288
|
+
var error = err("CSSVariableWatch");
|
|
6998
7289
|
var debug5 = dbg("CSSVariableWatch");
|
|
6999
7290
|
var WRAPPER_STYLE = {
|
|
7000
7291
|
position: "absolute",
|
|
@@ -7006,7 +7297,7 @@ var WRAPPER_STYLE = {
|
|
|
7006
7297
|
overflow: "hidden"
|
|
7007
7298
|
};
|
|
7008
7299
|
var useCSSVariableWatch = (params) => {
|
|
7009
|
-
const lastValueRef =
|
|
7300
|
+
const lastValueRef = useRef19(0);
|
|
7010
7301
|
const onResize = useCallback19(({ height }) => {
|
|
7011
7302
|
if (height && height !== lastValueRef.current) {
|
|
7012
7303
|
lastValueRef.current = height;
|
|
@@ -7021,12 +7312,12 @@ var useCSSVariableWatch = (params) => {
|
|
|
7021
7312
|
debug5(`Variable ${params.varName} found and equals ${value}.`);
|
|
7022
7313
|
params.onChange(value);
|
|
7023
7314
|
} else {
|
|
7024
|
-
|
|
7315
|
+
error(`Specified variable ${params.varName} not found or does not have a numeric value.`);
|
|
7025
7316
|
}
|
|
7026
7317
|
}, []);
|
|
7027
7318
|
};
|
|
7028
7319
|
var CSSVariableWatch = (props) => {
|
|
7029
|
-
const domRef =
|
|
7320
|
+
const domRef = useRef19(null);
|
|
7030
7321
|
useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
|
|
7031
7322
|
ref: domRef
|
|
7032
7323
|
}));
|
|
@@ -7171,9 +7462,15 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
7171
7462
|
});
|
|
7172
7463
|
var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
7173
7464
|
var _a;
|
|
7174
|
-
const { componentState, getComputed, computed } = useInfiniteTable();
|
|
7175
7465
|
const {
|
|
7176
|
-
componentState
|
|
7466
|
+
componentState,
|
|
7467
|
+
getComputed,
|
|
7468
|
+
computed,
|
|
7469
|
+
getState: getInfiniteTableState
|
|
7470
|
+
} = useInfiniteTable();
|
|
7471
|
+
const {
|
|
7472
|
+
componentState: { dataArray, loading },
|
|
7473
|
+
getState: getDataSourceState
|
|
7177
7474
|
} = useDataSourceContextValue();
|
|
7178
7475
|
const {
|
|
7179
7476
|
domRef,
|
|
@@ -7210,6 +7507,15 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
|
7210
7507
|
const licenseValid = useLicense(licenseKey);
|
|
7211
7508
|
const domProps = useDOMProps(componentState.domProps);
|
|
7212
7509
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
7510
|
+
useLayoutEffect6(() => {
|
|
7511
|
+
const dataSourceState = getDataSourceState();
|
|
7512
|
+
const { onScrollbarsChange } = getInfiniteTableState();
|
|
7513
|
+
const { notifyScrollbarsChange } = dataSourceState;
|
|
7514
|
+
if (onScrollbarsChange && dataSourceState.updatedAt && dataSourceState.dataArray.length) {
|
|
7515
|
+
onScrollbarsChange(scrollbars);
|
|
7516
|
+
}
|
|
7517
|
+
notifyScrollbarsChange(scrollbars);
|
|
7518
|
+
}, [scrollbars]);
|
|
7213
7519
|
return /* @__PURE__ */ createElement33("div", __spreadValues({
|
|
7214
7520
|
ref: domRef
|
|
7215
7521
|
}, domProps), header ? /* @__PURE__ */ createElement33(TableHeaderWrapper, {
|
|
@@ -7241,7 +7547,7 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
|
7241
7547
|
});
|
|
7242
7548
|
function InfiniteTableContextProvider() {
|
|
7243
7549
|
const { componentActions, componentState } = useComponentState();
|
|
7244
|
-
const { scrollerDOMRef } = componentState;
|
|
7550
|
+
const { scrollerDOMRef, scrollTopId } = componentState;
|
|
7245
7551
|
const computed = useComputed();
|
|
7246
7552
|
const getComputed = useLatest(computed);
|
|
7247
7553
|
const getState = useLatest(componentState);
|
|
@@ -7270,12 +7576,17 @@ function InfiniteTableContextProvider() {
|
|
|
7270
7576
|
}
|
|
7271
7577
|
componentActions.bodySize = bodySize;
|
|
7272
7578
|
}, { earlyAttach: true });
|
|
7273
|
-
|
|
7579
|
+
useEffect24(() => {
|
|
7274
7580
|
return () => {
|
|
7275
7581
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
7276
7582
|
componentState.onHeaderHeightCSSVarChange.destroy();
|
|
7277
7583
|
};
|
|
7278
7584
|
}, []);
|
|
7585
|
+
useEffect24(() => {
|
|
7586
|
+
if (scrollerDOMRef.current) {
|
|
7587
|
+
scrollerDOMRef.current.scrollTop = 0;
|
|
7588
|
+
}
|
|
7589
|
+
}, [scrollTopId, scrollerDOMRef]);
|
|
7279
7590
|
const TableContext2 = getInfiniteTableContext();
|
|
7280
7591
|
return /* @__PURE__ */ createElement33(TableContext2.Provider, {
|
|
7281
7592
|
value: contextValue
|
|
@@ -7300,6 +7611,7 @@ export {
|
|
|
7300
7611
|
getComponentStateRoot,
|
|
7301
7612
|
group,
|
|
7302
7613
|
interceptMap,
|
|
7614
|
+
multisort,
|
|
7303
7615
|
useComponentState,
|
|
7304
7616
|
useDataSource
|
|
7305
7617
|
};
|