@infinite-table/infinite-react 0.0.6 → 0.0.10
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 +212 -113
- package/index.esm.js +852 -515
- package/index.js +882 -546
- package/package.json +3 -4
- package/tmp.css.map +0 -1
package/index.esm.js
CHANGED
|
@@ -48,26 +48,6 @@ var __reExport = (target, module, desc) => {
|
|
|
48
48
|
var __toModule = (module) => {
|
|
49
49
|
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
|
|
50
50
|
};
|
|
51
|
-
var __async = (__this, __arguments, generator) => {
|
|
52
|
-
return new Promise((resolve, reject) => {
|
|
53
|
-
var fulfilled = (value) => {
|
|
54
|
-
try {
|
|
55
|
-
step(generator.next(value));
|
|
56
|
-
} catch (e) {
|
|
57
|
-
reject(e);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
var rejected = (value) => {
|
|
61
|
-
try {
|
|
62
|
-
step(generator.throw(value));
|
|
63
|
-
} catch (e) {
|
|
64
|
-
reject(e);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
68
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
51
|
|
|
72
52
|
// node_modules/ms/index.js
|
|
73
53
|
var require_ms = __commonJS({
|
|
@@ -211,6 +191,8 @@ var require_common = __commonJS({
|
|
|
211
191
|
function createDebug(namespace) {
|
|
212
192
|
let prevTime;
|
|
213
193
|
let enableOverride = null;
|
|
194
|
+
let namespacesCache;
|
|
195
|
+
let enabledCache;
|
|
214
196
|
function debug6(...args) {
|
|
215
197
|
if (!debug6.enabled) {
|
|
216
198
|
return;
|
|
@@ -253,7 +235,16 @@ var require_common = __commonJS({
|
|
|
253
235
|
Object.defineProperty(debug6, "enabled", {
|
|
254
236
|
enumerable: true,
|
|
255
237
|
configurable: false,
|
|
256
|
-
get: () =>
|
|
238
|
+
get: () => {
|
|
239
|
+
if (enableOverride !== null) {
|
|
240
|
+
return enableOverride;
|
|
241
|
+
}
|
|
242
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
243
|
+
namespacesCache = createDebug.namespaces;
|
|
244
|
+
enabledCache = createDebug.enabled(namespace);
|
|
245
|
+
}
|
|
246
|
+
return enabledCache;
|
|
247
|
+
},
|
|
257
248
|
set: (v) => {
|
|
258
249
|
enableOverride = v;
|
|
259
250
|
}
|
|
@@ -270,6 +261,7 @@ var require_common = __commonJS({
|
|
|
270
261
|
}
|
|
271
262
|
function enable(namespaces) {
|
|
272
263
|
createDebug.save(namespaces);
|
|
264
|
+
createDebug.namespaces = namespaces;
|
|
273
265
|
createDebug.names = [];
|
|
274
266
|
createDebug.skips = [];
|
|
275
267
|
let i;
|
|
@@ -465,14 +457,14 @@ var require_browser = __commonJS({
|
|
|
465
457
|
} else {
|
|
466
458
|
exports.storage.removeItem("debug");
|
|
467
459
|
}
|
|
468
|
-
} catch (
|
|
460
|
+
} catch (error2) {
|
|
469
461
|
}
|
|
470
462
|
}
|
|
471
463
|
function load() {
|
|
472
464
|
let r;
|
|
473
465
|
try {
|
|
474
466
|
r = exports.storage.getItem("debug");
|
|
475
|
-
} catch (
|
|
467
|
+
} catch (error2) {
|
|
476
468
|
}
|
|
477
469
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
478
470
|
r = process.env.DEBUG;
|
|
@@ -482,7 +474,7 @@ var require_browser = __commonJS({
|
|
|
482
474
|
function localstorage() {
|
|
483
475
|
try {
|
|
484
476
|
return localStorage;
|
|
485
|
-
} catch (
|
|
477
|
+
} catch (error2) {
|
|
486
478
|
}
|
|
487
479
|
}
|
|
488
480
|
module.exports = require_common()(exports);
|
|
@@ -490,10 +482,103 @@ var require_browser = __commonJS({
|
|
|
490
482
|
formatters.j = function(v) {
|
|
491
483
|
try {
|
|
492
484
|
return JSON.stringify(v);
|
|
493
|
-
} catch (
|
|
494
|
-
return "[UnexpectedJSONParseError]: " +
|
|
485
|
+
} catch (error2) {
|
|
486
|
+
return "[UnexpectedJSONParseError]: " + error2.message;
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
// node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.dev.js
|
|
493
|
+
var require_vanilla_extract_recipes_createRuntimeFn_cjs_dev = __commonJS({
|
|
494
|
+
"node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.dev.js"(exports) {
|
|
495
|
+
"use strict";
|
|
496
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
497
|
+
function _defineProperty(obj, key, value) {
|
|
498
|
+
if (key in obj) {
|
|
499
|
+
Object.defineProperty(obj, key, {
|
|
500
|
+
value,
|
|
501
|
+
enumerable: true,
|
|
502
|
+
configurable: true,
|
|
503
|
+
writable: true
|
|
504
|
+
});
|
|
505
|
+
} else {
|
|
506
|
+
obj[key] = value;
|
|
507
|
+
}
|
|
508
|
+
return obj;
|
|
509
|
+
}
|
|
510
|
+
function ownKeys(object, enumerableOnly) {
|
|
511
|
+
var keys = Object.keys(object);
|
|
512
|
+
if (Object.getOwnPropertySymbols) {
|
|
513
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
514
|
+
if (enumerableOnly) {
|
|
515
|
+
symbols = symbols.filter(function(sym) {
|
|
516
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
keys.push.apply(keys, symbols);
|
|
520
|
+
}
|
|
521
|
+
return keys;
|
|
522
|
+
}
|
|
523
|
+
function _objectSpread2(target) {
|
|
524
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
525
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
526
|
+
if (i % 2) {
|
|
527
|
+
ownKeys(Object(source), true).forEach(function(key) {
|
|
528
|
+
_defineProperty(target, key, source[key]);
|
|
529
|
+
});
|
|
530
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
531
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
532
|
+
} else {
|
|
533
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
534
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
return target;
|
|
539
|
+
}
|
|
540
|
+
var shouldApplyCompound = (compoundCheck, selections) => {
|
|
541
|
+
for (var key of Object.keys(compoundCheck)) {
|
|
542
|
+
if (compoundCheck[key] !== selections[key]) {
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
495
545
|
}
|
|
546
|
+
return true;
|
|
496
547
|
};
|
|
548
|
+
var createRuntimeFn = (config) => (options) => {
|
|
549
|
+
var className = config.defaultClassName;
|
|
550
|
+
var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
|
|
551
|
+
for (var variantName in selections) {
|
|
552
|
+
var _selections$variantNa;
|
|
553
|
+
var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
554
|
+
if (variantSelection != null) {
|
|
555
|
+
var selection = variantSelection;
|
|
556
|
+
if (typeof selection === "boolean") {
|
|
557
|
+
selection = selection === true ? "true" : "false";
|
|
558
|
+
}
|
|
559
|
+
className += " " + config.variantClassNames[variantName][selection];
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
|
|
563
|
+
if (shouldApplyCompound(compoundCheck, selections)) {
|
|
564
|
+
className += " " + compoundClassName;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return className;
|
|
568
|
+
};
|
|
569
|
+
exports.createRuntimeFn = createRuntimeFn;
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
// node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.js
|
|
574
|
+
var require_vanilla_extract_recipes_createRuntimeFn_cjs = __commonJS({
|
|
575
|
+
"node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.js"(exports, module) {
|
|
576
|
+
"use strict";
|
|
577
|
+
if (false) {
|
|
578
|
+
module.exports = null;
|
|
579
|
+
} else {
|
|
580
|
+
module.exports = require_vanilla_extract_recipes_createRuntimeFn_cjs_dev();
|
|
581
|
+
}
|
|
497
582
|
}
|
|
498
583
|
});
|
|
499
584
|
|
|
@@ -531,44 +616,13 @@ var require_binary_search = __commonJS({
|
|
|
531
616
|
}
|
|
532
617
|
});
|
|
533
618
|
|
|
534
|
-
// node_modules/decamelize/index.js
|
|
535
|
-
var require_decamelize = __commonJS({
|
|
536
|
-
"node_modules/decamelize/index.js"(exports, module) {
|
|
537
|
-
"use strict";
|
|
538
|
-
var handlePreserveConsecutiveUppercase = (decamelized, separator) => {
|
|
539
|
-
decamelized = decamelized.replace(/((?<![\p{Uppercase_Letter}\d])[\p{Uppercase_Letter}\d](?![\p{Uppercase_Letter}\d]))/gu, ($0) => {
|
|
540
|
-
return $0.toLowerCase();
|
|
541
|
-
});
|
|
542
|
-
return decamelized.replace(/(\p{Uppercase_Letter}+)(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, (_, $1, $2) => {
|
|
543
|
-
return $1 + separator + $2.toLowerCase();
|
|
544
|
-
});
|
|
545
|
-
};
|
|
546
|
-
module.exports = (text, {
|
|
547
|
-
separator = "_",
|
|
548
|
-
preserveConsecutiveUppercase = false
|
|
549
|
-
} = {}) => {
|
|
550
|
-
if (!(typeof text === "string" && typeof separator === "string")) {
|
|
551
|
-
throw new TypeError("The `text` and `separator` arguments should be of type `string`");
|
|
552
|
-
}
|
|
553
|
-
if (text.length < 2) {
|
|
554
|
-
return preserveConsecutiveUppercase ? text : text.toLowerCase();
|
|
555
|
-
}
|
|
556
|
-
const replacement = `$1${separator}$2`;
|
|
557
|
-
const decamelized = text.replace(/([\p{Lowercase_Letter}\d])(\p{Uppercase_Letter})/gu, replacement);
|
|
558
|
-
if (preserveConsecutiveUppercase) {
|
|
559
|
-
return handlePreserveConsecutiveUppercase(decamelized, separator);
|
|
560
|
-
}
|
|
561
|
-
return decamelized.replace(/(\p{Uppercase_Letter}+)(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, replacement).toLowerCase();
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
});
|
|
565
|
-
|
|
566
619
|
// src/components/InfiniteTable/index.tsx
|
|
567
620
|
import {
|
|
568
621
|
StrictMode,
|
|
569
622
|
createElement as createElement33,
|
|
570
623
|
memo as memo13,
|
|
571
|
-
useEffect as
|
|
624
|
+
useEffect as useEffect24,
|
|
625
|
+
useLayoutEffect as useLayoutEffect6
|
|
572
626
|
} from "react";
|
|
573
627
|
|
|
574
628
|
// src/components/InfiniteTable/internalProps.ts
|
|
@@ -651,7 +705,7 @@ var ScrollListener = class {
|
|
|
651
705
|
|
|
652
706
|
// src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
|
|
653
707
|
function computeColumnGroupsDepths(columnGroups) {
|
|
654
|
-
const
|
|
708
|
+
const map2 = new Map();
|
|
655
709
|
columnGroups.forEach((colGroup, colGroupId) => {
|
|
656
710
|
let parentGroupId = colGroup.columnGroup;
|
|
657
711
|
let depth = 0;
|
|
@@ -666,12 +720,24 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
666
720
|
depth++;
|
|
667
721
|
parentGroupId = parent.columnGroup;
|
|
668
722
|
}
|
|
669
|
-
|
|
723
|
+
map2.set(colGroupId, depth);
|
|
670
724
|
});
|
|
671
|
-
return
|
|
725
|
+
return map2;
|
|
672
726
|
}
|
|
673
727
|
|
|
674
728
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
729
|
+
function toMap(mapOrObject) {
|
|
730
|
+
if (!mapOrObject) {
|
|
731
|
+
return new Map();
|
|
732
|
+
}
|
|
733
|
+
if (mapOrObject instanceof Map) {
|
|
734
|
+
return mapOrObject;
|
|
735
|
+
}
|
|
736
|
+
return new Map(Object.entries(mapOrObject));
|
|
737
|
+
}
|
|
738
|
+
function toColumnTypesMap(mapOrObject) {
|
|
739
|
+
return toMap(mapOrObject);
|
|
740
|
+
}
|
|
675
741
|
function initSetupState() {
|
|
676
742
|
const columnsGeneratedForGrouping = new Map();
|
|
677
743
|
return {
|
|
@@ -701,7 +767,11 @@ function initSetupState() {
|
|
|
701
767
|
}
|
|
702
768
|
var forwardProps = () => {
|
|
703
769
|
return {
|
|
704
|
-
columns:
|
|
770
|
+
columns: (columns) => {
|
|
771
|
+
var _a;
|
|
772
|
+
return (_a = toMap(columns)) != null ? _a : new Map();
|
|
773
|
+
},
|
|
774
|
+
scrollTopId: 1,
|
|
705
775
|
components: 1,
|
|
706
776
|
loadingText: 1,
|
|
707
777
|
pivotColumns: 1,
|
|
@@ -727,15 +797,17 @@ var forwardProps = () => {
|
|
|
727
797
|
pivotColumn: 1,
|
|
728
798
|
pivotRowLabelsColumn: 1,
|
|
729
799
|
pivotColumnGroups: 1,
|
|
800
|
+
onScrollbarsChange: 1,
|
|
801
|
+
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
730
802
|
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
731
803
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
732
804
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
733
|
-
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth :
|
|
805
|
+
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
734
806
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
735
807
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
736
808
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
737
809
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
738
|
-
licenseKey: (licenseKey) => licenseKey ||
|
|
810
|
+
licenseKey: (licenseKey) => licenseKey || "",
|
|
739
811
|
columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
|
|
740
812
|
header: (header) => header != null ? header : true,
|
|
741
813
|
showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
|
|
@@ -745,6 +817,14 @@ var forwardProps = () => {
|
|
|
745
817
|
headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
|
|
746
818
|
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : new Map(),
|
|
747
819
|
columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
|
|
820
|
+
columnSizing: (columnSizing) => {
|
|
821
|
+
var _a;
|
|
822
|
+
return (_a = toMap(columnSizing)) != null ? _a : new Map();
|
|
823
|
+
},
|
|
824
|
+
columnTypes: (columnTypes) => {
|
|
825
|
+
var _a;
|
|
826
|
+
return (_a = toColumnTypesMap(columnTypes)) != null ? _a : new Map();
|
|
827
|
+
},
|
|
748
828
|
columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
|
|
749
829
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
750
830
|
columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
|
|
@@ -779,7 +859,7 @@ var mapPropsToState = (params) => {
|
|
|
779
859
|
return {
|
|
780
860
|
groupRenderStrategy,
|
|
781
861
|
groupRowsBy,
|
|
782
|
-
computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy ||
|
|
862
|
+
computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns,
|
|
783
863
|
virtualizeHeader,
|
|
784
864
|
columnGroupsDepthsMap,
|
|
785
865
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
@@ -919,7 +999,7 @@ var computeFlex = (params) => {
|
|
|
919
999
|
items.forEach((item, i) => {
|
|
920
1000
|
var _a, _b, _c, _d, _e, _f;
|
|
921
1001
|
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
922
|
-
let minSize = (_d = (_c = item.
|
|
1002
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
923
1003
|
if (item.size != null) {
|
|
924
1004
|
if (maxSize != null && item.size > maxSize) {
|
|
925
1005
|
item.size = maxSize;
|
|
@@ -947,7 +1027,7 @@ var computeFlex = (params) => {
|
|
|
947
1027
|
if (item.flex != null) {
|
|
948
1028
|
const approxFlexSize = sizePerFlex * item.flex;
|
|
949
1029
|
let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
|
|
950
|
-
let minSize = (_d = (_c = item.
|
|
1030
|
+
let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
|
|
951
1031
|
let constrained = false;
|
|
952
1032
|
let substractSize = 0;
|
|
953
1033
|
if (maxSize != null && approxFlexSize > maxSize) {
|
|
@@ -1082,8 +1162,52 @@ var Logger = class {
|
|
|
1082
1162
|
}
|
|
1083
1163
|
};
|
|
1084
1164
|
|
|
1165
|
+
// src/utils/getGlobal.ts
|
|
1166
|
+
function getGlobal() {
|
|
1167
|
+
return globalThis;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
// src/components/utils/getScrollbarWidth.ts
|
|
1171
|
+
var scrollbarWidth;
|
|
1172
|
+
function getScrollbarWidth() {
|
|
1173
|
+
var _a, _b;
|
|
1174
|
+
if (scrollbarWidth != null) {
|
|
1175
|
+
return scrollbarWidth;
|
|
1176
|
+
}
|
|
1177
|
+
const doc = (_a = getGlobal().document) != null ? _a : null;
|
|
1178
|
+
if (!doc) {
|
|
1179
|
+
return 0;
|
|
1180
|
+
}
|
|
1181
|
+
const outer = doc.createElement("div");
|
|
1182
|
+
outer.style.visibility = "hidden";
|
|
1183
|
+
outer.style.overflow = "scroll";
|
|
1184
|
+
doc.body.appendChild(outer);
|
|
1185
|
+
const inner = doc.createElement("div");
|
|
1186
|
+
outer.appendChild(inner);
|
|
1187
|
+
scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
|
1188
|
+
(_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
|
|
1189
|
+
return scrollbarWidth;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
// src/components/InfiniteTable/utils/getColumnComputedType.ts
|
|
1193
|
+
var emptyType = Object.freeze({});
|
|
1194
|
+
function getColumnComputedType(column, columnTypes) {
|
|
1195
|
+
const defaultType = columnTypes.get("default") || emptyType;
|
|
1196
|
+
if (column.type === void 0) {
|
|
1197
|
+
return defaultType;
|
|
1198
|
+
}
|
|
1199
|
+
if (column.type === null) {
|
|
1200
|
+
return emptyType;
|
|
1201
|
+
}
|
|
1202
|
+
if (typeof column.type === "string") {
|
|
1203
|
+
const type = columnTypes.get(column.type) || emptyType;
|
|
1204
|
+
return type;
|
|
1205
|
+
}
|
|
1206
|
+
return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes.get(columnType)), {});
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1085
1209
|
// src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
|
|
1086
|
-
var
|
|
1210
|
+
var logError = err("getComputedVisibleColumns");
|
|
1087
1211
|
var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
|
|
1088
1212
|
return !columnVisibility.has(colId) || columnVisibility.get(colId) !== false;
|
|
1089
1213
|
};
|
|
@@ -1104,22 +1228,26 @@ var getComputedVisibleColumns = ({
|
|
|
1104
1228
|
sortInfo,
|
|
1105
1229
|
setSortInfo,
|
|
1106
1230
|
multiSort,
|
|
1231
|
+
viewportReservedWidth,
|
|
1107
1232
|
draggableColumns,
|
|
1108
1233
|
columnOrder,
|
|
1109
1234
|
columnPinning,
|
|
1235
|
+
columnSizing,
|
|
1236
|
+
columnTypes,
|
|
1110
1237
|
columnVisibility,
|
|
1111
1238
|
columnVisibilityAssumeVisible
|
|
1112
1239
|
}) => {
|
|
1113
1240
|
let computedOffset = 0;
|
|
1114
1241
|
const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
|
|
1115
|
-
const visibleColumnOrder = normalizedColumnOrder.filter(
|
|
1116
|
-
|
|
1117
|
-
let col = columns.get(columnId);
|
|
1242
|
+
const visibleColumnOrder = normalizedColumnOrder.filter((colId) => {
|
|
1243
|
+
let col = columns.get(colId);
|
|
1118
1244
|
if (!col) {
|
|
1119
|
-
|
|
1245
|
+
logError(`Column with id "${colId}" specified in columnOrder array cannot be found in the columns map.`);
|
|
1246
|
+
return false;
|
|
1120
1247
|
}
|
|
1121
|
-
return
|
|
1122
|
-
})
|
|
1248
|
+
return isColumnVisible(columnVisibility, columnVisibilityAssumeVisible, colId);
|
|
1249
|
+
});
|
|
1250
|
+
const columnsArray = visibleColumnOrder.map((columnId) => columns.get(columnId)).filter(Boolean);
|
|
1123
1251
|
const sortedMap = (sortInfo != null ? sortInfo : []).reduce((acc, info, index) => {
|
|
1124
1252
|
if (info.id) {
|
|
1125
1253
|
acc[info.id] = { sortInfo: info, index };
|
|
@@ -1133,20 +1261,39 @@ var getComputedVisibleColumns = ({
|
|
|
1133
1261
|
return acc;
|
|
1134
1262
|
}, {});
|
|
1135
1263
|
const flexResult = computeFlex({
|
|
1136
|
-
availableSize: bodySize.width,
|
|
1264
|
+
availableSize: Math.max(bodySize.width - (viewportReservedWidth != null ? viewportReservedWidth : 0) - getScrollbarWidth(), 0),
|
|
1137
1265
|
maxSize: columnMaxWidth,
|
|
1138
1266
|
minSize: columnMinWidth,
|
|
1139
|
-
items:
|
|
1140
|
-
var _a, _b;
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1267
|
+
items: visibleColumnOrder.map((colId) => {
|
|
1268
|
+
var _a, _b, _c, _d;
|
|
1269
|
+
const column = columns.get(colId);
|
|
1270
|
+
const colType = getColumnComputedType(column, columnTypes);
|
|
1271
|
+
const colTypeSizing = {
|
|
1272
|
+
minWidth: colType == null ? void 0 : colType.minWidth,
|
|
1273
|
+
maxWidth: colType == null ? void 0 : colType.maxWidth,
|
|
1274
|
+
width: colType == null ? void 0 : colType.width,
|
|
1275
|
+
flex: colType == null ? void 0 : colType.flex
|
|
1276
|
+
};
|
|
1277
|
+
let colSizing = columnSizing.get(colId) || {};
|
|
1278
|
+
if (colSizing.width != null) {
|
|
1279
|
+
delete colTypeSizing.flex;
|
|
1280
|
+
}
|
|
1281
|
+
if (colSizing.flex != null) {
|
|
1282
|
+
delete colTypeSizing.width;
|
|
1283
|
+
}
|
|
1284
|
+
colSizing = Object.assign(colTypeSizing, colSizing);
|
|
1285
|
+
let colFlex = (_a = colSizing.flex) != null ? _a : void 0;
|
|
1286
|
+
const colMinWidth = (_b = colSizing.minWidth) != null ? _b : columnMinWidth;
|
|
1287
|
+
const colMaxWidth = (_c = colSizing.maxWidth) != null ? _c : columnMaxWidth;
|
|
1288
|
+
let size = colFlex != void 0 ? void 0 : (_d = colSizing.width) != null ? _d : columnDefaultWidth;
|
|
1289
|
+
if (!size && colFlex == void 0) {
|
|
1290
|
+
size = colMinWidth;
|
|
1144
1291
|
}
|
|
1145
1292
|
return {
|
|
1146
1293
|
size,
|
|
1147
|
-
flex:
|
|
1148
|
-
minSize:
|
|
1149
|
-
maxSize:
|
|
1294
|
+
flex: colFlex,
|
|
1295
|
+
minSize: colMinWidth,
|
|
1296
|
+
maxSize: colMaxWidth
|
|
1150
1297
|
};
|
|
1151
1298
|
})
|
|
1152
1299
|
});
|
|
@@ -1181,6 +1328,7 @@ var getComputedVisibleColumns = ({
|
|
|
1181
1328
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1182
1329
|
const id = visibleColumnOrder[i];
|
|
1183
1330
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
1331
|
+
const colType = getColumnComputedType(c, columnTypes);
|
|
1184
1332
|
const sortingInfo = sortedMap[id] ? sortedMap[id] : c.field ? (_a = sortedMap[c.field]) != null ? _a : null : null;
|
|
1185
1333
|
const computedSortInfo = (_b = sortingInfo == null ? void 0 : sortingInfo.sortInfo) != null ? _b : null;
|
|
1186
1334
|
const computedSorted = !!computedSortInfo;
|
|
@@ -1236,8 +1384,10 @@ var getComputedVisibleColumns = ({
|
|
|
1236
1384
|
const computedFirstInCategory = computedPinned !== prevPinned;
|
|
1237
1385
|
const computedLastInCategory = computedLast || computedPinned !== getComputedPinned(nextColumnId, columnPinning);
|
|
1238
1386
|
const result2 = __spreadProps(__spreadValues({
|
|
1239
|
-
align:
|
|
1240
|
-
verticalAlign:
|
|
1387
|
+
align: colType.align,
|
|
1388
|
+
verticalAlign: colType.verticalAlign,
|
|
1389
|
+
renderValue: colType.renderValue,
|
|
1390
|
+
render: colType.render
|
|
1241
1391
|
}, c), {
|
|
1242
1392
|
computedWidth,
|
|
1243
1393
|
computedAbsoluteOffset,
|
|
@@ -1316,28 +1466,28 @@ var useRerender = () => {
|
|
|
1316
1466
|
|
|
1317
1467
|
// src/components/hooks/useInterceptedMap.ts
|
|
1318
1468
|
import { useEffect as useEffect2 } from "react";
|
|
1319
|
-
function interceptMap(
|
|
1320
|
-
const { set, delete: deleteKey, clear } =
|
|
1469
|
+
function interceptMap(map2, fns) {
|
|
1470
|
+
const { set, delete: deleteKey, clear } = map2;
|
|
1321
1471
|
if (fns.set) {
|
|
1322
|
-
|
|
1323
|
-
set.call(
|
|
1472
|
+
map2.set = (key, value) => {
|
|
1473
|
+
set.call(map2, key, value);
|
|
1324
1474
|
fns.set(key, value);
|
|
1325
|
-
return
|
|
1475
|
+
return map2;
|
|
1326
1476
|
};
|
|
1327
1477
|
}
|
|
1328
1478
|
if (fns.delete) {
|
|
1329
|
-
|
|
1330
|
-
const removed = deleteKey.call(
|
|
1479
|
+
map2.delete = (key) => {
|
|
1480
|
+
const removed = deleteKey.call(map2, key);
|
|
1331
1481
|
fns.delete(key);
|
|
1332
1482
|
return removed;
|
|
1333
1483
|
};
|
|
1334
1484
|
}
|
|
1335
1485
|
if (fns.clear || fns.beforeClear) {
|
|
1336
|
-
|
|
1486
|
+
map2.clear = () => {
|
|
1337
1487
|
if (fns.beforeClear) {
|
|
1338
|
-
fns.beforeClear(
|
|
1488
|
+
fns.beforeClear(map2);
|
|
1339
1489
|
}
|
|
1340
|
-
const result = clear.call(
|
|
1490
|
+
const result = clear.call(map2);
|
|
1341
1491
|
if (fns.clear) {
|
|
1342
1492
|
fns.clear();
|
|
1343
1493
|
}
|
|
@@ -1346,13 +1496,13 @@ function interceptMap(map, fns) {
|
|
|
1346
1496
|
}
|
|
1347
1497
|
return () => {
|
|
1348
1498
|
if (set) {
|
|
1349
|
-
|
|
1499
|
+
map2.set = set;
|
|
1350
1500
|
}
|
|
1351
1501
|
if (deleteKey) {
|
|
1352
|
-
|
|
1502
|
+
map2.delete = deleteKey;
|
|
1353
1503
|
}
|
|
1354
1504
|
if (clear) {
|
|
1355
|
-
|
|
1505
|
+
map2.clear = clear;
|
|
1356
1506
|
}
|
|
1357
1507
|
};
|
|
1358
1508
|
}
|
|
@@ -1372,16 +1522,16 @@ var rafFn = (fn) => {
|
|
|
1372
1522
|
};
|
|
1373
1523
|
|
|
1374
1524
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
1375
|
-
var useRerenderOnKeyChange = (
|
|
1525
|
+
var useRerenderOnKeyChange = (map2) => {
|
|
1376
1526
|
const [renderId, rerender] = useRerender();
|
|
1377
1527
|
useEffect3(() => {
|
|
1378
1528
|
const update = rafFn(rerender);
|
|
1379
|
-
return interceptMap(
|
|
1529
|
+
return interceptMap(map2, {
|
|
1380
1530
|
set: update,
|
|
1381
1531
|
clear: update,
|
|
1382
1532
|
delete: update
|
|
1383
1533
|
});
|
|
1384
|
-
}, [
|
|
1534
|
+
}, [map2]);
|
|
1385
1535
|
return renderId;
|
|
1386
1536
|
};
|
|
1387
1537
|
|
|
@@ -1399,11 +1549,16 @@ var useComputedVisibleColumns = ({
|
|
|
1399
1549
|
setSortInfo,
|
|
1400
1550
|
columnOrder,
|
|
1401
1551
|
columnPinning,
|
|
1552
|
+
columnTypes,
|
|
1402
1553
|
pinnedEndMaxWidth,
|
|
1403
1554
|
pinnedStartMaxWidth,
|
|
1555
|
+
viewportReservedWidth,
|
|
1404
1556
|
columnVisibility,
|
|
1405
|
-
columnVisibilityAssumeVisible
|
|
1557
|
+
columnVisibilityAssumeVisible,
|
|
1558
|
+
columnSizing
|
|
1406
1559
|
}) => {
|
|
1560
|
+
const columnsSizingRenderId = useRerenderOnKeyChange(columnSizing);
|
|
1561
|
+
const columnTypesRenderId = useRerenderOnKeyChange(columnTypes);
|
|
1407
1562
|
const columnsRenderId = useRerenderOnKeyChange(columns);
|
|
1408
1563
|
const visibilityRenderId = useRerenderOnKeyChange(columnVisibility);
|
|
1409
1564
|
const pinningRenderId = useRerenderOnKeyChange(columnPinning);
|
|
@@ -1429,6 +1584,7 @@ var useComputedVisibleColumns = ({
|
|
|
1429
1584
|
columnMinWidth,
|
|
1430
1585
|
columnMaxWidth,
|
|
1431
1586
|
columnDefaultWidth,
|
|
1587
|
+
viewportReservedWidth,
|
|
1432
1588
|
sortable,
|
|
1433
1589
|
sortInfo,
|
|
1434
1590
|
setSortInfo,
|
|
@@ -1438,6 +1594,8 @@ var useComputedVisibleColumns = ({
|
|
|
1438
1594
|
draggableColumns,
|
|
1439
1595
|
columnOrder,
|
|
1440
1596
|
columnPinning,
|
|
1597
|
+
columnSizing,
|
|
1598
|
+
columnTypes,
|
|
1441
1599
|
columnVisibility,
|
|
1442
1600
|
columnVisibilityAssumeVisible: columnVisibilityAssumeVisible != null ? columnVisibilityAssumeVisible : true
|
|
1443
1601
|
});
|
|
@@ -1459,7 +1617,9 @@ var useComputedVisibleColumns = ({
|
|
|
1459
1617
|
columnPinning,
|
|
1460
1618
|
columnsRenderId,
|
|
1461
1619
|
visibilityRenderId,
|
|
1462
|
-
|
|
1620
|
+
columnsSizingRenderId,
|
|
1621
|
+
pinningRenderId,
|
|
1622
|
+
columnTypesRenderId
|
|
1463
1623
|
]);
|
|
1464
1624
|
const result = {
|
|
1465
1625
|
columns,
|
|
@@ -1485,7 +1645,7 @@ var useComputedVisibleColumns = ({
|
|
|
1485
1645
|
var sortAscending = (a, b) => a - b;
|
|
1486
1646
|
|
|
1487
1647
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
1488
|
-
import { useCallback as useCallback5, useState as
|
|
1648
|
+
import { useCallback as useCallback5, useState as useState5 } from "react";
|
|
1489
1649
|
|
|
1490
1650
|
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
1491
1651
|
import { useEffect as useEffect5 } from "react";
|
|
@@ -1608,7 +1768,7 @@ function getComponentStateContext() {
|
|
|
1608
1768
|
}
|
|
1609
1769
|
return ComponentContext = createContext3(null);
|
|
1610
1770
|
}
|
|
1611
|
-
function
|
|
1771
|
+
function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides, interceptedActions) {
|
|
1612
1772
|
const state = getState();
|
|
1613
1773
|
return Object.keys(state).reduce((actions, stateKey) => {
|
|
1614
1774
|
const key = stateKey;
|
|
@@ -1620,6 +1780,9 @@ function getReducerActions(dispatch, getState, getProps, propsToForward, allowed
|
|
|
1620
1780
|
return;
|
|
1621
1781
|
}
|
|
1622
1782
|
notifyChange(props, stateKey, value);
|
|
1783
|
+
if (interceptedActions && typeof interceptedActions[key] === "function") {
|
|
1784
|
+
interceptedActions[key](value, { actions, state: state2 });
|
|
1785
|
+
}
|
|
1623
1786
|
const forwardFn = propsToForward[key];
|
|
1624
1787
|
if (typeof forwardFn === "function") {
|
|
1625
1788
|
value = forwardFn(value);
|
|
@@ -1732,7 +1895,7 @@ function getComponentStateRoot(config) {
|
|
|
1732
1895
|
const getComponentState = useLatest(state);
|
|
1733
1896
|
const { allowedControlledPropOverrides } = config;
|
|
1734
1897
|
const actions = useMemo3(() => {
|
|
1735
|
-
const generatedActions =
|
|
1898
|
+
const generatedActions = getReducerGeneratedActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides, config.interceptActions);
|
|
1736
1899
|
return generatedActions;
|
|
1737
1900
|
}, [
|
|
1738
1901
|
dispatch,
|
|
@@ -1901,7 +2064,7 @@ function useColumnGroups() {
|
|
|
1901
2064
|
}
|
|
1902
2065
|
|
|
1903
2066
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
1904
|
-
import { useEffect as
|
|
2067
|
+
import { useEffect as useEffect10, useMemo as useMemo5 } from "react";
|
|
1905
2068
|
|
|
1906
2069
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
1907
2070
|
import {
|
|
@@ -1967,43 +2130,10 @@ function ExpanderIcon(props) {
|
|
|
1967
2130
|
}));
|
|
1968
2131
|
}
|
|
1969
2132
|
|
|
1970
|
-
// node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.esm.js
|
|
1971
|
-
var shouldApplyCompound = (compoundCheck, selections) => {
|
|
1972
|
-
for (const key of Object.keys(compoundCheck)) {
|
|
1973
|
-
if (compoundCheck[key] !== selections[key]) {
|
|
1974
|
-
return false;
|
|
1975
|
-
}
|
|
1976
|
-
}
|
|
1977
|
-
return true;
|
|
1978
|
-
};
|
|
1979
|
-
var createRuntimeFn = (config) => (options) => {
|
|
1980
|
-
let className = config.defaultClassName;
|
|
1981
|
-
const selections = {
|
|
1982
|
-
...config.defaultVariants,
|
|
1983
|
-
...options
|
|
1984
|
-
};
|
|
1985
|
-
for (const variantName in selections) {
|
|
1986
|
-
var _selections$variantNa;
|
|
1987
|
-
const variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
1988
|
-
if (variantSelection != null) {
|
|
1989
|
-
let selection = variantSelection;
|
|
1990
|
-
if (typeof selection === "boolean") {
|
|
1991
|
-
selection = selection === true ? "true" : "false";
|
|
1992
|
-
}
|
|
1993
|
-
className += " " + config.variantClassNames[variantName][selection];
|
|
1994
|
-
}
|
|
1995
|
-
}
|
|
1996
|
-
for (const [compoundCheck, compoundClassName] of config.compoundVariants) {
|
|
1997
|
-
if (shouldApplyCompound(compoundCheck, selections)) {
|
|
1998
|
-
className += " " + compoundClassName;
|
|
1999
|
-
}
|
|
2000
|
-
}
|
|
2001
|
-
return className;
|
|
2002
|
-
};
|
|
2003
|
-
|
|
2004
2133
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
2134
|
+
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2005
2135
|
var GroupRowExpanderCls = "_7pupv0b";
|
|
2006
|
-
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: [] });
|
|
2136
|
+
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: [] });
|
|
2007
2137
|
var RowHoverCls = "_7pupv01";
|
|
2008
2138
|
|
|
2009
2139
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
@@ -2198,62 +2328,231 @@ import {
|
|
|
2198
2328
|
createElement as createElement6
|
|
2199
2329
|
} from "react";
|
|
2200
2330
|
|
|
2201
|
-
// src/
|
|
2202
|
-
|
|
2331
|
+
// src/utils/multisort/sortTypes.ts
|
|
2332
|
+
var numberComparator = function(first, second) {
|
|
2333
|
+
return first - second;
|
|
2334
|
+
};
|
|
2335
|
+
var stringComparator = function(first, second) {
|
|
2336
|
+
first = `${first}`;
|
|
2337
|
+
second = `${second}`;
|
|
2338
|
+
return first.localeCompare(second);
|
|
2339
|
+
};
|
|
2340
|
+
var sortTypes = {
|
|
2341
|
+
number: numberComparator,
|
|
2342
|
+
string: stringComparator
|
|
2343
|
+
};
|
|
2344
|
+
var sortTypes_default = sortTypes;
|
|
2203
2345
|
|
|
2204
|
-
// src/
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2346
|
+
// src/utils/multisort/index.ts
|
|
2347
|
+
var multisort = (sortInfo, array, get) => {
|
|
2348
|
+
array.sort(getMultisortFunction(sortInfo, get));
|
|
2349
|
+
return array;
|
|
2350
|
+
};
|
|
2351
|
+
multisort.knownTypes = sortTypes_default;
|
|
2352
|
+
var getSingleSortFunction = (info) => {
|
|
2353
|
+
if (!info) {
|
|
2354
|
+
return;
|
|
2211
2355
|
}
|
|
2212
|
-
|
|
2213
|
-
|
|
2356
|
+
const field = info.field;
|
|
2357
|
+
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
2358
|
+
if (!dir) {
|
|
2359
|
+
return;
|
|
2360
|
+
}
|
|
2361
|
+
let fn = info.fn;
|
|
2362
|
+
if (!fn && info.type) {
|
|
2363
|
+
fn = multisort.knownTypes[info.type];
|
|
2364
|
+
if (!fn) {
|
|
2365
|
+
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
if (!fn) {
|
|
2369
|
+
fn = sortTypes_default.string;
|
|
2370
|
+
}
|
|
2371
|
+
return (first, second) => {
|
|
2372
|
+
const a = field ? first[field] : first;
|
|
2373
|
+
const b = field ? second[field] : second;
|
|
2374
|
+
return dir * fn(a, b);
|
|
2214
2375
|
};
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2376
|
+
};
|
|
2377
|
+
var getSortFunctions = (sortInfo) => {
|
|
2378
|
+
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
2379
|
+
};
|
|
2380
|
+
var getMultisortFunction = (sortInfo, get) => {
|
|
2381
|
+
const fns = getSortFunctions(sortInfo);
|
|
2382
|
+
return (first, second) => {
|
|
2383
|
+
if (get) {
|
|
2384
|
+
first = get(first);
|
|
2385
|
+
second = get(second);
|
|
2222
2386
|
}
|
|
2223
|
-
|
|
2224
|
-
|
|
2387
|
+
let result = 0;
|
|
2388
|
+
let i = 0;
|
|
2389
|
+
let fn;
|
|
2390
|
+
const len = fns.length;
|
|
2391
|
+
for (; i < len; i++) {
|
|
2392
|
+
fn = fns[i];
|
|
2393
|
+
if (!fn) {
|
|
2394
|
+
continue;
|
|
2395
|
+
}
|
|
2396
|
+
result = fn(first, second);
|
|
2397
|
+
if (result !== 0) {
|
|
2398
|
+
return result;
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
return result;
|
|
2402
|
+
};
|
|
2403
|
+
};
|
|
2404
|
+
|
|
2405
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2406
|
+
import { useEffect as useEffect9, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState4 } from "react";
|
|
2407
|
+
|
|
2408
|
+
// src/components/hooks/useEffectWithChanges.ts
|
|
2409
|
+
import { useEffect as useEffect8, useRef as useRef5 } from "react";
|
|
2410
|
+
function useEffectWithChanges(fn, deps) {
|
|
2411
|
+
const prevRef = useRef5({});
|
|
2412
|
+
const oldValuesRef = useRef5({});
|
|
2413
|
+
const oldValues = oldValuesRef.current;
|
|
2414
|
+
const changesRef = useRef5({});
|
|
2415
|
+
const changes = changesRef.current;
|
|
2416
|
+
const useEffectDeps = [];
|
|
2417
|
+
for (let k in deps) {
|
|
2418
|
+
if (deps.hasOwnProperty(k)) {
|
|
2419
|
+
if (deps[k] !== prevRef.current[k]) {
|
|
2420
|
+
changes[k] = deps[k];
|
|
2421
|
+
oldValues[k] = prevRef.current[k];
|
|
2422
|
+
}
|
|
2423
|
+
useEffectDeps.push(deps[k]);
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
prevRef.current = deps;
|
|
2427
|
+
useEffect8(() => {
|
|
2428
|
+
const changes2 = changesRef.current;
|
|
2429
|
+
const result = fn(changes2, oldValues);
|
|
2430
|
+
changesRef.current = {};
|
|
2431
|
+
oldValuesRef.current = {};
|
|
2432
|
+
return result;
|
|
2433
|
+
}, useEffectDeps);
|
|
2225
2434
|
}
|
|
2226
2435
|
|
|
2227
2436
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2228
|
-
function
|
|
2229
|
-
|
|
2437
|
+
function buildDataSourceDataParams(componentState) {
|
|
2438
|
+
var _a, _b;
|
|
2439
|
+
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
2440
|
+
const dataSourceParams = {
|
|
2441
|
+
originalDataArray: componentState.originalDataArray,
|
|
2442
|
+
sortInfo,
|
|
2443
|
+
groupRowsBy: componentState.groupRowsBy,
|
|
2444
|
+
pivotBy: componentState.pivotBy
|
|
2445
|
+
};
|
|
2446
|
+
if (componentState.livePagination !== void 0) {
|
|
2447
|
+
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
2448
|
+
}
|
|
2449
|
+
return dataSourceParams;
|
|
2450
|
+
}
|
|
2451
|
+
function notifyDataParamsChanged(componentState, actions) {
|
|
2452
|
+
var _a;
|
|
2453
|
+
if (typeof componentState.data === "function") {
|
|
2454
|
+
loadData(componentState.data, componentState, actions);
|
|
2455
|
+
}
|
|
2456
|
+
const dataParams = buildDataSourceDataParams(componentState);
|
|
2457
|
+
(_a = componentState.onDataParamsChange) == null ? void 0 : _a.call(componentState, dataParams);
|
|
2458
|
+
}
|
|
2459
|
+
function loadData(data, componentState, actions) {
|
|
2460
|
+
const dataParams = buildDataSourceDataParams(componentState);
|
|
2461
|
+
if (typeof data === "function") {
|
|
2462
|
+
data = data(dataParams);
|
|
2463
|
+
}
|
|
2464
|
+
const dataIsPromise = typeof data === "object" && typeof data.then === "function";
|
|
2465
|
+
if (dataIsPromise) {
|
|
2466
|
+
actions.loading = true;
|
|
2467
|
+
}
|
|
2468
|
+
Promise.resolve(data).then((dataParam) => {
|
|
2469
|
+
let dataArray = [];
|
|
2470
|
+
if (Array.isArray(dataParam.data)) {
|
|
2471
|
+
const remoteData = dataParam;
|
|
2472
|
+
dataArray = remoteData.data;
|
|
2473
|
+
if (remoteData.livePaginationCursor !== void 0) {
|
|
2474
|
+
actions.livePaginationCursor = remoteData.livePaginationCursor;
|
|
2475
|
+
}
|
|
2476
|
+
} else {
|
|
2477
|
+
dataArray = dataParam;
|
|
2478
|
+
}
|
|
2479
|
+
actions.originalDataArray = dataArray;
|
|
2480
|
+
if (dataIsPromise) {
|
|
2481
|
+
actions.loading = false;
|
|
2482
|
+
}
|
|
2483
|
+
});
|
|
2230
2484
|
}
|
|
2231
2485
|
function useLoadData() {
|
|
2232
2486
|
const {
|
|
2487
|
+
getComponentState,
|
|
2233
2488
|
componentActions: actions,
|
|
2234
2489
|
componentState: { data }
|
|
2235
2490
|
} = useComponentState();
|
|
2236
|
-
const loadData = (data2) => {
|
|
2237
|
-
let dataSourceInfo = {
|
|
2238
|
-
originalDataArray: []
|
|
2239
|
-
};
|
|
2240
|
-
if (typeof data2 === "function") {
|
|
2241
|
-
data2 = data2();
|
|
2242
|
-
}
|
|
2243
|
-
if (Array.isArray(data2)) {
|
|
2244
|
-
dataSourceInfo = buildDataSourceInfo(data2);
|
|
2245
|
-
actions.originalDataArray = dataSourceInfo.originalDataArray;
|
|
2246
|
-
} else {
|
|
2247
|
-
actions.loading = true;
|
|
2248
|
-
loadDataAsync(data2).then((dataSourceInfo2) => {
|
|
2249
|
-
actions.originalDataArray = dataSourceInfo2.originalDataArray;
|
|
2250
|
-
actions.loading = false;
|
|
2251
|
-
});
|
|
2252
|
-
}
|
|
2253
|
-
};
|
|
2254
2491
|
useLayoutEffect3(() => {
|
|
2255
|
-
loadData(data);
|
|
2492
|
+
loadData(data, getComponentState(), actions);
|
|
2256
2493
|
}, [data]);
|
|
2494
|
+
useLivePagination();
|
|
2495
|
+
}
|
|
2496
|
+
function useLivePagination() {
|
|
2497
|
+
const {
|
|
2498
|
+
getComponentState,
|
|
2499
|
+
componentActions: actions,
|
|
2500
|
+
componentState
|
|
2501
|
+
} = useComponentState();
|
|
2502
|
+
const {
|
|
2503
|
+
notifyScrollbarsChange,
|
|
2504
|
+
sortInfo,
|
|
2505
|
+
groupRowsBy,
|
|
2506
|
+
pivotBy,
|
|
2507
|
+
livePaginationCursor,
|
|
2508
|
+
scrollBottomId
|
|
2509
|
+
} = componentState;
|
|
2510
|
+
const [scrollbars, setScrollbars] = useState4({
|
|
2511
|
+
vertical: false,
|
|
2512
|
+
horizontal: false
|
|
2513
|
+
});
|
|
2514
|
+
const scrollbarsRef = useRef6(scrollbars);
|
|
2515
|
+
useEffect9(() => {
|
|
2516
|
+
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
2517
|
+
if (!scrollbars2) {
|
|
2518
|
+
return;
|
|
2519
|
+
}
|
|
2520
|
+
scrollbarsRef.current = scrollbars2;
|
|
2521
|
+
setScrollbars(scrollbars2);
|
|
2522
|
+
});
|
|
2523
|
+
return () => notifyScrollbarsChange.destroy();
|
|
2524
|
+
}, [notifyScrollbarsChange]);
|
|
2525
|
+
const [cursorId, updateCursorId] = useState4(void 0);
|
|
2526
|
+
useEffect9(() => {
|
|
2527
|
+
const frameId = requestAnimationFrame(() => {
|
|
2528
|
+
var _a;
|
|
2529
|
+
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical)) {
|
|
2530
|
+
updateCursorId(livePaginationCursor);
|
|
2531
|
+
}
|
|
2532
|
+
});
|
|
2533
|
+
return () => cancelAnimationFrame(frameId);
|
|
2534
|
+
}, [livePaginationCursor]);
|
|
2535
|
+
useEffect9(() => {
|
|
2536
|
+
const { livePaginationCursor: livePaginationCursor2, livePagination } = getComponentState();
|
|
2537
|
+
if (!scrollbars.vertical && livePagination) {
|
|
2538
|
+
updateCursorId(livePaginationCursor2);
|
|
2539
|
+
}
|
|
2540
|
+
}, [scrollbars.vertical]);
|
|
2541
|
+
useEffect9(() => {
|
|
2542
|
+
updateCursorId(scrollBottomId);
|
|
2543
|
+
}, [scrollBottomId]);
|
|
2544
|
+
const depsObject = {
|
|
2545
|
+
sortInfo,
|
|
2546
|
+
groupRowsBy,
|
|
2547
|
+
pivotBy,
|
|
2548
|
+
cursorId
|
|
2549
|
+
};
|
|
2550
|
+
useEffectWithChanges(() => {
|
|
2551
|
+
if (cursorId === void 0) {
|
|
2552
|
+
return;
|
|
2553
|
+
}
|
|
2554
|
+
notifyDataParamsChanged(getComponentState(), actions);
|
|
2555
|
+
}, depsObject);
|
|
2257
2556
|
}
|
|
2258
2557
|
|
|
2259
2558
|
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
@@ -2307,9 +2606,9 @@ var DeepMap = class {
|
|
|
2307
2606
|
if (!pair) {
|
|
2308
2607
|
return;
|
|
2309
2608
|
}
|
|
2310
|
-
const { map } = pair;
|
|
2609
|
+
const { map: map2 } = pair;
|
|
2311
2610
|
const keys = [...parentKeys, key];
|
|
2312
|
-
const next =
|
|
2611
|
+
const next = map2 ? () => this.visitWithNext(keys, fn, map2) : void 0;
|
|
2313
2612
|
if (pair.hasOwnProperty("value")) {
|
|
2314
2613
|
fn(pair.value, keys, i, next);
|
|
2315
2614
|
i++;
|
|
@@ -2375,14 +2674,14 @@ var DeepMap = class {
|
|
|
2375
2674
|
return this.length;
|
|
2376
2675
|
}
|
|
2377
2676
|
clear() {
|
|
2378
|
-
const clearMap = (
|
|
2379
|
-
|
|
2380
|
-
const { map:
|
|
2381
|
-
if (
|
|
2382
|
-
clearMap(
|
|
2677
|
+
const clearMap = (map2) => {
|
|
2678
|
+
map2.forEach((value, _key) => {
|
|
2679
|
+
const { map: map3 } = value;
|
|
2680
|
+
if (map3) {
|
|
2681
|
+
clearMap(map3);
|
|
2383
2682
|
}
|
|
2384
2683
|
});
|
|
2385
|
-
|
|
2684
|
+
map2.clear();
|
|
2386
2685
|
};
|
|
2387
2686
|
clearMap(this.map);
|
|
2388
2687
|
this.length = 0;
|
|
@@ -2427,9 +2726,9 @@ var DeepMap = class {
|
|
|
2427
2726
|
}
|
|
2428
2727
|
}
|
|
2429
2728
|
while (maps.length) {
|
|
2430
|
-
let
|
|
2729
|
+
let map2 = maps.pop();
|
|
2431
2730
|
let key = keys.pop();
|
|
2432
|
-
if (key && (
|
|
2731
|
+
if (key && (map2 == null ? void 0 : map2.size) === 0) {
|
|
2433
2732
|
let parentMap = maps[maps.length - 1];
|
|
2434
2733
|
let pair = parentMap == null ? void 0 : parentMap.get(key);
|
|
2435
2734
|
if (pair) {
|
|
@@ -2468,12 +2767,12 @@ var DeepMap = class {
|
|
|
2468
2767
|
if (!pair) {
|
|
2469
2768
|
return;
|
|
2470
2769
|
}
|
|
2471
|
-
const { map } = pair;
|
|
2770
|
+
const { map: map2 } = pair;
|
|
2472
2771
|
const keys = [...parentKeys, key];
|
|
2473
2772
|
const next = once(() => {
|
|
2474
|
-
if (
|
|
2475
|
-
|
|
2476
|
-
this.visitKey(k,
|
|
2773
|
+
if (map2) {
|
|
2774
|
+
map2.forEach((_, k) => {
|
|
2775
|
+
this.visitKey(k, map2, keys, fn);
|
|
2477
2776
|
});
|
|
2478
2777
|
}
|
|
2479
2778
|
});
|
|
@@ -2639,14 +2938,68 @@ var GroupRowsState = class {
|
|
|
2639
2938
|
}
|
|
2640
2939
|
};
|
|
2641
2940
|
|
|
2941
|
+
// src/utils/shallowEqualObjects.ts
|
|
2942
|
+
function shallowEqualObjects(objA, objB) {
|
|
2943
|
+
if (objA === objB) {
|
|
2944
|
+
return true;
|
|
2945
|
+
}
|
|
2946
|
+
if (!objA || !objB) {
|
|
2947
|
+
return false;
|
|
2948
|
+
}
|
|
2949
|
+
var aKeys = Object.keys(objA);
|
|
2950
|
+
var bKeys = Object.keys(objB);
|
|
2951
|
+
var len = aKeys.length;
|
|
2952
|
+
if (bKeys.length !== len) {
|
|
2953
|
+
return false;
|
|
2954
|
+
}
|
|
2955
|
+
for (var i = 0; i < len; i++) {
|
|
2956
|
+
var key = aKeys[i];
|
|
2957
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
2958
|
+
return false;
|
|
2959
|
+
}
|
|
2960
|
+
}
|
|
2961
|
+
return true;
|
|
2962
|
+
}
|
|
2963
|
+
|
|
2964
|
+
// src/components/utils/discardCallsWithEqualArg.ts
|
|
2965
|
+
var map = new WeakMap();
|
|
2966
|
+
var getCompareDefault = (a) => a;
|
|
2967
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject2) {
|
|
2968
|
+
map.set(fn, {
|
|
2969
|
+
lastCallTime: 0,
|
|
2970
|
+
lastCallArg: null
|
|
2971
|
+
});
|
|
2972
|
+
const getCompare = getCompareObject2 != null ? getCompareObject2 : getCompareDefault;
|
|
2973
|
+
return (arg) => {
|
|
2974
|
+
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
2975
|
+
lastCallTime: 0,
|
|
2976
|
+
lastCallArg: null
|
|
2977
|
+
};
|
|
2978
|
+
const now = Date.now();
|
|
2979
|
+
const diff = now - lastCallTime;
|
|
2980
|
+
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
2981
|
+
if (diff < timeframe && objectsEqual) {
|
|
2982
|
+
return;
|
|
2983
|
+
}
|
|
2984
|
+
map.set(fn, {
|
|
2985
|
+
lastCallTime: now,
|
|
2986
|
+
lastCallArg: arg
|
|
2987
|
+
});
|
|
2988
|
+
fn(arg);
|
|
2989
|
+
};
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2642
2992
|
// src/components/DataSource/state/getInitialState.ts
|
|
2643
2993
|
function initSetupState2() {
|
|
2644
2994
|
const now = Date.now();
|
|
2645
2995
|
const originalDataArray = [];
|
|
2646
2996
|
const dataArray = [];
|
|
2647
2997
|
return {
|
|
2998
|
+
dataParams: void 0,
|
|
2999
|
+
notifyScrollbarsChange: buildSubscriptionCallback(),
|
|
2648
3000
|
pivotTotalColumnPosition: "end",
|
|
2649
3001
|
originalDataArray,
|
|
3002
|
+
scrollBottomId: Symbol("scrollBottomId"),
|
|
2650
3003
|
pivotColumns: void 0,
|
|
2651
3004
|
pivotColumnGroups: void 0,
|
|
2652
3005
|
dataArray,
|
|
@@ -2663,12 +3016,20 @@ function initSetupState2() {
|
|
|
2663
3016
|
lastGroupDataArray: void 0
|
|
2664
3017
|
};
|
|
2665
3018
|
}
|
|
3019
|
+
function getCompareObject(dataParams) {
|
|
3020
|
+
const obj = __spreadValues({}, dataParams);
|
|
3021
|
+
delete obj.originalDataArray;
|
|
3022
|
+
return obj;
|
|
3023
|
+
}
|
|
2666
3024
|
var forwardProps3 = () => {
|
|
2667
3025
|
return {
|
|
3026
|
+
onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObject) : void 0,
|
|
2668
3027
|
remoteCount: 1,
|
|
2669
3028
|
data: 1,
|
|
2670
3029
|
pivotBy: 1,
|
|
2671
3030
|
primaryKey: 1,
|
|
3031
|
+
livePagination: 1,
|
|
3032
|
+
livePaginationCursor: 1,
|
|
2672
3033
|
loading: (loading) => loading != null ? loading : false,
|
|
2673
3034
|
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
|
|
2674
3035
|
groupRowsBy: (groupRowsBy) => groupRowsBy != null ? groupRowsBy : [],
|
|
@@ -2681,10 +3042,20 @@ var forwardProps3 = () => {
|
|
|
2681
3042
|
};
|
|
2682
3043
|
};
|
|
2683
3044
|
function mapPropsToState2(params) {
|
|
2684
|
-
var _a;
|
|
2685
3045
|
const { props } = params;
|
|
3046
|
+
const controlledSort = isControlledValue(props.sortInfo);
|
|
2686
3047
|
return {
|
|
2687
|
-
|
|
3048
|
+
controlledSort,
|
|
3049
|
+
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
|
|
3050
|
+
};
|
|
3051
|
+
}
|
|
3052
|
+
function getInterceptActions() {
|
|
3053
|
+
return {
|
|
3054
|
+
sortInfo: (sortInfo, { actions, state }) => {
|
|
3055
|
+
const dataParams = buildDataSourceDataParams(state);
|
|
3056
|
+
dataParams.sortInfo = sortInfo;
|
|
3057
|
+
actions.dataParams = dataParams;
|
|
3058
|
+
}
|
|
2688
3059
|
};
|
|
2689
3060
|
}
|
|
2690
3061
|
|
|
@@ -2874,121 +3245,49 @@ function enhancedFlatten(param) {
|
|
|
2874
3245
|
collapsed
|
|
2875
3246
|
}, deepMapValue);
|
|
2876
3247
|
const include = generateGroupRows || collapsed;
|
|
2877
|
-
if (include) {
|
|
2878
|
-
result.push(enhancedGroupData);
|
|
2879
|
-
}
|
|
2880
|
-
if (collapsed) {
|
|
2881
|
-
parents.forEach((parent) => {
|
|
2882
|
-
parent.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
2883
|
-
parent.collapsedGroupsCount += 1;
|
|
2884
|
-
});
|
|
2885
|
-
}
|
|
2886
|
-
indexInParentGroups.push(indexInGroup);
|
|
2887
|
-
parents.push(enhancedGroupData);
|
|
2888
|
-
if (!collapsed) {
|
|
2889
|
-
if (!next) {
|
|
2890
|
-
if (!pivot) {
|
|
2891
|
-
const startIndex = result.length;
|
|
2892
|
-
result.push(...items.map((item, index) => {
|
|
2893
|
-
return {
|
|
2894
|
-
id: toPrimaryKey(item),
|
|
2895
|
-
data: item,
|
|
2896
|
-
isGroupRow: false,
|
|
2897
|
-
collapsed: false,
|
|
2898
|
-
groupKeys,
|
|
2899
|
-
parents: Array.from(parents),
|
|
2900
|
-
indexInParentGroups: [...indexInParentGroups, index],
|
|
2901
|
-
indexInGroup: index,
|
|
2902
|
-
indexInAll: startIndex + index,
|
|
2903
|
-
groupBy: groupByStrings,
|
|
2904
|
-
groupNesting,
|
|
2905
|
-
groupCount: enhancedGroupData.groupCount
|
|
2906
|
-
};
|
|
2907
|
-
}));
|
|
2908
|
-
}
|
|
2909
|
-
} else {
|
|
2910
|
-
next();
|
|
2911
|
-
}
|
|
2912
|
-
}
|
|
2913
|
-
parents.pop();
|
|
2914
|
-
indexInParentGroups.pop();
|
|
2915
|
-
});
|
|
2916
|
-
return {
|
|
2917
|
-
data: result
|
|
2918
|
-
};
|
|
2919
|
-
}
|
|
2920
|
-
|
|
2921
|
-
// src/utils/multisort/sortTypes.ts
|
|
2922
|
-
var sortTypes = {
|
|
2923
|
-
number: function(first, second) {
|
|
2924
|
-
return first - second;
|
|
2925
|
-
},
|
|
2926
|
-
string: function(first, second) {
|
|
2927
|
-
first = `${first}`;
|
|
2928
|
-
second = `${second}`;
|
|
2929
|
-
return first.localeCompare(second);
|
|
2930
|
-
}
|
|
2931
|
-
};
|
|
2932
|
-
var sortTypes_default = sortTypes;
|
|
2933
|
-
|
|
2934
|
-
// src/utils/multisort/index.ts
|
|
2935
|
-
var multisort = (sortInfo, array, get) => {
|
|
2936
|
-
array.sort(getMultisortFunction(sortInfo, get));
|
|
2937
|
-
return array;
|
|
2938
|
-
};
|
|
2939
|
-
multisort.knownTypes = sortTypes_default;
|
|
2940
|
-
var getSingleSortFunction = (info) => {
|
|
2941
|
-
if (!info) {
|
|
2942
|
-
return;
|
|
2943
|
-
}
|
|
2944
|
-
const field = info.field;
|
|
2945
|
-
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
2946
|
-
if (!dir) {
|
|
2947
|
-
return;
|
|
2948
|
-
}
|
|
2949
|
-
let fn = info.fn;
|
|
2950
|
-
if (!fn && info.type) {
|
|
2951
|
-
fn = multisort.knownTypes[info.type];
|
|
2952
|
-
if (!fn) {
|
|
2953
|
-
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
2954
|
-
}
|
|
2955
|
-
}
|
|
2956
|
-
if (!fn) {
|
|
2957
|
-
fn = sortTypes_default.string;
|
|
2958
|
-
}
|
|
2959
|
-
return (first, second) => {
|
|
2960
|
-
const a = field ? first[field] : first;
|
|
2961
|
-
const b = field ? second[field] : second;
|
|
2962
|
-
return dir * fn(a, b);
|
|
2963
|
-
};
|
|
2964
|
-
};
|
|
2965
|
-
var getSortFunctions = (sortInfo) => {
|
|
2966
|
-
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
2967
|
-
};
|
|
2968
|
-
var getMultisortFunction = (sortInfo, get) => {
|
|
2969
|
-
const fns = getSortFunctions(sortInfo);
|
|
2970
|
-
return (first, second) => {
|
|
2971
|
-
if (get) {
|
|
2972
|
-
first = get(first);
|
|
2973
|
-
second = get(second);
|
|
3248
|
+
if (include) {
|
|
3249
|
+
result.push(enhancedGroupData);
|
|
2974
3250
|
}
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
3251
|
+
if (collapsed) {
|
|
3252
|
+
parents.forEach((parent) => {
|
|
3253
|
+
parent.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
3254
|
+
parent.collapsedGroupsCount += 1;
|
|
3255
|
+
});
|
|
3256
|
+
}
|
|
3257
|
+
indexInParentGroups.push(indexInGroup);
|
|
3258
|
+
parents.push(enhancedGroupData);
|
|
3259
|
+
if (!collapsed) {
|
|
3260
|
+
if (!next) {
|
|
3261
|
+
if (!pivot) {
|
|
3262
|
+
const startIndex = result.length;
|
|
3263
|
+
result.push(...items.map((item, index) => {
|
|
3264
|
+
return {
|
|
3265
|
+
id: toPrimaryKey(item),
|
|
3266
|
+
data: item,
|
|
3267
|
+
isGroupRow: false,
|
|
3268
|
+
collapsed: false,
|
|
3269
|
+
groupKeys,
|
|
3270
|
+
parents: Array.from(parents),
|
|
3271
|
+
indexInParentGroups: [...indexInParentGroups, index],
|
|
3272
|
+
indexInGroup: index,
|
|
3273
|
+
indexInAll: startIndex + index,
|
|
3274
|
+
groupBy: groupByStrings,
|
|
3275
|
+
groupNesting,
|
|
3276
|
+
groupCount: enhancedGroupData.groupCount
|
|
3277
|
+
};
|
|
3278
|
+
}));
|
|
3279
|
+
}
|
|
3280
|
+
} else {
|
|
3281
|
+
next();
|
|
2987
3282
|
}
|
|
2988
3283
|
}
|
|
2989
|
-
|
|
3284
|
+
parents.pop();
|
|
3285
|
+
indexInParentGroups.pop();
|
|
3286
|
+
});
|
|
3287
|
+
return {
|
|
3288
|
+
data: result
|
|
2990
3289
|
};
|
|
2991
|
-
}
|
|
3290
|
+
}
|
|
2992
3291
|
|
|
2993
3292
|
// src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
|
|
2994
3293
|
function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPosition) {
|
|
@@ -3114,7 +3413,7 @@ function concludeReducer(params) {
|
|
|
3114
3413
|
var _a;
|
|
3115
3414
|
const { state, previousState } = params;
|
|
3116
3415
|
const sortInfo = state.sortInfo;
|
|
3117
|
-
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length);
|
|
3416
|
+
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
3118
3417
|
const sortDepsChanged = haveDepsChanged(previousState, state, [
|
|
3119
3418
|
"originalDataArray",
|
|
3120
3419
|
"sortInfo"
|
|
@@ -3184,7 +3483,9 @@ function concludeReducer(params) {
|
|
|
3184
3483
|
}
|
|
3185
3484
|
state.dataArray = rowInfoDataArray;
|
|
3186
3485
|
state.reducedAt = now;
|
|
3187
|
-
|
|
3486
|
+
if (true) {
|
|
3487
|
+
globalThis.state = state;
|
|
3488
|
+
}
|
|
3188
3489
|
return state;
|
|
3189
3490
|
}
|
|
3190
3491
|
|
|
@@ -3207,7 +3508,8 @@ var DataSourceRoot = getComponentStateRoot({
|
|
|
3207
3508
|
initSetupState: initSetupState2,
|
|
3208
3509
|
forwardProps: forwardProps3,
|
|
3209
3510
|
concludeReducer,
|
|
3210
|
-
mapPropsToState: mapPropsToState2
|
|
3511
|
+
mapPropsToState: mapPropsToState2,
|
|
3512
|
+
interceptActions: getInterceptActions()
|
|
3211
3513
|
});
|
|
3212
3514
|
function DataSourceCmp({ children }) {
|
|
3213
3515
|
const DataSourceContext = getDataSourceContext();
|
|
@@ -3267,10 +3569,10 @@ function useColumnsWhen() {
|
|
|
3267
3569
|
componentState: { groupRenderStrategy, pivotTotalColumnPosition }
|
|
3268
3570
|
} = useComponentState();
|
|
3269
3571
|
const groupRowsMap = useGroupRowsMap(groupRowsBy);
|
|
3270
|
-
|
|
3572
|
+
useEffect10(() => {
|
|
3271
3573
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
3272
3574
|
}, [groupRenderStrategy]);
|
|
3273
|
-
|
|
3575
|
+
useEffect10(() => {
|
|
3274
3576
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3275
3577
|
}, [pivotTotalColumnPosition]);
|
|
3276
3578
|
useColumnsWhenInlineGroupRenderStrategy(groupRowsMap);
|
|
@@ -3333,7 +3635,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3333
3635
|
});
|
|
3334
3636
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
3335
3637
|
}
|
|
3336
|
-
|
|
3638
|
+
useEffect10(() => {
|
|
3337
3639
|
const update = () => {
|
|
3338
3640
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupRowsMap, groupRenderStrategy, toggleGroupRow);
|
|
3339
3641
|
};
|
|
@@ -3359,7 +3661,7 @@ function useColumnsWhenPivoting() {
|
|
|
3359
3661
|
}
|
|
3360
3662
|
} = useComponentState();
|
|
3361
3663
|
const toggleGroupRow = useToggleGroupRow();
|
|
3362
|
-
|
|
3664
|
+
useEffect10(() => {
|
|
3363
3665
|
const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
|
|
3364
3666
|
pivotColumn,
|
|
3365
3667
|
pivotRowLabelsColumn,
|
|
@@ -3380,7 +3682,7 @@ function useColumnsWhenGrouping() {
|
|
|
3380
3682
|
componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
|
|
3381
3683
|
} = useComponentState();
|
|
3382
3684
|
const toggleGroupRow = useToggleGroupRow();
|
|
3383
|
-
|
|
3685
|
+
useEffect10(() => {
|
|
3384
3686
|
if (pivotColumns) {
|
|
3385
3687
|
return;
|
|
3386
3688
|
}
|
|
@@ -3417,7 +3719,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3417
3719
|
groupRenderStrategy
|
|
3418
3720
|
}
|
|
3419
3721
|
} = useComponentState();
|
|
3420
|
-
|
|
3722
|
+
useEffect10(() => {
|
|
3421
3723
|
if (groupRenderStrategy === "single-column") {
|
|
3422
3724
|
return;
|
|
3423
3725
|
}
|
|
@@ -3482,25 +3784,27 @@ function getColumnsWhenGrouping(params) {
|
|
|
3482
3784
|
const computedColumns = new Map();
|
|
3483
3785
|
if (groupRenderStrategy === "multi-column") {
|
|
3484
3786
|
groupRowsBy.forEach((groupByForColumn, groupIndexForColumn, arr) => {
|
|
3485
|
-
|
|
3787
|
+
const generatedGroupColumn = getColumnForGroupBy({
|
|
3486
3788
|
groupByForColumn,
|
|
3487
3789
|
groupRowsBy,
|
|
3488
3790
|
groupIndexForColumn,
|
|
3489
3791
|
groupCount: arr.length,
|
|
3490
3792
|
groupRenderStrategy
|
|
3491
|
-
}, toggleGroupRow, groupColumn)
|
|
3793
|
+
}, toggleGroupRow, groupColumn);
|
|
3794
|
+
computedColumns.set(generatedGroupColumn.id || `group-by-${groupByForColumn.field}`, generatedGroupColumn);
|
|
3492
3795
|
});
|
|
3493
3796
|
} else if (groupRenderStrategy === "single-column") {
|
|
3494
|
-
|
|
3797
|
+
const singleGroupColumn = getSingleGroupColumn({
|
|
3495
3798
|
groupCount: groupRowsBy.length,
|
|
3496
3799
|
groupRowsBy,
|
|
3497
3800
|
groupRenderStrategy
|
|
3498
|
-
}, toggleGroupRow, groupColumn)
|
|
3801
|
+
}, toggleGroupRow, groupColumn);
|
|
3802
|
+
computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
|
|
3499
3803
|
}
|
|
3500
3804
|
columns.forEach((col, colId) => {
|
|
3501
3805
|
computedColumns.set(colId, col);
|
|
3502
3806
|
});
|
|
3503
|
-
return computedColumns;
|
|
3807
|
+
return computedColumns.size ? computedColumns : void 0;
|
|
3504
3808
|
}
|
|
3505
3809
|
|
|
3506
3810
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
@@ -3511,8 +3815,15 @@ function useComputed() {
|
|
|
3511
3815
|
componentActions: dataSourceActions,
|
|
3512
3816
|
componentState: dataSourceState
|
|
3513
3817
|
} = useDataSourceContextValue();
|
|
3514
|
-
const {
|
|
3515
|
-
|
|
3818
|
+
const {
|
|
3819
|
+
columnOrder,
|
|
3820
|
+
columnVisibility,
|
|
3821
|
+
columnPinning,
|
|
3822
|
+
columnSizing,
|
|
3823
|
+
columnTypes,
|
|
3824
|
+
bodySize
|
|
3825
|
+
} = componentState;
|
|
3826
|
+
useState5(() => {
|
|
3516
3827
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
3517
3828
|
if (rowHeight) {
|
|
3518
3829
|
componentActions.rowHeight = rowHeight;
|
|
@@ -3530,7 +3841,8 @@ function useComputed() {
|
|
|
3530
3841
|
useColumnsWhen();
|
|
3531
3842
|
const setSortInfo = useCallback5((sortInfo) => {
|
|
3532
3843
|
var _a2;
|
|
3533
|
-
|
|
3844
|
+
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
3845
|
+
dataSourceActions.sortInfo = newSortInfo;
|
|
3534
3846
|
}, []);
|
|
3535
3847
|
const columns = componentState.computedColumns;
|
|
3536
3848
|
const {
|
|
@@ -3556,6 +3868,7 @@ function useComputed() {
|
|
|
3556
3868
|
pinnedStartMaxWidth: componentState.pinnedStartMaxWidth,
|
|
3557
3869
|
pinnedEndMaxWidth: componentState.pinnedEndMaxWidth,
|
|
3558
3870
|
bodySize,
|
|
3871
|
+
viewportReservedWidth: componentState.viewportReservedWidth,
|
|
3559
3872
|
sortable: componentState.sortable,
|
|
3560
3873
|
draggableColumns: componentState.draggableColumns,
|
|
3561
3874
|
sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
|
|
@@ -3564,7 +3877,9 @@ function useComputed() {
|
|
|
3564
3877
|
columnOrder,
|
|
3565
3878
|
columnVisibility,
|
|
3566
3879
|
columnVisibilityAssumeVisible: true,
|
|
3567
|
-
columnPinning
|
|
3880
|
+
columnPinning,
|
|
3881
|
+
columnSizing,
|
|
3882
|
+
columnTypes
|
|
3568
3883
|
});
|
|
3569
3884
|
const unpinnedColumnWidths = computedUnpinnedColumns.map((c) => c.computedWidth);
|
|
3570
3885
|
let sortedUnpinnedColumnWidths = [...unpinnedColumnWidths].sort(sortAscending);
|
|
@@ -3640,33 +3955,6 @@ import {
|
|
|
3640
3955
|
createElement as createElement19
|
|
3641
3956
|
} from "react";
|
|
3642
3957
|
|
|
3643
|
-
// src/utils/getGlobal.ts
|
|
3644
|
-
function getGlobal() {
|
|
3645
|
-
return globalThis;
|
|
3646
|
-
}
|
|
3647
|
-
|
|
3648
|
-
// src/components/utils/getScrollbarWidth.ts
|
|
3649
|
-
var scrollbarWidth;
|
|
3650
|
-
function getScrollbarWidth() {
|
|
3651
|
-
var _a, _b;
|
|
3652
|
-
if (scrollbarWidth != null) {
|
|
3653
|
-
return scrollbarWidth;
|
|
3654
|
-
}
|
|
3655
|
-
const doc = (_a = getGlobal().document) != null ? _a : null;
|
|
3656
|
-
if (!doc) {
|
|
3657
|
-
return 0;
|
|
3658
|
-
}
|
|
3659
|
-
const outer = doc.createElement("div");
|
|
3660
|
-
outer.style.visibility = "hidden";
|
|
3661
|
-
outer.style.overflow = "scroll";
|
|
3662
|
-
doc.body.appendChild(outer);
|
|
3663
|
-
const inner = doc.createElement("div");
|
|
3664
|
-
outer.appendChild(inner);
|
|
3665
|
-
scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
|
3666
|
-
(_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
|
|
3667
|
-
return scrollbarWidth;
|
|
3668
|
-
}
|
|
3669
|
-
|
|
3670
3958
|
// src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx
|
|
3671
3959
|
import {
|
|
3672
3960
|
createElement as createElement8,
|
|
@@ -3706,10 +3994,11 @@ function VerticalScrollbarPlaceholderFn(props) {
|
|
|
3706
3994
|
var VerticalScrollbarPlaceholder = memo2(VerticalScrollbarPlaceholderFn);
|
|
3707
3995
|
|
|
3708
3996
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
3997
|
+
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3709
3998
|
var CellCls = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
3710
3999
|
var HeaderCellProxy = "_12zfob10";
|
|
3711
|
-
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"]] });
|
|
3712
|
-
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"]] });
|
|
4000
|
+
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"]] });
|
|
4001
|
+
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"]] });
|
|
3713
4002
|
var HeaderGroupCls = "_16lm1iwz _16lm1iwj";
|
|
3714
4003
|
var HeaderGroup_Children = "_16lm1iwj _16lm1iw10 _16lm1iw12 _16lm1iwc";
|
|
3715
4004
|
var HeaderGroup_Header = "_12zfob1x _16lm1iwj _16lm1iw10 _16lm1iw11";
|
|
@@ -3721,14 +4010,14 @@ import {
|
|
|
3721
4010
|
createElement as createElement15,
|
|
3722
4011
|
memo as memo6
|
|
3723
4012
|
} from "react";
|
|
3724
|
-
import { useCallback as useCallback8, useEffect as
|
|
4013
|
+
import { useCallback as useCallback8, useEffect as useEffect14, useRef as useRef9 } from "react";
|
|
3725
4014
|
|
|
3726
4015
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3727
4016
|
import {
|
|
3728
4017
|
Fragment as Fragment2,
|
|
3729
4018
|
createElement as createElement11
|
|
3730
4019
|
} from "react";
|
|
3731
|
-
import { useCallback as useCallback7, useEffect as
|
|
4020
|
+
import { useCallback as useCallback7, useEffect as useEffect12, useRef as useRef8 } from "react";
|
|
3732
4021
|
|
|
3733
4022
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
3734
4023
|
import {
|
|
@@ -3745,9 +4034,10 @@ var useInfiniteTableState = () => {
|
|
|
3745
4034
|
};
|
|
3746
4035
|
|
|
3747
4036
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
4037
|
+
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3748
4038
|
var CellCls2 = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
3749
4039
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
3750
|
-
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"]] });
|
|
4040
|
+
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"]] });
|
|
3751
4041
|
var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
|
|
3752
4042
|
|
|
3753
4043
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
@@ -3808,8 +4098,8 @@ var import_binary_search = __toModule(require_binary_search());
|
|
|
3808
4098
|
import {
|
|
3809
4099
|
useCallback as useCallback6,
|
|
3810
4100
|
useMemo as useMemo6,
|
|
3811
|
-
useRef as
|
|
3812
|
-
useState as
|
|
4101
|
+
useRef as useRef7,
|
|
4102
|
+
useState as useState6
|
|
3813
4103
|
} from "react";
|
|
3814
4104
|
|
|
3815
4105
|
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
@@ -3844,13 +4134,13 @@ var useColumnPointerEvents = ({
|
|
|
3844
4134
|
columns,
|
|
3845
4135
|
computedRemainingSpace
|
|
3846
4136
|
}) => {
|
|
3847
|
-
const [draggingDiff, setDraggingDiff] =
|
|
3848
|
-
const [proxyOffset, setProxyOffset] =
|
|
3849
|
-
const breakpointsRef =
|
|
3850
|
-
const pointerMoveRef =
|
|
3851
|
-
const didDragRef =
|
|
3852
|
-
const initialClientPos =
|
|
3853
|
-
const currentDropIndexRef =
|
|
4137
|
+
const [draggingDiff, setDraggingDiff] = useState6(null);
|
|
4138
|
+
const [proxyOffset, setProxyOffset] = useState6(null);
|
|
4139
|
+
const breakpointsRef = useRef7([]);
|
|
4140
|
+
const pointerMoveRef = useRef7(null);
|
|
4141
|
+
const didDragRef = useRef7(false);
|
|
4142
|
+
const initialClientPos = useRef7(null);
|
|
4143
|
+
const currentDropIndexRef = useRef7(null);
|
|
3854
4144
|
const dragging = draggingDiff != null;
|
|
3855
4145
|
const { componentActions, computed } = useInfiniteTable();
|
|
3856
4146
|
const { computedColumnOrder } = computed;
|
|
@@ -3863,7 +4153,7 @@ var useColumnPointerEvents = ({
|
|
|
3863
4153
|
columnWidth: column.computedWidth
|
|
3864
4154
|
};
|
|
3865
4155
|
}, [columns, columnId, column]);
|
|
3866
|
-
let cursorRef =
|
|
4156
|
+
let cursorRef = useRef7("auto");
|
|
3867
4157
|
const onPointerDown = useCallback6((e) => {
|
|
3868
4158
|
const target = domRef.current;
|
|
3869
4159
|
cursorRef.current = target.style.cursor;
|
|
@@ -4004,7 +4294,7 @@ import { createPortal } from "react-dom";
|
|
|
4004
4294
|
import {
|
|
4005
4295
|
createElement as createElement10
|
|
4006
4296
|
} from "react";
|
|
4007
|
-
import { useEffect as
|
|
4297
|
+
import { useEffect as useEffect11, useState as useState7 } from "react";
|
|
4008
4298
|
var defaultLineStyle = {
|
|
4009
4299
|
marginTop: 2,
|
|
4010
4300
|
marginBottom: 2,
|
|
@@ -4012,8 +4302,8 @@ var defaultLineStyle = {
|
|
|
4012
4302
|
};
|
|
4013
4303
|
function SortIcon(props) {
|
|
4014
4304
|
var _a;
|
|
4015
|
-
const [rendered, setRendered] =
|
|
4016
|
-
const [opacity, setOpacity] =
|
|
4305
|
+
const [rendered, setRendered] = useState7(true);
|
|
4306
|
+
const [opacity, setOpacity] = useState7(0);
|
|
4017
4307
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
4018
4308
|
const showIndex = index != null && index > 0;
|
|
4019
4309
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -4027,7 +4317,7 @@ function SortIcon(props) {
|
|
|
4027
4317
|
}), props.lineStyle), {
|
|
4028
4318
|
opacity
|
|
4029
4319
|
});
|
|
4030
|
-
|
|
4320
|
+
useEffect11(() => {
|
|
4031
4321
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
4032
4322
|
if (!rendered && newOpacity) {
|
|
4033
4323
|
setRendered(true);
|
|
@@ -4104,7 +4394,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4104
4394
|
className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
|
|
4105
4395
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
4106
4396
|
});
|
|
4107
|
-
const domRef =
|
|
4397
|
+
const domRef = useRef8(null);
|
|
4108
4398
|
const ref = useCallback7((node) => {
|
|
4109
4399
|
var _a2;
|
|
4110
4400
|
domRef.current = node;
|
|
@@ -4114,7 +4404,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4114
4404
|
computed: { computedRemainingSpace },
|
|
4115
4405
|
componentState: { portalDOMRef }
|
|
4116
4406
|
} = useInfiniteTable();
|
|
4117
|
-
|
|
4407
|
+
useEffect12(() => {
|
|
4118
4408
|
let clearOnResize = null;
|
|
4119
4409
|
const node = domRef.current;
|
|
4120
4410
|
if (onResize && node) {
|
|
@@ -4170,7 +4460,29 @@ import {
|
|
|
4170
4460
|
createElement as createElement14,
|
|
4171
4461
|
memo as memo5
|
|
4172
4462
|
} from "react";
|
|
4173
|
-
import {
|
|
4463
|
+
import { useEffect as useEffect13 } from "react";
|
|
4464
|
+
|
|
4465
|
+
// src/components/RawList/AvoidReactDiff.tsx
|
|
4466
|
+
import {
|
|
4467
|
+
Fragment as Fragment3,
|
|
4468
|
+
createElement as createElement12,
|
|
4469
|
+
memo as memo4
|
|
4470
|
+
} from "react";
|
|
4471
|
+
import { useLayoutEffect as useLayoutEffect4, useState as useState8 } from "react";
|
|
4472
|
+
function AvoidReactDiffFn(props) {
|
|
4473
|
+
const [children, setChildren] = useState8(props.updater.get());
|
|
4474
|
+
useLayoutEffect4(() => {
|
|
4475
|
+
const remove = props.updater.onChange((children2) => {
|
|
4476
|
+
setChildren(children2);
|
|
4477
|
+
});
|
|
4478
|
+
return remove;
|
|
4479
|
+
}, [props.updater]);
|
|
4480
|
+
return /* @__PURE__ */ createElement12(Fragment3, null, children);
|
|
4481
|
+
}
|
|
4482
|
+
var AvoidReactDiff = memo4(AvoidReactDiffFn);
|
|
4483
|
+
|
|
4484
|
+
// src/components/RawList/useVirtualRenderer.ts
|
|
4485
|
+
import { useMemo as useMemo7 } from "react";
|
|
4174
4486
|
|
|
4175
4487
|
// src/components/RawList/ReactVirtualRenderer.tsx
|
|
4176
4488
|
import {
|
|
@@ -4191,10 +4503,10 @@ var MappedItems = class extends Logger {
|
|
|
4191
4503
|
return result;
|
|
4192
4504
|
};
|
|
4193
4505
|
this.getElementsOutsideItemRange = (startIndex, endIndex) => {
|
|
4194
|
-
const
|
|
4506
|
+
const map2 = this.elementIndexToItemIndex;
|
|
4195
4507
|
const result = [];
|
|
4196
|
-
for (const elementIndex in
|
|
4197
|
-
const itemIndex =
|
|
4508
|
+
for (const elementIndex in map2) {
|
|
4509
|
+
const itemIndex = map2[elementIndex];
|
|
4198
4510
|
if (itemIndex < startIndex || itemIndex > endIndex) {
|
|
4199
4511
|
result.push(elementIndex >> 0);
|
|
4200
4512
|
}
|
|
@@ -4270,6 +4582,9 @@ var MappedItems = class extends Logger {
|
|
|
4270
4582
|
this.itemIndexToElementIndex = {};
|
|
4271
4583
|
this.renderedElements = {};
|
|
4272
4584
|
}
|
|
4585
|
+
reset() {
|
|
4586
|
+
this.init();
|
|
4587
|
+
}
|
|
4273
4588
|
destroy() {
|
|
4274
4589
|
this.init();
|
|
4275
4590
|
}
|
|
@@ -4289,25 +4604,6 @@ var MappedItems = class extends Logger {
|
|
|
4289
4604
|
}
|
|
4290
4605
|
};
|
|
4291
4606
|
|
|
4292
|
-
// src/components/RawList/AvoidReactDiff.tsx
|
|
4293
|
-
import {
|
|
4294
|
-
Fragment as Fragment3,
|
|
4295
|
-
createElement as createElement12,
|
|
4296
|
-
memo as memo4
|
|
4297
|
-
} from "react";
|
|
4298
|
-
import { useLayoutEffect as useLayoutEffect4, useState as useState7 } from "react";
|
|
4299
|
-
function AvoidReactDiffFn(props) {
|
|
4300
|
-
const [children, setChildren] = useState7(props.updater.get());
|
|
4301
|
-
useLayoutEffect4(() => {
|
|
4302
|
-
const remove = props.updater.onChange((children2) => {
|
|
4303
|
-
setChildren(children2);
|
|
4304
|
-
});
|
|
4305
|
-
return remove;
|
|
4306
|
-
}, [props.updater]);
|
|
4307
|
-
return /* @__PURE__ */ createElement12(Fragment3, null, children);
|
|
4308
|
-
}
|
|
4309
|
-
var AvoidReactDiff = memo4(AvoidReactDiffFn);
|
|
4310
|
-
|
|
4311
4607
|
// src/components/RawList/ReactVirtualRenderer.tsx
|
|
4312
4608
|
var ITEM_POSITION_WITH_TRANSFORM = true;
|
|
4313
4609
|
var ReactVirtualRenderer = class extends Logger {
|
|
@@ -4414,17 +4710,12 @@ var ReactVirtualRenderer = class extends Logger {
|
|
|
4414
4710
|
}
|
|
4415
4711
|
};
|
|
4416
4712
|
this.destroy = () => {
|
|
4417
|
-
if (true) {
|
|
4418
|
-
return;
|
|
4419
|
-
}
|
|
4420
4713
|
this.destroyed = true;
|
|
4421
|
-
this.
|
|
4422
|
-
this.itemDOMElements = [];
|
|
4423
|
-
this.itemDOMRefs = [];
|
|
4424
|
-
this.updaters = [];
|
|
4714
|
+
this.reset();
|
|
4425
4715
|
this.onRender = null;
|
|
4426
4716
|
this.renderItem = null;
|
|
4427
4717
|
this.brain = null;
|
|
4718
|
+
this.mappedItems = null;
|
|
4428
4719
|
};
|
|
4429
4720
|
if (onRender) {
|
|
4430
4721
|
this.onRender = onRender;
|
|
@@ -4482,28 +4773,53 @@ var ReactVirtualRenderer = class extends Logger {
|
|
|
4482
4773
|
itemUpdater(renderedNode);
|
|
4483
4774
|
this.updateElementPosition(elementIndex);
|
|
4484
4775
|
}
|
|
4776
|
+
reset() {
|
|
4777
|
+
this.itemDOMElements = {};
|
|
4778
|
+
this.itemDOMRefs = {};
|
|
4779
|
+
this.updaters = {};
|
|
4780
|
+
this.items = [];
|
|
4781
|
+
this.mappedItems.reset();
|
|
4782
|
+
}
|
|
4485
4783
|
};
|
|
4486
4784
|
|
|
4785
|
+
// src/components/RawList/useVirtualRenderer.ts
|
|
4786
|
+
function createRenderer(brain) {
|
|
4787
|
+
const renderer = new ReactVirtualRenderer(brain, {});
|
|
4788
|
+
const onRenderUpdater = buildSubscriptionCallback();
|
|
4789
|
+
brain.onDestroy(() => {
|
|
4790
|
+
renderer.destroy();
|
|
4791
|
+
onRenderUpdater.destroy();
|
|
4792
|
+
});
|
|
4793
|
+
return {
|
|
4794
|
+
renderer,
|
|
4795
|
+
onRenderUpdater
|
|
4796
|
+
};
|
|
4797
|
+
}
|
|
4798
|
+
function useVirtualRenderer({
|
|
4799
|
+
brain
|
|
4800
|
+
}) {
|
|
4801
|
+
return useMemo7(() => {
|
|
4802
|
+
return createRenderer(brain);
|
|
4803
|
+
}, [brain]);
|
|
4804
|
+
}
|
|
4805
|
+
|
|
4487
4806
|
// src/components/RawList/index.tsx
|
|
4488
4807
|
function RawListFn(props) {
|
|
4489
4808
|
const { renderItem, brain, debugChannel } = props;
|
|
4490
|
-
const { onRenderUpdater, renderer } =
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
});
|
|
4495
|
-
return { onRenderUpdater: onRenderUpdater2, renderer: renderer2 };
|
|
4496
|
-
}, []);
|
|
4809
|
+
const { onRenderUpdater, renderer } = useVirtualRenderer({
|
|
4810
|
+
brain,
|
|
4811
|
+
debugChannel
|
|
4812
|
+
});
|
|
4497
4813
|
const getRenderItem = useLatest(renderItem);
|
|
4498
|
-
|
|
4814
|
+
useEffect13(() => {
|
|
4499
4815
|
const renderRange = brain.getRenderRange();
|
|
4500
4816
|
renderer.renderRange(renderRange, {
|
|
4501
4817
|
renderItem,
|
|
4502
4818
|
force: true,
|
|
4503
4819
|
onRender: onRenderUpdater
|
|
4504
4820
|
});
|
|
4505
|
-
}, [renderItem, onRenderUpdater]);
|
|
4506
|
-
|
|
4821
|
+
}, [brain, renderItem, onRenderUpdater]);
|
|
4822
|
+
useEffect13(() => {
|
|
4507
4823
|
const remove = brain.onRenderRangeChange((renderRange) => {
|
|
4508
4824
|
renderer.renderRange(renderRange, {
|
|
4509
4825
|
force: false,
|
|
@@ -4513,12 +4829,6 @@ function RawListFn(props) {
|
|
|
4513
4829
|
});
|
|
4514
4830
|
return remove;
|
|
4515
4831
|
}, [brain, onRenderUpdater]);
|
|
4516
|
-
useEffect11(() => {
|
|
4517
|
-
return () => {
|
|
4518
|
-
renderer.destroy();
|
|
4519
|
-
onRenderUpdater.destroy();
|
|
4520
|
-
};
|
|
4521
|
-
}, [renderer, onRenderUpdater]);
|
|
4522
4832
|
return /* @__PURE__ */ createElement14(AvoidReactDiff, {
|
|
4523
4833
|
updater: onRenderUpdater
|
|
4524
4834
|
});
|
|
@@ -4551,14 +4861,14 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4551
4861
|
columns: computedVisibleColumnsMap
|
|
4552
4862
|
});
|
|
4553
4863
|
}, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
|
|
4554
|
-
|
|
4864
|
+
useEffect14(() => {
|
|
4555
4865
|
const onScroll = (scrollPosition) => {
|
|
4556
4866
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
4557
4867
|
};
|
|
4558
4868
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4559
4869
|
return removeOnScroll;
|
|
4560
4870
|
}, [brain]);
|
|
4561
|
-
const domRef =
|
|
4871
|
+
const domRef = useRef9(null);
|
|
4562
4872
|
const headerCls = HeaderClsRecipe({
|
|
4563
4873
|
pinned: pinning,
|
|
4564
4874
|
overflow: false,
|
|
@@ -4581,7 +4891,7 @@ import {
|
|
|
4581
4891
|
createElement as createElement18,
|
|
4582
4892
|
memo as memo7,
|
|
4583
4893
|
useMemo as useMemo8,
|
|
4584
|
-
useRef as
|
|
4894
|
+
useRef as useRef10
|
|
4585
4895
|
} from "react";
|
|
4586
4896
|
|
|
4587
4897
|
// src/components/InfiniteTable/components/InfiniteTableHeader/renderColumnHeaderGroups.tsx
|
|
@@ -4591,7 +4901,7 @@ import {
|
|
|
4591
4901
|
|
|
4592
4902
|
// src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
|
|
4593
4903
|
function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
4594
|
-
const
|
|
4904
|
+
const map2 = new Map();
|
|
4595
4905
|
const temporaryMap = new Map();
|
|
4596
4906
|
const mapOfAllParentGroupsForColumns = new Map();
|
|
4597
4907
|
columns.forEach((col, index) => {
|
|
@@ -4609,7 +4919,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4609
4919
|
computedWidth: col.computedWidth,
|
|
4610
4920
|
depth: col.columnGroup ? ((_d = columnGroupsDepthsMap.get(col.columnGroup)) != null ? _d : 0) + 1 : 0
|
|
4611
4921
|
};
|
|
4612
|
-
|
|
4922
|
+
map2.set([colId], colItem);
|
|
4613
4923
|
let groupId = col.columnGroup;
|
|
4614
4924
|
let colGroupItem;
|
|
4615
4925
|
let prevGroupItem = colItem;
|
|
@@ -4631,7 +4941,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4631
4941
|
computedWidth: 0,
|
|
4632
4942
|
depth: (_e = columnGroupsDepthsMap.get(groupId)) != null ? _e : 0
|
|
4633
4943
|
};
|
|
4634
|
-
|
|
4944
|
+
map2.set(groupAbsoluteId, colGroupItem);
|
|
4635
4945
|
temporaryMap.set(groupId, colGroupItem);
|
|
4636
4946
|
}
|
|
4637
4947
|
colGroupItem.columnItems.push(colItem);
|
|
@@ -4648,7 +4958,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4648
4958
|
});
|
|
4649
4959
|
const result = [];
|
|
4650
4960
|
let groupOffset = 0;
|
|
4651
|
-
|
|
4961
|
+
map2.forEach((item) => {
|
|
4652
4962
|
if (!item.ref.columnGroup) {
|
|
4653
4963
|
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum, col) => sum + col.ref.computedWidth, 0);
|
|
4654
4964
|
item.groupOffset = groupOffset;
|
|
@@ -4660,7 +4970,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4660
4970
|
groupOffset += itemWidth;
|
|
4661
4971
|
}
|
|
4662
4972
|
});
|
|
4663
|
-
|
|
4973
|
+
map2.clear();
|
|
4664
4974
|
temporaryMap.clear();
|
|
4665
4975
|
return result;
|
|
4666
4976
|
}
|
|
@@ -4759,7 +5069,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
4759
5069
|
}
|
|
4760
5070
|
|
|
4761
5071
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
|
|
4762
|
-
import { useEffect as
|
|
5072
|
+
import { useEffect as useEffect15 } from "react";
|
|
4763
5073
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
4764
5074
|
var TableHeaderClassName2 = `${rootClassName5}Header`;
|
|
4765
5075
|
var UPDATE_SCROLL = (node, scrollPosition) => {
|
|
@@ -4792,7 +5102,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4792
5102
|
},
|
|
4793
5103
|
computed: { computedVisibleColumnsMap: columnsMap }
|
|
4794
5104
|
} = useInfiniteTable();
|
|
4795
|
-
const domRef =
|
|
5105
|
+
const domRef = useRef10(null);
|
|
4796
5106
|
const hasColumnGroups = computedColumnGroups.size > 0;
|
|
4797
5107
|
const columnHeaderGroups = useMemo8(() => {
|
|
4798
5108
|
return hasColumnGroups ? renderColumnHeaderGroups({
|
|
@@ -4825,7 +5135,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4825
5135
|
if (totalWidth != null) {
|
|
4826
5136
|
style.width = availableWidth;
|
|
4827
5137
|
}
|
|
4828
|
-
|
|
5138
|
+
useEffect15(() => {
|
|
4829
5139
|
const scroller = brain || scrollListener;
|
|
4830
5140
|
if (!scroller || !scrollable) {
|
|
4831
5141
|
return;
|
|
@@ -4942,12 +5252,12 @@ import {
|
|
|
4942
5252
|
createElement as createElement20,
|
|
4943
5253
|
forwardRef as forwardRef2
|
|
4944
5254
|
} from "react";
|
|
4945
|
-
import { useRef as
|
|
5255
|
+
import { useRef as useRef11 } from "react";
|
|
4946
5256
|
|
|
4947
5257
|
// src/components/hooks/useOnScroll.ts
|
|
4948
|
-
import { useEffect as
|
|
5258
|
+
import { useEffect as useEffect16 } from "react";
|
|
4949
5259
|
var useOnScroll = (domRef, onScroll) => {
|
|
4950
|
-
|
|
5260
|
+
useEffect16(() => {
|
|
4951
5261
|
const domNode = domRef == null ? void 0 : domRef.current;
|
|
4952
5262
|
const scrollFn = (event) => {
|
|
4953
5263
|
const node = event.target;
|
|
@@ -4993,7 +5303,7 @@ var VirtualScrollContainer = forwardRef2(function VirtualScrollContainer2(props,
|
|
|
4993
5303
|
className,
|
|
4994
5304
|
style
|
|
4995
5305
|
} = props;
|
|
4996
|
-
const domRef = ref != null ? ref :
|
|
5306
|
+
const domRef = ref != null ? ref : useRef11(null);
|
|
4997
5307
|
useOnScroll(domRef, onContainerScroll);
|
|
4998
5308
|
return /* @__PURE__ */ createElement20("div", {
|
|
4999
5309
|
ref: domRef,
|
|
@@ -5027,7 +5337,7 @@ function SpacePlaceholderFn(props) {
|
|
|
5027
5337
|
var SpacePlaceholder = memo8(SpacePlaceholderFn);
|
|
5028
5338
|
|
|
5029
5339
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
5030
|
-
import { useCallback as useCallback17, useEffect as
|
|
5340
|
+
import { useCallback as useCallback17, useEffect as useEffect22, useMemo as useMemo10, useRef as useRef17 } from "react";
|
|
5031
5341
|
|
|
5032
5342
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
5033
5343
|
import {
|
|
@@ -5046,7 +5356,7 @@ import {
|
|
|
5046
5356
|
Fragment as Fragment4,
|
|
5047
5357
|
createElement as createElement22
|
|
5048
5358
|
} from "react";
|
|
5049
|
-
import { useRef as
|
|
5359
|
+
import { useRef as useRef12, useEffect as useEffect17, useState as useState9 } from "react";
|
|
5050
5360
|
|
|
5051
5361
|
// src/components/VirtualList/VirtualList.css.ts
|
|
5052
5362
|
var VirtualListCls = "mlx2t0 _16lm1iw0";
|
|
@@ -5089,11 +5399,11 @@ var VirtualList = (props) => {
|
|
|
5089
5399
|
"onContainerScroll",
|
|
5090
5400
|
"children"
|
|
5091
5401
|
]);
|
|
5092
|
-
const domRef =
|
|
5402
|
+
const domRef = useRef12(null);
|
|
5093
5403
|
const [, rerender] = useRerender();
|
|
5094
|
-
const [totalSize, setTotalSize] =
|
|
5095
|
-
const renderCountRef =
|
|
5096
|
-
|
|
5404
|
+
const [totalSize, setTotalSize] = useState9(0);
|
|
5405
|
+
const renderCountRef = useRef12(0);
|
|
5406
|
+
useEffect17(() => {
|
|
5097
5407
|
const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
|
|
5098
5408
|
renderCountRef.current = renderCount;
|
|
5099
5409
|
if (true) {
|
|
@@ -5112,7 +5422,7 @@ var VirtualList = (props) => {
|
|
|
5112
5422
|
removeOnTotalSizeChange();
|
|
5113
5423
|
};
|
|
5114
5424
|
}, [virtualBrain]);
|
|
5115
|
-
|
|
5425
|
+
useEffect17(() => {
|
|
5116
5426
|
const onScroll = (scrollPosition) => {
|
|
5117
5427
|
UPDATE_SCROLL2(domRef.current, scrollPosition);
|
|
5118
5428
|
};
|
|
@@ -5138,7 +5448,7 @@ var VirtualList = (props) => {
|
|
|
5138
5448
|
brain: virtualBrain,
|
|
5139
5449
|
renderItem,
|
|
5140
5450
|
repaintId,
|
|
5141
|
-
debugChannel: "VirtualList"
|
|
5451
|
+
debugChannel: "VirtualList-" + mainAxis
|
|
5142
5452
|
})), children, /* @__PURE__ */ createElement22(SpacePlaceholder, {
|
|
5143
5453
|
count,
|
|
5144
5454
|
width,
|
|
@@ -5170,7 +5480,7 @@ import {
|
|
|
5170
5480
|
memo as memo10,
|
|
5171
5481
|
useCallback as useCallback11
|
|
5172
5482
|
} from "react";
|
|
5173
|
-
import { useRef as
|
|
5483
|
+
import { useRef as useRef14 } from "react";
|
|
5174
5484
|
|
|
5175
5485
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5176
5486
|
import {
|
|
@@ -5279,7 +5589,7 @@ var InfiniteTableColumnCell = memo9(InfiniteTableColumnCellFn);
|
|
|
5279
5589
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
5280
5590
|
import {
|
|
5281
5591
|
useCallback as useCallback10,
|
|
5282
|
-
useRef as
|
|
5592
|
+
useRef as useRef13
|
|
5283
5593
|
} from "react";
|
|
5284
5594
|
|
|
5285
5595
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
|
|
@@ -5305,7 +5615,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5305
5615
|
domRef: domRefFromProps,
|
|
5306
5616
|
rowInfo
|
|
5307
5617
|
} = props;
|
|
5308
|
-
const domRef =
|
|
5618
|
+
const domRef = useRef13(null);
|
|
5309
5619
|
const rowDOMRef = useCallback10((node) => {
|
|
5310
5620
|
domRefFromProps(node);
|
|
5311
5621
|
domRef.current = node;
|
|
@@ -5408,7 +5718,7 @@ function InfiniteTableRowFn(props) {
|
|
|
5408
5718
|
width: rowWidth,
|
|
5409
5719
|
height: rowHeight
|
|
5410
5720
|
}, domProps.style);
|
|
5411
|
-
const renderCellRef =
|
|
5721
|
+
const renderCellRef = useRef14(null);
|
|
5412
5722
|
const renderCell = useCallback11(({ domRef, itemIndex }) => {
|
|
5413
5723
|
const column = columns[itemIndex];
|
|
5414
5724
|
if (!column) {
|
|
@@ -5581,22 +5891,23 @@ function useUnpinnedRendering(params) {
|
|
|
5581
5891
|
}
|
|
5582
5892
|
|
|
5583
5893
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5584
|
-
import { useCallback as useCallback13, useEffect as
|
|
5894
|
+
import { useCallback as useCallback13, useEffect as useEffect18, useRef as useRef15 } from "react";
|
|
5585
5895
|
|
|
5586
5896
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5897
|
+
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5587
5898
|
var FooterCls = "_16lm1iw1";
|
|
5588
5899
|
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwj _16lm1iwz _16lm1iw0";
|
|
5589
|
-
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: [] });
|
|
5900
|
+
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: [] });
|
|
5590
5901
|
var InfiniteClsScrolling = "_1yeub2v1";
|
|
5591
5902
|
var InfiniteClsShiftingColumns = "_16lm1iwm";
|
|
5592
5903
|
var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
|
|
5593
|
-
var PinnedRowsContainerClsVariants = createRuntimeFn({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5904
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5594
5905
|
|
|
5595
5906
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5596
5907
|
var DELAY = 200;
|
|
5597
5908
|
var TableClassName = internalProps.rootClassName;
|
|
5598
5909
|
var TableClassName__Scrolling = `${TableClassName}--scrolling`;
|
|
5599
|
-
var SCROLL_BOTTOM_OFFSET =
|
|
5910
|
+
var SCROLL_BOTTOM_OFFSET = 1;
|
|
5600
5911
|
var useOnContainerScroll = ({
|
|
5601
5912
|
verticalVirtualBrain,
|
|
5602
5913
|
horizontalVirtualBrain,
|
|
@@ -5612,10 +5923,11 @@ var useOnContainerScroll = ({
|
|
|
5612
5923
|
bodySize
|
|
5613
5924
|
}
|
|
5614
5925
|
} = useInfiniteTable();
|
|
5615
|
-
const
|
|
5616
|
-
const
|
|
5617
|
-
const
|
|
5618
|
-
|
|
5926
|
+
const { componentActions: dataSourceActions, getState: getDataSourceState } = useDataSourceContextValue();
|
|
5927
|
+
const timeoutIdRef = useRef15(0);
|
|
5928
|
+
const scrollingRef = useRef15(false);
|
|
5929
|
+
const scrollTopMaxRef = useRef15(0);
|
|
5930
|
+
useEffect18(() => {
|
|
5619
5931
|
const { current: node } = scrollerDOMRef;
|
|
5620
5932
|
scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
|
|
5621
5933
|
}, [reservedContentHeight, bodySize.height]);
|
|
@@ -5654,7 +5966,7 @@ var useOnContainerScroll = ({
|
|
|
5654
5966
|
domRef.current,
|
|
5655
5967
|
setScrolling
|
|
5656
5968
|
]);
|
|
5657
|
-
const scrollPositionRef =
|
|
5969
|
+
const scrollPositionRef = useRef15({
|
|
5658
5970
|
scrollLeft: 0,
|
|
5659
5971
|
scrollTop: 0
|
|
5660
5972
|
});
|
|
@@ -5672,6 +5984,9 @@ var useOnContainerScroll = ({
|
|
|
5672
5984
|
const isScrollBottom = scrollTop + offset >= scrollTopMaxRef.current;
|
|
5673
5985
|
if (isScrollBottom) {
|
|
5674
5986
|
onScrollToBottom == null ? void 0 : onScrollToBottom();
|
|
5987
|
+
if (getDataSourceState().livePagination) {
|
|
5988
|
+
dataSourceActions.scrollBottomId = Date.now();
|
|
5989
|
+
}
|
|
5675
5990
|
}
|
|
5676
5991
|
}, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
|
|
5677
5992
|
return {
|
|
@@ -5691,12 +6006,12 @@ import { useCallback as useCallback15 } from "react";
|
|
|
5691
6006
|
import {
|
|
5692
6007
|
createElement as createElement28
|
|
5693
6008
|
} from "react";
|
|
5694
|
-
import { useEffect as
|
|
6009
|
+
import { useEffect as useEffect20, useCallback as useCallback14, useRef as useRef16 } from "react";
|
|
5695
6010
|
|
|
5696
6011
|
// src/components/hooks/useOnMount.ts
|
|
5697
|
-
import { useEffect as
|
|
6012
|
+
import { useEffect as useEffect19 } from "react";
|
|
5698
6013
|
function useOnMount(domRef, props) {
|
|
5699
|
-
|
|
6014
|
+
useEffect19(() => {
|
|
5700
6015
|
const { onMount, onUnmount } = props;
|
|
5701
6016
|
const node = domRef == null ? void 0 : domRef.current;
|
|
5702
6017
|
onMount == null ? void 0 : onMount(node);
|
|
@@ -5727,7 +6042,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5727
6042
|
onMount,
|
|
5728
6043
|
onUnmount
|
|
5729
6044
|
} = props;
|
|
5730
|
-
const domRef =
|
|
6045
|
+
const domRef = useRef16(null);
|
|
5731
6046
|
const renderItem = useCallback14((renderProps) => renderRow({
|
|
5732
6047
|
domRef: renderProps.domRef,
|
|
5733
6048
|
rowHeight: renderProps.itemSize,
|
|
@@ -5737,7 +6052,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5737
6052
|
onMount,
|
|
5738
6053
|
onUnmount
|
|
5739
6054
|
});
|
|
5740
|
-
|
|
6055
|
+
useEffect20(() => {
|
|
5741
6056
|
const onScroll = (scrollPosition) => {
|
|
5742
6057
|
const node = domRef.current;
|
|
5743
6058
|
if (node) {
|
|
@@ -5960,7 +6275,7 @@ function usePinnedStartRendering(params) {
|
|
|
5960
6275
|
}
|
|
5961
6276
|
|
|
5962
6277
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
5963
|
-
import { useEffect as
|
|
6278
|
+
import { useEffect as useEffect21 } from "react";
|
|
5964
6279
|
|
|
5965
6280
|
// src/components/VirtualBrain/index.ts
|
|
5966
6281
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
@@ -5976,11 +6291,13 @@ var VirtualBrain = class extends Logger {
|
|
|
5976
6291
|
super(`VirtualBrain:${options.mainAxis}`);
|
|
5977
6292
|
this.scrollPosition = initialScrollPosition2;
|
|
5978
6293
|
this.scrollPositionOnMainAxis = 0;
|
|
6294
|
+
this.destroyed = false;
|
|
5979
6295
|
this.totalSize = 0;
|
|
5980
6296
|
this.onScrollFns = [];
|
|
5981
6297
|
this.onTotalSizeChangeFns = [];
|
|
5982
6298
|
this.onRenderCountChangeFns = [];
|
|
5983
6299
|
this.onRenderRangeChangeFns = [];
|
|
6300
|
+
this.onDestroyFns = [];
|
|
5984
6301
|
this.renderCount = 0;
|
|
5985
6302
|
this.renderRange = {
|
|
5986
6303
|
renderStartIndex: -1,
|
|
@@ -6077,6 +6394,12 @@ var VirtualBrain = class extends Logger {
|
|
|
6077
6394
|
this.onRenderRangeChangeFns = this.onRenderRangeChangeFns.filter((f) => f !== fn);
|
|
6078
6395
|
};
|
|
6079
6396
|
};
|
|
6397
|
+
this.onDestroy = (fn) => {
|
|
6398
|
+
this.onDestroyFns.push(fn);
|
|
6399
|
+
return () => {
|
|
6400
|
+
this.onDestroyFns = this.onDestroyFns.filter((f) => f !== fn);
|
|
6401
|
+
};
|
|
6402
|
+
};
|
|
6080
6403
|
this.update = (newCount, newItemSize, newItemSpan) => {
|
|
6081
6404
|
const { itemSize, count, itemSpan } = this.options;
|
|
6082
6405
|
const countChange = count !== newCount;
|
|
@@ -6273,7 +6596,13 @@ var VirtualBrain = class extends Logger {
|
|
|
6273
6596
|
return result;
|
|
6274
6597
|
};
|
|
6275
6598
|
this.destroy = () => {
|
|
6599
|
+
if (this.destroyed) {
|
|
6600
|
+
return;
|
|
6601
|
+
}
|
|
6602
|
+
this.notifyDestroy();
|
|
6276
6603
|
this.reset();
|
|
6604
|
+
this.destroyed = true;
|
|
6605
|
+
this.onDestroyFns = [];
|
|
6277
6606
|
this.onScrollFns = [];
|
|
6278
6607
|
this.onTotalSizeChangeFns = [];
|
|
6279
6608
|
this.onRenderCountChangeFns = [];
|
|
@@ -6309,6 +6638,12 @@ var VirtualBrain = class extends Logger {
|
|
|
6309
6638
|
fns[i](scrollPosition);
|
|
6310
6639
|
}
|
|
6311
6640
|
}
|
|
6641
|
+
notifyDestroy() {
|
|
6642
|
+
const fns = this.onDestroyFns;
|
|
6643
|
+
for (let i = 0, len = fns.length; i < len; i++) {
|
|
6644
|
+
fns[i]();
|
|
6645
|
+
}
|
|
6646
|
+
}
|
|
6312
6647
|
notifyTotalSizeChange() {
|
|
6313
6648
|
const totalSize = this.getTotalSize();
|
|
6314
6649
|
const fns = this.onTotalSizeChangeFns;
|
|
@@ -6419,16 +6754,21 @@ function useYourBrain(param) {
|
|
|
6419
6754
|
});
|
|
6420
6755
|
return brain;
|
|
6421
6756
|
});
|
|
6757
|
+
useEffect21(() => {
|
|
6758
|
+
return () => {
|
|
6759
|
+
horizontalVirtualBrain.destroy();
|
|
6760
|
+
verticalVirtualBrain.destroy();
|
|
6761
|
+
};
|
|
6762
|
+
}, []);
|
|
6422
6763
|
horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
|
|
6423
6764
|
verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
|
|
6424
|
-
|
|
6425
|
-
useEffect19(() => {
|
|
6765
|
+
useEffect21(() => {
|
|
6426
6766
|
verticalVirtualBrain.setAvailableSize({
|
|
6427
6767
|
height: bodySize.height,
|
|
6428
6768
|
width: 0
|
|
6429
6769
|
});
|
|
6430
6770
|
}, [bodySize, verticalVirtualBrain]);
|
|
6431
|
-
|
|
6771
|
+
useEffect21(() => {
|
|
6432
6772
|
horizontalVirtualBrain.setAvailableSize({
|
|
6433
6773
|
height: 0,
|
|
6434
6774
|
width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
|
|
@@ -6437,29 +6777,6 @@ function useYourBrain(param) {
|
|
|
6437
6777
|
return { horizontalVirtualBrain, verticalVirtualBrain };
|
|
6438
6778
|
}
|
|
6439
6779
|
|
|
6440
|
-
// src/utils/shallowEqualObjects.ts
|
|
6441
|
-
function shallowEqualObjects(objA, objB) {
|
|
6442
|
-
if (objA === objB) {
|
|
6443
|
-
return true;
|
|
6444
|
-
}
|
|
6445
|
-
if (!objA || !objB) {
|
|
6446
|
-
return false;
|
|
6447
|
-
}
|
|
6448
|
-
var aKeys = Object.keys(objA);
|
|
6449
|
-
var bKeys = Object.keys(objB);
|
|
6450
|
-
var len = aKeys.length;
|
|
6451
|
-
if (bKeys.length !== len) {
|
|
6452
|
-
return false;
|
|
6453
|
-
}
|
|
6454
|
-
for (var i = 0; i < len; i++) {
|
|
6455
|
-
var key = aKeys[i];
|
|
6456
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
6457
|
-
return false;
|
|
6458
|
-
}
|
|
6459
|
-
}
|
|
6460
|
-
return true;
|
|
6461
|
-
}
|
|
6462
|
-
|
|
6463
6780
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
6464
6781
|
function useListRendering(param) {
|
|
6465
6782
|
const { computed, bodySize, columnShifts } = param;
|
|
@@ -6489,7 +6806,7 @@ function useListRendering(param) {
|
|
|
6489
6806
|
pinnedEndScrollListener
|
|
6490
6807
|
} = componentState;
|
|
6491
6808
|
const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
|
|
6492
|
-
const repaintIdRef =
|
|
6809
|
+
const repaintIdRef = useRef17(0);
|
|
6493
6810
|
if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
|
|
6494
6811
|
repaintIdRef.current++;
|
|
6495
6812
|
}
|
|
@@ -6531,12 +6848,12 @@ function useListRendering(param) {
|
|
|
6531
6848
|
});
|
|
6532
6849
|
const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
|
|
6533
6850
|
const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
6534
|
-
const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
|
|
6851
|
+
const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
|
|
6535
6852
|
const scrollbars = useMemo10(() => ({
|
|
6536
6853
|
vertical: hasVerticalScrollbar,
|
|
6537
6854
|
horizontal: hasHorizontalScrollbar
|
|
6538
6855
|
}), [hasVerticalScrollbar, hasHorizontalScrollbar]);
|
|
6539
|
-
|
|
6856
|
+
useEffect22(() => {
|
|
6540
6857
|
if (!bodySize.height) {
|
|
6541
6858
|
return;
|
|
6542
6859
|
}
|
|
@@ -6597,7 +6914,7 @@ function useListRendering(param) {
|
|
|
6597
6914
|
computedUnpinnedColumns
|
|
6598
6915
|
});
|
|
6599
6916
|
const [, rerender] = useRerender();
|
|
6600
|
-
|
|
6917
|
+
useEffect22(() => {
|
|
6601
6918
|
rerender();
|
|
6602
6919
|
}, [dataSourceState]);
|
|
6603
6920
|
const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
|
|
@@ -6624,16 +6941,15 @@ import {
|
|
|
6624
6941
|
createElement as createElement30,
|
|
6625
6942
|
forwardRef as forwardRef3,
|
|
6626
6943
|
useCallback as useCallback18,
|
|
6627
|
-
useRef as
|
|
6944
|
+
useRef as useRef18
|
|
6628
6945
|
} from "react";
|
|
6629
|
-
import { useEffect as
|
|
6946
|
+
import { useEffect as useEffect23 } from "react";
|
|
6630
6947
|
|
|
6631
6948
|
// src/components/utils/decamelize.ts
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
};
|
|
6949
|
+
function decamelize(str, options) {
|
|
6950
|
+
const { separator } = options != null ? options : { separator: "-" };
|
|
6951
|
+
return str.replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2").replace(new RegExp("(" + separator + "[A-Z])([A-Z])", "g"), "$1" + separator + "$2").toLowerCase();
|
|
6952
|
+
}
|
|
6637
6953
|
|
|
6638
6954
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
6639
6955
|
var defaultStyle2 = {
|
|
@@ -6664,7 +6980,7 @@ var enforceStyle = (node, style) => {
|
|
|
6664
6980
|
};
|
|
6665
6981
|
var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter2(props, ref) {
|
|
6666
6982
|
const { rootClassName: rootClassName12 } = useInternalProps();
|
|
6667
|
-
const domRef =
|
|
6983
|
+
const domRef = useRef18(null);
|
|
6668
6984
|
const domCallback = useCallback18((node) => {
|
|
6669
6985
|
domRef.current = node;
|
|
6670
6986
|
if (!ref) {
|
|
@@ -6676,7 +6992,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
6676
6992
|
ref.current = node;
|
|
6677
6993
|
}
|
|
6678
6994
|
}, []);
|
|
6679
|
-
|
|
6995
|
+
useEffect23(() => {
|
|
6680
6996
|
const forceStyle = () => {
|
|
6681
6997
|
requestAnimationFrame(() => {
|
|
6682
6998
|
var _a;
|
|
@@ -6853,11 +7169,11 @@ var SANDBOX_REGEX = /(https):\/\/\d+\-\d+\-\d\-(sandpack\.codesandbox\.io)/g;
|
|
|
6853
7169
|
var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
6854
7170
|
var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
|
|
6855
7171
|
var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
|
|
6856
|
-
var useLicense = (licenseKey) => {
|
|
7172
|
+
var useLicense = (licenseKey = "") => {
|
|
6857
7173
|
const valid = useMemo11(() => {
|
|
6858
7174
|
let valid2 = isValidLicense(licenseKey, {
|
|
6859
7175
|
publishedAt: 1624970570587,
|
|
6860
|
-
version: "0.0.
|
|
7176
|
+
version: "0.0.10"
|
|
6861
7177
|
});
|
|
6862
7178
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
6863
7179
|
return true;
|
|
@@ -6873,8 +7189,8 @@ import {
|
|
|
6873
7189
|
useCallback as useCallback19,
|
|
6874
7190
|
useLayoutEffect as useLayoutEffect5
|
|
6875
7191
|
} from "react";
|
|
6876
|
-
import { useRef as
|
|
6877
|
-
var
|
|
7192
|
+
import { useRef as useRef19 } from "react";
|
|
7193
|
+
var error = err("CSSVariableWatch");
|
|
6878
7194
|
var debug5 = dbg("CSSVariableWatch");
|
|
6879
7195
|
var WRAPPER_STYLE = {
|
|
6880
7196
|
position: "absolute",
|
|
@@ -6886,7 +7202,7 @@ var WRAPPER_STYLE = {
|
|
|
6886
7202
|
overflow: "hidden"
|
|
6887
7203
|
};
|
|
6888
7204
|
var useCSSVariableWatch = (params) => {
|
|
6889
|
-
const lastValueRef =
|
|
7205
|
+
const lastValueRef = useRef19(0);
|
|
6890
7206
|
const onResize = useCallback19(({ height }) => {
|
|
6891
7207
|
if (height && height !== lastValueRef.current) {
|
|
6892
7208
|
lastValueRef.current = height;
|
|
@@ -6901,12 +7217,12 @@ var useCSSVariableWatch = (params) => {
|
|
|
6901
7217
|
debug5(`Variable ${params.varName} found and equals ${value}.`);
|
|
6902
7218
|
params.onChange(value);
|
|
6903
7219
|
} else {
|
|
6904
|
-
|
|
7220
|
+
error(`Specified variable ${params.varName} not found or does not have a numeric value.`);
|
|
6905
7221
|
}
|
|
6906
7222
|
}, []);
|
|
6907
7223
|
};
|
|
6908
7224
|
var CSSVariableWatch = (props) => {
|
|
6909
|
-
const domRef =
|
|
7225
|
+
const domRef = useRef19(null);
|
|
6910
7226
|
useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
|
|
6911
7227
|
ref: domRef
|
|
6912
7228
|
}));
|
|
@@ -7051,9 +7367,15 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
7051
7367
|
});
|
|
7052
7368
|
var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
7053
7369
|
var _a;
|
|
7054
|
-
const { componentState, getComputed, computed } = useInfiniteTable();
|
|
7055
7370
|
const {
|
|
7056
|
-
componentState
|
|
7371
|
+
componentState,
|
|
7372
|
+
getComputed,
|
|
7373
|
+
computed,
|
|
7374
|
+
getState: getInfiniteTableState
|
|
7375
|
+
} = useInfiniteTable();
|
|
7376
|
+
const {
|
|
7377
|
+
componentState: { dataArray, loading },
|
|
7378
|
+
getState: getDataSourceState
|
|
7057
7379
|
} = useDataSourceContextValue();
|
|
7058
7380
|
const {
|
|
7059
7381
|
domRef,
|
|
@@ -7090,6 +7412,15 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
|
7090
7412
|
const licenseValid = useLicense(licenseKey);
|
|
7091
7413
|
const domProps = useDOMProps(componentState.domProps);
|
|
7092
7414
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
7415
|
+
useLayoutEffect6(() => {
|
|
7416
|
+
const dataSourceState = getDataSourceState();
|
|
7417
|
+
const { onScrollbarsChange } = getInfiniteTableState();
|
|
7418
|
+
const { notifyScrollbarsChange } = dataSourceState;
|
|
7419
|
+
if (onScrollbarsChange && dataSourceState.updatedAt && dataSourceState.dataArray.length) {
|
|
7420
|
+
onScrollbarsChange(scrollbars);
|
|
7421
|
+
}
|
|
7422
|
+
notifyScrollbarsChange(scrollbars);
|
|
7423
|
+
}, [scrollbars]);
|
|
7093
7424
|
return /* @__PURE__ */ createElement33("div", __spreadValues({
|
|
7094
7425
|
ref: domRef
|
|
7095
7426
|
}, domProps), header ? /* @__PURE__ */ createElement33(TableHeaderWrapper, {
|
|
@@ -7121,7 +7452,7 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
|
7121
7452
|
});
|
|
7122
7453
|
function InfiniteTableContextProvider() {
|
|
7123
7454
|
const { componentActions, componentState } = useComponentState();
|
|
7124
|
-
const { scrollerDOMRef } = componentState;
|
|
7455
|
+
const { scrollerDOMRef, scrollTopId } = componentState;
|
|
7125
7456
|
const computed = useComputed();
|
|
7126
7457
|
const getComputed = useLatest(computed);
|
|
7127
7458
|
const getState = useLatest(componentState);
|
|
@@ -7150,12 +7481,17 @@ function InfiniteTableContextProvider() {
|
|
|
7150
7481
|
}
|
|
7151
7482
|
componentActions.bodySize = bodySize;
|
|
7152
7483
|
}, { earlyAttach: true });
|
|
7153
|
-
|
|
7484
|
+
useEffect24(() => {
|
|
7154
7485
|
return () => {
|
|
7155
7486
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
7156
7487
|
componentState.onHeaderHeightCSSVarChange.destroy();
|
|
7157
7488
|
};
|
|
7158
7489
|
}, []);
|
|
7490
|
+
useEffect24(() => {
|
|
7491
|
+
if (scrollerDOMRef.current) {
|
|
7492
|
+
scrollerDOMRef.current.scrollTop = 0;
|
|
7493
|
+
}
|
|
7494
|
+
}, [scrollTopId, scrollerDOMRef]);
|
|
7159
7495
|
const TableContext2 = getInfiniteTableContext();
|
|
7160
7496
|
return /* @__PURE__ */ createElement33(TableContext2.Provider, {
|
|
7161
7497
|
value: contextValue
|
|
@@ -7180,6 +7516,7 @@ export {
|
|
|
7180
7516
|
getComponentStateRoot,
|
|
7181
7517
|
group,
|
|
7182
7518
|
interceptMap,
|
|
7519
|
+
multisort,
|
|
7183
7520
|
useComponentState,
|
|
7184
7521
|
useDataSource
|
|
7185
7522
|
};
|