@infinite-table/infinite-react 0.0.5 → 0.0.9
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 +0 -3
- package/index.d.ts +210 -111
- package/index.esm.js +852 -482
- package/index.js +882 -513
- package/package.json +2 -2
- package/tmp.css.map +0 -1
package/index.js
CHANGED
|
@@ -53,26 +53,6 @@ var __reExport = (target, module2, desc) => {
|
|
|
53
53
|
var __toModule = (module2) => {
|
|
54
54
|
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
55
55
|
};
|
|
56
|
-
var __async = (__this, __arguments, generator) => {
|
|
57
|
-
return new Promise((resolve, reject) => {
|
|
58
|
-
var fulfilled = (value) => {
|
|
59
|
-
try {
|
|
60
|
-
step(generator.next(value));
|
|
61
|
-
} catch (e) {
|
|
62
|
-
reject(e);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
var rejected = (value) => {
|
|
66
|
-
try {
|
|
67
|
-
step(generator.throw(value));
|
|
68
|
-
} catch (e) {
|
|
69
|
-
reject(e);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
73
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
56
|
|
|
77
57
|
// node_modules/ms/index.js
|
|
78
58
|
var require_ms = __commonJS({
|
|
@@ -216,6 +196,8 @@ var require_common = __commonJS({
|
|
|
216
196
|
function createDebug(namespace) {
|
|
217
197
|
let prevTime;
|
|
218
198
|
let enableOverride = null;
|
|
199
|
+
let namespacesCache;
|
|
200
|
+
let enabledCache;
|
|
219
201
|
function debug6(...args) {
|
|
220
202
|
if (!debug6.enabled) {
|
|
221
203
|
return;
|
|
@@ -258,7 +240,16 @@ var require_common = __commonJS({
|
|
|
258
240
|
Object.defineProperty(debug6, "enabled", {
|
|
259
241
|
enumerable: true,
|
|
260
242
|
configurable: false,
|
|
261
|
-
get: () =>
|
|
243
|
+
get: () => {
|
|
244
|
+
if (enableOverride !== null) {
|
|
245
|
+
return enableOverride;
|
|
246
|
+
}
|
|
247
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
248
|
+
namespacesCache = createDebug.namespaces;
|
|
249
|
+
enabledCache = createDebug.enabled(namespace);
|
|
250
|
+
}
|
|
251
|
+
return enabledCache;
|
|
252
|
+
},
|
|
262
253
|
set: (v) => {
|
|
263
254
|
enableOverride = v;
|
|
264
255
|
}
|
|
@@ -275,6 +266,7 @@ var require_common = __commonJS({
|
|
|
275
266
|
}
|
|
276
267
|
function enable(namespaces) {
|
|
277
268
|
createDebug.save(namespaces);
|
|
269
|
+
createDebug.namespaces = namespaces;
|
|
278
270
|
createDebug.names = [];
|
|
279
271
|
createDebug.skips = [];
|
|
280
272
|
let i;
|
|
@@ -470,14 +462,14 @@ var require_browser = __commonJS({
|
|
|
470
462
|
} else {
|
|
471
463
|
exports.storage.removeItem("debug");
|
|
472
464
|
}
|
|
473
|
-
} catch (
|
|
465
|
+
} catch (error2) {
|
|
474
466
|
}
|
|
475
467
|
}
|
|
476
468
|
function load() {
|
|
477
469
|
let r;
|
|
478
470
|
try {
|
|
479
471
|
r = exports.storage.getItem("debug");
|
|
480
|
-
} catch (
|
|
472
|
+
} catch (error2) {
|
|
481
473
|
}
|
|
482
474
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
483
475
|
r = process.env.DEBUG;
|
|
@@ -487,7 +479,7 @@ var require_browser = __commonJS({
|
|
|
487
479
|
function localstorage() {
|
|
488
480
|
try {
|
|
489
481
|
return localStorage;
|
|
490
|
-
} catch (
|
|
482
|
+
} catch (error2) {
|
|
491
483
|
}
|
|
492
484
|
}
|
|
493
485
|
module2.exports = require_common()(exports);
|
|
@@ -495,13 +487,106 @@ var require_browser = __commonJS({
|
|
|
495
487
|
formatters.j = function(v) {
|
|
496
488
|
try {
|
|
497
489
|
return JSON.stringify(v);
|
|
498
|
-
} catch (
|
|
499
|
-
return "[UnexpectedJSONParseError]: " +
|
|
490
|
+
} catch (error2) {
|
|
491
|
+
return "[UnexpectedJSONParseError]: " + error2.message;
|
|
500
492
|
}
|
|
501
493
|
};
|
|
502
494
|
}
|
|
503
495
|
});
|
|
504
496
|
|
|
497
|
+
// node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.dev.js
|
|
498
|
+
var require_vanilla_extract_recipes_createRuntimeFn_cjs_dev = __commonJS({
|
|
499
|
+
"node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.dev.js"(exports) {
|
|
500
|
+
"use strict";
|
|
501
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
502
|
+
function _defineProperty(obj, key, value) {
|
|
503
|
+
if (key in obj) {
|
|
504
|
+
Object.defineProperty(obj, key, {
|
|
505
|
+
value,
|
|
506
|
+
enumerable: true,
|
|
507
|
+
configurable: true,
|
|
508
|
+
writable: true
|
|
509
|
+
});
|
|
510
|
+
} else {
|
|
511
|
+
obj[key] = value;
|
|
512
|
+
}
|
|
513
|
+
return obj;
|
|
514
|
+
}
|
|
515
|
+
function ownKeys(object, enumerableOnly) {
|
|
516
|
+
var keys = Object.keys(object);
|
|
517
|
+
if (Object.getOwnPropertySymbols) {
|
|
518
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
519
|
+
if (enumerableOnly) {
|
|
520
|
+
symbols = symbols.filter(function(sym) {
|
|
521
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
keys.push.apply(keys, symbols);
|
|
525
|
+
}
|
|
526
|
+
return keys;
|
|
527
|
+
}
|
|
528
|
+
function _objectSpread2(target) {
|
|
529
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
530
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
531
|
+
if (i % 2) {
|
|
532
|
+
ownKeys(Object(source), true).forEach(function(key) {
|
|
533
|
+
_defineProperty(target, key, source[key]);
|
|
534
|
+
});
|
|
535
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
536
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
537
|
+
} else {
|
|
538
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
539
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
return target;
|
|
544
|
+
}
|
|
545
|
+
var shouldApplyCompound = (compoundCheck, selections) => {
|
|
546
|
+
for (var key of Object.keys(compoundCheck)) {
|
|
547
|
+
if (compoundCheck[key] !== selections[key]) {
|
|
548
|
+
return false;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return true;
|
|
552
|
+
};
|
|
553
|
+
var createRuntimeFn = (config) => (options) => {
|
|
554
|
+
var className = config.defaultClassName;
|
|
555
|
+
var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
|
|
556
|
+
for (var variantName in selections) {
|
|
557
|
+
var _selections$variantNa;
|
|
558
|
+
var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
559
|
+
if (variantSelection != null) {
|
|
560
|
+
var selection = variantSelection;
|
|
561
|
+
if (typeof selection === "boolean") {
|
|
562
|
+
selection = selection === true ? "true" : "false";
|
|
563
|
+
}
|
|
564
|
+
className += " " + config.variantClassNames[variantName][selection];
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
|
|
568
|
+
if (shouldApplyCompound(compoundCheck, selections)) {
|
|
569
|
+
className += " " + compoundClassName;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
return className;
|
|
573
|
+
};
|
|
574
|
+
exports.createRuntimeFn = createRuntimeFn;
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
// node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.js
|
|
579
|
+
var require_vanilla_extract_recipes_createRuntimeFn_cjs = __commonJS({
|
|
580
|
+
"node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.js"(exports, module2) {
|
|
581
|
+
"use strict";
|
|
582
|
+
if (false) {
|
|
583
|
+
module2.exports = null;
|
|
584
|
+
} else {
|
|
585
|
+
module2.exports = require_vanilla_extract_recipes_createRuntimeFn_cjs_dev();
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
|
|
505
590
|
// node_modules/binary-search/index.js
|
|
506
591
|
var require_binary_search = __commonJS({
|
|
507
592
|
"node_modules/binary-search/index.js"(exports, module2) {
|
|
@@ -563,7 +648,7 @@ var require_decamelize = __commonJS({
|
|
|
563
648
|
if (preserveConsecutiveUppercase) {
|
|
564
649
|
return handlePreserveConsecutiveUppercase(decamelized, separator);
|
|
565
650
|
}
|
|
566
|
-
return decamelized.replace(/(\p{Uppercase_Letter}
|
|
651
|
+
return decamelized.replace(/(\p{Uppercase_Letter})(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, replacement).toLowerCase();
|
|
567
652
|
};
|
|
568
653
|
}
|
|
569
654
|
});
|
|
@@ -580,6 +665,7 @@ __export(exports, {
|
|
|
580
665
|
getComponentStateRoot: () => getComponentStateRoot,
|
|
581
666
|
group: () => group,
|
|
582
667
|
interceptMap: () => interceptMap,
|
|
668
|
+
multisort: () => multisort,
|
|
583
669
|
useComponentState: () => useComponentState,
|
|
584
670
|
useDataSource: () => useDataSource
|
|
585
671
|
});
|
|
@@ -667,7 +753,7 @@ var ScrollListener = class {
|
|
|
667
753
|
|
|
668
754
|
// src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
|
|
669
755
|
function computeColumnGroupsDepths(columnGroups) {
|
|
670
|
-
const
|
|
756
|
+
const map2 = new Map();
|
|
671
757
|
columnGroups.forEach((colGroup, colGroupId) => {
|
|
672
758
|
let parentGroupId = colGroup.columnGroup;
|
|
673
759
|
let depth = 0;
|
|
@@ -682,12 +768,24 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
682
768
|
depth++;
|
|
683
769
|
parentGroupId = parent.columnGroup;
|
|
684
770
|
}
|
|
685
|
-
|
|
771
|
+
map2.set(colGroupId, depth);
|
|
686
772
|
});
|
|
687
|
-
return
|
|
773
|
+
return map2;
|
|
688
774
|
}
|
|
689
775
|
|
|
690
776
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
777
|
+
function toMap(mapOrObject) {
|
|
778
|
+
if (!mapOrObject) {
|
|
779
|
+
return new Map();
|
|
780
|
+
}
|
|
781
|
+
if (mapOrObject instanceof Map) {
|
|
782
|
+
return mapOrObject;
|
|
783
|
+
}
|
|
784
|
+
return new Map(Object.entries(mapOrObject));
|
|
785
|
+
}
|
|
786
|
+
function toColumnTypesMap(mapOrObject) {
|
|
787
|
+
return toMap(mapOrObject);
|
|
788
|
+
}
|
|
691
789
|
function initSetupState() {
|
|
692
790
|
const columnsGeneratedForGrouping = new Map();
|
|
693
791
|
return {
|
|
@@ -717,7 +815,11 @@ function initSetupState() {
|
|
|
717
815
|
}
|
|
718
816
|
var forwardProps = () => {
|
|
719
817
|
return {
|
|
720
|
-
columns:
|
|
818
|
+
columns: (columns) => {
|
|
819
|
+
var _a;
|
|
820
|
+
return (_a = toMap(columns)) != null ? _a : new Map();
|
|
821
|
+
},
|
|
822
|
+
scrollTopId: 1,
|
|
721
823
|
components: 1,
|
|
722
824
|
loadingText: 1,
|
|
723
825
|
pivotColumns: 1,
|
|
@@ -743,15 +845,17 @@ var forwardProps = () => {
|
|
|
743
845
|
pivotColumn: 1,
|
|
744
846
|
pivotRowLabelsColumn: 1,
|
|
745
847
|
pivotColumnGroups: 1,
|
|
848
|
+
onScrollbarsChange: 1,
|
|
849
|
+
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
746
850
|
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
747
851
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
748
852
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
749
|
-
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth :
|
|
853
|
+
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
750
854
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
751
855
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
752
856
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
753
857
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
754
|
-
licenseKey: (licenseKey) => licenseKey ||
|
|
858
|
+
licenseKey: (licenseKey) => licenseKey || "",
|
|
755
859
|
columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
|
|
756
860
|
header: (header) => header != null ? header : true,
|
|
757
861
|
showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
|
|
@@ -761,6 +865,14 @@ var forwardProps = () => {
|
|
|
761
865
|
headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
|
|
762
866
|
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : new Map(),
|
|
763
867
|
columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
|
|
868
|
+
columnSizing: (columnSizing) => {
|
|
869
|
+
var _a;
|
|
870
|
+
return (_a = toMap(columnSizing)) != null ? _a : new Map();
|
|
871
|
+
},
|
|
872
|
+
columnTypes: (columnTypes) => {
|
|
873
|
+
var _a;
|
|
874
|
+
return (_a = toColumnTypesMap(columnTypes)) != null ? _a : new Map();
|
|
875
|
+
},
|
|
764
876
|
columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
|
|
765
877
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
766
878
|
columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
|
|
@@ -795,7 +907,7 @@ var mapPropsToState = (params) => {
|
|
|
795
907
|
return {
|
|
796
908
|
groupRenderStrategy,
|
|
797
909
|
groupRowsBy,
|
|
798
|
-
computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy ||
|
|
910
|
+
computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns,
|
|
799
911
|
virtualizeHeader,
|
|
800
912
|
columnGroupsDepthsMap,
|
|
801
913
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
@@ -927,7 +1039,7 @@ var computeFlex = (params) => {
|
|
|
927
1039
|
items.forEach((item, i) => {
|
|
928
1040
|
var _a, _b, _c, _d, _e, _f;
|
|
929
1041
|
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
930
|
-
let minSize = (_d = (_c = item.
|
|
1042
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
931
1043
|
if (item.size != null) {
|
|
932
1044
|
if (maxSize != null && item.size > maxSize) {
|
|
933
1045
|
item.size = maxSize;
|
|
@@ -955,7 +1067,7 @@ var computeFlex = (params) => {
|
|
|
955
1067
|
if (item.flex != null) {
|
|
956
1068
|
const approxFlexSize = sizePerFlex * item.flex;
|
|
957
1069
|
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
958
|
-
let minSize = (_d = (_c = item.
|
|
1070
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
959
1071
|
let constrained = false;
|
|
960
1072
|
let substractSize = 0;
|
|
961
1073
|
if (maxSize != null && approxFlexSize > maxSize) {
|
|
@@ -1090,8 +1202,52 @@ var Logger = class {
|
|
|
1090
1202
|
}
|
|
1091
1203
|
};
|
|
1092
1204
|
|
|
1205
|
+
// src/utils/getGlobal.ts
|
|
1206
|
+
function getGlobal() {
|
|
1207
|
+
return globalThis;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
// src/components/utils/getScrollbarWidth.ts
|
|
1211
|
+
var scrollbarWidth;
|
|
1212
|
+
function getScrollbarWidth() {
|
|
1213
|
+
var _a, _b;
|
|
1214
|
+
if (scrollbarWidth != null) {
|
|
1215
|
+
return scrollbarWidth;
|
|
1216
|
+
}
|
|
1217
|
+
const doc = (_a = getGlobal().document) != null ? _a : null;
|
|
1218
|
+
if (!doc) {
|
|
1219
|
+
return 0;
|
|
1220
|
+
}
|
|
1221
|
+
const outer = doc.createElement("div");
|
|
1222
|
+
outer.style.visibility = "hidden";
|
|
1223
|
+
outer.style.overflow = "scroll";
|
|
1224
|
+
doc.body.appendChild(outer);
|
|
1225
|
+
const inner = doc.createElement("div");
|
|
1226
|
+
outer.appendChild(inner);
|
|
1227
|
+
scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
|
1228
|
+
(_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
|
|
1229
|
+
return scrollbarWidth;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
// src/components/InfiniteTable/utils/getColumnComputedType.ts
|
|
1233
|
+
var emptyType = Object.freeze({});
|
|
1234
|
+
function getColumnComputedType(column, columnTypes) {
|
|
1235
|
+
const defaultType = columnTypes.get("default") || emptyType;
|
|
1236
|
+
if (column.type === void 0) {
|
|
1237
|
+
return defaultType;
|
|
1238
|
+
}
|
|
1239
|
+
if (column.type === null) {
|
|
1240
|
+
return emptyType;
|
|
1241
|
+
}
|
|
1242
|
+
if (typeof column.type === "string") {
|
|
1243
|
+
const type = columnTypes.get(column.type) || emptyType;
|
|
1244
|
+
return type;
|
|
1245
|
+
}
|
|
1246
|
+
return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes.get(columnType)), {});
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1093
1249
|
// src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
|
|
1094
|
-
var
|
|
1250
|
+
var logError = err("getComputedVisibleColumns");
|
|
1095
1251
|
var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
|
|
1096
1252
|
return !columnVisibility.has(colId) || columnVisibility.get(colId) !== false;
|
|
1097
1253
|
};
|
|
@@ -1112,22 +1268,26 @@ var getComputedVisibleColumns = ({
|
|
|
1112
1268
|
sortInfo,
|
|
1113
1269
|
setSortInfo,
|
|
1114
1270
|
multiSort,
|
|
1271
|
+
viewportReservedWidth,
|
|
1115
1272
|
draggableColumns,
|
|
1116
1273
|
columnOrder,
|
|
1117
1274
|
columnPinning,
|
|
1275
|
+
columnSizing,
|
|
1276
|
+
columnTypes,
|
|
1118
1277
|
columnVisibility,
|
|
1119
1278
|
columnVisibilityAssumeVisible
|
|
1120
1279
|
}) => {
|
|
1121
1280
|
let computedOffset = 0;
|
|
1122
1281
|
const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
|
|
1123
|
-
const visibleColumnOrder = normalizedColumnOrder.filter(
|
|
1124
|
-
|
|
1125
|
-
let col = columns.get(columnId);
|
|
1282
|
+
const visibleColumnOrder = normalizedColumnOrder.filter((colId) => {
|
|
1283
|
+
let col = columns.get(colId);
|
|
1126
1284
|
if (!col) {
|
|
1127
|
-
|
|
1285
|
+
logError(`Column with id "${colId}" specified in columnOrder array cannot be found in the columns map.`);
|
|
1286
|
+
return false;
|
|
1128
1287
|
}
|
|
1129
|
-
return
|
|
1130
|
-
})
|
|
1288
|
+
return isColumnVisible(columnVisibility, columnVisibilityAssumeVisible, colId);
|
|
1289
|
+
});
|
|
1290
|
+
const columnsArray = visibleColumnOrder.map((columnId) => columns.get(columnId)).filter(Boolean);
|
|
1131
1291
|
const sortedMap = (sortInfo != null ? sortInfo : []).reduce((acc, info, index) => {
|
|
1132
1292
|
if (info.id) {
|
|
1133
1293
|
acc[info.id] = { sortInfo: info, index };
|
|
@@ -1141,20 +1301,39 @@ var getComputedVisibleColumns = ({
|
|
|
1141
1301
|
return acc;
|
|
1142
1302
|
}, {});
|
|
1143
1303
|
const flexResult = computeFlex({
|
|
1144
|
-
availableSize: bodySize.width,
|
|
1304
|
+
availableSize: Math.max(bodySize.width - (viewportReservedWidth != null ? viewportReservedWidth : 0) - getScrollbarWidth(), 0),
|
|
1145
1305
|
maxSize: columnMaxWidth,
|
|
1146
1306
|
minSize: columnMinWidth,
|
|
1147
|
-
items:
|
|
1148
|
-
var _a, _b;
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1307
|
+
items: visibleColumnOrder.map((colId) => {
|
|
1308
|
+
var _a, _b, _c, _d;
|
|
1309
|
+
const column = columns.get(colId);
|
|
1310
|
+
const colType = getColumnComputedType(column, columnTypes);
|
|
1311
|
+
const colTypeSizing = {
|
|
1312
|
+
minWidth: colType == null ? void 0 : colType.minWidth,
|
|
1313
|
+
maxWidth: colType == null ? void 0 : colType.maxWidth,
|
|
1314
|
+
width: colType == null ? void 0 : colType.width,
|
|
1315
|
+
flex: colType == null ? void 0 : colType.flex
|
|
1316
|
+
};
|
|
1317
|
+
let colSizing = columnSizing.get(colId) || {};
|
|
1318
|
+
if (colSizing.width != null) {
|
|
1319
|
+
delete colTypeSizing.flex;
|
|
1320
|
+
}
|
|
1321
|
+
if (colSizing.flex != null) {
|
|
1322
|
+
delete colTypeSizing.width;
|
|
1323
|
+
}
|
|
1324
|
+
colSizing = Object.assign(colTypeSizing, colSizing);
|
|
1325
|
+
let colFlex = (_a = colSizing.flex) != null ? _a : void 0;
|
|
1326
|
+
const colMinWidth = (_b = colSizing.minWidth) != null ? _b : columnMinWidth;
|
|
1327
|
+
const colMaxWidth = (_c = colSizing.maxWidth) != null ? _c : columnMaxWidth;
|
|
1328
|
+
let size = colFlex != void 0 ? void 0 : (_d = colSizing.width) != null ? _d : columnDefaultWidth;
|
|
1329
|
+
if (!size && colFlex == void 0) {
|
|
1330
|
+
size = colMinWidth;
|
|
1152
1331
|
}
|
|
1153
1332
|
return {
|
|
1154
1333
|
size,
|
|
1155
|
-
flex:
|
|
1156
|
-
minSize:
|
|
1157
|
-
maxSize:
|
|
1334
|
+
flex: colFlex,
|
|
1335
|
+
minSize: colMinWidth,
|
|
1336
|
+
maxSize: colMaxWidth
|
|
1158
1337
|
};
|
|
1159
1338
|
})
|
|
1160
1339
|
});
|
|
@@ -1189,6 +1368,7 @@ var getComputedVisibleColumns = ({
|
|
|
1189
1368
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1190
1369
|
const id = visibleColumnOrder[i];
|
|
1191
1370
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
1371
|
+
const colType = getColumnComputedType(c, columnTypes);
|
|
1192
1372
|
const sortingInfo = sortedMap[id] ? sortedMap[id] : c.field ? (_a = sortedMap[c.field]) != null ? _a : null : null;
|
|
1193
1373
|
const computedSortInfo = (_b = sortingInfo == null ? void 0 : sortingInfo.sortInfo) != null ? _b : null;
|
|
1194
1374
|
const computedSorted = !!computedSortInfo;
|
|
@@ -1244,8 +1424,10 @@ var getComputedVisibleColumns = ({
|
|
|
1244
1424
|
const computedFirstInCategory = computedPinned !== prevPinned;
|
|
1245
1425
|
const computedLastInCategory = computedLast || computedPinned !== getComputedPinned(nextColumnId, columnPinning);
|
|
1246
1426
|
const result2 = __spreadProps(__spreadValues({
|
|
1247
|
-
align:
|
|
1248
|
-
verticalAlign:
|
|
1427
|
+
align: colType.align,
|
|
1428
|
+
verticalAlign: colType.verticalAlign,
|
|
1429
|
+
renderValue: colType.renderValue,
|
|
1430
|
+
render: colType.render
|
|
1249
1431
|
}, c), {
|
|
1250
1432
|
computedWidth,
|
|
1251
1433
|
computedAbsoluteOffset,
|
|
@@ -1324,28 +1506,28 @@ var useRerender = () => {
|
|
|
1324
1506
|
|
|
1325
1507
|
// src/components/hooks/useInterceptedMap.ts
|
|
1326
1508
|
var import_react6 = __toModule(require("react"));
|
|
1327
|
-
function interceptMap(
|
|
1328
|
-
const { set, delete: deleteKey, clear } =
|
|
1509
|
+
function interceptMap(map2, fns) {
|
|
1510
|
+
const { set, delete: deleteKey, clear } = map2;
|
|
1329
1511
|
if (fns.set) {
|
|
1330
|
-
|
|
1331
|
-
set.call(
|
|
1512
|
+
map2.set = (key, value) => {
|
|
1513
|
+
set.call(map2, key, value);
|
|
1332
1514
|
fns.set(key, value);
|
|
1333
|
-
return
|
|
1515
|
+
return map2;
|
|
1334
1516
|
};
|
|
1335
1517
|
}
|
|
1336
1518
|
if (fns.delete) {
|
|
1337
|
-
|
|
1338
|
-
const removed = deleteKey.call(
|
|
1519
|
+
map2.delete = (key) => {
|
|
1520
|
+
const removed = deleteKey.call(map2, key);
|
|
1339
1521
|
fns.delete(key);
|
|
1340
1522
|
return removed;
|
|
1341
1523
|
};
|
|
1342
1524
|
}
|
|
1343
1525
|
if (fns.clear || fns.beforeClear) {
|
|
1344
|
-
|
|
1526
|
+
map2.clear = () => {
|
|
1345
1527
|
if (fns.beforeClear) {
|
|
1346
|
-
fns.beforeClear(
|
|
1528
|
+
fns.beforeClear(map2);
|
|
1347
1529
|
}
|
|
1348
|
-
const result = clear.call(
|
|
1530
|
+
const result = clear.call(map2);
|
|
1349
1531
|
if (fns.clear) {
|
|
1350
1532
|
fns.clear();
|
|
1351
1533
|
}
|
|
@@ -1354,13 +1536,13 @@ function interceptMap(map, fns) {
|
|
|
1354
1536
|
}
|
|
1355
1537
|
return () => {
|
|
1356
1538
|
if (set) {
|
|
1357
|
-
|
|
1539
|
+
map2.set = set;
|
|
1358
1540
|
}
|
|
1359
1541
|
if (deleteKey) {
|
|
1360
|
-
|
|
1542
|
+
map2.delete = deleteKey;
|
|
1361
1543
|
}
|
|
1362
1544
|
if (clear) {
|
|
1363
|
-
|
|
1545
|
+
map2.clear = clear;
|
|
1364
1546
|
}
|
|
1365
1547
|
};
|
|
1366
1548
|
}
|
|
@@ -1380,16 +1562,16 @@ var rafFn = (fn) => {
|
|
|
1380
1562
|
};
|
|
1381
1563
|
|
|
1382
1564
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
1383
|
-
var useRerenderOnKeyChange = (
|
|
1565
|
+
var useRerenderOnKeyChange = (map2) => {
|
|
1384
1566
|
const [renderId, rerender] = useRerender();
|
|
1385
1567
|
(0, import_react7.useEffect)(() => {
|
|
1386
1568
|
const update = rafFn(rerender);
|
|
1387
|
-
return interceptMap(
|
|
1569
|
+
return interceptMap(map2, {
|
|
1388
1570
|
set: update,
|
|
1389
1571
|
clear: update,
|
|
1390
1572
|
delete: update
|
|
1391
1573
|
});
|
|
1392
|
-
}, [
|
|
1574
|
+
}, [map2]);
|
|
1393
1575
|
return renderId;
|
|
1394
1576
|
};
|
|
1395
1577
|
|
|
@@ -1407,11 +1589,16 @@ var useComputedVisibleColumns = ({
|
|
|
1407
1589
|
setSortInfo,
|
|
1408
1590
|
columnOrder,
|
|
1409
1591
|
columnPinning,
|
|
1592
|
+
columnTypes,
|
|
1410
1593
|
pinnedEndMaxWidth,
|
|
1411
1594
|
pinnedStartMaxWidth,
|
|
1595
|
+
viewportReservedWidth,
|
|
1412
1596
|
columnVisibility,
|
|
1413
|
-
columnVisibilityAssumeVisible
|
|
1597
|
+
columnVisibilityAssumeVisible,
|
|
1598
|
+
columnSizing
|
|
1414
1599
|
}) => {
|
|
1600
|
+
const columnsSizingRenderId = useRerenderOnKeyChange(columnSizing);
|
|
1601
|
+
const columnTypesRenderId = useRerenderOnKeyChange(columnTypes);
|
|
1415
1602
|
const columnsRenderId = useRerenderOnKeyChange(columns);
|
|
1416
1603
|
const visibilityRenderId = useRerenderOnKeyChange(columnVisibility);
|
|
1417
1604
|
const pinningRenderId = useRerenderOnKeyChange(columnPinning);
|
|
@@ -1437,6 +1624,7 @@ var useComputedVisibleColumns = ({
|
|
|
1437
1624
|
columnMinWidth,
|
|
1438
1625
|
columnMaxWidth,
|
|
1439
1626
|
columnDefaultWidth,
|
|
1627
|
+
viewportReservedWidth,
|
|
1440
1628
|
sortable,
|
|
1441
1629
|
sortInfo,
|
|
1442
1630
|
setSortInfo,
|
|
@@ -1446,6 +1634,8 @@ var useComputedVisibleColumns = ({
|
|
|
1446
1634
|
draggableColumns,
|
|
1447
1635
|
columnOrder,
|
|
1448
1636
|
columnPinning,
|
|
1637
|
+
columnSizing,
|
|
1638
|
+
columnTypes,
|
|
1449
1639
|
columnVisibility,
|
|
1450
1640
|
columnVisibilityAssumeVisible: columnVisibilityAssumeVisible != null ? columnVisibilityAssumeVisible : true
|
|
1451
1641
|
});
|
|
@@ -1467,7 +1657,9 @@ var useComputedVisibleColumns = ({
|
|
|
1467
1657
|
columnPinning,
|
|
1468
1658
|
columnsRenderId,
|
|
1469
1659
|
visibilityRenderId,
|
|
1470
|
-
|
|
1660
|
+
columnsSizingRenderId,
|
|
1661
|
+
pinningRenderId,
|
|
1662
|
+
columnTypesRenderId
|
|
1471
1663
|
]);
|
|
1472
1664
|
const result = {
|
|
1473
1665
|
columns,
|
|
@@ -1493,7 +1685,7 @@ var useComputedVisibleColumns = ({
|
|
|
1493
1685
|
var sortAscending = (a, b) => a - b;
|
|
1494
1686
|
|
|
1495
1687
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
1496
|
-
var
|
|
1688
|
+
var import_react20 = __toModule(require("react"));
|
|
1497
1689
|
|
|
1498
1690
|
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
1499
1691
|
var import_react12 = __toModule(require("react"));
|
|
@@ -1601,7 +1793,7 @@ function getComponentStateContext() {
|
|
|
1601
1793
|
}
|
|
1602
1794
|
return ComponentContext = (0, import_react11.createContext)(null);
|
|
1603
1795
|
}
|
|
1604
|
-
function
|
|
1796
|
+
function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides, interceptedActions) {
|
|
1605
1797
|
const state = getState();
|
|
1606
1798
|
return Object.keys(state).reduce((actions, stateKey) => {
|
|
1607
1799
|
const key = stateKey;
|
|
@@ -1613,6 +1805,9 @@ function getReducerActions(dispatch, getState, getProps, propsToForward, allowed
|
|
|
1613
1805
|
return;
|
|
1614
1806
|
}
|
|
1615
1807
|
notifyChange(props, stateKey, value);
|
|
1808
|
+
if (interceptedActions && typeof interceptedActions[key] === "function") {
|
|
1809
|
+
interceptedActions[key](value, { actions, state: state2 });
|
|
1810
|
+
}
|
|
1616
1811
|
const forwardFn = propsToForward[key];
|
|
1617
1812
|
if (typeof forwardFn === "function") {
|
|
1618
1813
|
value = forwardFn(value);
|
|
@@ -1725,7 +1920,7 @@ function getComponentStateRoot(config) {
|
|
|
1725
1920
|
const getComponentState = useLatest(state);
|
|
1726
1921
|
const { allowedControlledPropOverrides } = config;
|
|
1727
1922
|
const actions = (0, import_react11.useMemo)(() => {
|
|
1728
|
-
const generatedActions =
|
|
1923
|
+
const generatedActions = getReducerGeneratedActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides, config.interceptActions);
|
|
1729
1924
|
return generatedActions;
|
|
1730
1925
|
}, [
|
|
1731
1926
|
dispatch,
|
|
@@ -1892,7 +2087,7 @@ function useColumnGroups() {
|
|
|
1892
2087
|
}
|
|
1893
2088
|
|
|
1894
2089
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
1895
|
-
var
|
|
2090
|
+
var import_react19 = __toModule(require("react"));
|
|
1896
2091
|
|
|
1897
2092
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
1898
2093
|
var React7 = __toModule(require("react"));
|
|
@@ -1953,43 +2148,10 @@ function ExpanderIcon(props) {
|
|
|
1953
2148
|
}));
|
|
1954
2149
|
}
|
|
1955
2150
|
|
|
1956
|
-
// node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.esm.js
|
|
1957
|
-
var shouldApplyCompound = (compoundCheck, selections) => {
|
|
1958
|
-
for (const key of Object.keys(compoundCheck)) {
|
|
1959
|
-
if (compoundCheck[key] !== selections[key]) {
|
|
1960
|
-
return false;
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
return true;
|
|
1964
|
-
};
|
|
1965
|
-
var createRuntimeFn = (config) => (options) => {
|
|
1966
|
-
let className = config.defaultClassName;
|
|
1967
|
-
const selections = {
|
|
1968
|
-
...config.defaultVariants,
|
|
1969
|
-
...options
|
|
1970
|
-
};
|
|
1971
|
-
for (const variantName in selections) {
|
|
1972
|
-
var _selections$variantNa;
|
|
1973
|
-
const variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
1974
|
-
if (variantSelection != null) {
|
|
1975
|
-
let selection = variantSelection;
|
|
1976
|
-
if (typeof selection === "boolean") {
|
|
1977
|
-
selection = selection === true ? "true" : "false";
|
|
1978
|
-
}
|
|
1979
|
-
className += " " + config.variantClassNames[variantName][selection];
|
|
1980
|
-
}
|
|
1981
|
-
}
|
|
1982
|
-
for (const [compoundCheck, compoundClassName] of config.compoundVariants) {
|
|
1983
|
-
if (shouldApplyCompound(compoundCheck, selections)) {
|
|
1984
|
-
className += " " + compoundClassName;
|
|
1985
|
-
}
|
|
1986
|
-
}
|
|
1987
|
-
return className;
|
|
1988
|
-
};
|
|
1989
|
-
|
|
1990
2151
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
2152
|
+
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
1991
2153
|
var GroupRowExpanderCls = "_7pupv0b";
|
|
1992
|
-
var RowClsRecipe = createRuntimeFn({ defaultClassName: "_7pupv00", variantClassNames: { zebra: { false: "_7pupv02", even: "_7pupv03", odd: "_7pupv04" }, groupRow: { true: "_7pupv05", false: "_7pupv06" }, inlineGroupRow: { true: "_7pupv07", false: "_7pupv08" }, showHoverRows: { true: "_7pupv09", false: "_7pupv0a" } }, defaultVariants: {}, compoundVariants: [] });
|
|
2154
|
+
var RowClsRecipe = (0, import_createRuntimeFn.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: [] });
|
|
1993
2155
|
var RowHoverCls = "_7pupv01";
|
|
1994
2156
|
|
|
1995
2157
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
@@ -2174,67 +2336,236 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2174
2336
|
}
|
|
2175
2337
|
|
|
2176
2338
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
2177
|
-
var
|
|
2339
|
+
var import_react18 = __toModule(require("react"));
|
|
2178
2340
|
|
|
2179
2341
|
// src/components/DataSource/index.tsx
|
|
2180
2342
|
var React9 = __toModule(require("react"));
|
|
2181
2343
|
|
|
2182
|
-
// src/
|
|
2183
|
-
var
|
|
2344
|
+
// src/utils/multisort/sortTypes.ts
|
|
2345
|
+
var numberComparator = function(first, second) {
|
|
2346
|
+
return first - second;
|
|
2347
|
+
};
|
|
2348
|
+
var stringComparator = function(first, second) {
|
|
2349
|
+
first = `${first}`;
|
|
2350
|
+
second = `${second}`;
|
|
2351
|
+
return first.localeCompare(second);
|
|
2352
|
+
};
|
|
2353
|
+
var sortTypes = {
|
|
2354
|
+
number: numberComparator,
|
|
2355
|
+
string: stringComparator
|
|
2356
|
+
};
|
|
2357
|
+
var sortTypes_default = sortTypes;
|
|
2184
2358
|
|
|
2185
|
-
// src/
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2359
|
+
// src/utils/multisort/index.ts
|
|
2360
|
+
var multisort = (sortInfo, array, get) => {
|
|
2361
|
+
array.sort(getMultisortFunction(sortInfo, get));
|
|
2362
|
+
return array;
|
|
2363
|
+
};
|
|
2364
|
+
multisort.knownTypes = sortTypes_default;
|
|
2365
|
+
var getSingleSortFunction = (info) => {
|
|
2366
|
+
if (!info) {
|
|
2367
|
+
return;
|
|
2192
2368
|
}
|
|
2193
|
-
|
|
2194
|
-
|
|
2369
|
+
const field = info.field;
|
|
2370
|
+
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
2371
|
+
if (!dir) {
|
|
2372
|
+
return;
|
|
2373
|
+
}
|
|
2374
|
+
let fn = info.fn;
|
|
2375
|
+
if (!fn && info.type) {
|
|
2376
|
+
fn = multisort.knownTypes[info.type];
|
|
2377
|
+
if (!fn) {
|
|
2378
|
+
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
if (!fn) {
|
|
2382
|
+
fn = sortTypes_default.string;
|
|
2383
|
+
}
|
|
2384
|
+
return (first, second) => {
|
|
2385
|
+
const a = field ? first[field] : first;
|
|
2386
|
+
const b = field ? second[field] : second;
|
|
2387
|
+
return dir * fn(a, b);
|
|
2195
2388
|
};
|
|
2196
|
-
}
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2389
|
+
};
|
|
2390
|
+
var getSortFunctions = (sortInfo) => {
|
|
2391
|
+
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
2392
|
+
};
|
|
2393
|
+
var getMultisortFunction = (sortInfo, get) => {
|
|
2394
|
+
const fns = getSortFunctions(sortInfo);
|
|
2395
|
+
return (first, second) => {
|
|
2396
|
+
if (get) {
|
|
2397
|
+
first = get(first);
|
|
2398
|
+
second = get(second);
|
|
2203
2399
|
}
|
|
2204
|
-
|
|
2205
|
-
|
|
2400
|
+
let result = 0;
|
|
2401
|
+
let i = 0;
|
|
2402
|
+
let fn;
|
|
2403
|
+
const len = fns.length;
|
|
2404
|
+
for (; i < len; i++) {
|
|
2405
|
+
fn = fns[i];
|
|
2406
|
+
if (!fn) {
|
|
2407
|
+
continue;
|
|
2408
|
+
}
|
|
2409
|
+
result = fn(first, second);
|
|
2410
|
+
if (result !== 0) {
|
|
2411
|
+
return result;
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
return result;
|
|
2415
|
+
};
|
|
2416
|
+
};
|
|
2417
|
+
|
|
2418
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2419
|
+
var import_react16 = __toModule(require("react"));
|
|
2420
|
+
|
|
2421
|
+
// src/components/hooks/useEffectWithChanges.ts
|
|
2422
|
+
var import_react15 = __toModule(require("react"));
|
|
2423
|
+
function useEffectWithChanges(fn, deps) {
|
|
2424
|
+
const prevRef = (0, import_react15.useRef)({});
|
|
2425
|
+
const oldValuesRef = (0, import_react15.useRef)({});
|
|
2426
|
+
const oldValues = oldValuesRef.current;
|
|
2427
|
+
const changesRef = (0, import_react15.useRef)({});
|
|
2428
|
+
const changes = changesRef.current;
|
|
2429
|
+
const useEffectDeps = [];
|
|
2430
|
+
for (let k in deps) {
|
|
2431
|
+
if (deps.hasOwnProperty(k)) {
|
|
2432
|
+
if (deps[k] !== prevRef.current[k]) {
|
|
2433
|
+
changes[k] = deps[k];
|
|
2434
|
+
oldValues[k] = prevRef.current[k];
|
|
2435
|
+
}
|
|
2436
|
+
useEffectDeps.push(deps[k]);
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
prevRef.current = deps;
|
|
2440
|
+
(0, import_react15.useEffect)(() => {
|
|
2441
|
+
const changes2 = changesRef.current;
|
|
2442
|
+
const result = fn(changes2, oldValues);
|
|
2443
|
+
changesRef.current = {};
|
|
2444
|
+
oldValuesRef.current = {};
|
|
2445
|
+
return result;
|
|
2446
|
+
}, useEffectDeps);
|
|
2206
2447
|
}
|
|
2207
2448
|
|
|
2208
2449
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2209
|
-
function
|
|
2210
|
-
|
|
2450
|
+
function buildDataSourceDataParams(componentState) {
|
|
2451
|
+
var _a, _b;
|
|
2452
|
+
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
2453
|
+
const dataSourceParams = {
|
|
2454
|
+
originalDataArray: componentState.originalDataArray,
|
|
2455
|
+
sortInfo,
|
|
2456
|
+
groupRowsBy: componentState.groupRowsBy,
|
|
2457
|
+
pivotBy: componentState.pivotBy
|
|
2458
|
+
};
|
|
2459
|
+
if (componentState.livePagination !== void 0) {
|
|
2460
|
+
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
2461
|
+
}
|
|
2462
|
+
return dataSourceParams;
|
|
2463
|
+
}
|
|
2464
|
+
function notifyDataParamsChanged(componentState, actions) {
|
|
2465
|
+
var _a;
|
|
2466
|
+
if (typeof componentState.data === "function") {
|
|
2467
|
+
loadData(componentState.data, componentState, actions);
|
|
2468
|
+
}
|
|
2469
|
+
const dataParams = buildDataSourceDataParams(componentState);
|
|
2470
|
+
(_a = componentState.onDataParamsChange) == null ? void 0 : _a.call(componentState, dataParams);
|
|
2471
|
+
}
|
|
2472
|
+
function loadData(data, componentState, actions) {
|
|
2473
|
+
const dataParams = buildDataSourceDataParams(componentState);
|
|
2474
|
+
if (typeof data === "function") {
|
|
2475
|
+
data = data(dataParams);
|
|
2476
|
+
}
|
|
2477
|
+
const dataIsPromise = typeof data === "object" && typeof data.then === "function";
|
|
2478
|
+
if (dataIsPromise) {
|
|
2479
|
+
actions.loading = true;
|
|
2480
|
+
}
|
|
2481
|
+
Promise.resolve(data).then((dataParam) => {
|
|
2482
|
+
let dataArray = [];
|
|
2483
|
+
if (Array.isArray(dataParam.data)) {
|
|
2484
|
+
const remoteData = dataParam;
|
|
2485
|
+
dataArray = remoteData.data;
|
|
2486
|
+
if (remoteData.livePaginationCursor !== void 0) {
|
|
2487
|
+
actions.livePaginationCursor = remoteData.livePaginationCursor;
|
|
2488
|
+
}
|
|
2489
|
+
} else {
|
|
2490
|
+
dataArray = dataParam;
|
|
2491
|
+
}
|
|
2492
|
+
actions.originalDataArray = dataArray;
|
|
2493
|
+
if (dataIsPromise) {
|
|
2494
|
+
actions.loading = false;
|
|
2495
|
+
}
|
|
2496
|
+
});
|
|
2211
2497
|
}
|
|
2212
2498
|
function useLoadData() {
|
|
2213
2499
|
const {
|
|
2500
|
+
getComponentState,
|
|
2214
2501
|
componentActions: actions,
|
|
2215
2502
|
componentState: { data }
|
|
2216
2503
|
} = useComponentState();
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
originalDataArray: []
|
|
2220
|
-
};
|
|
2221
|
-
if (typeof data2 === "function") {
|
|
2222
|
-
data2 = data2();
|
|
2223
|
-
}
|
|
2224
|
-
if (Array.isArray(data2)) {
|
|
2225
|
-
dataSourceInfo = buildDataSourceInfo(data2);
|
|
2226
|
-
actions.originalDataArray = dataSourceInfo.originalDataArray;
|
|
2227
|
-
} else {
|
|
2228
|
-
actions.loading = true;
|
|
2229
|
-
loadDataAsync(data2).then((dataSourceInfo2) => {
|
|
2230
|
-
actions.originalDataArray = dataSourceInfo2.originalDataArray;
|
|
2231
|
-
actions.loading = false;
|
|
2232
|
-
});
|
|
2233
|
-
}
|
|
2234
|
-
};
|
|
2235
|
-
(0, import_react15.useLayoutEffect)(() => {
|
|
2236
|
-
loadData(data);
|
|
2504
|
+
(0, import_react16.useLayoutEffect)(() => {
|
|
2505
|
+
loadData(data, getComponentState(), actions);
|
|
2237
2506
|
}, [data]);
|
|
2507
|
+
useLivePagination();
|
|
2508
|
+
}
|
|
2509
|
+
function useLivePagination() {
|
|
2510
|
+
const {
|
|
2511
|
+
getComponentState,
|
|
2512
|
+
componentActions: actions,
|
|
2513
|
+
componentState
|
|
2514
|
+
} = useComponentState();
|
|
2515
|
+
const {
|
|
2516
|
+
notifyScrollbarsChange,
|
|
2517
|
+
sortInfo,
|
|
2518
|
+
groupRowsBy,
|
|
2519
|
+
pivotBy,
|
|
2520
|
+
livePaginationCursor,
|
|
2521
|
+
scrollBottomId
|
|
2522
|
+
} = componentState;
|
|
2523
|
+
const [scrollbars, setScrollbars] = (0, import_react16.useState)({
|
|
2524
|
+
vertical: false,
|
|
2525
|
+
horizontal: false
|
|
2526
|
+
});
|
|
2527
|
+
const scrollbarsRef = (0, import_react16.useRef)(scrollbars);
|
|
2528
|
+
(0, import_react16.useEffect)(() => {
|
|
2529
|
+
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
2530
|
+
if (!scrollbars2) {
|
|
2531
|
+
return;
|
|
2532
|
+
}
|
|
2533
|
+
scrollbarsRef.current = scrollbars2;
|
|
2534
|
+
setScrollbars(scrollbars2);
|
|
2535
|
+
});
|
|
2536
|
+
return () => notifyScrollbarsChange.destroy();
|
|
2537
|
+
}, [notifyScrollbarsChange]);
|
|
2538
|
+
const [cursorId, updateCursorId] = (0, import_react16.useState)(void 0);
|
|
2539
|
+
(0, import_react16.useEffect)(() => {
|
|
2540
|
+
const frameId = requestAnimationFrame(() => {
|
|
2541
|
+
var _a;
|
|
2542
|
+
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical)) {
|
|
2543
|
+
updateCursorId(livePaginationCursor);
|
|
2544
|
+
}
|
|
2545
|
+
});
|
|
2546
|
+
return () => cancelAnimationFrame(frameId);
|
|
2547
|
+
}, [livePaginationCursor]);
|
|
2548
|
+
(0, import_react16.useEffect)(() => {
|
|
2549
|
+
const { livePaginationCursor: livePaginationCursor2, livePagination } = getComponentState();
|
|
2550
|
+
if (!scrollbars.vertical && livePagination) {
|
|
2551
|
+
updateCursorId(livePaginationCursor2);
|
|
2552
|
+
}
|
|
2553
|
+
}, [scrollbars.vertical]);
|
|
2554
|
+
(0, import_react16.useEffect)(() => {
|
|
2555
|
+
updateCursorId(scrollBottomId);
|
|
2556
|
+
}, [scrollBottomId]);
|
|
2557
|
+
const depsObject = {
|
|
2558
|
+
sortInfo,
|
|
2559
|
+
groupRowsBy,
|
|
2560
|
+
pivotBy,
|
|
2561
|
+
cursorId
|
|
2562
|
+
};
|
|
2563
|
+
useEffectWithChanges(() => {
|
|
2564
|
+
if (cursorId === void 0) {
|
|
2565
|
+
return;
|
|
2566
|
+
}
|
|
2567
|
+
notifyDataParamsChanged(getComponentState(), actions);
|
|
2568
|
+
}, depsObject);
|
|
2238
2569
|
}
|
|
2239
2570
|
|
|
2240
2571
|
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
@@ -2244,7 +2575,7 @@ var normalizeSortInfo = (sortInfo) => {
|
|
|
2244
2575
|
};
|
|
2245
2576
|
|
|
2246
2577
|
// src/components/hooks/useOnce.ts
|
|
2247
|
-
var
|
|
2578
|
+
var import_react17 = __toModule(require("react"));
|
|
2248
2579
|
function once(fn) {
|
|
2249
2580
|
let called = false;
|
|
2250
2581
|
let result = null;
|
|
@@ -2259,7 +2590,7 @@ function once(fn) {
|
|
|
2259
2590
|
return onceFn;
|
|
2260
2591
|
}
|
|
2261
2592
|
function useOnce(fn) {
|
|
2262
|
-
const onceFn = (0,
|
|
2593
|
+
const onceFn = (0, import_react17.useMemo)(() => {
|
|
2263
2594
|
return once(fn);
|
|
2264
2595
|
}, []);
|
|
2265
2596
|
return onceFn();
|
|
@@ -2288,9 +2619,9 @@ var DeepMap = class {
|
|
|
2288
2619
|
if (!pair) {
|
|
2289
2620
|
return;
|
|
2290
2621
|
}
|
|
2291
|
-
const { map } = pair;
|
|
2622
|
+
const { map: map2 } = pair;
|
|
2292
2623
|
const keys = [...parentKeys, key];
|
|
2293
|
-
const next =
|
|
2624
|
+
const next = map2 ? () => this.visitWithNext(keys, fn, map2) : void 0;
|
|
2294
2625
|
if (pair.hasOwnProperty("value")) {
|
|
2295
2626
|
fn(pair.value, keys, i, next);
|
|
2296
2627
|
i++;
|
|
@@ -2356,14 +2687,14 @@ var DeepMap = class {
|
|
|
2356
2687
|
return this.length;
|
|
2357
2688
|
}
|
|
2358
2689
|
clear() {
|
|
2359
|
-
const clearMap = (
|
|
2360
|
-
|
|
2361
|
-
const { map:
|
|
2362
|
-
if (
|
|
2363
|
-
clearMap(
|
|
2690
|
+
const clearMap = (map2) => {
|
|
2691
|
+
map2.forEach((value, _key) => {
|
|
2692
|
+
const { map: map3 } = value;
|
|
2693
|
+
if (map3) {
|
|
2694
|
+
clearMap(map3);
|
|
2364
2695
|
}
|
|
2365
2696
|
});
|
|
2366
|
-
|
|
2697
|
+
map2.clear();
|
|
2367
2698
|
};
|
|
2368
2699
|
clearMap(this.map);
|
|
2369
2700
|
this.length = 0;
|
|
@@ -2408,9 +2739,9 @@ var DeepMap = class {
|
|
|
2408
2739
|
}
|
|
2409
2740
|
}
|
|
2410
2741
|
while (maps.length) {
|
|
2411
|
-
let
|
|
2742
|
+
let map2 = maps.pop();
|
|
2412
2743
|
let key = keys.pop();
|
|
2413
|
-
if (key && (
|
|
2744
|
+
if (key && (map2 == null ? void 0 : map2.size) === 0) {
|
|
2414
2745
|
let parentMap = maps[maps.length - 1];
|
|
2415
2746
|
let pair = parentMap == null ? void 0 : parentMap.get(key);
|
|
2416
2747
|
if (pair) {
|
|
@@ -2449,12 +2780,12 @@ var DeepMap = class {
|
|
|
2449
2780
|
if (!pair) {
|
|
2450
2781
|
return;
|
|
2451
2782
|
}
|
|
2452
|
-
const { map } = pair;
|
|
2783
|
+
const { map: map2 } = pair;
|
|
2453
2784
|
const keys = [...parentKeys, key];
|
|
2454
2785
|
const next = once(() => {
|
|
2455
|
-
if (
|
|
2456
|
-
|
|
2457
|
-
this.visitKey(k,
|
|
2786
|
+
if (map2) {
|
|
2787
|
+
map2.forEach((_, k) => {
|
|
2788
|
+
this.visitKey(k, map2, keys, fn);
|
|
2458
2789
|
});
|
|
2459
2790
|
}
|
|
2460
2791
|
});
|
|
@@ -2620,14 +2951,68 @@ var GroupRowsState = class {
|
|
|
2620
2951
|
}
|
|
2621
2952
|
};
|
|
2622
2953
|
|
|
2954
|
+
// src/utils/shallowEqualObjects.ts
|
|
2955
|
+
function shallowEqualObjects(objA, objB) {
|
|
2956
|
+
if (objA === objB) {
|
|
2957
|
+
return true;
|
|
2958
|
+
}
|
|
2959
|
+
if (!objA || !objB) {
|
|
2960
|
+
return false;
|
|
2961
|
+
}
|
|
2962
|
+
var aKeys = Object.keys(objA);
|
|
2963
|
+
var bKeys = Object.keys(objB);
|
|
2964
|
+
var len = aKeys.length;
|
|
2965
|
+
if (bKeys.length !== len) {
|
|
2966
|
+
return false;
|
|
2967
|
+
}
|
|
2968
|
+
for (var i = 0; i < len; i++) {
|
|
2969
|
+
var key = aKeys[i];
|
|
2970
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
2971
|
+
return false;
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
return true;
|
|
2975
|
+
}
|
|
2976
|
+
|
|
2977
|
+
// src/components/utils/discardCallsWithEqualArg.ts
|
|
2978
|
+
var map = new WeakMap();
|
|
2979
|
+
var getCompareDefault = (a) => a;
|
|
2980
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject2) {
|
|
2981
|
+
map.set(fn, {
|
|
2982
|
+
lastCallTime: 0,
|
|
2983
|
+
lastCallArg: null
|
|
2984
|
+
});
|
|
2985
|
+
const getCompare = getCompareObject2 != null ? getCompareObject2 : getCompareDefault;
|
|
2986
|
+
return (arg) => {
|
|
2987
|
+
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
2988
|
+
lastCallTime: 0,
|
|
2989
|
+
lastCallArg: null
|
|
2990
|
+
};
|
|
2991
|
+
const now = Date.now();
|
|
2992
|
+
const diff = now - lastCallTime;
|
|
2993
|
+
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
2994
|
+
if (diff < timeframe && objectsEqual) {
|
|
2995
|
+
return;
|
|
2996
|
+
}
|
|
2997
|
+
map.set(fn, {
|
|
2998
|
+
lastCallTime: now,
|
|
2999
|
+
lastCallArg: arg
|
|
3000
|
+
});
|
|
3001
|
+
fn(arg);
|
|
3002
|
+
};
|
|
3003
|
+
}
|
|
3004
|
+
|
|
2623
3005
|
// src/components/DataSource/state/getInitialState.ts
|
|
2624
3006
|
function initSetupState2() {
|
|
2625
3007
|
const now = Date.now();
|
|
2626
3008
|
const originalDataArray = [];
|
|
2627
3009
|
const dataArray = [];
|
|
2628
3010
|
return {
|
|
3011
|
+
dataParams: void 0,
|
|
3012
|
+
notifyScrollbarsChange: buildSubscriptionCallback(),
|
|
2629
3013
|
pivotTotalColumnPosition: "end",
|
|
2630
3014
|
originalDataArray,
|
|
3015
|
+
scrollBottomId: Symbol("scrollBottomId"),
|
|
2631
3016
|
pivotColumns: void 0,
|
|
2632
3017
|
pivotColumnGroups: void 0,
|
|
2633
3018
|
dataArray,
|
|
@@ -2644,12 +3029,20 @@ function initSetupState2() {
|
|
|
2644
3029
|
lastGroupDataArray: void 0
|
|
2645
3030
|
};
|
|
2646
3031
|
}
|
|
3032
|
+
function getCompareObject(dataParams) {
|
|
3033
|
+
const obj = __spreadValues({}, dataParams);
|
|
3034
|
+
delete obj.originalDataArray;
|
|
3035
|
+
return obj;
|
|
3036
|
+
}
|
|
2647
3037
|
var forwardProps3 = () => {
|
|
2648
3038
|
return {
|
|
3039
|
+
onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObject) : void 0,
|
|
2649
3040
|
remoteCount: 1,
|
|
2650
3041
|
data: 1,
|
|
2651
3042
|
pivotBy: 1,
|
|
2652
3043
|
primaryKey: 1,
|
|
3044
|
+
livePagination: 1,
|
|
3045
|
+
livePaginationCursor: 1,
|
|
2653
3046
|
loading: (loading) => loading != null ? loading : false,
|
|
2654
3047
|
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
|
|
2655
3048
|
groupRowsBy: (groupRowsBy) => groupRowsBy != null ? groupRowsBy : [],
|
|
@@ -2662,10 +3055,20 @@ var forwardProps3 = () => {
|
|
|
2662
3055
|
};
|
|
2663
3056
|
};
|
|
2664
3057
|
function mapPropsToState2(params) {
|
|
2665
|
-
var _a;
|
|
2666
3058
|
const { props } = params;
|
|
3059
|
+
const controlledSort = isControlledValue(props.sortInfo);
|
|
2667
3060
|
return {
|
|
2668
|
-
|
|
3061
|
+
controlledSort,
|
|
3062
|
+
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
|
|
3063
|
+
};
|
|
3064
|
+
}
|
|
3065
|
+
function getInterceptActions() {
|
|
3066
|
+
return {
|
|
3067
|
+
sortInfo: (sortInfo, { actions, state }) => {
|
|
3068
|
+
const dataParams = buildDataSourceDataParams(state);
|
|
3069
|
+
dataParams.sortInfo = sortInfo;
|
|
3070
|
+
actions.dataParams = dataParams;
|
|
3071
|
+
}
|
|
2669
3072
|
};
|
|
2670
3073
|
}
|
|
2671
3074
|
|
|
@@ -2844,132 +3247,60 @@ function enhancedFlatten(param) {
|
|
|
2844
3247
|
var _a;
|
|
2845
3248
|
const items = deepMapValue.items;
|
|
2846
3249
|
const groupNesting = groupKeys.length;
|
|
2847
|
-
const collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
|
|
2848
|
-
const enhancedGroupData = getEnhancedGroupData({
|
|
2849
|
-
groupBy: groupByStrings,
|
|
2850
|
-
parents: Array.from(parents),
|
|
2851
|
-
indexInGroup,
|
|
2852
|
-
indexInParentGroups: Array.from(indexInParentGroups),
|
|
2853
|
-
indexInAll: result.length,
|
|
2854
|
-
groupKeys,
|
|
2855
|
-
collapsed
|
|
2856
|
-
}, deepMapValue);
|
|
2857
|
-
const include = generateGroupRows || collapsed;
|
|
2858
|
-
if (include) {
|
|
2859
|
-
result.push(enhancedGroupData);
|
|
2860
|
-
}
|
|
2861
|
-
if (collapsed) {
|
|
2862
|
-
parents.forEach((parent) => {
|
|
2863
|
-
parent.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
2864
|
-
parent.collapsedGroupsCount += 1;
|
|
2865
|
-
});
|
|
2866
|
-
}
|
|
2867
|
-
indexInParentGroups.push(indexInGroup);
|
|
2868
|
-
parents.push(enhancedGroupData);
|
|
2869
|
-
if (!collapsed) {
|
|
2870
|
-
if (!next) {
|
|
2871
|
-
if (!pivot) {
|
|
2872
|
-
const startIndex = result.length;
|
|
2873
|
-
result.push(...items.map((item, index) => {
|
|
2874
|
-
return {
|
|
2875
|
-
id: toPrimaryKey(item),
|
|
2876
|
-
data: item,
|
|
2877
|
-
isGroupRow: false,
|
|
2878
|
-
collapsed: false,
|
|
2879
|
-
groupKeys,
|
|
2880
|
-
parents: Array.from(parents),
|
|
2881
|
-
indexInParentGroups: [...indexInParentGroups, index],
|
|
2882
|
-
indexInGroup: index,
|
|
2883
|
-
indexInAll: startIndex + index,
|
|
2884
|
-
groupBy: groupByStrings,
|
|
2885
|
-
groupNesting,
|
|
2886
|
-
groupCount: enhancedGroupData.groupCount
|
|
2887
|
-
};
|
|
2888
|
-
}));
|
|
2889
|
-
}
|
|
2890
|
-
} else {
|
|
2891
|
-
next();
|
|
2892
|
-
}
|
|
2893
|
-
}
|
|
2894
|
-
parents.pop();
|
|
2895
|
-
indexInParentGroups.pop();
|
|
2896
|
-
});
|
|
2897
|
-
return {
|
|
2898
|
-
data: result
|
|
2899
|
-
};
|
|
2900
|
-
}
|
|
2901
|
-
|
|
2902
|
-
// src/utils/multisort/sortTypes.ts
|
|
2903
|
-
var sortTypes = {
|
|
2904
|
-
number: function(first, second) {
|
|
2905
|
-
return first - second;
|
|
2906
|
-
},
|
|
2907
|
-
string: function(first, second) {
|
|
2908
|
-
first = `${first}`;
|
|
2909
|
-
second = `${second}`;
|
|
2910
|
-
return first.localeCompare(second);
|
|
2911
|
-
}
|
|
2912
|
-
};
|
|
2913
|
-
var sortTypes_default = sortTypes;
|
|
2914
|
-
|
|
2915
|
-
// src/utils/multisort/index.ts
|
|
2916
|
-
var multisort = (sortInfo, array, get) => {
|
|
2917
|
-
array.sort(getMultisortFunction(sortInfo, get));
|
|
2918
|
-
return array;
|
|
2919
|
-
};
|
|
2920
|
-
multisort.knownTypes = sortTypes_default;
|
|
2921
|
-
var getSingleSortFunction = (info) => {
|
|
2922
|
-
if (!info) {
|
|
2923
|
-
return;
|
|
2924
|
-
}
|
|
2925
|
-
const field = info.field;
|
|
2926
|
-
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
2927
|
-
if (!dir) {
|
|
2928
|
-
return;
|
|
2929
|
-
}
|
|
2930
|
-
let fn = info.fn;
|
|
2931
|
-
if (!fn && info.type) {
|
|
2932
|
-
fn = multisort.knownTypes[info.type];
|
|
2933
|
-
if (!fn) {
|
|
2934
|
-
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
2935
|
-
}
|
|
2936
|
-
}
|
|
2937
|
-
if (!fn) {
|
|
2938
|
-
fn = sortTypes_default.string;
|
|
2939
|
-
}
|
|
2940
|
-
return (first, second) => {
|
|
2941
|
-
const a = field ? first[field] : first;
|
|
2942
|
-
const b = field ? second[field] : second;
|
|
2943
|
-
return dir * fn(a, b);
|
|
2944
|
-
};
|
|
2945
|
-
};
|
|
2946
|
-
var getSortFunctions = (sortInfo) => {
|
|
2947
|
-
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
2948
|
-
};
|
|
2949
|
-
var getMultisortFunction = (sortInfo, get) => {
|
|
2950
|
-
const fns = getSortFunctions(sortInfo);
|
|
2951
|
-
return (first, second) => {
|
|
2952
|
-
if (get) {
|
|
2953
|
-
first = get(first);
|
|
2954
|
-
second = get(second);
|
|
3250
|
+
const collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
|
|
3251
|
+
const enhancedGroupData = getEnhancedGroupData({
|
|
3252
|
+
groupBy: groupByStrings,
|
|
3253
|
+
parents: Array.from(parents),
|
|
3254
|
+
indexInGroup,
|
|
3255
|
+
indexInParentGroups: Array.from(indexInParentGroups),
|
|
3256
|
+
indexInAll: result.length,
|
|
3257
|
+
groupKeys,
|
|
3258
|
+
collapsed
|
|
3259
|
+
}, deepMapValue);
|
|
3260
|
+
const include = generateGroupRows || collapsed;
|
|
3261
|
+
if (include) {
|
|
3262
|
+
result.push(enhancedGroupData);
|
|
2955
3263
|
}
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
3264
|
+
if (collapsed) {
|
|
3265
|
+
parents.forEach((parent) => {
|
|
3266
|
+
parent.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
3267
|
+
parent.collapsedGroupsCount += 1;
|
|
3268
|
+
});
|
|
3269
|
+
}
|
|
3270
|
+
indexInParentGroups.push(indexInGroup);
|
|
3271
|
+
parents.push(enhancedGroupData);
|
|
3272
|
+
if (!collapsed) {
|
|
3273
|
+
if (!next) {
|
|
3274
|
+
if (!pivot) {
|
|
3275
|
+
const startIndex = result.length;
|
|
3276
|
+
result.push(...items.map((item, index) => {
|
|
3277
|
+
return {
|
|
3278
|
+
id: toPrimaryKey(item),
|
|
3279
|
+
data: item,
|
|
3280
|
+
isGroupRow: false,
|
|
3281
|
+
collapsed: false,
|
|
3282
|
+
groupKeys,
|
|
3283
|
+
parents: Array.from(parents),
|
|
3284
|
+
indexInParentGroups: [...indexInParentGroups, index],
|
|
3285
|
+
indexInGroup: index,
|
|
3286
|
+
indexInAll: startIndex + index,
|
|
3287
|
+
groupBy: groupByStrings,
|
|
3288
|
+
groupNesting,
|
|
3289
|
+
groupCount: enhancedGroupData.groupCount
|
|
3290
|
+
};
|
|
3291
|
+
}));
|
|
3292
|
+
}
|
|
3293
|
+
} else {
|
|
3294
|
+
next();
|
|
2968
3295
|
}
|
|
2969
3296
|
}
|
|
2970
|
-
|
|
3297
|
+
parents.pop();
|
|
3298
|
+
indexInParentGroups.pop();
|
|
3299
|
+
});
|
|
3300
|
+
return {
|
|
3301
|
+
data: result
|
|
2971
3302
|
};
|
|
2972
|
-
}
|
|
3303
|
+
}
|
|
2973
3304
|
|
|
2974
3305
|
// src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
|
|
2975
3306
|
function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPosition) {
|
|
@@ -3095,7 +3426,7 @@ function concludeReducer(params) {
|
|
|
3095
3426
|
var _a;
|
|
3096
3427
|
const { state, previousState } = params;
|
|
3097
3428
|
const sortInfo = state.sortInfo;
|
|
3098
|
-
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length);
|
|
3429
|
+
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
3099
3430
|
const sortDepsChanged = haveDepsChanged(previousState, state, [
|
|
3100
3431
|
"originalDataArray",
|
|
3101
3432
|
"sortInfo"
|
|
@@ -3165,7 +3496,9 @@ function concludeReducer(params) {
|
|
|
3165
3496
|
}
|
|
3166
3497
|
state.dataArray = rowInfoDataArray;
|
|
3167
3498
|
state.reducedAt = now;
|
|
3168
|
-
|
|
3499
|
+
if (true) {
|
|
3500
|
+
globalThis.state = state;
|
|
3501
|
+
}
|
|
3169
3502
|
return state;
|
|
3170
3503
|
}
|
|
3171
3504
|
|
|
@@ -3188,7 +3521,8 @@ var DataSourceRoot = getComponentStateRoot({
|
|
|
3188
3521
|
initSetupState: initSetupState2,
|
|
3189
3522
|
forwardProps: forwardProps3,
|
|
3190
3523
|
concludeReducer,
|
|
3191
|
-
mapPropsToState: mapPropsToState2
|
|
3524
|
+
mapPropsToState: mapPropsToState2,
|
|
3525
|
+
interceptActions: getInterceptActions()
|
|
3192
3526
|
});
|
|
3193
3527
|
function DataSourceCmp({ children }) {
|
|
3194
3528
|
const DataSourceContext = getDataSourceContext();
|
|
@@ -3218,7 +3552,7 @@ function DataSource(props) {
|
|
|
3218
3552
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
3219
3553
|
function useToggleGroupRow() {
|
|
3220
3554
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
3221
|
-
const toggleGroupRow = (0,
|
|
3555
|
+
const toggleGroupRow = (0, import_react18.useCallback)((groupKeys) => {
|
|
3222
3556
|
const newState = new GroupRowsState(getDataSourceState().groupRowsState);
|
|
3223
3557
|
newState.toggleGroupRow(groupKeys);
|
|
3224
3558
|
dataSourceActions.groupRowsState = newState;
|
|
@@ -3228,7 +3562,7 @@ function useToggleGroupRow() {
|
|
|
3228
3562
|
|
|
3229
3563
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
3230
3564
|
function useGroupRowsMap(groupRowsBy) {
|
|
3231
|
-
const groupRowsMap = (0,
|
|
3565
|
+
const groupRowsMap = (0, import_react19.useMemo)(() => {
|
|
3232
3566
|
return groupRowsBy.reduce((acc, groupBy, index) => {
|
|
3233
3567
|
acc.set(groupBy.field, {
|
|
3234
3568
|
groupBy,
|
|
@@ -3248,10 +3582,10 @@ function useColumnsWhen() {
|
|
|
3248
3582
|
componentState: { groupRenderStrategy, pivotTotalColumnPosition }
|
|
3249
3583
|
} = useComponentState();
|
|
3250
3584
|
const groupRowsMap = useGroupRowsMap(groupRowsBy);
|
|
3251
|
-
(0,
|
|
3585
|
+
(0, import_react19.useEffect)(() => {
|
|
3252
3586
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
3253
3587
|
}, [groupRenderStrategy]);
|
|
3254
|
-
(0,
|
|
3588
|
+
(0, import_react19.useEffect)(() => {
|
|
3255
3589
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3256
3590
|
}, [pivotTotalColumnPosition]);
|
|
3257
3591
|
useColumnsWhenInlineGroupRenderStrategy(groupRowsMap);
|
|
@@ -3314,7 +3648,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3314
3648
|
});
|
|
3315
3649
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
3316
3650
|
}
|
|
3317
|
-
(0,
|
|
3651
|
+
(0, import_react19.useEffect)(() => {
|
|
3318
3652
|
const update = () => {
|
|
3319
3653
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupRowsMap, groupRenderStrategy, toggleGroupRow);
|
|
3320
3654
|
};
|
|
@@ -3340,7 +3674,7 @@ function useColumnsWhenPivoting() {
|
|
|
3340
3674
|
}
|
|
3341
3675
|
} = useComponentState();
|
|
3342
3676
|
const toggleGroupRow = useToggleGroupRow();
|
|
3343
|
-
(0,
|
|
3677
|
+
(0, import_react19.useEffect)(() => {
|
|
3344
3678
|
const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
|
|
3345
3679
|
pivotColumn,
|
|
3346
3680
|
pivotRowLabelsColumn,
|
|
@@ -3361,7 +3695,7 @@ function useColumnsWhenGrouping() {
|
|
|
3361
3695
|
componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
|
|
3362
3696
|
} = useComponentState();
|
|
3363
3697
|
const toggleGroupRow = useToggleGroupRow();
|
|
3364
|
-
(0,
|
|
3698
|
+
(0, import_react19.useEffect)(() => {
|
|
3365
3699
|
if (pivotColumns) {
|
|
3366
3700
|
return;
|
|
3367
3701
|
}
|
|
@@ -3398,7 +3732,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3398
3732
|
groupRenderStrategy
|
|
3399
3733
|
}
|
|
3400
3734
|
} = useComponentState();
|
|
3401
|
-
(0,
|
|
3735
|
+
(0, import_react19.useEffect)(() => {
|
|
3402
3736
|
if (groupRenderStrategy === "single-column") {
|
|
3403
3737
|
return;
|
|
3404
3738
|
}
|
|
@@ -3463,25 +3797,27 @@ function getColumnsWhenGrouping(params) {
|
|
|
3463
3797
|
const computedColumns = new Map();
|
|
3464
3798
|
if (groupRenderStrategy === "multi-column") {
|
|
3465
3799
|
groupRowsBy.forEach((groupByForColumn, groupIndexForColumn, arr) => {
|
|
3466
|
-
|
|
3800
|
+
const generatedGroupColumn = getColumnForGroupBy({
|
|
3467
3801
|
groupByForColumn,
|
|
3468
3802
|
groupRowsBy,
|
|
3469
3803
|
groupIndexForColumn,
|
|
3470
3804
|
groupCount: arr.length,
|
|
3471
3805
|
groupRenderStrategy
|
|
3472
|
-
}, toggleGroupRow, groupColumn)
|
|
3806
|
+
}, toggleGroupRow, groupColumn);
|
|
3807
|
+
computedColumns.set(generatedGroupColumn.id || `group-by-${groupByForColumn.field}`, generatedGroupColumn);
|
|
3473
3808
|
});
|
|
3474
3809
|
} else if (groupRenderStrategy === "single-column") {
|
|
3475
|
-
|
|
3810
|
+
const singleGroupColumn = getSingleGroupColumn({
|
|
3476
3811
|
groupCount: groupRowsBy.length,
|
|
3477
3812
|
groupRowsBy,
|
|
3478
3813
|
groupRenderStrategy
|
|
3479
|
-
}, toggleGroupRow, groupColumn)
|
|
3814
|
+
}, toggleGroupRow, groupColumn);
|
|
3815
|
+
computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
|
|
3480
3816
|
}
|
|
3481
3817
|
columns.forEach((col, colId) => {
|
|
3482
3818
|
computedColumns.set(colId, col);
|
|
3483
3819
|
});
|
|
3484
|
-
return computedColumns;
|
|
3820
|
+
return computedColumns.size ? computedColumns : void 0;
|
|
3485
3821
|
}
|
|
3486
3822
|
|
|
3487
3823
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
@@ -3492,8 +3828,15 @@ function useComputed() {
|
|
|
3492
3828
|
componentActions: dataSourceActions,
|
|
3493
3829
|
componentState: dataSourceState
|
|
3494
3830
|
} = useDataSourceContextValue();
|
|
3495
|
-
const {
|
|
3496
|
-
|
|
3831
|
+
const {
|
|
3832
|
+
columnOrder,
|
|
3833
|
+
columnVisibility,
|
|
3834
|
+
columnPinning,
|
|
3835
|
+
columnSizing,
|
|
3836
|
+
columnTypes,
|
|
3837
|
+
bodySize
|
|
3838
|
+
} = componentState;
|
|
3839
|
+
(0, import_react20.useState)(() => {
|
|
3497
3840
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
3498
3841
|
if (rowHeight) {
|
|
3499
3842
|
componentActions.rowHeight = rowHeight;
|
|
@@ -3509,9 +3852,10 @@ function useComputed() {
|
|
|
3509
3852
|
const { multiSort } = dataSourceState;
|
|
3510
3853
|
useColumnGroups();
|
|
3511
3854
|
useColumnsWhen();
|
|
3512
|
-
const setSortInfo = (0,
|
|
3855
|
+
const setSortInfo = (0, import_react20.useCallback)((sortInfo) => {
|
|
3513
3856
|
var _a2;
|
|
3514
|
-
|
|
3857
|
+
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
3858
|
+
dataSourceActions.sortInfo = newSortInfo;
|
|
3515
3859
|
}, []);
|
|
3516
3860
|
const columns = componentState.computedColumns;
|
|
3517
3861
|
const {
|
|
@@ -3537,6 +3881,7 @@ function useComputed() {
|
|
|
3537
3881
|
pinnedStartMaxWidth: componentState.pinnedStartMaxWidth,
|
|
3538
3882
|
pinnedEndMaxWidth: componentState.pinnedEndMaxWidth,
|
|
3539
3883
|
bodySize,
|
|
3884
|
+
viewportReservedWidth: componentState.viewportReservedWidth,
|
|
3540
3885
|
sortable: componentState.sortable,
|
|
3541
3886
|
draggableColumns: componentState.draggableColumns,
|
|
3542
3887
|
sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
|
|
@@ -3545,7 +3890,9 @@ function useComputed() {
|
|
|
3545
3890
|
columnOrder,
|
|
3546
3891
|
columnVisibility,
|
|
3547
3892
|
columnVisibilityAssumeVisible: true,
|
|
3548
|
-
columnPinning
|
|
3893
|
+
columnPinning,
|
|
3894
|
+
columnSizing,
|
|
3895
|
+
columnTypes
|
|
3549
3896
|
});
|
|
3550
3897
|
const unpinnedColumnWidths = computedUnpinnedColumns.map((c) => c.computedWidth);
|
|
3551
3898
|
let sortedUnpinnedColumnWidths = [...unpinnedColumnWidths].sort(sortAscending);
|
|
@@ -3616,33 +3963,6 @@ var InfiniteTableBody = React10.forwardRef(function InfiniteTableBody2(props, re
|
|
|
3616
3963
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
3617
3964
|
var React22 = __toModule(require("react"));
|
|
3618
3965
|
|
|
3619
|
-
// src/utils/getGlobal.ts
|
|
3620
|
-
function getGlobal() {
|
|
3621
|
-
return globalThis;
|
|
3622
|
-
}
|
|
3623
|
-
|
|
3624
|
-
// src/components/utils/getScrollbarWidth.ts
|
|
3625
|
-
var scrollbarWidth;
|
|
3626
|
-
function getScrollbarWidth() {
|
|
3627
|
-
var _a, _b;
|
|
3628
|
-
if (scrollbarWidth != null) {
|
|
3629
|
-
return scrollbarWidth;
|
|
3630
|
-
}
|
|
3631
|
-
const doc = (_a = getGlobal().document) != null ? _a : null;
|
|
3632
|
-
if (!doc) {
|
|
3633
|
-
return 0;
|
|
3634
|
-
}
|
|
3635
|
-
const outer = doc.createElement("div");
|
|
3636
|
-
outer.style.visibility = "hidden";
|
|
3637
|
-
outer.style.overflow = "scroll";
|
|
3638
|
-
doc.body.appendChild(outer);
|
|
3639
|
-
const inner = doc.createElement("div");
|
|
3640
|
-
outer.appendChild(inner);
|
|
3641
|
-
scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
|
3642
|
-
(_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
|
|
3643
|
-
return scrollbarWidth;
|
|
3644
|
-
}
|
|
3645
|
-
|
|
3646
3966
|
// src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx
|
|
3647
3967
|
var React11 = __toModule(require("react"));
|
|
3648
3968
|
function HorizontalScrollbarPlaceholderFn(props) {
|
|
@@ -3679,10 +3999,11 @@ function VerticalScrollbarPlaceholderFn(props) {
|
|
|
3679
3999
|
var VerticalScrollbarPlaceholder = React11.memo(VerticalScrollbarPlaceholderFn);
|
|
3680
4000
|
|
|
3681
4001
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
4002
|
+
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3682
4003
|
var CellCls = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
3683
4004
|
var HeaderCellProxy = "_12zfob10";
|
|
3684
|
-
var HeaderCellRecipe = createRuntimeFn({ defaultClassName: "_12zfob1c", variantClassNames: { dragging: { true: "_12zfob1d", false: "_12zfob1e" }, first: { true: "_12zfob1f", false: "_12zfob1g" }, last: { true: "_12zfob1h", false: "_12zfob1i" }, groupByField: { true: "_12zfob1j", false: "_12zfob1k" }, firstInCategory: { true: "_12zfob1l", false: "_12zfob1m" }, lastInCategory: { true: "_12zfob1n", false: "_12zfob1o" }, pinned: { start: "_12zfob1p", end: "_12zfob1q", false: "_12zfob1r" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob1s"], [{ pinned: "end", firstInCategory: true }, "_12zfob1t"], [{ pinned: false, lastInCategory: true }, "_12zfob1u"]] });
|
|
3685
|
-
var HeaderClsRecipe = createRuntimeFn({ defaultClassName: "_12zfob12 _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"]] });
|
|
4005
|
+
var HeaderCellRecipe = (0, import_createRuntimeFn2.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"]] });
|
|
4006
|
+
var HeaderClsRecipe = (0, import_createRuntimeFn2.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"]] });
|
|
3686
4007
|
var HeaderGroupCls = "_16lm1iwz _16lm1iwj";
|
|
3687
4008
|
var HeaderGroup_Children = "_16lm1iwj _16lm1iw10 _16lm1iw12 _16lm1iwc";
|
|
3688
4009
|
var HeaderGroup_Header = "_12zfob1x _16lm1iwj _16lm1iw10 _16lm1iw11";
|
|
@@ -3691,27 +4012,28 @@ var HeaderWrapperCls = "_12zfob1v _16lm1iw16 _16lm1iw1 _16lm1iwj _16lm1iw10";
|
|
|
3691
4012
|
|
|
3692
4013
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
3693
4014
|
var React18 = __toModule(require("react"));
|
|
3694
|
-
var
|
|
4015
|
+
var import_react28 = __toModule(require("react"));
|
|
3695
4016
|
|
|
3696
4017
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3697
4018
|
var React14 = __toModule(require("react"));
|
|
3698
|
-
var
|
|
4019
|
+
var import_react24 = __toModule(require("react"));
|
|
3699
4020
|
|
|
3700
4021
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
3701
4022
|
var React12 = __toModule(require("react"));
|
|
3702
4023
|
|
|
3703
4024
|
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
3704
|
-
var
|
|
4025
|
+
var import_react21 = __toModule(require("react"));
|
|
3705
4026
|
var useInfiniteTableState = () => {
|
|
3706
4027
|
const TableContext2 = getInfiniteTableContext();
|
|
3707
|
-
const { componentState } = (0,
|
|
4028
|
+
const { componentState } = (0, import_react21.useContext)(TableContext2);
|
|
3708
4029
|
return componentState;
|
|
3709
4030
|
};
|
|
3710
4031
|
|
|
3711
4032
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
4033
|
+
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3712
4034
|
var CellCls2 = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
3713
4035
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
3714
|
-
var ColumnCellRecipe = 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"]] });
|
|
4036
|
+
var ColumnCellRecipe = (0, import_createRuntimeFn3.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"]] });
|
|
3715
4037
|
var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
|
|
3716
4038
|
|
|
3717
4039
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
@@ -3769,7 +4091,7 @@ var InfiniteTableCell = React12.memo(InfiniteTableCellFn);
|
|
|
3769
4091
|
|
|
3770
4092
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3771
4093
|
var import_binary_search = __toModule(require_binary_search());
|
|
3772
|
-
var
|
|
4094
|
+
var import_react22 = __toModule(require("react"));
|
|
3773
4095
|
|
|
3774
4096
|
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
3775
4097
|
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
@@ -3803,18 +4125,18 @@ var useColumnPointerEvents = ({
|
|
|
3803
4125
|
columns,
|
|
3804
4126
|
computedRemainingSpace
|
|
3805
4127
|
}) => {
|
|
3806
|
-
const [draggingDiff, setDraggingDiff] = (0,
|
|
3807
|
-
const [proxyOffset, setProxyOffset] = (0,
|
|
3808
|
-
const breakpointsRef = (0,
|
|
3809
|
-
const pointerMoveRef = (0,
|
|
3810
|
-
const didDragRef = (0,
|
|
3811
|
-
const initialClientPos = (0,
|
|
3812
|
-
const currentDropIndexRef = (0,
|
|
4128
|
+
const [draggingDiff, setDraggingDiff] = (0, import_react22.useState)(null);
|
|
4129
|
+
const [proxyOffset, setProxyOffset] = (0, import_react22.useState)(null);
|
|
4130
|
+
const breakpointsRef = (0, import_react22.useRef)([]);
|
|
4131
|
+
const pointerMoveRef = (0, import_react22.useRef)(null);
|
|
4132
|
+
const didDragRef = (0, import_react22.useRef)(false);
|
|
4133
|
+
const initialClientPos = (0, import_react22.useRef)(null);
|
|
4134
|
+
const currentDropIndexRef = (0, import_react22.useRef)(null);
|
|
3813
4135
|
const dragging = draggingDiff != null;
|
|
3814
4136
|
const { componentActions, computed } = useInfiniteTable();
|
|
3815
4137
|
const { computedColumnOrder } = computed;
|
|
3816
|
-
const column = (0,
|
|
3817
|
-
const { columnIndex, columnWidth, columnsArray } = (0,
|
|
4138
|
+
const column = (0, import_react22.useMemo)(() => columns.get(columnId), [columnId, columns]);
|
|
4139
|
+
const { columnIndex, columnWidth, columnsArray } = (0, import_react22.useMemo)(() => {
|
|
3818
4140
|
const columnsArray2 = Array.from(columns.values());
|
|
3819
4141
|
return {
|
|
3820
4142
|
columnsArray: columnsArray2,
|
|
@@ -3822,8 +4144,8 @@ var useColumnPointerEvents = ({
|
|
|
3822
4144
|
columnWidth: column.computedWidth
|
|
3823
4145
|
};
|
|
3824
4146
|
}, [columns, columnId, column]);
|
|
3825
|
-
let cursorRef = (0,
|
|
3826
|
-
const onPointerDown = (0,
|
|
4147
|
+
let cursorRef = (0, import_react22.useRef)("auto");
|
|
4148
|
+
const onPointerDown = (0, import_react22.useCallback)((e) => {
|
|
3827
4149
|
const target = domRef.current;
|
|
3828
4150
|
cursorRef.current = target.style.cursor;
|
|
3829
4151
|
didDragRef.current = false;
|
|
@@ -3886,7 +4208,7 @@ var useColumnPointerEvents = ({
|
|
|
3886
4208
|
target.addEventListener("pointermove", onPointerMove);
|
|
3887
4209
|
target.setPointerCapture(e.pointerId);
|
|
3888
4210
|
}, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
|
|
3889
|
-
const onPointerUp = (0,
|
|
4211
|
+
const onPointerUp = (0, import_react22.useCallback)((e) => {
|
|
3890
4212
|
const target = domRef.current;
|
|
3891
4213
|
target.style.cursor = cursorRef.current;
|
|
3892
4214
|
target.releasePointerCapture(e.pointerId);
|
|
@@ -3961,7 +4283,7 @@ var import_react_dom = __toModule(require("react-dom"));
|
|
|
3961
4283
|
|
|
3962
4284
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
3963
4285
|
var React13 = __toModule(require("react"));
|
|
3964
|
-
var
|
|
4286
|
+
var import_react23 = __toModule(require("react"));
|
|
3965
4287
|
var defaultLineStyle = {
|
|
3966
4288
|
marginTop: 2,
|
|
3967
4289
|
marginBottom: 2,
|
|
@@ -3969,8 +4291,8 @@ var defaultLineStyle = {
|
|
|
3969
4291
|
};
|
|
3970
4292
|
function SortIcon(props) {
|
|
3971
4293
|
var _a;
|
|
3972
|
-
const [rendered, setRendered] = (0,
|
|
3973
|
-
const [opacity, setOpacity] = (0,
|
|
4294
|
+
const [rendered, setRendered] = (0, import_react23.useState)(true);
|
|
4295
|
+
const [opacity, setOpacity] = (0, import_react23.useState)(0);
|
|
3974
4296
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
3975
4297
|
const showIndex = index != null && index > 0;
|
|
3976
4298
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -3984,7 +4306,7 @@ function SortIcon(props) {
|
|
|
3984
4306
|
}), props.lineStyle), {
|
|
3985
4307
|
opacity
|
|
3986
4308
|
});
|
|
3987
|
-
(0,
|
|
4309
|
+
(0, import_react23.useEffect)(() => {
|
|
3988
4310
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
3989
4311
|
if (!rendered && newOpacity) {
|
|
3990
4312
|
setRendered(true);
|
|
@@ -4061,8 +4383,8 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4061
4383
|
className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
|
|
4062
4384
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
4063
4385
|
});
|
|
4064
|
-
const domRef = (0,
|
|
4065
|
-
const ref = (0,
|
|
4386
|
+
const domRef = (0, import_react24.useRef)(null);
|
|
4387
|
+
const ref = (0, import_react24.useCallback)((node) => {
|
|
4066
4388
|
var _a2;
|
|
4067
4389
|
domRef.current = node;
|
|
4068
4390
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
@@ -4071,7 +4393,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4071
4393
|
computed: { computedRemainingSpace },
|
|
4072
4394
|
componentState: { portalDOMRef }
|
|
4073
4395
|
} = useInfiniteTable();
|
|
4074
|
-
(0,
|
|
4396
|
+
(0, import_react24.useEffect)(() => {
|
|
4075
4397
|
let clearOnResize = null;
|
|
4076
4398
|
const node = domRef.current;
|
|
4077
4399
|
if (onResize && node) {
|
|
@@ -4124,7 +4446,25 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4124
4446
|
|
|
4125
4447
|
// src/components/RawList/index.tsx
|
|
4126
4448
|
var React17 = __toModule(require("react"));
|
|
4449
|
+
var import_react27 = __toModule(require("react"));
|
|
4450
|
+
|
|
4451
|
+
// src/components/RawList/AvoidReactDiff.tsx
|
|
4452
|
+
var React15 = __toModule(require("react"));
|
|
4127
4453
|
var import_react25 = __toModule(require("react"));
|
|
4454
|
+
function AvoidReactDiffFn(props) {
|
|
4455
|
+
const [children, setChildren] = (0, import_react25.useState)(props.updater.get());
|
|
4456
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
4457
|
+
const remove = props.updater.onChange((children2) => {
|
|
4458
|
+
setChildren(children2);
|
|
4459
|
+
});
|
|
4460
|
+
return remove;
|
|
4461
|
+
}, [props.updater]);
|
|
4462
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, children);
|
|
4463
|
+
}
|
|
4464
|
+
var AvoidReactDiff = React15.memo(AvoidReactDiffFn);
|
|
4465
|
+
|
|
4466
|
+
// src/components/RawList/useVirtualRenderer.ts
|
|
4467
|
+
var import_react26 = __toModule(require("react"));
|
|
4128
4468
|
|
|
4129
4469
|
// src/components/RawList/ReactVirtualRenderer.tsx
|
|
4130
4470
|
var React16 = __toModule(require("react"));
|
|
@@ -4143,10 +4483,10 @@ var MappedItems = class extends Logger {
|
|
|
4143
4483
|
return result;
|
|
4144
4484
|
};
|
|
4145
4485
|
this.getElementsOutsideItemRange = (startIndex, endIndex) => {
|
|
4146
|
-
const
|
|
4486
|
+
const map2 = this.elementIndexToItemIndex;
|
|
4147
4487
|
const result = [];
|
|
4148
|
-
for (const elementIndex in
|
|
4149
|
-
const itemIndex =
|
|
4488
|
+
for (const elementIndex in map2) {
|
|
4489
|
+
const itemIndex = map2[elementIndex];
|
|
4150
4490
|
if (itemIndex < startIndex || itemIndex > endIndex) {
|
|
4151
4491
|
result.push(elementIndex >> 0);
|
|
4152
4492
|
}
|
|
@@ -4222,6 +4562,9 @@ var MappedItems = class extends Logger {
|
|
|
4222
4562
|
this.itemIndexToElementIndex = {};
|
|
4223
4563
|
this.renderedElements = {};
|
|
4224
4564
|
}
|
|
4565
|
+
reset() {
|
|
4566
|
+
this.init();
|
|
4567
|
+
}
|
|
4225
4568
|
destroy() {
|
|
4226
4569
|
this.init();
|
|
4227
4570
|
}
|
|
@@ -4241,21 +4584,6 @@ var MappedItems = class extends Logger {
|
|
|
4241
4584
|
}
|
|
4242
4585
|
};
|
|
4243
4586
|
|
|
4244
|
-
// src/components/RawList/AvoidReactDiff.tsx
|
|
4245
|
-
var React15 = __toModule(require("react"));
|
|
4246
|
-
var import_react24 = __toModule(require("react"));
|
|
4247
|
-
function AvoidReactDiffFn(props) {
|
|
4248
|
-
const [children, setChildren] = (0, import_react24.useState)(props.updater.get());
|
|
4249
|
-
(0, import_react24.useLayoutEffect)(() => {
|
|
4250
|
-
const remove = props.updater.onChange((children2) => {
|
|
4251
|
-
setChildren(children2);
|
|
4252
|
-
});
|
|
4253
|
-
return remove;
|
|
4254
|
-
}, [props.updater]);
|
|
4255
|
-
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, children);
|
|
4256
|
-
}
|
|
4257
|
-
var AvoidReactDiff = React15.memo(AvoidReactDiffFn);
|
|
4258
|
-
|
|
4259
4587
|
// src/components/RawList/ReactVirtualRenderer.tsx
|
|
4260
4588
|
var ITEM_POSITION_WITH_TRANSFORM = true;
|
|
4261
4589
|
var ReactVirtualRenderer = class extends Logger {
|
|
@@ -4362,17 +4690,12 @@ var ReactVirtualRenderer = class extends Logger {
|
|
|
4362
4690
|
}
|
|
4363
4691
|
};
|
|
4364
4692
|
this.destroy = () => {
|
|
4365
|
-
if (true) {
|
|
4366
|
-
return;
|
|
4367
|
-
}
|
|
4368
4693
|
this.destroyed = true;
|
|
4369
|
-
this.
|
|
4370
|
-
this.itemDOMElements = [];
|
|
4371
|
-
this.itemDOMRefs = [];
|
|
4372
|
-
this.updaters = [];
|
|
4694
|
+
this.reset();
|
|
4373
4695
|
this.onRender = null;
|
|
4374
4696
|
this.renderItem = null;
|
|
4375
4697
|
this.brain = null;
|
|
4698
|
+
this.mappedItems = null;
|
|
4376
4699
|
};
|
|
4377
4700
|
if (onRender) {
|
|
4378
4701
|
this.onRender = onRender;
|
|
@@ -4430,28 +4753,53 @@ var ReactVirtualRenderer = class extends Logger {
|
|
|
4430
4753
|
itemUpdater(renderedNode);
|
|
4431
4754
|
this.updateElementPosition(elementIndex);
|
|
4432
4755
|
}
|
|
4756
|
+
reset() {
|
|
4757
|
+
this.itemDOMElements = {};
|
|
4758
|
+
this.itemDOMRefs = {};
|
|
4759
|
+
this.updaters = {};
|
|
4760
|
+
this.items = [];
|
|
4761
|
+
this.mappedItems.reset();
|
|
4762
|
+
}
|
|
4433
4763
|
};
|
|
4434
4764
|
|
|
4765
|
+
// src/components/RawList/useVirtualRenderer.ts
|
|
4766
|
+
function createRenderer(brain) {
|
|
4767
|
+
const renderer = new ReactVirtualRenderer(brain, {});
|
|
4768
|
+
const onRenderUpdater = buildSubscriptionCallback();
|
|
4769
|
+
brain.onDestroy(() => {
|
|
4770
|
+
renderer.destroy();
|
|
4771
|
+
onRenderUpdater.destroy();
|
|
4772
|
+
});
|
|
4773
|
+
return {
|
|
4774
|
+
renderer,
|
|
4775
|
+
onRenderUpdater
|
|
4776
|
+
};
|
|
4777
|
+
}
|
|
4778
|
+
function useVirtualRenderer({
|
|
4779
|
+
brain
|
|
4780
|
+
}) {
|
|
4781
|
+
return (0, import_react26.useMemo)(() => {
|
|
4782
|
+
return createRenderer(brain);
|
|
4783
|
+
}, [brain]);
|
|
4784
|
+
}
|
|
4785
|
+
|
|
4435
4786
|
// src/components/RawList/index.tsx
|
|
4436
4787
|
function RawListFn(props) {
|
|
4437
4788
|
const { renderItem, brain, debugChannel } = props;
|
|
4438
|
-
const { onRenderUpdater, renderer } = (
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
});
|
|
4443
|
-
return { onRenderUpdater: onRenderUpdater2, renderer: renderer2 };
|
|
4444
|
-
}, []);
|
|
4789
|
+
const { onRenderUpdater, renderer } = useVirtualRenderer({
|
|
4790
|
+
brain,
|
|
4791
|
+
debugChannel
|
|
4792
|
+
});
|
|
4445
4793
|
const getRenderItem = useLatest(renderItem);
|
|
4446
|
-
(0,
|
|
4794
|
+
(0, import_react27.useEffect)(() => {
|
|
4447
4795
|
const renderRange = brain.getRenderRange();
|
|
4448
4796
|
renderer.renderRange(renderRange, {
|
|
4449
4797
|
renderItem,
|
|
4450
4798
|
force: true,
|
|
4451
4799
|
onRender: onRenderUpdater
|
|
4452
4800
|
});
|
|
4453
|
-
}, [renderItem, onRenderUpdater]);
|
|
4454
|
-
(0,
|
|
4801
|
+
}, [brain, renderItem, onRenderUpdater]);
|
|
4802
|
+
(0, import_react27.useEffect)(() => {
|
|
4455
4803
|
const remove = brain.onRenderRangeChange((renderRange) => {
|
|
4456
4804
|
renderer.renderRange(renderRange, {
|
|
4457
4805
|
force: false,
|
|
@@ -4461,12 +4809,6 @@ function RawListFn(props) {
|
|
|
4461
4809
|
});
|
|
4462
4810
|
return remove;
|
|
4463
4811
|
}, [brain, onRenderUpdater]);
|
|
4464
|
-
(0, import_react25.useEffect)(() => {
|
|
4465
|
-
return () => {
|
|
4466
|
-
renderer.destroy();
|
|
4467
|
-
onRenderUpdater.destroy();
|
|
4468
|
-
};
|
|
4469
|
-
}, [renderer, onRenderUpdater]);
|
|
4470
4812
|
return /* @__PURE__ */ React17.createElement(AvoidReactDiff, {
|
|
4471
4813
|
updater: onRenderUpdater
|
|
4472
4814
|
});
|
|
@@ -4484,7 +4826,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4484
4826
|
componentState: { headerHeight }
|
|
4485
4827
|
} = useInfiniteTable();
|
|
4486
4828
|
const { computedVisibleColumnsMap } = computed;
|
|
4487
|
-
const renderColumn = (0,
|
|
4829
|
+
const renderColumn = (0, import_react28.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
|
|
4488
4830
|
const column = columns[columnIndex];
|
|
4489
4831
|
if (!column) {
|
|
4490
4832
|
if (true) {
|
|
@@ -4499,14 +4841,14 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4499
4841
|
columns: computedVisibleColumnsMap
|
|
4500
4842
|
});
|
|
4501
4843
|
}, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
|
|
4502
|
-
(0,
|
|
4844
|
+
(0, import_react28.useEffect)(() => {
|
|
4503
4845
|
const onScroll = (scrollPosition) => {
|
|
4504
4846
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
4505
4847
|
};
|
|
4506
4848
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4507
4849
|
return removeOnScroll;
|
|
4508
4850
|
}, [brain]);
|
|
4509
|
-
const domRef = (0,
|
|
4851
|
+
const domRef = (0, import_react28.useRef)(null);
|
|
4510
4852
|
const headerCls = HeaderClsRecipe({
|
|
4511
4853
|
pinned: pinning,
|
|
4512
4854
|
overflow: false,
|
|
@@ -4532,7 +4874,7 @@ var React20 = __toModule(require("react"));
|
|
|
4532
4874
|
|
|
4533
4875
|
// src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
|
|
4534
4876
|
function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
4535
|
-
const
|
|
4877
|
+
const map2 = new Map();
|
|
4536
4878
|
const temporaryMap = new Map();
|
|
4537
4879
|
const mapOfAllParentGroupsForColumns = new Map();
|
|
4538
4880
|
columns.forEach((col, index) => {
|
|
@@ -4550,7 +4892,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4550
4892
|
computedWidth: col.computedWidth,
|
|
4551
4893
|
depth: col.columnGroup ? ((_d = columnGroupsDepthsMap.get(col.columnGroup)) != null ? _d : 0) + 1 : 0
|
|
4552
4894
|
};
|
|
4553
|
-
|
|
4895
|
+
map2.set([colId], colItem);
|
|
4554
4896
|
let groupId = col.columnGroup;
|
|
4555
4897
|
let colGroupItem;
|
|
4556
4898
|
let prevGroupItem = colItem;
|
|
@@ -4572,7 +4914,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4572
4914
|
computedWidth: 0,
|
|
4573
4915
|
depth: (_e = columnGroupsDepthsMap.get(groupId)) != null ? _e : 0
|
|
4574
4916
|
};
|
|
4575
|
-
|
|
4917
|
+
map2.set(groupAbsoluteId, colGroupItem);
|
|
4576
4918
|
temporaryMap.set(groupId, colGroupItem);
|
|
4577
4919
|
}
|
|
4578
4920
|
colGroupItem.columnItems.push(colItem);
|
|
@@ -4589,7 +4931,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4589
4931
|
});
|
|
4590
4932
|
const result = [];
|
|
4591
4933
|
let groupOffset = 0;
|
|
4592
|
-
|
|
4934
|
+
map2.forEach((item) => {
|
|
4593
4935
|
if (!item.ref.columnGroup) {
|
|
4594
4936
|
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum, col) => sum + col.ref.computedWidth, 0);
|
|
4595
4937
|
item.groupOffset = groupOffset;
|
|
@@ -4601,7 +4943,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4601
4943
|
groupOffset += itemWidth;
|
|
4602
4944
|
}
|
|
4603
4945
|
});
|
|
4604
|
-
|
|
4946
|
+
map2.clear();
|
|
4605
4947
|
temporaryMap.clear();
|
|
4606
4948
|
return result;
|
|
4607
4949
|
}
|
|
@@ -4698,7 +5040,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
4698
5040
|
}
|
|
4699
5041
|
|
|
4700
5042
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
|
|
4701
|
-
var
|
|
5043
|
+
var import_react29 = __toModule(require("react"));
|
|
4702
5044
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
4703
5045
|
var TableHeaderClassName2 = `${rootClassName5}Header`;
|
|
4704
5046
|
var UPDATE_SCROLL = (node, scrollPosition) => {
|
|
@@ -4764,7 +5106,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4764
5106
|
if (totalWidth != null) {
|
|
4765
5107
|
style.width = availableWidth;
|
|
4766
5108
|
}
|
|
4767
|
-
(0,
|
|
5109
|
+
(0, import_react29.useEffect)(() => {
|
|
4768
5110
|
const scroller = brain || scrollListener;
|
|
4769
5111
|
if (!scroller || !scrollable) {
|
|
4770
5112
|
return;
|
|
@@ -4878,12 +5220,12 @@ function TableHeaderWrapper(props) {
|
|
|
4878
5220
|
|
|
4879
5221
|
// src/components/VirtualScrollContainer/index.tsx
|
|
4880
5222
|
var React23 = __toModule(require("react"));
|
|
4881
|
-
var
|
|
5223
|
+
var import_react31 = __toModule(require("react"));
|
|
4882
5224
|
|
|
4883
5225
|
// src/components/hooks/useOnScroll.ts
|
|
4884
|
-
var
|
|
5226
|
+
var import_react30 = __toModule(require("react"));
|
|
4885
5227
|
var useOnScroll = (domRef, onScroll) => {
|
|
4886
|
-
(0,
|
|
5228
|
+
(0, import_react30.useEffect)(() => {
|
|
4887
5229
|
const domNode = domRef == null ? void 0 : domRef.current;
|
|
4888
5230
|
const scrollFn = (event) => {
|
|
4889
5231
|
const node = event.target;
|
|
@@ -4929,7 +5271,7 @@ var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2
|
|
|
4929
5271
|
className,
|
|
4930
5272
|
style
|
|
4931
5273
|
} = props;
|
|
4932
|
-
const domRef = ref != null ? ref : (0,
|
|
5274
|
+
const domRef = ref != null ? ref : (0, import_react31.useRef)(null);
|
|
4933
5275
|
useOnScroll(domRef, onContainerScroll);
|
|
4934
5276
|
return /* @__PURE__ */ React23.createElement("div", {
|
|
4935
5277
|
ref: domRef,
|
|
@@ -4960,18 +5302,18 @@ function SpacePlaceholderFn(props) {
|
|
|
4960
5302
|
var SpacePlaceholder = React24.memo(SpacePlaceholderFn);
|
|
4961
5303
|
|
|
4962
5304
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
4963
|
-
var
|
|
5305
|
+
var import_react42 = __toModule(require("react"));
|
|
4964
5306
|
|
|
4965
5307
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
4966
5308
|
var React30 = __toModule(require("react"));
|
|
4967
|
-
var
|
|
5309
|
+
var import_react35 = __toModule(require("react"));
|
|
4968
5310
|
|
|
4969
5311
|
// src/components/VirtualList/VirtualRowList.tsx
|
|
4970
5312
|
var React26 = __toModule(require("react"));
|
|
4971
5313
|
|
|
4972
5314
|
// src/components/VirtualList/VirtualList.tsx
|
|
4973
5315
|
var React25 = __toModule(require("react"));
|
|
4974
|
-
var
|
|
5316
|
+
var import_react32 = __toModule(require("react"));
|
|
4975
5317
|
|
|
4976
5318
|
// src/components/VirtualList/VirtualList.css.ts
|
|
4977
5319
|
var VirtualListCls = "mlx2t0 _16lm1iw0";
|
|
@@ -5014,11 +5356,11 @@ var VirtualList = (props) => {
|
|
|
5014
5356
|
"onContainerScroll",
|
|
5015
5357
|
"children"
|
|
5016
5358
|
]);
|
|
5017
|
-
const domRef = (0,
|
|
5359
|
+
const domRef = (0, import_react32.useRef)(null);
|
|
5018
5360
|
const [, rerender] = useRerender();
|
|
5019
|
-
const [totalSize, setTotalSize] = (0,
|
|
5020
|
-
const renderCountRef = (0,
|
|
5021
|
-
(0,
|
|
5361
|
+
const [totalSize, setTotalSize] = (0, import_react32.useState)(0);
|
|
5362
|
+
const renderCountRef = (0, import_react32.useRef)(0);
|
|
5363
|
+
(0, import_react32.useEffect)(() => {
|
|
5022
5364
|
const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
|
|
5023
5365
|
renderCountRef.current = renderCount;
|
|
5024
5366
|
if (true) {
|
|
@@ -5037,7 +5379,7 @@ var VirtualList = (props) => {
|
|
|
5037
5379
|
removeOnTotalSizeChange();
|
|
5038
5380
|
};
|
|
5039
5381
|
}, [virtualBrain]);
|
|
5040
|
-
(0,
|
|
5382
|
+
(0, import_react32.useEffect)(() => {
|
|
5041
5383
|
const onScroll = (scrollPosition) => {
|
|
5042
5384
|
UPDATE_SCROLL2(domRef.current, scrollPosition);
|
|
5043
5385
|
};
|
|
@@ -5063,7 +5405,7 @@ var VirtualList = (props) => {
|
|
|
5063
5405
|
brain: virtualBrain,
|
|
5064
5406
|
renderItem,
|
|
5065
5407
|
repaintId,
|
|
5066
|
-
debugChannel: "VirtualList"
|
|
5408
|
+
debugChannel: "VirtualList-" + mainAxis
|
|
5067
5409
|
})), children, /* @__PURE__ */ React25.createElement(SpacePlaceholder, {
|
|
5068
5410
|
count,
|
|
5069
5411
|
width,
|
|
@@ -5091,7 +5433,7 @@ var VirtualRowList = (props) => {
|
|
|
5091
5433
|
|
|
5092
5434
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx
|
|
5093
5435
|
var React28 = __toModule(require("react"));
|
|
5094
|
-
var
|
|
5436
|
+
var import_react34 = __toModule(require("react"));
|
|
5095
5437
|
|
|
5096
5438
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5097
5439
|
var React27 = __toModule(require("react"));
|
|
@@ -5195,7 +5537,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5195
5537
|
var InfiniteTableColumnCell = React27.memo(InfiniteTableColumnCellFn);
|
|
5196
5538
|
|
|
5197
5539
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
5198
|
-
var
|
|
5540
|
+
var import_react33 = __toModule(require("react"));
|
|
5199
5541
|
|
|
5200
5542
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
|
|
5201
5543
|
var { rootClassName: rootClassName9 } = internalProps;
|
|
@@ -5220,8 +5562,8 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5220
5562
|
domRef: domRefFromProps,
|
|
5221
5563
|
rowInfo
|
|
5222
5564
|
} = props;
|
|
5223
|
-
const domRef = (0,
|
|
5224
|
-
const rowDOMRef = (0,
|
|
5565
|
+
const domRef = (0, import_react33.useRef)(null);
|
|
5566
|
+
const rowDOMRef = (0, import_react33.useCallback)((node) => {
|
|
5225
5567
|
domRefFromProps(node);
|
|
5226
5568
|
domRef.current = node;
|
|
5227
5569
|
}, []);
|
|
@@ -5253,7 +5595,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5253
5595
|
}), `${InfiniteTableRowClassName}--${rowInfo.isGroupRow ? "group" : "normal"}-row`, inlineGroupRoot ? `${InfiniteTableRowClassName}--inline-group-row` : "", showZebraRows ? `${InfiniteTableRowClassName}--${odd ? "odd" : "even"}` : null, showHoverRows ? `${InfiniteTableRowClassName}--show-hover` : null, domProps == null ? void 0 : domProps.className, rowProps == null ? void 0 : rowProps.className, rowComputedClassName);
|
|
5254
5596
|
const initialMouseEnter = rowProps == null ? void 0 : rowProps.onMouseEnter;
|
|
5255
5597
|
const initialMouseLeave = rowProps == null ? void 0 : rowProps.onMouseLeave;
|
|
5256
|
-
const onMouseEnter = (0,
|
|
5598
|
+
const onMouseEnter = (0, import_react33.useCallback)((event) => {
|
|
5257
5599
|
var _a;
|
|
5258
5600
|
initialMouseEnter == null ? void 0 : initialMouseEnter(event);
|
|
5259
5601
|
const rowIndex2 = ((_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex) * 1;
|
|
@@ -5267,7 +5609,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5267
5609
|
const rows = parentNode.querySelectorAll(hoverSelector.join(","));
|
|
5268
5610
|
rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover, RowHoverCls));
|
|
5269
5611
|
}, [initialMouseEnter, showHoverRows]);
|
|
5270
|
-
const onMouseLeave = (0,
|
|
5612
|
+
const onMouseLeave = (0, import_react33.useCallback)((event) => {
|
|
5271
5613
|
var _a;
|
|
5272
5614
|
initialMouseLeave == null ? void 0 : initialMouseLeave(event);
|
|
5273
5615
|
const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
|
|
@@ -5323,7 +5665,7 @@ function InfiniteTableRowFn(props) {
|
|
|
5323
5665
|
width: rowWidth,
|
|
5324
5666
|
height: rowHeight
|
|
5325
5667
|
}, domProps.style);
|
|
5326
|
-
const renderCellRef = (0,
|
|
5668
|
+
const renderCellRef = (0, import_react34.useRef)(null);
|
|
5327
5669
|
const renderCell = React28.useCallback(({ domRef, itemIndex }) => {
|
|
5328
5670
|
const column = columns[itemIndex];
|
|
5329
5671
|
if (!column) {
|
|
@@ -5427,7 +5769,7 @@ function useUnpinnedRendering(params) {
|
|
|
5427
5769
|
} = params;
|
|
5428
5770
|
const { virtualizeColumns } = getState();
|
|
5429
5771
|
const shouldVirtualizeColumns = typeof virtualizeColumns === "function" ? virtualizeColumns(computedUnpinnedColumns) : virtualizeColumns != null ? virtualizeColumns : true;
|
|
5430
|
-
const renderRowUnpinned = (0,
|
|
5772
|
+
const renderRowUnpinned = (0, import_react35.useCallback)((rowParams) => {
|
|
5431
5773
|
const dataArray = getData();
|
|
5432
5774
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
5433
5775
|
const { showZebraRows, showHoverRows } = getState();
|
|
@@ -5493,22 +5835,23 @@ function useUnpinnedRendering(params) {
|
|
|
5493
5835
|
}
|
|
5494
5836
|
|
|
5495
5837
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5496
|
-
var
|
|
5838
|
+
var import_react36 = __toModule(require("react"));
|
|
5497
5839
|
|
|
5498
5840
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5841
|
+
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5499
5842
|
var FooterCls = "_16lm1iw1";
|
|
5500
5843
|
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwj _16lm1iwz _16lm1iw0";
|
|
5501
|
-
var InfiniteClsRecipe = createRuntimeFn({ defaultClassName: "", variantClassNames: { focused: { true: "_1yeub2v2", false: "_1yeub2v3" }, focusedWithin: { true: "_1yeub2v4", false: "_1yeub2v5" }, hasPinnedStart: { true: "_1yeub2v6", false: "_1yeub2v7" }, hasPinnedEnd: { true: "_1yeub2v8", false: "_1yeub2v9" }, hasPinnedStartOverflow: { true: "_1yeub2va", false: "_1yeub2vb" }, hasPinnedEndOverflow: { true: "_1yeub2vc", false: "_1yeub2vd" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5844
|
+
var InfiniteClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { focused: { true: "_1yeub2v2", false: "_1yeub2v3" }, focusedWithin: { true: "_1yeub2v4", false: "_1yeub2v5" }, hasPinnedStart: { true: "_1yeub2v6", false: "_1yeub2v7" }, hasPinnedEnd: { true: "_1yeub2v8", false: "_1yeub2v9" }, hasPinnedStartOverflow: { true: "_1yeub2va", false: "_1yeub2vb" }, hasPinnedEndOverflow: { true: "_1yeub2vc", false: "_1yeub2vd" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5502
5845
|
var InfiniteClsScrolling = "_1yeub2v1";
|
|
5503
5846
|
var InfiniteClsShiftingColumns = "_16lm1iwm";
|
|
5504
5847
|
var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
|
|
5505
|
-
var PinnedRowsContainerClsVariants = createRuntimeFn({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5848
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5506
5849
|
|
|
5507
5850
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5508
5851
|
var DELAY = 200;
|
|
5509
5852
|
var TableClassName = internalProps.rootClassName;
|
|
5510
5853
|
var TableClassName__Scrolling = `${TableClassName}--scrolling`;
|
|
5511
|
-
var SCROLL_BOTTOM_OFFSET =
|
|
5854
|
+
var SCROLL_BOTTOM_OFFSET = 1;
|
|
5512
5855
|
var useOnContainerScroll = ({
|
|
5513
5856
|
verticalVirtualBrain,
|
|
5514
5857
|
horizontalVirtualBrain,
|
|
@@ -5524,14 +5867,15 @@ var useOnContainerScroll = ({
|
|
|
5524
5867
|
bodySize
|
|
5525
5868
|
}
|
|
5526
5869
|
} = useInfiniteTable();
|
|
5527
|
-
const
|
|
5528
|
-
const
|
|
5529
|
-
const
|
|
5530
|
-
(0,
|
|
5870
|
+
const { componentActions: dataSourceActions, getState: getDataSourceState } = useDataSourceContextValue();
|
|
5871
|
+
const timeoutIdRef = (0, import_react36.useRef)(0);
|
|
5872
|
+
const scrollingRef = (0, import_react36.useRef)(false);
|
|
5873
|
+
const scrollTopMaxRef = (0, import_react36.useRef)(0);
|
|
5874
|
+
(0, import_react36.useEffect)(() => {
|
|
5531
5875
|
const { current: node } = scrollerDOMRef;
|
|
5532
5876
|
scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
|
|
5533
5877
|
}, [reservedContentHeight, bodySize.height]);
|
|
5534
|
-
const setScrolling = (0,
|
|
5878
|
+
const setScrolling = (0, import_react36.useCallback)((scrolling) => {
|
|
5535
5879
|
var _a;
|
|
5536
5880
|
const prevScrolling = scrollingRef.current;
|
|
5537
5881
|
scrollingRef.current = scrolling;
|
|
@@ -5556,7 +5900,7 @@ var useOnContainerScroll = ({
|
|
|
5556
5900
|
}
|
|
5557
5901
|
}
|
|
5558
5902
|
}, []);
|
|
5559
|
-
const onContainerScroll = (0,
|
|
5903
|
+
const onContainerScroll = (0, import_react36.useCallback)((scrollInfo) => {
|
|
5560
5904
|
verticalVirtualBrain.setScrollPosition(scrollInfo);
|
|
5561
5905
|
horizontalVirtualBrain.setScrollPosition(scrollInfo);
|
|
5562
5906
|
setScrolling(true);
|
|
@@ -5566,15 +5910,15 @@ var useOnContainerScroll = ({
|
|
|
5566
5910
|
domRef.current,
|
|
5567
5911
|
setScrolling
|
|
5568
5912
|
]);
|
|
5569
|
-
const scrollPositionRef = (0,
|
|
5913
|
+
const scrollPositionRef = (0, import_react36.useRef)({
|
|
5570
5914
|
scrollLeft: 0,
|
|
5571
5915
|
scrollTop: 0
|
|
5572
5916
|
});
|
|
5573
|
-
const applyScrollHorizontal = (0,
|
|
5917
|
+
const applyScrollHorizontal = (0, import_react36.useCallback)(({ scrollLeft }) => {
|
|
5574
5918
|
scrollPositionRef.current.scrollLeft = scrollLeft;
|
|
5575
5919
|
onContainerScroll(scrollPositionRef.current);
|
|
5576
5920
|
}, [onContainerScroll]);
|
|
5577
|
-
const applyScrollVertical = (0,
|
|
5921
|
+
const applyScrollVertical = (0, import_react36.useCallback)(({ scrollTop }) => {
|
|
5578
5922
|
scrollPositionRef.current.scrollTop = scrollTop;
|
|
5579
5923
|
onContainerScroll(scrollPositionRef.current);
|
|
5580
5924
|
if (scrollTop === 0) {
|
|
@@ -5584,6 +5928,9 @@ var useOnContainerScroll = ({
|
|
|
5584
5928
|
const isScrollBottom = scrollTop + offset >= scrollTopMaxRef.current;
|
|
5585
5929
|
if (isScrollBottom) {
|
|
5586
5930
|
onScrollToBottom == null ? void 0 : onScrollToBottom();
|
|
5931
|
+
if (getDataSourceState().livePagination) {
|
|
5932
|
+
dataSourceActions.scrollBottomId = Date.now();
|
|
5933
|
+
}
|
|
5587
5934
|
}
|
|
5588
5935
|
}, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
|
|
5589
5936
|
return {
|
|
@@ -5594,16 +5941,16 @@ var useOnContainerScroll = ({
|
|
|
5594
5941
|
|
|
5595
5942
|
// src/components/InfiniteTable/hooks/usePinnedRendering.tsx
|
|
5596
5943
|
var React32 = __toModule(require("react"));
|
|
5597
|
-
var
|
|
5944
|
+
var import_react39 = __toModule(require("react"));
|
|
5598
5945
|
|
|
5599
5946
|
// src/components/VirtualList/RowListWithExternalScrolling.tsx
|
|
5600
5947
|
var React31 = __toModule(require("react"));
|
|
5601
|
-
var
|
|
5948
|
+
var import_react38 = __toModule(require("react"));
|
|
5602
5949
|
|
|
5603
5950
|
// src/components/hooks/useOnMount.ts
|
|
5604
|
-
var
|
|
5951
|
+
var import_react37 = __toModule(require("react"));
|
|
5605
5952
|
function useOnMount(domRef, props) {
|
|
5606
|
-
(0,
|
|
5953
|
+
(0, import_react37.useEffect)(() => {
|
|
5607
5954
|
const { onMount, onUnmount } = props;
|
|
5608
5955
|
const node = domRef == null ? void 0 : domRef.current;
|
|
5609
5956
|
onMount == null ? void 0 : onMount(node);
|
|
@@ -5634,8 +5981,8 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5634
5981
|
onMount,
|
|
5635
5982
|
onUnmount
|
|
5636
5983
|
} = props;
|
|
5637
|
-
const domRef = (0,
|
|
5638
|
-
const renderItem = (0,
|
|
5984
|
+
const domRef = (0, import_react38.useRef)(null);
|
|
5985
|
+
const renderItem = (0, import_react38.useCallback)((renderProps) => renderRow({
|
|
5639
5986
|
domRef: renderProps.domRef,
|
|
5640
5987
|
rowHeight: renderProps.itemSize,
|
|
5641
5988
|
rowIndex: renderProps.itemIndex
|
|
@@ -5644,7 +5991,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5644
5991
|
onMount,
|
|
5645
5992
|
onUnmount
|
|
5646
5993
|
});
|
|
5647
|
-
(0,
|
|
5994
|
+
(0, import_react38.useEffect)(() => {
|
|
5648
5995
|
const onScroll = (scrollPosition) => {
|
|
5649
5996
|
const node = domRef.current;
|
|
5650
5997
|
if (node) {
|
|
@@ -5711,7 +6058,7 @@ function PinnedRowsContainer(props) {
|
|
|
5711
6058
|
}
|
|
5712
6059
|
return result;
|
|
5713
6060
|
}, [height, rowWidth, pinning, hasOverflow]);
|
|
5714
|
-
const updateScroll = (0,
|
|
6061
|
+
const updateScroll = (0, import_react39.useCallback)((node, scrollPosition) => {
|
|
5715
6062
|
UPDATE_SCROLL3(node, scrollPosition, hasOverflow ? pinnedScrollListener.getScrollPosition() : void 0);
|
|
5716
6063
|
}, [hasOverflow, pinnedScrollListener]);
|
|
5717
6064
|
const rowListProps = {
|
|
@@ -5753,7 +6100,7 @@ function PinnedRowsContainer(props) {
|
|
|
5753
6100
|
}
|
|
5754
6101
|
function useRenderPinnedRow(params) {
|
|
5755
6102
|
const { getData, getState, columnsWidth, columns, verticalBrain } = params;
|
|
5756
|
-
const renderPinnedRow = (0,
|
|
6103
|
+
const renderPinnedRow = (0, import_react39.useCallback)((rowParams) => {
|
|
5757
6104
|
const dataArray = getData();
|
|
5758
6105
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
5759
6106
|
const { showZebraRows, showHoverRows } = getState();
|
|
@@ -5867,7 +6214,7 @@ function usePinnedStartRendering(params) {
|
|
|
5867
6214
|
}
|
|
5868
6215
|
|
|
5869
6216
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
5870
|
-
var
|
|
6217
|
+
var import_react41 = __toModule(require("react"));
|
|
5871
6218
|
|
|
5872
6219
|
// src/components/VirtualBrain/index.ts
|
|
5873
6220
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
@@ -5883,11 +6230,13 @@ var VirtualBrain = class extends Logger {
|
|
|
5883
6230
|
super(`VirtualBrain:${options.mainAxis}`);
|
|
5884
6231
|
this.scrollPosition = initialScrollPosition2;
|
|
5885
6232
|
this.scrollPositionOnMainAxis = 0;
|
|
6233
|
+
this.destroyed = false;
|
|
5886
6234
|
this.totalSize = 0;
|
|
5887
6235
|
this.onScrollFns = [];
|
|
5888
6236
|
this.onTotalSizeChangeFns = [];
|
|
5889
6237
|
this.onRenderCountChangeFns = [];
|
|
5890
6238
|
this.onRenderRangeChangeFns = [];
|
|
6239
|
+
this.onDestroyFns = [];
|
|
5891
6240
|
this.renderCount = 0;
|
|
5892
6241
|
this.renderRange = {
|
|
5893
6242
|
renderStartIndex: -1,
|
|
@@ -5984,6 +6333,12 @@ var VirtualBrain = class extends Logger {
|
|
|
5984
6333
|
this.onRenderRangeChangeFns = this.onRenderRangeChangeFns.filter((f) => f !== fn);
|
|
5985
6334
|
};
|
|
5986
6335
|
};
|
|
6336
|
+
this.onDestroy = (fn) => {
|
|
6337
|
+
this.onDestroyFns.push(fn);
|
|
6338
|
+
return () => {
|
|
6339
|
+
this.onDestroyFns = this.onDestroyFns.filter((f) => f !== fn);
|
|
6340
|
+
};
|
|
6341
|
+
};
|
|
5987
6342
|
this.update = (newCount, newItemSize, newItemSpan) => {
|
|
5988
6343
|
const { itemSize, count, itemSpan } = this.options;
|
|
5989
6344
|
const countChange = count !== newCount;
|
|
@@ -6180,7 +6535,13 @@ var VirtualBrain = class extends Logger {
|
|
|
6180
6535
|
return result;
|
|
6181
6536
|
};
|
|
6182
6537
|
this.destroy = () => {
|
|
6538
|
+
if (this.destroyed) {
|
|
6539
|
+
return;
|
|
6540
|
+
}
|
|
6541
|
+
this.notifyDestroy();
|
|
6183
6542
|
this.reset();
|
|
6543
|
+
this.destroyed = true;
|
|
6544
|
+
this.onDestroyFns = [];
|
|
6184
6545
|
this.onScrollFns = [];
|
|
6185
6546
|
this.onTotalSizeChangeFns = [];
|
|
6186
6547
|
this.onRenderCountChangeFns = [];
|
|
@@ -6216,6 +6577,12 @@ var VirtualBrain = class extends Logger {
|
|
|
6216
6577
|
fns[i](scrollPosition);
|
|
6217
6578
|
}
|
|
6218
6579
|
}
|
|
6580
|
+
notifyDestroy() {
|
|
6581
|
+
const fns = this.onDestroyFns;
|
|
6582
|
+
for (let i = 0, len = fns.length; i < len; i++) {
|
|
6583
|
+
fns[i]();
|
|
6584
|
+
}
|
|
6585
|
+
}
|
|
6219
6586
|
notifyTotalSizeChange() {
|
|
6220
6587
|
const totalSize = this.getTotalSize();
|
|
6221
6588
|
const fns = this.onTotalSizeChangeFns;
|
|
@@ -6285,9 +6652,9 @@ var VirtualBrain = class extends Logger {
|
|
|
6285
6652
|
};
|
|
6286
6653
|
|
|
6287
6654
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
6288
|
-
var
|
|
6655
|
+
var import_react40 = __toModule(require("react"));
|
|
6289
6656
|
function useColumnSizeFn(computedUnpinnedColumns) {
|
|
6290
|
-
const columnSize = (0,
|
|
6657
|
+
const columnSize = (0, import_react40.useCallback)((index) => {
|
|
6291
6658
|
const column = computedUnpinnedColumns[index];
|
|
6292
6659
|
if (!column) {
|
|
6293
6660
|
console.log("cannot find column at index", index, computedUnpinnedColumns);
|
|
@@ -6326,16 +6693,21 @@ function useYourBrain(param) {
|
|
|
6326
6693
|
});
|
|
6327
6694
|
return brain;
|
|
6328
6695
|
});
|
|
6696
|
+
(0, import_react41.useEffect)(() => {
|
|
6697
|
+
return () => {
|
|
6698
|
+
horizontalVirtualBrain.destroy();
|
|
6699
|
+
verticalVirtualBrain.destroy();
|
|
6700
|
+
};
|
|
6701
|
+
}, []);
|
|
6329
6702
|
horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
|
|
6330
6703
|
verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
|
|
6331
|
-
|
|
6332
|
-
(0, import_react39.useEffect)(() => {
|
|
6704
|
+
(0, import_react41.useEffect)(() => {
|
|
6333
6705
|
verticalVirtualBrain.setAvailableSize({
|
|
6334
6706
|
height: bodySize.height,
|
|
6335
6707
|
width: 0
|
|
6336
6708
|
});
|
|
6337
6709
|
}, [bodySize, verticalVirtualBrain]);
|
|
6338
|
-
(0,
|
|
6710
|
+
(0, import_react41.useEffect)(() => {
|
|
6339
6711
|
horizontalVirtualBrain.setAvailableSize({
|
|
6340
6712
|
height: 0,
|
|
6341
6713
|
width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
|
|
@@ -6344,29 +6716,6 @@ function useYourBrain(param) {
|
|
|
6344
6716
|
return { horizontalVirtualBrain, verticalVirtualBrain };
|
|
6345
6717
|
}
|
|
6346
6718
|
|
|
6347
|
-
// src/utils/shallowEqualObjects.ts
|
|
6348
|
-
function shallowEqualObjects(objA, objB) {
|
|
6349
|
-
if (objA === objB) {
|
|
6350
|
-
return true;
|
|
6351
|
-
}
|
|
6352
|
-
if (!objA || !objB) {
|
|
6353
|
-
return false;
|
|
6354
|
-
}
|
|
6355
|
-
var aKeys = Object.keys(objA);
|
|
6356
|
-
var bKeys = Object.keys(objB);
|
|
6357
|
-
var len = aKeys.length;
|
|
6358
|
-
if (bKeys.length !== len) {
|
|
6359
|
-
return false;
|
|
6360
|
-
}
|
|
6361
|
-
for (var i = 0; i < len; i++) {
|
|
6362
|
-
var key = aKeys[i];
|
|
6363
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
6364
|
-
return false;
|
|
6365
|
-
}
|
|
6366
|
-
}
|
|
6367
|
-
return true;
|
|
6368
|
-
}
|
|
6369
|
-
|
|
6370
6719
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
6371
6720
|
function useListRendering(param) {
|
|
6372
6721
|
const { computed, bodySize, columnShifts } = param;
|
|
@@ -6396,12 +6745,12 @@ function useListRendering(param) {
|
|
|
6396
6745
|
pinnedEndScrollListener
|
|
6397
6746
|
} = componentState;
|
|
6398
6747
|
const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
|
|
6399
|
-
const repaintIdRef = (0,
|
|
6748
|
+
const repaintIdRef = (0, import_react42.useRef)(0);
|
|
6400
6749
|
if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
|
|
6401
6750
|
repaintIdRef.current++;
|
|
6402
6751
|
}
|
|
6403
6752
|
const repaintId = repaintIdRef.current;
|
|
6404
|
-
const rowSpan = (0,
|
|
6753
|
+
const rowSpan = (0, import_react42.useMemo)(() => {
|
|
6405
6754
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
6406
6755
|
return colsWithRowspan.length ? ({ itemIndex }) => {
|
|
6407
6756
|
let maxSpan = 1;
|
|
@@ -6438,12 +6787,12 @@ function useListRendering(param) {
|
|
|
6438
6787
|
});
|
|
6439
6788
|
const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
|
|
6440
6789
|
const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
6441
|
-
const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
|
|
6442
|
-
const scrollbars = (0,
|
|
6790
|
+
const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
|
|
6791
|
+
const scrollbars = (0, import_react42.useMemo)(() => ({
|
|
6443
6792
|
vertical: hasVerticalScrollbar,
|
|
6444
6793
|
horizontal: hasHorizontalScrollbar
|
|
6445
6794
|
}), [hasVerticalScrollbar, hasHorizontalScrollbar]);
|
|
6446
|
-
(0,
|
|
6795
|
+
(0, import_react42.useEffect)(() => {
|
|
6447
6796
|
if (!bodySize.height) {
|
|
6448
6797
|
return;
|
|
6449
6798
|
}
|
|
@@ -6469,7 +6818,7 @@ function useListRendering(param) {
|
|
|
6469
6818
|
reservedContentHeight
|
|
6470
6819
|
});
|
|
6471
6820
|
const { componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
6472
|
-
const toggleGroupRow = (0,
|
|
6821
|
+
const toggleGroupRow = (0, import_react42.useCallback)((groupKeys) => {
|
|
6473
6822
|
const newState = new GroupRowsState(getDataSourceState().groupRowsState);
|
|
6474
6823
|
newState.toggleGroupRow(groupKeys);
|
|
6475
6824
|
dataSourceActions.groupRowsState = newState;
|
|
@@ -6504,7 +6853,7 @@ function useListRendering(param) {
|
|
|
6504
6853
|
computedUnpinnedColumns
|
|
6505
6854
|
});
|
|
6506
6855
|
const [, rerender] = useRerender();
|
|
6507
|
-
(0,
|
|
6856
|
+
(0, import_react42.useEffect)(() => {
|
|
6508
6857
|
rerender();
|
|
6509
6858
|
}, [dataSourceState]);
|
|
6510
6859
|
const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
|
|
@@ -6528,7 +6877,7 @@ function useListRendering(param) {
|
|
|
6528
6877
|
|
|
6529
6878
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
6530
6879
|
var React33 = __toModule(require("react"));
|
|
6531
|
-
var
|
|
6880
|
+
var import_react43 = __toModule(require("react"));
|
|
6532
6881
|
|
|
6533
6882
|
// src/components/utils/decamelize.ts
|
|
6534
6883
|
var import_decamelize = __toModule(require_decamelize());
|
|
@@ -6578,7 +6927,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
|
|
|
6578
6927
|
ref.current = node;
|
|
6579
6928
|
}
|
|
6580
6929
|
}, []);
|
|
6581
|
-
(0,
|
|
6930
|
+
(0, import_react43.useEffect)(() => {
|
|
6582
6931
|
const forceStyle = () => {
|
|
6583
6932
|
requestAnimationFrame(() => {
|
|
6584
6933
|
var _a;
|
|
@@ -6606,7 +6955,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
|
|
|
6606
6955
|
});
|
|
6607
6956
|
|
|
6608
6957
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
6609
|
-
var
|
|
6958
|
+
var import_react44 = __toModule(require("react"));
|
|
6610
6959
|
|
|
6611
6960
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
6612
6961
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -6755,11 +7104,11 @@ var SANDBOX_REGEX = /(https):\/\/\d+\-\d+\-\d\-(sandpack\.codesandbox\.io)/g;
|
|
|
6755
7104
|
var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
6756
7105
|
var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
|
|
6757
7106
|
var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
|
|
6758
|
-
var useLicense = (licenseKey) => {
|
|
6759
|
-
const valid = (0,
|
|
7107
|
+
var useLicense = (licenseKey = "") => {
|
|
7108
|
+
const valid = (0, import_react44.useMemo)(() => {
|
|
6760
7109
|
let valid2 = isValidLicense(licenseKey, {
|
|
6761
7110
|
publishedAt: 1624970570587,
|
|
6762
|
-
version: "0.0.
|
|
7111
|
+
version: "0.0.9"
|
|
6763
7112
|
});
|
|
6764
7113
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
6765
7114
|
return true;
|
|
@@ -6771,8 +7120,8 @@ var useLicense = (licenseKey) => {
|
|
|
6771
7120
|
|
|
6772
7121
|
// src/components/CSSVariableWatch.tsx
|
|
6773
7122
|
var React34 = __toModule(require("react"));
|
|
6774
|
-
var
|
|
6775
|
-
var
|
|
7123
|
+
var import_react45 = __toModule(require("react"));
|
|
7124
|
+
var error = err("CSSVariableWatch");
|
|
6776
7125
|
var debug5 = dbg("CSSVariableWatch");
|
|
6777
7126
|
var WRAPPER_STYLE = {
|
|
6778
7127
|
position: "absolute",
|
|
@@ -6784,7 +7133,7 @@ var WRAPPER_STYLE = {
|
|
|
6784
7133
|
overflow: "hidden"
|
|
6785
7134
|
};
|
|
6786
7135
|
var useCSSVariableWatch = (params) => {
|
|
6787
|
-
const lastValueRef = (0,
|
|
7136
|
+
const lastValueRef = (0, import_react45.useRef)(0);
|
|
6788
7137
|
const onResize = React34.useCallback(({ height }) => {
|
|
6789
7138
|
if (height && height !== lastValueRef.current) {
|
|
6790
7139
|
lastValueRef.current = height;
|
|
@@ -6799,12 +7148,12 @@ var useCSSVariableWatch = (params) => {
|
|
|
6799
7148
|
debug5(`Variable ${params.varName} found and equals ${value}.`);
|
|
6800
7149
|
params.onChange(value);
|
|
6801
7150
|
} else {
|
|
6802
|
-
|
|
7151
|
+
error(`Specified variable ${params.varName} not found or does not have a numeric value.`);
|
|
6803
7152
|
}
|
|
6804
7153
|
}, []);
|
|
6805
7154
|
};
|
|
6806
7155
|
var CSSVariableWatch = (props) => {
|
|
6807
|
-
const domRef = (0,
|
|
7156
|
+
const domRef = (0, import_react45.useRef)(null);
|
|
6808
7157
|
useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
|
|
6809
7158
|
ref: domRef
|
|
6810
7159
|
}));
|
|
@@ -6946,9 +7295,15 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
6946
7295
|
});
|
|
6947
7296
|
var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
6948
7297
|
var _a;
|
|
6949
|
-
const { componentState, getComputed, computed } = useInfiniteTable();
|
|
6950
7298
|
const {
|
|
6951
|
-
componentState
|
|
7299
|
+
componentState,
|
|
7300
|
+
getComputed,
|
|
7301
|
+
computed,
|
|
7302
|
+
getState: getInfiniteTableState
|
|
7303
|
+
} = useInfiniteTable();
|
|
7304
|
+
const {
|
|
7305
|
+
componentState: { dataArray, loading },
|
|
7306
|
+
getState: getDataSourceState
|
|
6952
7307
|
} = useDataSourceContextValue();
|
|
6953
7308
|
const {
|
|
6954
7309
|
domRef,
|
|
@@ -6985,6 +7340,15 @@ var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
|
6985
7340
|
const licenseValid = useLicense(licenseKey);
|
|
6986
7341
|
const domProps = useDOMProps(componentState.domProps);
|
|
6987
7342
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
7343
|
+
React36.useLayoutEffect(() => {
|
|
7344
|
+
const dataSourceState = getDataSourceState();
|
|
7345
|
+
const { onScrollbarsChange } = getInfiniteTableState();
|
|
7346
|
+
const { notifyScrollbarsChange } = dataSourceState;
|
|
7347
|
+
if (onScrollbarsChange && dataSourceState.updatedAt && dataSourceState.dataArray.length) {
|
|
7348
|
+
onScrollbarsChange(scrollbars);
|
|
7349
|
+
}
|
|
7350
|
+
notifyScrollbarsChange(scrollbars);
|
|
7351
|
+
}, [scrollbars]);
|
|
6988
7352
|
return /* @__PURE__ */ React36.createElement("div", __spreadValues({
|
|
6989
7353
|
ref: domRef
|
|
6990
7354
|
}, domProps), header ? /* @__PURE__ */ React36.createElement(TableHeaderWrapper, {
|
|
@@ -7016,7 +7380,7 @@ var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
|
7016
7380
|
});
|
|
7017
7381
|
function InfiniteTableContextProvider() {
|
|
7018
7382
|
const { componentActions, componentState } = useComponentState();
|
|
7019
|
-
const { scrollerDOMRef } = componentState;
|
|
7383
|
+
const { scrollerDOMRef, scrollTopId } = componentState;
|
|
7020
7384
|
const computed = useComputed();
|
|
7021
7385
|
const getComputed = useLatest(computed);
|
|
7022
7386
|
const getState = useLatest(componentState);
|
|
@@ -7051,6 +7415,11 @@ function InfiniteTableContextProvider() {
|
|
|
7051
7415
|
componentState.onHeaderHeightCSSVarChange.destroy();
|
|
7052
7416
|
};
|
|
7053
7417
|
}, []);
|
|
7418
|
+
React36.useEffect(() => {
|
|
7419
|
+
if (scrollerDOMRef.current) {
|
|
7420
|
+
scrollerDOMRef.current.scrollTop = 0;
|
|
7421
|
+
}
|
|
7422
|
+
}, [scrollTopId, scrollerDOMRef]);
|
|
7054
7423
|
const TableContext2 = getInfiniteTableContext();
|
|
7055
7424
|
return /* @__PURE__ */ React36.createElement(TableContext2.Provider, {
|
|
7056
7425
|
value: contextValue
|