@infinite-table/infinite-react 6.2.11 → 6.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.css +1 -1
- package/index.d.ts +761 -558
- package/index.dev.js +976 -247
- package/index.dev.mjs +973 -244
- package/index.js +13 -9
- package/index.mjs +13 -9
- package/package.json +2 -2
package/index.dev.mjs
CHANGED
|
@@ -73,7 +73,7 @@ function debounce(fn, { wait }) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// src/components/InfiniteTable/index.tsx
|
|
76
|
-
import * as
|
|
76
|
+
import * as React70 from "react";
|
|
77
77
|
|
|
78
78
|
// src/utils/join.ts
|
|
79
79
|
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
@@ -82,6 +82,49 @@ var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
|
82
82
|
import * as React2 from "react";
|
|
83
83
|
import { useRef as useRef2 } from "react";
|
|
84
84
|
|
|
85
|
+
// src/components/utils/buildSubscriptionCallback.tsx
|
|
86
|
+
function buildSubscriptionCallback(withRaf = false) {
|
|
87
|
+
let lastCallValue = null;
|
|
88
|
+
let fns = [];
|
|
89
|
+
let rafId = null;
|
|
90
|
+
const updater = (items, callback) => {
|
|
91
|
+
const results = [];
|
|
92
|
+
if (withRaf) {
|
|
93
|
+
if (rafId != null) {
|
|
94
|
+
cancelAnimationFrame(rafId);
|
|
95
|
+
rafId = null;
|
|
96
|
+
}
|
|
97
|
+
requestAnimationFrame(() => {
|
|
98
|
+
lastCallValue = items;
|
|
99
|
+
rafId = null;
|
|
100
|
+
for (let i = 0, len = fns.length; i < len; i++) {
|
|
101
|
+
results.push(fns[i](items));
|
|
102
|
+
}
|
|
103
|
+
callback?.(results);
|
|
104
|
+
});
|
|
105
|
+
} else {
|
|
106
|
+
lastCallValue = items;
|
|
107
|
+
for (let i = 0, len = fns.length; i < len; i++) {
|
|
108
|
+
results.push(fns[i](items));
|
|
109
|
+
}
|
|
110
|
+
callback?.(results);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
updater.get = () => lastCallValue;
|
|
114
|
+
updater.onChange = (fn) => {
|
|
115
|
+
fns.push(fn);
|
|
116
|
+
return () => {
|
|
117
|
+
fns = fns.filter((f) => f !== fn);
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
updater.destroy = () => {
|
|
121
|
+
updater(null);
|
|
122
|
+
fns.length = 0;
|
|
123
|
+
};
|
|
124
|
+
updater.getListenersCount = () => fns.length;
|
|
125
|
+
return updater;
|
|
126
|
+
}
|
|
127
|
+
|
|
85
128
|
// src/utils/DeepMap/once.ts
|
|
86
129
|
function once(fn) {
|
|
87
130
|
let called = false;
|
|
@@ -712,6 +755,7 @@ var COLORS = [
|
|
|
712
755
|
];
|
|
713
756
|
var COLOR_SYMBOL = Symbol("color");
|
|
714
757
|
var USED_COLORS_MAP = /* @__PURE__ */ new WeakMap();
|
|
758
|
+
var GLOBAL_LOG_INTENT = buildSubscriptionCallback();
|
|
715
759
|
function initUsedColors(colors = COLORS) {
|
|
716
760
|
USED_COLORS_MAP.set(
|
|
717
761
|
colors,
|
|
@@ -762,7 +806,7 @@ function isChannelTargeted(channel, permissionToken) {
|
|
|
762
806
|
}
|
|
763
807
|
return void 0;
|
|
764
808
|
}
|
|
765
|
-
function
|
|
809
|
+
function isChannelEnabled(channel, permissions) {
|
|
766
810
|
const cacheKey = `channel=${channel}_permissions=${permissions}`;
|
|
767
811
|
if (enabledChannelsCache.has(cacheKey)) {
|
|
768
812
|
return enabledChannelsCache.get(cacheKey);
|
|
@@ -823,20 +867,32 @@ function debugPackage(channelName) {
|
|
|
823
867
|
function debugFactory(channelName2, parentChannel) {
|
|
824
868
|
const channel = parentChannel ? `${parentChannel}${CHANNEL_SEPARATOR}${channelName2}` : channelName2;
|
|
825
869
|
const channelParts = channel.split(CHANNEL_SEPARATOR);
|
|
826
|
-
|
|
827
|
-
|
|
870
|
+
const foundLogger = loggers.get(channelParts);
|
|
871
|
+
if (foundLogger) {
|
|
872
|
+
return foundLogger;
|
|
828
873
|
}
|
|
829
874
|
const parentLogger = loggers.get(channelParts.slice(0, -1));
|
|
830
875
|
const defaultLogFn = (parentLogger ? parentLogger.logFn : debug.logFn) ?? defaultLogger;
|
|
831
876
|
let logFn = defaultLogFn;
|
|
832
877
|
let enabled;
|
|
833
878
|
let lastMessageTimestamp = 0;
|
|
834
|
-
const isEnabled = () => enabled ??
|
|
879
|
+
const isEnabled = () => enabled ?? isChannelEnabled(channel, storageKeyValue);
|
|
835
880
|
const color = getNextColor(debug.colors);
|
|
836
|
-
const
|
|
881
|
+
const logger2 = Object.defineProperties(
|
|
837
882
|
(...args) => {
|
|
838
|
-
|
|
839
|
-
|
|
883
|
+
const intentListenersCount = GLOBAL_LOG_INTENT.getListenersCount();
|
|
884
|
+
let now;
|
|
885
|
+
if (intentListenersCount > 0) {
|
|
886
|
+
now = now ?? Date.now();
|
|
887
|
+
GLOBAL_LOG_INTENT({
|
|
888
|
+
color,
|
|
889
|
+
channel,
|
|
890
|
+
args,
|
|
891
|
+
timestamp: now
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
if (isEnabled()) {
|
|
895
|
+
now = now ?? Date.now();
|
|
840
896
|
if (lastMessageTimestamp && logDiffs) {
|
|
841
897
|
const diff = now - lastMessageTimestamp;
|
|
842
898
|
logFn(`%c[${channel}]`, `color: ${color}`, `+${diff}ms:`);
|
|
@@ -894,7 +950,10 @@ function debugPackage(channelName) {
|
|
|
894
950
|
}
|
|
895
951
|
},
|
|
896
952
|
enabled: {
|
|
897
|
-
get: () => isEnabled()
|
|
953
|
+
get: () => isEnabled(),
|
|
954
|
+
set: (value) => {
|
|
955
|
+
enabled = value;
|
|
956
|
+
}
|
|
898
957
|
},
|
|
899
958
|
logFn: {
|
|
900
959
|
configurable: false,
|
|
@@ -910,8 +969,8 @@ function debugPackage(channelName) {
|
|
|
910
969
|
}
|
|
911
970
|
}
|
|
912
971
|
);
|
|
913
|
-
loggers.set(channelParts,
|
|
914
|
-
return
|
|
972
|
+
loggers.set(channelParts, logger2);
|
|
973
|
+
return logger2;
|
|
915
974
|
}
|
|
916
975
|
return debugFactory(channelName);
|
|
917
976
|
}
|
|
@@ -927,22 +986,45 @@ Object.defineProperty(debugPackage, "enable", {
|
|
|
927
986
|
var debug = debugPackage;
|
|
928
987
|
debug.colors = COLORS;
|
|
929
988
|
debug.logFn = defaultLogger;
|
|
989
|
+
var onLogIntentGlobal = (intentChannel, fn) => {
|
|
990
|
+
return GLOBAL_LOG_INTENT.onChange((options) => {
|
|
991
|
+
if (!options) {
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
const { channel, args, color, timestamp } = options;
|
|
995
|
+
if (isChannelTargeted(channel, intentChannel)) {
|
|
996
|
+
fn({
|
|
997
|
+
channel,
|
|
998
|
+
color,
|
|
999
|
+
args,
|
|
1000
|
+
timestamp
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
};
|
|
1005
|
+
debug.onLogIntent = onLogIntentGlobal;
|
|
930
1006
|
debug.destroyAll = () => {
|
|
931
1007
|
initUsedColors();
|
|
932
1008
|
initUsedColors(debug.colors);
|
|
933
1009
|
loggers.clear();
|
|
934
1010
|
enabledChannelsCache.clear();
|
|
935
1011
|
};
|
|
1012
|
+
if (false) {
|
|
1013
|
+
globalThis.debugPackage = debug;
|
|
1014
|
+
}
|
|
936
1015
|
|
|
937
|
-
// src/utils/
|
|
938
|
-
var debugTable = debug(`InfiniteTable`);
|
|
1016
|
+
// src/utils/debugLoggers.ts
|
|
939
1017
|
var dbg = (channelName) => {
|
|
940
|
-
const result =
|
|
1018
|
+
const result = debug(
|
|
1019
|
+
channelName ? `${channelName}:TYPE=debug` : "TYPE=debug"
|
|
1020
|
+
);
|
|
941
1021
|
result.logFn = console.log.bind(console);
|
|
942
1022
|
return result;
|
|
943
1023
|
};
|
|
944
1024
|
var err = (channelName) => {
|
|
945
|
-
const result =
|
|
1025
|
+
const result = debug(
|
|
1026
|
+
channelName ? `${channelName}:TYPE=error` : "TYPE=error"
|
|
1027
|
+
);
|
|
946
1028
|
result.logFn = console.error.bind(console);
|
|
947
1029
|
return result;
|
|
948
1030
|
};
|
|
@@ -1304,49 +1386,6 @@ function AvoidReactDiffFn(props) {
|
|
|
1304
1386
|
}
|
|
1305
1387
|
var AvoidReactDiff = React8.memo(AvoidReactDiffFn);
|
|
1306
1388
|
|
|
1307
|
-
// src/components/utils/buildSubscriptionCallback.tsx
|
|
1308
|
-
function buildSubscriptionCallback(withRaf = false) {
|
|
1309
|
-
let lastCallValue = null;
|
|
1310
|
-
let fns = [];
|
|
1311
|
-
let rafId = null;
|
|
1312
|
-
const updater = (items, callback) => {
|
|
1313
|
-
const results = [];
|
|
1314
|
-
if (withRaf) {
|
|
1315
|
-
if (rafId != null) {
|
|
1316
|
-
cancelAnimationFrame(rafId);
|
|
1317
|
-
rafId = null;
|
|
1318
|
-
}
|
|
1319
|
-
requestAnimationFrame(() => {
|
|
1320
|
-
lastCallValue = items;
|
|
1321
|
-
rafId = null;
|
|
1322
|
-
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1323
|
-
results.push(fns[i](items));
|
|
1324
|
-
}
|
|
1325
|
-
callback?.(results);
|
|
1326
|
-
});
|
|
1327
|
-
} else {
|
|
1328
|
-
lastCallValue = items;
|
|
1329
|
-
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1330
|
-
results.push(fns[i](items));
|
|
1331
|
-
}
|
|
1332
|
-
callback?.(results);
|
|
1333
|
-
}
|
|
1334
|
-
};
|
|
1335
|
-
updater.get = () => lastCallValue;
|
|
1336
|
-
updater.onChange = (fn) => {
|
|
1337
|
-
fns.push(fn);
|
|
1338
|
-
return () => {
|
|
1339
|
-
fns = fns.filter((f) => f !== fn);
|
|
1340
|
-
};
|
|
1341
|
-
};
|
|
1342
|
-
updater.destroy = () => {
|
|
1343
|
-
updater(null);
|
|
1344
|
-
fns.length = 0;
|
|
1345
|
-
};
|
|
1346
|
-
updater.getListenersCount = () => fns.length;
|
|
1347
|
-
return updater;
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
1389
|
// src/utils/selectParent.ts
|
|
1351
1390
|
function selectParent(el, selector2) {
|
|
1352
1391
|
let node = el;
|
|
@@ -1564,6 +1603,15 @@ function getGreatestCountVisibleInSize(availableSize, itemSizes) {
|
|
|
1564
1603
|
return maxCount < 0 ? len : Math.min(maxCount, len);
|
|
1565
1604
|
}
|
|
1566
1605
|
|
|
1606
|
+
// src/utils/debugChannel.ts
|
|
1607
|
+
var PREFIX = "DebugID=";
|
|
1608
|
+
function getDebugChannel(debugId, channel) {
|
|
1609
|
+
if (channel && channel.startsWith(PREFIX)) {
|
|
1610
|
+
return channel;
|
|
1611
|
+
}
|
|
1612
|
+
return channel ? `${PREFIX}${debugId}:${channel}` : `${PREFIX}${debugId}`;
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1567
1615
|
// src/components/VirtualBrain/MatrixBrain.ts
|
|
1568
1616
|
var DEFAULT_EXTEND_BY = {
|
|
1569
1617
|
start: 0,
|
|
@@ -1593,7 +1641,7 @@ function defaultShouldUpdateRenderCount(options) {
|
|
|
1593
1641
|
}
|
|
1594
1642
|
var MatrixBrain = class extends Logger {
|
|
1595
1643
|
constructor(name) {
|
|
1596
|
-
const logName =
|
|
1644
|
+
const logName = getDebugChannel(name, `${name}:MatrixBrain`);
|
|
1597
1645
|
super(logName);
|
|
1598
1646
|
this.scrolling = false;
|
|
1599
1647
|
this.RENDER_COUNT_SAFETY_MARGIN_START = 1;
|
|
@@ -2383,7 +2431,7 @@ var MatrixBrain = class extends Logger {
|
|
|
2383
2431
|
height: this.availableRenderHeight ?? this.availableHeight
|
|
2384
2432
|
};
|
|
2385
2433
|
};
|
|
2386
|
-
this.name =
|
|
2434
|
+
this.name = logName;
|
|
2387
2435
|
this.update = this.update.bind(this);
|
|
2388
2436
|
this.destroy = this.destroy.bind(this);
|
|
2389
2437
|
this.getCellOffset = this.getCellOffset.bind(this);
|
|
@@ -4985,9 +5033,9 @@ var HorizontalLayoutTableRenderer = class extends GridRenderer {
|
|
|
4985
5033
|
|
|
4986
5034
|
// src/components/HeadlessTable/createRenderer.ts
|
|
4987
5035
|
function createRenderer(brain) {
|
|
4988
|
-
const renderer = !brain.isHorizontalLayoutBrain ? new GridRenderer(brain,
|
|
5036
|
+
const renderer = !brain.isHorizontalLayoutBrain ? new GridRenderer(brain, `${brain.name}:ReactHeadlessTableRenderer`) : new HorizontalLayoutTableRenderer(
|
|
4989
5037
|
brain,
|
|
4990
|
-
|
|
5038
|
+
`${brain.name}:HorizontalLayoutTableRenderer`
|
|
4991
5039
|
);
|
|
4992
5040
|
const onRenderUpdater = buildSubscriptionCallback();
|
|
4993
5041
|
brain.onDestroy(() => {
|
|
@@ -5854,8 +5902,10 @@ function buildManagedComponent(config) {
|
|
|
5854
5902
|
}
|
|
5855
5903
|
});
|
|
5856
5904
|
if (updatedPropsToStateCount > 0 || newMappedStateCount > 0) {
|
|
5857
|
-
const
|
|
5858
|
-
|
|
5905
|
+
const logger2 = config.debugName ? dbg(
|
|
5906
|
+
typeof config.debugName === "function" ? `${config.debugName(currentProps)}:rerender` : `${config.debugName}:rerender`
|
|
5907
|
+
) : dbg("rerender");
|
|
5908
|
+
logger2(
|
|
5859
5909
|
"Triggered by new values for the following props",
|
|
5860
5910
|
...[
|
|
5861
5911
|
...Object.keys(newMappedState ?? {}),
|
|
@@ -9654,6 +9704,8 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
9654
9704
|
column,
|
|
9655
9705
|
onMouseLeave,
|
|
9656
9706
|
onMouseEnter,
|
|
9707
|
+
onRowMouseEnter,
|
|
9708
|
+
onRowMouseLeave,
|
|
9657
9709
|
// toggleGroupRow,
|
|
9658
9710
|
rowIndex,
|
|
9659
9711
|
rowHeight,
|
|
@@ -9725,6 +9777,24 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
9725
9777
|
const { align: align2, verticalAlign } = renderParams;
|
|
9726
9778
|
const renderParam = renderParams;
|
|
9727
9779
|
const renderParamRef = React37.useRef(renderParam);
|
|
9780
|
+
const handleMouseEnter = onRowMouseEnter && onMouseEnter ? (event) => {
|
|
9781
|
+
const rowInfoDiscriminator = formattedValueContext;
|
|
9782
|
+
const rowContext = {
|
|
9783
|
+
...rowInfoDiscriminator,
|
|
9784
|
+
rowIndex
|
|
9785
|
+
};
|
|
9786
|
+
onRowMouseEnter(rowContext, event);
|
|
9787
|
+
onMouseEnter(event);
|
|
9788
|
+
} : onMouseEnter;
|
|
9789
|
+
const handleMouseLeave = onRowMouseLeave && onMouseLeave ? (event) => {
|
|
9790
|
+
const rowContext = {
|
|
9791
|
+
...formattedValueContext,
|
|
9792
|
+
rowIndex,
|
|
9793
|
+
rowInfo
|
|
9794
|
+
};
|
|
9795
|
+
onRowMouseLeave(rowContext, event);
|
|
9796
|
+
onMouseLeave(event);
|
|
9797
|
+
} : onMouseLeave;
|
|
9728
9798
|
const onClick = useCallback12(
|
|
9729
9799
|
(event) => {
|
|
9730
9800
|
const colIndex = column.computedVisibleIndex;
|
|
@@ -10078,8 +10148,8 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
10078
10148
|
rowId: rowInfo.id,
|
|
10079
10149
|
horizontalLayoutPageIndex,
|
|
10080
10150
|
style: memoizedStyle,
|
|
10081
|
-
onMouseLeave,
|
|
10082
|
-
onMouseEnter,
|
|
10151
|
+
onMouseLeave: handleMouseLeave,
|
|
10152
|
+
onMouseEnter: handleMouseEnter,
|
|
10083
10153
|
onClick,
|
|
10084
10154
|
afterChildren,
|
|
10085
10155
|
onMouseDown,
|
|
@@ -13783,7 +13853,6 @@ var RowSelectionState = class {
|
|
|
13783
13853
|
};
|
|
13784
13854
|
|
|
13785
13855
|
// src/components/DataSource/CellSelectionState.ts
|
|
13786
|
-
var debug3 = dbg("CellSelectionState");
|
|
13787
13856
|
var WILDCARD = "*";
|
|
13788
13857
|
var CellSelectionState = class {
|
|
13789
13858
|
constructor(clone) {
|
|
@@ -13794,6 +13863,7 @@ var CellSelectionState = class {
|
|
|
13794
13863
|
this.deselectedRowsToColumns = /* @__PURE__ */ new Map();
|
|
13795
13864
|
this.deselectedColumnsToRows = /* @__PURE__ */ new Map();
|
|
13796
13865
|
this.defaultSelection = false;
|
|
13866
|
+
this.debugId = "";
|
|
13797
13867
|
this.deselectAll = () => {
|
|
13798
13868
|
this.update({
|
|
13799
13869
|
defaultSelection: false,
|
|
@@ -14039,12 +14109,17 @@ var CellSelectionState = class {
|
|
|
14039
14109
|
}
|
|
14040
14110
|
return false;
|
|
14041
14111
|
}
|
|
14112
|
+
// private debug(message: string) {
|
|
14113
|
+
// const debug = dbg(`${this.debugId}:CellSelectionState`);
|
|
14114
|
+
// debug(message);
|
|
14115
|
+
// }
|
|
14116
|
+
error(message) {
|
|
14117
|
+
const error4 = err(`${this.debugId}:CellSelectionState`);
|
|
14118
|
+
error4(message);
|
|
14119
|
+
}
|
|
14042
14120
|
isCellSelected(rowId, colId) {
|
|
14043
14121
|
if (rowId === this.wildcard || colId === this.wildcard) {
|
|
14044
|
-
|
|
14045
|
-
`CellSelectionState.isCellSelected should not be called with wildcard`
|
|
14046
|
-
);
|
|
14047
|
-
debug3(
|
|
14122
|
+
this.error(
|
|
14048
14123
|
`CellSelectionState.isCellSelected should not be called with wildcard`
|
|
14049
14124
|
);
|
|
14050
14125
|
return false;
|
|
@@ -14127,6 +14202,7 @@ var CellSelectionState = class {
|
|
|
14127
14202
|
|
|
14128
14203
|
// src/utils/logger.ts
|
|
14129
14204
|
var log = debug("InfiniteTable");
|
|
14205
|
+
var COLOR_ERROR_VALUE = `#dc3545`;
|
|
14130
14206
|
var COLOR_WARN_VALUE = `#eb9316`;
|
|
14131
14207
|
var warnChannel = "Warn";
|
|
14132
14208
|
var errorChannel = "Error";
|
|
@@ -14139,9 +14215,18 @@ var warnLogger = logger.extend(warnChannel);
|
|
|
14139
14215
|
var errorLogger = logger.extend(errorChannel);
|
|
14140
14216
|
var successLogger = logger.extend(successChannel);
|
|
14141
14217
|
var logColorWarn = COLOR_WARN_VALUE;
|
|
14142
|
-
var
|
|
14143
|
-
|
|
14144
|
-
|
|
14218
|
+
var logColorError = COLOR_ERROR_VALUE;
|
|
14219
|
+
var warn = (message, logger2) => {
|
|
14220
|
+
logger2 = logger2 ? logger2.extend ? logger2.extend(warnChannel) : logger2 : warnLogger;
|
|
14221
|
+
logger2(
|
|
14222
|
+
typeof logger2.color === "function" ? logger2.color(logColorWarn, message) : message
|
|
14223
|
+
);
|
|
14224
|
+
};
|
|
14225
|
+
var error2 = (message, logger2) => {
|
|
14226
|
+
logger2 = logger2 ? logger2.extend ? logger2.extend(errorChannel) : logger2 : errorLogger;
|
|
14227
|
+
logger2(
|
|
14228
|
+
typeof logger2.color === "function" ? logger2.color(logColorError, message) : message
|
|
14229
|
+
);
|
|
14145
14230
|
};
|
|
14146
14231
|
var doOnceFlags = new DeepMap();
|
|
14147
14232
|
var doOnce = (func, ...keys) => {
|
|
@@ -14151,8 +14236,11 @@ var doOnce = (func, ...keys) => {
|
|
|
14151
14236
|
doOnceFlags.set(keys, true);
|
|
14152
14237
|
func();
|
|
14153
14238
|
};
|
|
14154
|
-
var warnOnce = (message, key = message,
|
|
14155
|
-
doOnce(() => warn(message,
|
|
14239
|
+
var warnOnce = (message, key = message, logger2) => {
|
|
14240
|
+
doOnce(() => warn(message, logger2), key, "warn");
|
|
14241
|
+
};
|
|
14242
|
+
var errorOnce = (message, key = message, logger2) => {
|
|
14243
|
+
doOnce(() => error2(message, logger2), key, "error");
|
|
14156
14244
|
};
|
|
14157
14245
|
|
|
14158
14246
|
// src/components/InfiniteTable/api/getRowSelectionApi.ts
|
|
@@ -16056,12 +16144,12 @@ var DataSourceApiImpl = class {
|
|
|
16056
16144
|
}
|
|
16057
16145
|
return this.waitForNodePath(nodePath, { timeout }).then((okay) => {
|
|
16058
16146
|
if (!okay) {
|
|
16059
|
-
const
|
|
16147
|
+
const error4 = `Cannot find node path "${nodePath.join(
|
|
16060
16148
|
"/"
|
|
16061
16149
|
)}" (we waited for it ${timeout}ms)`;
|
|
16062
|
-
console.error(
|
|
16150
|
+
console.error(error4);
|
|
16063
16151
|
return fn({
|
|
16064
|
-
error:
|
|
16152
|
+
error: error4,
|
|
16065
16153
|
resolved: false
|
|
16066
16154
|
});
|
|
16067
16155
|
}
|
|
@@ -16078,8 +16166,8 @@ var DataSourceApiImpl = class {
|
|
|
16078
16166
|
this.updateChildrenByNodePath = (childrenOrFn, nodePath, options) => {
|
|
16079
16167
|
return this.withWaitForNode(
|
|
16080
16168
|
nodePath,
|
|
16081
|
-
({ error:
|
|
16082
|
-
if (
|
|
16169
|
+
({ error: error4 }) => {
|
|
16170
|
+
if (error4) {
|
|
16083
16171
|
return false;
|
|
16084
16172
|
}
|
|
16085
16173
|
return this.updateChildrenByNodePath_Internal(
|
|
@@ -16107,8 +16195,8 @@ var DataSourceApiImpl = class {
|
|
|
16107
16195
|
if (!this.isNodePathAvailable(nodePath)) {
|
|
16108
16196
|
return this.withWaitForNode(
|
|
16109
16197
|
nodePath,
|
|
16110
|
-
({ error:
|
|
16111
|
-
if (
|
|
16198
|
+
({ error: error4 }) => {
|
|
16199
|
+
if (error4) {
|
|
16112
16200
|
return false;
|
|
16113
16201
|
}
|
|
16114
16202
|
return this.updateDataArrayByNodePath_Internal(
|
|
@@ -16141,7 +16229,7 @@ var DataSourceApiImpl = class {
|
|
|
16141
16229
|
const allNodePaths = updateInfo.map((info) => info.nodePath);
|
|
16142
16230
|
const promiseWithAll = Promise.allSettled(
|
|
16143
16231
|
allNodePaths.map((nodePath) => {
|
|
16144
|
-
return this.withWaitForNode(nodePath, ({ error:
|
|
16232
|
+
return this.withWaitForNode(nodePath, ({ error: error4 }) => !error4, options);
|
|
16145
16233
|
})
|
|
16146
16234
|
);
|
|
16147
16235
|
return promiseWithAll.then((allGood) => {
|
|
@@ -16260,8 +16348,8 @@ var DataSourceApiImpl = class {
|
|
|
16260
16348
|
if (isTree && nodePath?.length) {
|
|
16261
16349
|
return this.withWaitForNode(
|
|
16262
16350
|
nodePath,
|
|
16263
|
-
({ error:
|
|
16264
|
-
if (
|
|
16351
|
+
({ error: error4 }) => {
|
|
16352
|
+
if (error4) {
|
|
16265
16353
|
return false;
|
|
16266
16354
|
}
|
|
16267
16355
|
if (options.position === "before" || options.position === "after") {
|
|
@@ -16324,8 +16412,8 @@ var DataSourceApiImpl = class {
|
|
|
16324
16412
|
if (nodePath.length && !this.isNodePathAvailable(nodePath)) {
|
|
16325
16413
|
return this.withWaitForNode(
|
|
16326
16414
|
nodePath,
|
|
16327
|
-
({ error:
|
|
16328
|
-
if (
|
|
16415
|
+
({ error: error4 }) => {
|
|
16416
|
+
if (error4) {
|
|
16329
16417
|
return false;
|
|
16330
16418
|
}
|
|
16331
16419
|
const result2 = this.batchOperation({
|
|
@@ -16364,6 +16452,9 @@ var DataSourceApiImpl = class {
|
|
|
16364
16452
|
this.actions.sortInfo = sortInfo;
|
|
16365
16453
|
return;
|
|
16366
16454
|
};
|
|
16455
|
+
this.setGroupBy = (groupBy) => {
|
|
16456
|
+
this.actions.groupBy = groupBy;
|
|
16457
|
+
};
|
|
16367
16458
|
this.isRowDisabledAt = (rowIndex) => {
|
|
16368
16459
|
const rowInfo = this.getRowInfoByIndex(rowIndex);
|
|
16369
16460
|
return rowInfo?.rowDisabled ?? false;
|
|
@@ -17110,20 +17201,31 @@ function concludeReducer(params) {
|
|
|
17110
17201
|
}
|
|
17111
17202
|
if (shouldFilterClientSide) {
|
|
17112
17203
|
state.unfilteredCount = dataArray.length;
|
|
17113
|
-
|
|
17114
|
-
|
|
17115
|
-
|
|
17116
|
-
|
|
17117
|
-
|
|
17118
|
-
|
|
17119
|
-
|
|
17120
|
-
|
|
17121
|
-
|
|
17122
|
-
|
|
17123
|
-
|
|
17124
|
-
|
|
17125
|
-
|
|
17126
|
-
|
|
17204
|
+
let filterTimestamp = now;
|
|
17205
|
+
if (shouldFilterAgain) {
|
|
17206
|
+
if (state.devToolsDetected) {
|
|
17207
|
+
filterTimestamp = Date.now();
|
|
17208
|
+
}
|
|
17209
|
+
dataArray = filterDataSource({
|
|
17210
|
+
// tree-related stuff
|
|
17211
|
+
getNodeChildren,
|
|
17212
|
+
isLeafNode,
|
|
17213
|
+
nodesKey,
|
|
17214
|
+
treeFilterFunction,
|
|
17215
|
+
// ---
|
|
17216
|
+
dataArray,
|
|
17217
|
+
toPrimaryKey,
|
|
17218
|
+
filterTypes,
|
|
17219
|
+
operatorsByFilterType,
|
|
17220
|
+
filterFunction,
|
|
17221
|
+
filterValue
|
|
17222
|
+
});
|
|
17223
|
+
if (state.devToolsDetected) {
|
|
17224
|
+
state.debugTimings.set("filter", Date.now() - filterTimestamp);
|
|
17225
|
+
}
|
|
17226
|
+
} else {
|
|
17227
|
+
dataArray = state.lastFilterDataArray;
|
|
17228
|
+
}
|
|
17127
17229
|
state.lastFilterDataArray = dataArray;
|
|
17128
17230
|
state.filteredAt = now;
|
|
17129
17231
|
}
|
|
@@ -17133,6 +17235,10 @@ function concludeReducer(params) {
|
|
|
17133
17235
|
const prevKnownTypes = multisort.knownTypes;
|
|
17134
17236
|
multisort.knownTypes = { ...prevKnownTypes, ...state.sortTypes };
|
|
17135
17237
|
if (shouldSortAgain) {
|
|
17238
|
+
let sortTimestamp = now;
|
|
17239
|
+
if (state.devToolsDetected) {
|
|
17240
|
+
sortTimestamp = Date.now();
|
|
17241
|
+
}
|
|
17136
17242
|
if (state.sortFunction) {
|
|
17137
17243
|
dataArray = state.sortFunction(sortInfo, [...dataArray]);
|
|
17138
17244
|
} else {
|
|
@@ -17148,6 +17254,10 @@ function concludeReducer(params) {
|
|
|
17148
17254
|
dataArray = multisort(sortInfo, [...dataArray]);
|
|
17149
17255
|
}
|
|
17150
17256
|
}
|
|
17257
|
+
if (state.devToolsDetected) {
|
|
17258
|
+
const sortDuration = Date.now() - sortTimestamp;
|
|
17259
|
+
state.debugTimings.set("sort", sortDuration);
|
|
17260
|
+
}
|
|
17151
17261
|
} else {
|
|
17152
17262
|
dataArray = state.lastSortDataArray;
|
|
17153
17263
|
}
|
|
@@ -17194,6 +17304,10 @@ function concludeReducer(params) {
|
|
|
17194
17304
|
const rowInfoReducers = state.rowInfoReducers;
|
|
17195
17305
|
if (shouldGroup) {
|
|
17196
17306
|
if (shouldGroupAgain) {
|
|
17307
|
+
let groupTimestamp = now;
|
|
17308
|
+
if (state.devToolsDetected) {
|
|
17309
|
+
groupTimestamp = Date.now();
|
|
17310
|
+
}
|
|
17197
17311
|
let aggregationReducers = state.aggregationReducers;
|
|
17198
17312
|
const groupResult = state.lazyLoad ? lazyGroup(
|
|
17199
17313
|
{
|
|
@@ -17276,6 +17390,9 @@ function concludeReducer(params) {
|
|
|
17276
17390
|
}) : void 0;
|
|
17277
17391
|
state.pivotColumns = pivotGroupsAndCols?.columns;
|
|
17278
17392
|
state.pivotColumnGroups = pivotGroupsAndCols?.columnGroups;
|
|
17393
|
+
if (state.devToolsDetected) {
|
|
17394
|
+
state.debugTimings.set("group-and-pivot", Date.now() - groupTimestamp);
|
|
17395
|
+
}
|
|
17279
17396
|
} else {
|
|
17280
17397
|
rowInfoDataArray = state.lastGroupDataArray;
|
|
17281
17398
|
}
|
|
@@ -17283,6 +17400,10 @@ function concludeReducer(params) {
|
|
|
17283
17400
|
state.groupedAt = now;
|
|
17284
17401
|
} else if (shouldTree) {
|
|
17285
17402
|
if (shouldTreeAgain) {
|
|
17403
|
+
let treeTimestamp = now;
|
|
17404
|
+
if (state.devToolsDetected) {
|
|
17405
|
+
treeTimestamp = Date.now();
|
|
17406
|
+
}
|
|
17286
17407
|
let aggregationReducers = state.aggregationReducers;
|
|
17287
17408
|
const treeParams = {
|
|
17288
17409
|
isLeafNode,
|
|
@@ -17352,6 +17473,9 @@ function concludeReducer(params) {
|
|
|
17352
17473
|
state.reducerResults = treeResult.reducerResults;
|
|
17353
17474
|
state.totalLeafNodesCount = treeResult.deepMap.get([])?.totalLeafNodesCount ?? 0;
|
|
17354
17475
|
state.treeAt = now;
|
|
17476
|
+
if (state.devToolsDetected) {
|
|
17477
|
+
state.debugTimings.set("tree", Date.now() - treeTimestamp);
|
|
17478
|
+
}
|
|
17355
17479
|
} else {
|
|
17356
17480
|
rowInfoDataArray = state.lastTreeDataArray;
|
|
17357
17481
|
}
|
|
@@ -17449,6 +17573,155 @@ function getChangeDetect() {
|
|
|
17449
17573
|
return `${Date.now()}:${perfNow}`;
|
|
17450
17574
|
}
|
|
17451
17575
|
|
|
17576
|
+
// src/components/InfiniteTable/errorCodes.ts
|
|
17577
|
+
function buildErrorPayload(code, message, type) {
|
|
17578
|
+
message = message.replaceAll("$ERR_CODE", code);
|
|
17579
|
+
message = `${message}
|
|
17580
|
+
|
|
17581
|
+
ERROR_CODE = ${code}
|
|
17582
|
+
|
|
17583
|
+
See http://infinite-table.com/docs/reference/error-codes#${code} for more info.`;
|
|
17584
|
+
return {
|
|
17585
|
+
code,
|
|
17586
|
+
message,
|
|
17587
|
+
type: type ?? "error"
|
|
17588
|
+
};
|
|
17589
|
+
}
|
|
17590
|
+
function buildErrors(errors) {
|
|
17591
|
+
return Object.entries(errors).reduce((acc, [key, message]) => {
|
|
17592
|
+
const code = key;
|
|
17593
|
+
const payload = buildErrorPayload(
|
|
17594
|
+
code,
|
|
17595
|
+
typeof message === "string" ? message : message.message,
|
|
17596
|
+
typeof message === "string" ? void 0 : message.type
|
|
17597
|
+
);
|
|
17598
|
+
acc[code] = payload;
|
|
17599
|
+
return acc;
|
|
17600
|
+
}, {});
|
|
17601
|
+
}
|
|
17602
|
+
function warn2(strings) {
|
|
17603
|
+
return {
|
|
17604
|
+
message: strings.join(""),
|
|
17605
|
+
type: "warning"
|
|
17606
|
+
};
|
|
17607
|
+
}
|
|
17608
|
+
function error3(strings) {
|
|
17609
|
+
return {
|
|
17610
|
+
message: strings.join(""),
|
|
17611
|
+
type: "error"
|
|
17612
|
+
};
|
|
17613
|
+
}
|
|
17614
|
+
var DS_ERROR_CODES = buildErrors({
|
|
17615
|
+
DS001: warn2`The "data" prop of your DataSource seems to be updating too frequently.
|
|
17616
|
+
Make sure you don't pass a new reference on every render.`
|
|
17617
|
+
});
|
|
17618
|
+
var INFINITE_ERROR_CODES = buildErrors({
|
|
17619
|
+
CSS001_CSS: error3`It appears you have not loaded the CSS file for InfiniteTable.
|
|
17620
|
+
In most environments, you should be able to fix this by adding the following line:
|
|
17621
|
+
|
|
17622
|
+
import '@infinite-table/infinite-react/index.css'
|
|
17623
|
+
`
|
|
17624
|
+
});
|
|
17625
|
+
var ERROR_CODES = {
|
|
17626
|
+
...DS_ERROR_CODES,
|
|
17627
|
+
...INFINITE_ERROR_CODES
|
|
17628
|
+
};
|
|
17629
|
+
|
|
17630
|
+
// src/DEV_TOOLS_OVERRIDES.ts
|
|
17631
|
+
var DEV_TOOLS_INFINITE_OVERRIDES = /* @__PURE__ */ new Map();
|
|
17632
|
+
var DEV_TOOLS_DATASOURCE_OVERRIDES = /* @__PURE__ */ new Map();
|
|
17633
|
+
var DEV_TOOLS_INFINITE_INITIALS = /* @__PURE__ */ new Map();
|
|
17634
|
+
var DEV_TOOLS_DATASOURCE_INITIALS = /* @__PURE__ */ new Map();
|
|
17635
|
+
|
|
17636
|
+
// src/utils/debugModeUtils.ts
|
|
17637
|
+
var INSTANCES = /* @__PURE__ */ new Map();
|
|
17638
|
+
var deleteInstanceFromDevTools = (debugId) => {
|
|
17639
|
+
INSTANCES.delete(debugId);
|
|
17640
|
+
DEV_TOOLS_INFINITE_INITIALS.delete(debugId);
|
|
17641
|
+
DEV_TOOLS_INFINITE_OVERRIDES.delete(debugId);
|
|
17642
|
+
DEV_TOOLS_DATASOURCE_INITIALS.delete(debugId);
|
|
17643
|
+
DEV_TOOLS_DATASOURCE_OVERRIDES.delete(debugId);
|
|
17644
|
+
};
|
|
17645
|
+
function setDevToolInfinitePropertyOverride(debugId, property, value) {
|
|
17646
|
+
const instance = INSTANCES.get(debugId);
|
|
17647
|
+
if (!instance) {
|
|
17648
|
+
return;
|
|
17649
|
+
}
|
|
17650
|
+
const initial = DEV_TOOLS_INFINITE_INITIALS.get(debugId);
|
|
17651
|
+
if (!initial || !Object.hasOwn(initial, property)) {
|
|
17652
|
+
DEV_TOOLS_INFINITE_INITIALS.set(debugId, {
|
|
17653
|
+
...initial || {},
|
|
17654
|
+
[property]: instance.getState()[property]
|
|
17655
|
+
});
|
|
17656
|
+
}
|
|
17657
|
+
DEV_TOOLS_INFINITE_OVERRIDES.set(debugId, {
|
|
17658
|
+
...DEV_TOOLS_INFINITE_OVERRIDES.get(debugId) || {},
|
|
17659
|
+
[property]: value
|
|
17660
|
+
});
|
|
17661
|
+
instance.actions[property] = value;
|
|
17662
|
+
}
|
|
17663
|
+
function setDevToolDataSourcePropertyOverride(debugId, property, value) {
|
|
17664
|
+
const instance = INSTANCES.get(debugId);
|
|
17665
|
+
if (!instance) {
|
|
17666
|
+
return;
|
|
17667
|
+
}
|
|
17668
|
+
const initial = DEV_TOOLS_DATASOURCE_INITIALS.get(debugId);
|
|
17669
|
+
if (!initial || !Object.hasOwn(initial, property)) {
|
|
17670
|
+
DEV_TOOLS_DATASOURCE_INITIALS.set(debugId, {
|
|
17671
|
+
...initial || {},
|
|
17672
|
+
[property]: instance.getDataSourceState()[property]
|
|
17673
|
+
});
|
|
17674
|
+
}
|
|
17675
|
+
DEV_TOOLS_DATASOURCE_OVERRIDES.set(debugId, {
|
|
17676
|
+
...DEV_TOOLS_DATASOURCE_OVERRIDES.get(debugId) || {},
|
|
17677
|
+
[property]: value
|
|
17678
|
+
});
|
|
17679
|
+
instance.dataSourceActions[property] = value;
|
|
17680
|
+
}
|
|
17681
|
+
var warnKnownErrorOnce = (error4) => {
|
|
17682
|
+
const logger2 = error4.type === "error" ? err(error4.debugId) : dbg(error4.debugId);
|
|
17683
|
+
const onceLogger = error4.type === "error" ? errorOnce : warnOnce;
|
|
17684
|
+
const onceKey = error4.debugId ? `${error4.code}-${error4.debugId}` : error4.code;
|
|
17685
|
+
let message = error4.message;
|
|
17686
|
+
if (error4.debugId) {
|
|
17687
|
+
message = `${message}
|
|
17688
|
+
|
|
17689
|
+
Component DEBUG_ID = "${error4.debugId}"`;
|
|
17690
|
+
}
|
|
17691
|
+
onceLogger(message, onceKey, logger2);
|
|
17692
|
+
};
|
|
17693
|
+
var logDevToolsWarning = (options) => {
|
|
17694
|
+
const { debugId, key } = options;
|
|
17695
|
+
const knownError = ERROR_CODES[key];
|
|
17696
|
+
if (!knownError) {
|
|
17697
|
+
return;
|
|
17698
|
+
}
|
|
17699
|
+
warnKnownErrorOnce({ ...knownError, debugId });
|
|
17700
|
+
if (debugId && key) {
|
|
17701
|
+
const instance = INSTANCES.get(debugId);
|
|
17702
|
+
if (instance && instance.getState().devToolsDetected && knownError) {
|
|
17703
|
+
instance.getState().debugWarnings.set(key, {
|
|
17704
|
+
...knownError,
|
|
17705
|
+
debugId,
|
|
17706
|
+
status: "new"
|
|
17707
|
+
});
|
|
17708
|
+
updateDevToolsForInstance(debugId);
|
|
17709
|
+
}
|
|
17710
|
+
}
|
|
17711
|
+
};
|
|
17712
|
+
globalThis.logDevToolsWarning = logDevToolsWarning;
|
|
17713
|
+
var updateDevToolsForInstance = (debugId) => {
|
|
17714
|
+
const hookFn = window.__INFINITE_TABLE_DEVTOOLS_HOOK__;
|
|
17715
|
+
if (!hookFn) {
|
|
17716
|
+
return;
|
|
17717
|
+
}
|
|
17718
|
+
const instance = INSTANCES.get(debugId);
|
|
17719
|
+
if (!instance) {
|
|
17720
|
+
return;
|
|
17721
|
+
}
|
|
17722
|
+
hookFn(debugId, instance);
|
|
17723
|
+
};
|
|
17724
|
+
|
|
17452
17725
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
17453
17726
|
var CACHE_DEFAULT = true;
|
|
17454
17727
|
var getRafPromise = () => new Promise((resolve) => {
|
|
@@ -17606,7 +17879,7 @@ function loadData(data, componentState, actions, overrides, masterContext) {
|
|
|
17606
17879
|
const theKey = [LAZY_ROOT_KEY_FOR_GROUPS, ...keys];
|
|
17607
17880
|
const dataArray2 = remoteData2.data;
|
|
17608
17881
|
const newGroupRowInfo = {
|
|
17609
|
-
cache:
|
|
17882
|
+
cache: remoteData2.cache ?? CACHE_DEFAULT,
|
|
17610
17883
|
childrenLoading: false,
|
|
17611
17884
|
childrenAvailable: true,
|
|
17612
17885
|
totalCount: remoteData2.totalCount ?? dataArray2.length,
|
|
@@ -17839,11 +18112,10 @@ function useLoadData(options) {
|
|
|
17839
18112
|
timestamps.push(now);
|
|
17840
18113
|
const timeDiff = now - timestamps[0];
|
|
17841
18114
|
if (timeDiff < 200 && timestamps.length >= 10) {
|
|
17842
|
-
|
|
17843
|
-
|
|
17844
|
-
|
|
17845
|
-
|
|
17846
|
-
);
|
|
18115
|
+
logDevToolsWarning({
|
|
18116
|
+
debugId: componentState2.debugId,
|
|
18117
|
+
key: "DS001"
|
|
18118
|
+
});
|
|
17847
18119
|
}
|
|
17848
18120
|
if (typeof componentState2.data !== "function") {
|
|
17849
18121
|
loadData(
|
|
@@ -18112,7 +18384,6 @@ var normalizeSortInfo = (initialSortInfo, weakMap3) => {
|
|
|
18112
18384
|
};
|
|
18113
18385
|
|
|
18114
18386
|
// src/components/DataSource/state/getInitialState.ts
|
|
18115
|
-
var DataSourceLogger = dbg("DataSource");
|
|
18116
18387
|
var defaultCursorId = Symbol("cursorId");
|
|
18117
18388
|
var isNodeReadOnly = (rowInfo) => {
|
|
18118
18389
|
return rowInfo.totalLeafNodesCount === 0;
|
|
@@ -18120,12 +18391,17 @@ var isNodeReadOnly = (rowInfo) => {
|
|
|
18120
18391
|
var isNodeSelectable = (rowInfo) => {
|
|
18121
18392
|
return rowInfo.isParentNode ? !isNodeReadOnly(rowInfo) : true;
|
|
18122
18393
|
};
|
|
18123
|
-
function initSetupState() {
|
|
18394
|
+
function initSetupState(props) {
|
|
18124
18395
|
const now = Date.now();
|
|
18125
18396
|
const originalDataArray = [];
|
|
18126
18397
|
const dataArray = [];
|
|
18127
18398
|
const originalLazyGroupData = new DeepMap();
|
|
18399
|
+
const DataSourceLogger = dbg(`${props.debugId}:DataSource`);
|
|
18128
18400
|
return {
|
|
18401
|
+
logger: DataSourceLogger,
|
|
18402
|
+
debugTimings: /* @__PURE__ */ new Map(),
|
|
18403
|
+
debugWarnings: /* @__PURE__ */ new Map(),
|
|
18404
|
+
devToolsDetected: !!globalThis.__INFINITE_TABLE_DEVTOOLS_HOOK__,
|
|
18129
18405
|
// TODO cleanup indexer on unmount
|
|
18130
18406
|
indexer: new Indexer(),
|
|
18131
18407
|
totalLeafNodesCount: 0,
|
|
@@ -18196,7 +18472,8 @@ function initSetupState() {
|
|
|
18196
18472
|
postSortDataArray: void 0,
|
|
18197
18473
|
postGroupDataArray: void 0,
|
|
18198
18474
|
lastSortDataArray: void 0,
|
|
18199
|
-
lastGroupDataArray: void 0
|
|
18475
|
+
lastGroupDataArray: void 0,
|
|
18476
|
+
forceRerenderTimestamp: 0
|
|
18200
18477
|
};
|
|
18201
18478
|
}
|
|
18202
18479
|
function getCompareObjectForDataParams(dataParams) {
|
|
@@ -18232,13 +18509,11 @@ var forwardProps3 = (setupState, props) => {
|
|
|
18232
18509
|
isNodeReadOnly: (isReadOnly) => isReadOnly ?? isNodeReadOnly,
|
|
18233
18510
|
isNodeSelectable: (isSelectable) => isSelectable ?? isNodeSelectable,
|
|
18234
18511
|
data: 1,
|
|
18235
|
-
debugId: 1,
|
|
18236
18512
|
nodesKey: 1,
|
|
18237
18513
|
isNodeExpanded: 1,
|
|
18238
18514
|
isNodeCollapsed: 1,
|
|
18239
18515
|
pivotBy: 1,
|
|
18240
18516
|
primaryKey: 1,
|
|
18241
|
-
debugMode: 1,
|
|
18242
18517
|
livePagination: 1,
|
|
18243
18518
|
treeSelection: 1,
|
|
18244
18519
|
refetchKey: (refetchKey) => refetchKey ?? "",
|
|
@@ -18261,7 +18536,7 @@ var forwardProps3 = (setupState, props) => {
|
|
|
18261
18536
|
state.idToIndexMap.clear();
|
|
18262
18537
|
},
|
|
18263
18538
|
reducer: (_, rowInfo) => {
|
|
18264
|
-
if (props.
|
|
18539
|
+
if (props.debugId && !props.nodesKey && state.idToIndexMap.has(rowInfo.id)) {
|
|
18265
18540
|
console.warn(`Duplicate id found in data source: ${rowInfo.id}`);
|
|
18266
18541
|
}
|
|
18267
18542
|
state.idToIndexMap.set(rowInfo.id, rowInfo.indexInAll);
|
|
@@ -18282,7 +18557,7 @@ var forwardProps3 = (setupState, props) => {
|
|
|
18282
18557
|
reducer: (_, rowInfo) => {
|
|
18283
18558
|
if (rowInfo.isTreeNode) {
|
|
18284
18559
|
state.idToPathMap.set(rowInfo.id, rowInfo.nodePath);
|
|
18285
|
-
if (props.
|
|
18560
|
+
if (props.debugId && state.pathToIndexMap.has(rowInfo.nodePath)) {
|
|
18286
18561
|
console.warn(
|
|
18287
18562
|
`Duplicate node path found in data source (debugId: ${props.debugId || "none"}): ${rowInfo.nodePath}`
|
|
18288
18563
|
);
|
|
@@ -18512,21 +18787,21 @@ function deriveStateFromProps(params) {
|
|
|
18512
18787
|
warnOnce(
|
|
18513
18788
|
`"groupMode" prop is deprecated for the <DataSource />, use "shouldReloadData.groupBy: true|false" instead`,
|
|
18514
18789
|
"groupMode deprecated",
|
|
18515
|
-
|
|
18790
|
+
state.logger
|
|
18516
18791
|
);
|
|
18517
18792
|
}
|
|
18518
18793
|
if (props.sortMode) {
|
|
18519
18794
|
warnOnce(
|
|
18520
18795
|
`"sortMode" prop is deprecated for the <DataSource />, use "shouldReloadData.sortInfo: true|false" instead`,
|
|
18521
18796
|
"sortMode deprecated",
|
|
18522
|
-
|
|
18797
|
+
state.logger
|
|
18523
18798
|
);
|
|
18524
18799
|
}
|
|
18525
18800
|
if (props.filterMode) {
|
|
18526
18801
|
warnOnce(
|
|
18527
18802
|
`"filterMode" prop is deprecated for the <DataSource />, use "shouldReloadData.filterValue: true|false" instead`,
|
|
18528
18803
|
"filterMode deprecated",
|
|
18529
|
-
|
|
18804
|
+
state.logger
|
|
18530
18805
|
);
|
|
18531
18806
|
}
|
|
18532
18807
|
const groupMode = typeof props.data === "function" ? propsGroupMode ?? "local" : "local";
|
|
@@ -18546,7 +18821,8 @@ function deriveStateFromProps(params) {
|
|
|
18546
18821
|
weakMap.set(rowDisabledState, isRowDisabled);
|
|
18547
18822
|
}
|
|
18548
18823
|
}
|
|
18549
|
-
|
|
18824
|
+
let result = {
|
|
18825
|
+
debugId: state.debugId ?? props.debugId,
|
|
18550
18826
|
isTree,
|
|
18551
18827
|
selectionMode,
|
|
18552
18828
|
groupRowsState,
|
|
@@ -18586,6 +18862,17 @@ function deriveStateFromProps(params) {
|
|
|
18586
18862
|
const livePaginationCursor = typeof props.livePaginationCursor === "function" ? dataArrayChanged ? getLivePaginationCursorValue(props.livePaginationCursor, state) : state.livePaginationCursor : props.livePaginationCursor;
|
|
18587
18863
|
result.livePaginationCursor = livePaginationCursor;
|
|
18588
18864
|
}
|
|
18865
|
+
if (state.devToolsDetected && state.debugId) {
|
|
18866
|
+
const devToolsDataSourceOverrides = DEV_TOOLS_DATASOURCE_OVERRIDES.get(
|
|
18867
|
+
state.debugId
|
|
18868
|
+
);
|
|
18869
|
+
if (devToolsDataSourceOverrides) {
|
|
18870
|
+
result = {
|
|
18871
|
+
...result,
|
|
18872
|
+
...devToolsDataSourceOverrides
|
|
18873
|
+
};
|
|
18874
|
+
}
|
|
18875
|
+
}
|
|
18589
18876
|
return result;
|
|
18590
18877
|
}
|
|
18591
18878
|
var debugFullLazyLoad = dbg("DataSource:fullLazyLoad");
|
|
@@ -18603,7 +18890,6 @@ function onPropChange(params, props, actions) {
|
|
|
18603
18890
|
}
|
|
18604
18891
|
}
|
|
18605
18892
|
}
|
|
18606
|
-
var debugDataParams = dbg("DataSource:dataParams");
|
|
18607
18893
|
function getMappedCallbacks() {
|
|
18608
18894
|
return {
|
|
18609
18895
|
rowSelection: (rowSelection, state) => {
|
|
@@ -18779,6 +19065,9 @@ function getInterceptActions() {
|
|
|
18779
19065
|
)) {
|
|
18780
19066
|
return false;
|
|
18781
19067
|
}
|
|
19068
|
+
const debugDataParams = dbg(
|
|
19069
|
+
getDebugChannel(state.debugId, "DataSource:dataParams")
|
|
19070
|
+
);
|
|
18782
19071
|
debugDataParams(
|
|
18783
19072
|
"onDataParamsChange triggered because the following values have changed",
|
|
18784
19073
|
dataParams?.changes
|
|
@@ -19265,6 +19554,7 @@ var InfiniteTableCellSelectionApiImpl = class {
|
|
|
19265
19554
|
return;
|
|
19266
19555
|
}
|
|
19267
19556
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
19557
|
+
newCellSelection.debugId = dataSourceState.debugId ?? "";
|
|
19268
19558
|
const [startRowId, startColId] = this.getCellSelectionPosition(startOptions);
|
|
19269
19559
|
const [endRowId, endColId] = this.getCellSelectionPosition(endOptions);
|
|
19270
19560
|
const startCol = this.getComputed().computedVisibleColumnsMap.get(startColId);
|
|
@@ -19356,6 +19646,7 @@ var InfiniteTableCellSelectionApiImpl = class {
|
|
|
19356
19646
|
return;
|
|
19357
19647
|
}
|
|
19358
19648
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
19649
|
+
newCellSelection.debugId = dataSourceState.debugId ?? "";
|
|
19359
19650
|
newCellSelection.deselectAll();
|
|
19360
19651
|
this.dataSourceActions.cellSelection = newCellSelection;
|
|
19361
19652
|
};
|
|
@@ -19369,6 +19660,7 @@ var InfiniteTableCellSelectionApiImpl = class {
|
|
|
19369
19660
|
return;
|
|
19370
19661
|
}
|
|
19371
19662
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
19663
|
+
newCellSelection.debugId = dataSourceState.debugId ?? "";
|
|
19372
19664
|
newCellSelection.selectAll();
|
|
19373
19665
|
this.dataSourceActions.cellSelection = newCellSelection;
|
|
19374
19666
|
};
|
|
@@ -19383,22 +19675,26 @@ var InfiniteTableCellSelectionApiImpl = class {
|
|
|
19383
19675
|
return this.getDataSourceState().cellSelection?.isCellSelected(pk, colId) ?? false;
|
|
19384
19676
|
};
|
|
19385
19677
|
this.selectCell = (options) => {
|
|
19386
|
-
const
|
|
19678
|
+
const dataSourceState = this.getDataSourceState();
|
|
19679
|
+
const cellSelection = dataSourceState.cellSelection;
|
|
19387
19680
|
if (!cellSelection) {
|
|
19388
19681
|
return;
|
|
19389
19682
|
}
|
|
19390
19683
|
const [pk, colId] = this.getCellSelectionPosition(options);
|
|
19391
19684
|
const newCellSelection = options.clear ? new CellSelectionState() : new CellSelectionState(cellSelection);
|
|
19685
|
+
newCellSelection.debugId = dataSourceState.debugId ?? "";
|
|
19392
19686
|
newCellSelection.selectCell(pk, colId);
|
|
19393
19687
|
this.dataSourceActions.cellSelection = newCellSelection;
|
|
19394
19688
|
};
|
|
19395
19689
|
this.deselectCell = (options) => {
|
|
19396
|
-
const
|
|
19690
|
+
const dataSourceState = this.getDataSourceState();
|
|
19691
|
+
const cellSelection = dataSourceState.cellSelection;
|
|
19397
19692
|
if (!cellSelection) {
|
|
19398
19693
|
return;
|
|
19399
19694
|
}
|
|
19400
19695
|
const [pk, colId] = this.getCellSelectionPosition(options);
|
|
19401
19696
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
19697
|
+
newCellSelection.debugId = dataSourceState.debugId ?? "";
|
|
19402
19698
|
newCellSelection.deselectCell(pk, colId);
|
|
19403
19699
|
this.dataSourceActions.cellSelection = newCellSelection;
|
|
19404
19700
|
};
|
|
@@ -19406,20 +19702,24 @@ var InfiniteTableCellSelectionApiImpl = class {
|
|
|
19406
19702
|
if (options?.clear) {
|
|
19407
19703
|
this.deselectAll();
|
|
19408
19704
|
}
|
|
19409
|
-
const
|
|
19705
|
+
const dataSourceState = this.getDataSourceState();
|
|
19706
|
+
const cellSelection = dataSourceState.cellSelection;
|
|
19410
19707
|
if (!cellSelection) {
|
|
19411
19708
|
return;
|
|
19412
19709
|
}
|
|
19413
19710
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
19711
|
+
newCellSelection.debugId = dataSourceState.debugId ?? "";
|
|
19414
19712
|
newCellSelection.selectColumn(colId);
|
|
19415
19713
|
this.dataSourceActions.cellSelection = newCellSelection;
|
|
19416
19714
|
};
|
|
19417
19715
|
this.deselectColumn = (colId) => {
|
|
19418
|
-
const
|
|
19716
|
+
const dataSourceState = this.getDataSourceState();
|
|
19717
|
+
const cellSelection = dataSourceState.cellSelection;
|
|
19419
19718
|
if (!cellSelection) {
|
|
19420
19719
|
return;
|
|
19421
19720
|
}
|
|
19422
19721
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
19722
|
+
newCellSelection.debugId = dataSourceState.debugId ?? "";
|
|
19423
19723
|
newCellSelection.deselectColumn(colId);
|
|
19424
19724
|
this.dataSourceActions.cellSelection = newCellSelection;
|
|
19425
19725
|
};
|
|
@@ -19917,6 +20217,9 @@ var InfiniteTableApiImpl = class {
|
|
|
19917
20217
|
this.hideFilterOperatorMenu = () => {
|
|
19918
20218
|
this.actions.filterOperatorMenuVisibleForColumnId = null;
|
|
19919
20219
|
};
|
|
20220
|
+
this.setGroupRenderStrategy = (groupRenderStrategy) => {
|
|
20221
|
+
this.actions.groupRenderStrategy = groupRenderStrategy;
|
|
20222
|
+
};
|
|
19920
20223
|
this.getColumnOrder = () => {
|
|
19921
20224
|
return this.getComputed().computedColumnOrder;
|
|
19922
20225
|
};
|
|
@@ -21192,6 +21495,8 @@ function useCellRendering(param) {
|
|
|
21192
21495
|
const {
|
|
21193
21496
|
rowHeight,
|
|
21194
21497
|
rowDetailHeight,
|
|
21498
|
+
onRowMouseEnter,
|
|
21499
|
+
onRowMouseLeave,
|
|
21195
21500
|
groupRenderStrategy,
|
|
21196
21501
|
brain,
|
|
21197
21502
|
showZebraRows,
|
|
@@ -21333,6 +21638,8 @@ function useCellRendering(param) {
|
|
|
21333
21638
|
rowDetailState,
|
|
21334
21639
|
onMouseEnter,
|
|
21335
21640
|
onMouseLeave,
|
|
21641
|
+
onRowMouseEnter,
|
|
21642
|
+
onRowMouseLeave,
|
|
21336
21643
|
domRef,
|
|
21337
21644
|
width,
|
|
21338
21645
|
column,
|
|
@@ -21348,6 +21655,8 @@ function useCellRendering(param) {
|
|
|
21348
21655
|
[
|
|
21349
21656
|
rowHeight,
|
|
21350
21657
|
rowDetailHeight,
|
|
21658
|
+
onRowMouseEnter,
|
|
21659
|
+
onRowMouseLeave,
|
|
21351
21660
|
computedRowSizeCacheForDetails,
|
|
21352
21661
|
computedRowHeight,
|
|
21353
21662
|
isRowDetailsExpanded,
|
|
@@ -21666,13 +21975,13 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
21666
21975
|
|
|
21667
21976
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
21668
21977
|
import { useCallback as useCallback21 } from "react";
|
|
21669
|
-
var
|
|
21978
|
+
var debug3 = dbg("useColumnSizeFn");
|
|
21670
21979
|
function useColumnSizeFn(columns) {
|
|
21671
21980
|
const columnSize = useCallback21(
|
|
21672
21981
|
(index) => {
|
|
21673
21982
|
const column = columns[index];
|
|
21674
21983
|
if (false) {
|
|
21675
|
-
|
|
21984
|
+
debug3("cannot find column at index", index, columns);
|
|
21676
21985
|
}
|
|
21677
21986
|
return column ? column.computedWidth : 0;
|
|
21678
21987
|
},
|
|
@@ -21764,7 +22073,7 @@ function getRowDetailRendererFromComponent(RowDetail) {
|
|
|
21764
22073
|
// src/components/VirtualBrain/HorizontalLayoutMatrixBrain.ts
|
|
21765
22074
|
var HorizontalLayoutMatrixBrain = class extends MatrixBrain {
|
|
21766
22075
|
constructor(name, opts) {
|
|
21767
|
-
super(
|
|
22076
|
+
super(`${name}:HorizontalLayout`);
|
|
21768
22077
|
this.visiblePageCount = 0;
|
|
21769
22078
|
this.isHorizontalLayoutBrain = true;
|
|
21770
22079
|
this._totalPageCount = 0;
|
|
@@ -22043,10 +22352,11 @@ function getCellSelector(cellPosition) {
|
|
|
22043
22352
|
return selector2;
|
|
22044
22353
|
}
|
|
22045
22354
|
function createBrains(debugId, wrapRowsHorizontally) {
|
|
22046
|
-
const
|
|
22355
|
+
const debugChannel = getDebugChannel(debugId);
|
|
22356
|
+
const brain = !wrapRowsHorizontally ? new MatrixBrain(debugChannel) : new HorizontalLayoutMatrixBrain(debugChannel, {
|
|
22047
22357
|
isHeader: false
|
|
22048
22358
|
});
|
|
22049
|
-
const headerBrain = !wrapRowsHorizontally ? new MatrixBrain(
|
|
22359
|
+
const headerBrain = !wrapRowsHorizontally ? new MatrixBrain(debugChannel) : new HorizontalLayoutMatrixBrain(debugChannel, {
|
|
22050
22360
|
isHeader: true,
|
|
22051
22361
|
masterBrain: brain
|
|
22052
22362
|
});
|
|
@@ -22077,8 +22387,10 @@ function initSetupState2({
|
|
|
22077
22387
|
);
|
|
22078
22388
|
const domRef = createRef();
|
|
22079
22389
|
return {
|
|
22390
|
+
debugWarnings: /* @__PURE__ */ new Map(),
|
|
22080
22391
|
renderer,
|
|
22081
22392
|
onRenderUpdater,
|
|
22393
|
+
devToolsDetected: !!globalThis.__INFINITE_TABLE_DEVTOOLS_HOOK__,
|
|
22082
22394
|
propsCache: /* @__PURE__ */ new Map([]),
|
|
22083
22395
|
lastRowToCollapseRef: { current: null },
|
|
22084
22396
|
lastRowToExpandRef: { current: null },
|
|
@@ -22148,7 +22460,6 @@ var forwardProps4 = (_setupState) => {
|
|
|
22148
22460
|
groupColumn: 1,
|
|
22149
22461
|
onReady: 1,
|
|
22150
22462
|
domProps: 1,
|
|
22151
|
-
debugMode: 1,
|
|
22152
22463
|
onKeyDown: 1,
|
|
22153
22464
|
onCellClick: 1,
|
|
22154
22465
|
onCellDoubleClick: 1,
|
|
@@ -22163,6 +22474,8 @@ var forwardProps4 = (_setupState) => {
|
|
|
22163
22474
|
onContextMenu: 1,
|
|
22164
22475
|
onCellContextMenu: 1,
|
|
22165
22476
|
onRenderRangeChange: 1,
|
|
22477
|
+
onRowMouseEnter: 1,
|
|
22478
|
+
onRowMouseLeave: 1,
|
|
22166
22479
|
onScrollToTop: 1,
|
|
22167
22480
|
onScrollToBottom: 1,
|
|
22168
22481
|
onScrollStop: 1,
|
|
@@ -22358,7 +22671,7 @@ var mapPropsToState = (params) => {
|
|
|
22358
22671
|
}
|
|
22359
22672
|
}
|
|
22360
22673
|
const isRowDetailEnabled = !rowDetailRenderer ? false : props.isRowDetailEnabled || true;
|
|
22361
|
-
|
|
22674
|
+
let result = {
|
|
22362
22675
|
isTree: parentState.isTree,
|
|
22363
22676
|
rowDetailRenderer,
|
|
22364
22677
|
rowDetailState,
|
|
@@ -22383,6 +22696,16 @@ var mapPropsToState = (params) => {
|
|
|
22383
22696
|
rowDetailHeightCSSVar: typeof props.rowDetailHeight === "string" ? props.rowDetailHeight : "",
|
|
22384
22697
|
columnHeaderHeightCSSVar: typeof props.columnHeaderHeight === "string" ? props.columnHeaderHeight || ThemeVars.components.Header.columnHeaderHeight : ""
|
|
22385
22698
|
};
|
|
22699
|
+
if (state.devToolsDetected && state.debugId) {
|
|
22700
|
+
const devToolsOverrides = DEV_TOOLS_INFINITE_OVERRIDES.get(state.debugId);
|
|
22701
|
+
if (devToolsOverrides) {
|
|
22702
|
+
result = {
|
|
22703
|
+
...result,
|
|
22704
|
+
...devToolsOverrides
|
|
22705
|
+
};
|
|
22706
|
+
}
|
|
22707
|
+
}
|
|
22708
|
+
return result;
|
|
22386
22709
|
};
|
|
22387
22710
|
|
|
22388
22711
|
// src/components/InfiniteTable/state/getColumnVisibilityForHideEmptyGroupColumns.ts
|
|
@@ -23560,7 +23883,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
23560
23883
|
}
|
|
23561
23884
|
let valid2 = isValidLicense(licenseKey, {
|
|
23562
23885
|
publishedAt: 1624970570587,
|
|
23563
|
-
version: "6.2.
|
|
23886
|
+
version: "6.2.12"
|
|
23564
23887
|
});
|
|
23565
23888
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
23566
23889
|
return true;
|
|
@@ -23700,10 +24023,11 @@ function updateCellSelectionOnCellClick(context, event) {
|
|
|
23700
24023
|
return;
|
|
23701
24024
|
}
|
|
23702
24025
|
const { multiCellSelector, computedVisibleColumns } = getComputed();
|
|
23703
|
-
const { brain } = getState();
|
|
24026
|
+
const { brain, debugId } = getState();
|
|
23704
24027
|
const { rowsPerPage } = brain;
|
|
23705
24028
|
const columnsPerSet = computedVisibleColumns.length;
|
|
23706
24029
|
const cellSelection = new CellSelectionState(existingCellSelection);
|
|
24030
|
+
cellSelection.debugId = debugId ?? "";
|
|
23707
24031
|
multiCellSelector.cellSelectionState = cellSelection;
|
|
23708
24032
|
const position2 = {
|
|
23709
24033
|
rowIndex,
|
|
@@ -27132,37 +27456,414 @@ function useHorizontalLayout() {
|
|
|
27132
27456
|
}
|
|
27133
27457
|
|
|
27134
27458
|
// src/components/InfiniteTable/hooks/useDebugMode.ts
|
|
27135
|
-
import
|
|
27136
|
-
var logWarning = once(() => {
|
|
27137
|
-
console.warn(
|
|
27138
|
-
`It appears you have not loaded the CSS file for InfiniteTable.
|
|
27139
|
-
In most environments, you should be able to fix this by adding the following line:
|
|
27459
|
+
import { useEffect as useEffect39, useRef as useRef31 } from "react";
|
|
27140
27460
|
|
|
27141
|
-
|
|
27461
|
+
// src/components/InfiniteTable/hooks/debugModeDevToolsOverlay.css.ts
|
|
27462
|
+
var DevToolsOverlay = createRuntimeFn({ defaultClassName: "_143ofgf0", variantClassNames: { active: { true: "_143ofgf1", false: "_143ofgf2" } }, defaultVariants: {}, compoundVariants: [] });
|
|
27463
|
+
var DevToolsOverlayBg = "_143ofgf5";
|
|
27464
|
+
var DevToolsOverlayText = "_143ofgf3";
|
|
27142
27465
|
|
|
27143
|
-
|
|
27144
|
-
);
|
|
27145
|
-
});
|
|
27466
|
+
// src/components/InfiniteTable/hooks/useDebugMode.ts
|
|
27146
27467
|
var cssFileLoadedVarName = stripVar(ThemeVars.loaded);
|
|
27147
|
-
|
|
27148
|
-
|
|
27149
|
-
|
|
27150
|
-
|
|
27151
|
-
|
|
27468
|
+
var messageBase = {
|
|
27469
|
+
source: "infinite-table-page",
|
|
27470
|
+
target: "infinite-table-devtools-background"
|
|
27471
|
+
};
|
|
27472
|
+
function buildMessageForExtension(params, options) {
|
|
27473
|
+
const { type, debugId } = params;
|
|
27474
|
+
if (type === "unmount") {
|
|
27475
|
+
return {
|
|
27476
|
+
...messageBase,
|
|
27477
|
+
url: getPageUrlOfWindow(),
|
|
27478
|
+
type,
|
|
27479
|
+
payload: {
|
|
27480
|
+
debugId
|
|
27481
|
+
}
|
|
27482
|
+
};
|
|
27483
|
+
}
|
|
27484
|
+
const opts = options;
|
|
27485
|
+
const computedValues = opts.getComputed();
|
|
27486
|
+
const dataSourceState = opts.getDataSourceState();
|
|
27487
|
+
const state = opts.getState();
|
|
27488
|
+
const message = {
|
|
27489
|
+
...messageBase,
|
|
27490
|
+
url: getPageUrlOfWindow(),
|
|
27491
|
+
type,
|
|
27492
|
+
payload: {
|
|
27493
|
+
debugId,
|
|
27494
|
+
columnVisibility: state.columnVisibility,
|
|
27495
|
+
columnOrder: computedValues.computedColumnOrder,
|
|
27496
|
+
visibleColumnIds: computedValues.computedVisibleColumns.map((c) => c.id),
|
|
27497
|
+
selectionMode: dataSourceState.selectionMode,
|
|
27498
|
+
columns: Object.fromEntries(
|
|
27499
|
+
computedValues.computedVisibleColumns.map((c) => [
|
|
27500
|
+
c.id,
|
|
27501
|
+
{
|
|
27502
|
+
field: c.field,
|
|
27503
|
+
dataType: c.computedDataType,
|
|
27504
|
+
sortType: c.computedSortType,
|
|
27505
|
+
filtered: c.computedFiltered,
|
|
27506
|
+
sorted: c.computedSorted,
|
|
27507
|
+
width: c.computedWidth
|
|
27508
|
+
}
|
|
27509
|
+
])
|
|
27510
|
+
),
|
|
27511
|
+
groupRenderStrategy: state.groupRenderStrategy,
|
|
27512
|
+
groupBy: dataSourceState.groupBy.map(
|
|
27513
|
+
(g) => g.field ? `${g.field}` : "<fn>"
|
|
27514
|
+
),
|
|
27515
|
+
sortInfo: (dataSourceState.sortInfo || []).filter((sortInfo) => typeof sortInfo.field === "string").map((s) => {
|
|
27516
|
+
return {
|
|
27517
|
+
field: `${s.field}`,
|
|
27518
|
+
dir: s.dir,
|
|
27519
|
+
type: Array.isArray(s.type) ? s.type[0] : s.type ?? "string"
|
|
27520
|
+
};
|
|
27521
|
+
}),
|
|
27522
|
+
multiSort: dataSourceState.multiSort,
|
|
27523
|
+
devToolsDetected: state.devToolsDetected,
|
|
27524
|
+
debugTimings: Object.fromEntries(dataSourceState.debugTimings),
|
|
27525
|
+
debugWarnings: {
|
|
27526
|
+
...Object.fromEntries(dataSourceState.debugWarnings),
|
|
27527
|
+
...Object.fromEntries(state.debugWarnings)
|
|
27528
|
+
}
|
|
27529
|
+
}
|
|
27530
|
+
};
|
|
27531
|
+
return message;
|
|
27152
27532
|
}
|
|
27153
|
-
|
|
27533
|
+
var getPageUrlOfWindow = once(function() {
|
|
27534
|
+
const url = new URL(window.location.href);
|
|
27535
|
+
return url.origin + url.pathname;
|
|
27536
|
+
});
|
|
27537
|
+
function postMessage(message) {
|
|
27538
|
+
window.postMessage(message);
|
|
27539
|
+
}
|
|
27540
|
+
var setupHook = once(() => {
|
|
27541
|
+
console.log("Infinite Table DevTools detected!");
|
|
27542
|
+
const hookFn = (debugId, options) => {
|
|
27543
|
+
if (options) {
|
|
27544
|
+
INSTANCES.set(debugId, options);
|
|
27545
|
+
const { devToolsDetected } = options.getState();
|
|
27546
|
+
if (!devToolsDetected) {
|
|
27547
|
+
options.actions.devToolsDetected = true;
|
|
27548
|
+
}
|
|
27549
|
+
const dataSourceState = options.getDataSourceState();
|
|
27550
|
+
if (dataSourceState.debugId !== debugId) {
|
|
27551
|
+
options.dataSourceActions.debugId = debugId;
|
|
27552
|
+
}
|
|
27553
|
+
if (!dataSourceState.devToolsDetected) {
|
|
27554
|
+
options.dataSourceActions.devToolsDetected = true;
|
|
27555
|
+
}
|
|
27556
|
+
window.postMessage(
|
|
27557
|
+
buildMessageForExtension({ type: "update", debugId }, options)
|
|
27558
|
+
);
|
|
27559
|
+
} else {
|
|
27560
|
+
deleteInstanceFromDevTools(debugId);
|
|
27561
|
+
window.postMessage(
|
|
27562
|
+
buildMessageForExtension({ type: "unmount", debugId }, null)
|
|
27563
|
+
);
|
|
27564
|
+
}
|
|
27565
|
+
};
|
|
27566
|
+
window.__INFINITE_TABLE_DEVTOOLS_HOOK__ = hookFn;
|
|
27567
|
+
debug.onLogIntent("*", (options) => {
|
|
27568
|
+
postMessage({
|
|
27569
|
+
...messageBase,
|
|
27570
|
+
url: getPageUrlOfWindow(),
|
|
27571
|
+
type: "log",
|
|
27572
|
+
payload: {
|
|
27573
|
+
debugId: void 0,
|
|
27574
|
+
channel: options.channel,
|
|
27575
|
+
color: options.color,
|
|
27576
|
+
args: options.args.map((arg) => {
|
|
27577
|
+
if (typeof arg === "object" && arg !== null) {
|
|
27578
|
+
return JSON.stringify(arg);
|
|
27579
|
+
}
|
|
27580
|
+
return String(arg);
|
|
27581
|
+
}),
|
|
27582
|
+
timestamp: options.timestamp
|
|
27583
|
+
}
|
|
27584
|
+
});
|
|
27585
|
+
});
|
|
27586
|
+
return hookFn;
|
|
27587
|
+
});
|
|
27588
|
+
function useDebugMode() {
|
|
27589
|
+
const { getState, getDataSourceState, dataSourceActions } = useInfiniteTable();
|
|
27154
27590
|
const state = getState();
|
|
27155
|
-
const {
|
|
27156
|
-
if (
|
|
27591
|
+
const { domRef, debugId } = state;
|
|
27592
|
+
if (debugId) {
|
|
27157
27593
|
if (domRef.current) {
|
|
27158
27594
|
const value = getComputedStyle(domRef.current).getPropertyValue(
|
|
27159
27595
|
cssFileLoadedVarName
|
|
27160
27596
|
);
|
|
27161
27597
|
if (value !== `${CSS_LOADED_VALUE}`) {
|
|
27162
|
-
|
|
27598
|
+
logDevToolsWarning({
|
|
27599
|
+
debugId,
|
|
27600
|
+
key: "CSS001_CSS"
|
|
27601
|
+
});
|
|
27163
27602
|
}
|
|
27164
27603
|
}
|
|
27165
27604
|
}
|
|
27605
|
+
useEffect39(() => {
|
|
27606
|
+
const dataSourceState = getDataSourceState();
|
|
27607
|
+
if (dataSourceState.debugId !== debugId) {
|
|
27608
|
+
dataSourceActions.debugId = debugId;
|
|
27609
|
+
}
|
|
27610
|
+
}, [debugId]);
|
|
27611
|
+
return useDevTools();
|
|
27612
|
+
}
|
|
27613
|
+
var HOOK_FN_SETUP_CALLBACK = buildSubscriptionCallback();
|
|
27614
|
+
var DEVTOOLS_MESSAGES = {
|
|
27615
|
+
revertAll: (payload) => {
|
|
27616
|
+
const instance = INSTANCES.get(payload.debugId);
|
|
27617
|
+
if (instance) {
|
|
27618
|
+
const infiniteInitials = DEV_TOOLS_INFINITE_INITIALS.get(payload.debugId);
|
|
27619
|
+
DEV_TOOLS_INFINITE_INITIALS.delete(payload.debugId);
|
|
27620
|
+
DEV_TOOLS_INFINITE_OVERRIDES.delete(payload.debugId);
|
|
27621
|
+
if (infiniteInitials) {
|
|
27622
|
+
Object.keys(infiniteInitials).forEach((key) => {
|
|
27623
|
+
instance.actions[key] = infiniteInitials[key];
|
|
27624
|
+
delete infiniteInitials[key];
|
|
27625
|
+
});
|
|
27626
|
+
}
|
|
27627
|
+
const dataSourceInitials = DEV_TOOLS_DATASOURCE_INITIALS.get(
|
|
27628
|
+
payload.debugId
|
|
27629
|
+
);
|
|
27630
|
+
DEV_TOOLS_DATASOURCE_INITIALS.delete(payload.debugId);
|
|
27631
|
+
DEV_TOOLS_DATASOURCE_OVERRIDES.delete(payload.debugId);
|
|
27632
|
+
if (dataSourceInitials) {
|
|
27633
|
+
Object.keys(dataSourceInitials).forEach((key) => {
|
|
27634
|
+
instance.dataSourceActions[key] = dataSourceInitials[key];
|
|
27635
|
+
delete dataSourceInitials[key];
|
|
27636
|
+
});
|
|
27637
|
+
}
|
|
27638
|
+
}
|
|
27639
|
+
},
|
|
27640
|
+
revertProperty: (payload) => {
|
|
27641
|
+
const instance = INSTANCES.get(payload.debugId);
|
|
27642
|
+
if (instance) {
|
|
27643
|
+
const property = payload.property;
|
|
27644
|
+
const infiniteOverrides = DEV_TOOLS_INFINITE_OVERRIDES.get(
|
|
27645
|
+
payload.debugId
|
|
27646
|
+
);
|
|
27647
|
+
const infiniteInitials = DEV_TOOLS_INFINITE_INITIALS.get(payload.debugId);
|
|
27648
|
+
const dataSourceOverrides = DEV_TOOLS_DATASOURCE_OVERRIDES.get(
|
|
27649
|
+
payload.debugId
|
|
27650
|
+
);
|
|
27651
|
+
const dataSourceInitials = DEV_TOOLS_DATASOURCE_INITIALS.get(
|
|
27652
|
+
payload.debugId
|
|
27653
|
+
);
|
|
27654
|
+
const infiniteStateProp = property;
|
|
27655
|
+
if (infiniteInitials && infiniteOverrides && infiniteOverrides[infiniteStateProp] !== void 0) {
|
|
27656
|
+
delete infiniteOverrides[infiniteStateProp];
|
|
27657
|
+
instance.actions[infiniteStateProp] = infiniteInitials[infiniteStateProp];
|
|
27658
|
+
delete infiniteInitials[infiniteStateProp];
|
|
27659
|
+
}
|
|
27660
|
+
const dataSourceStateProp = property;
|
|
27661
|
+
if (dataSourceInitials && dataSourceOverrides && dataSourceOverrides[dataSourceStateProp] !== void 0) {
|
|
27662
|
+
const dataSourceInitials2 = DEV_TOOLS_DATASOURCE_INITIALS.get(payload.debugId) || {};
|
|
27663
|
+
delete dataSourceOverrides[dataSourceStateProp];
|
|
27664
|
+
instance.dataSourceActions[dataSourceStateProp] = dataSourceInitials2[dataSourceStateProp];
|
|
27665
|
+
delete dataSourceInitials2[dataSourceStateProp];
|
|
27666
|
+
}
|
|
27667
|
+
}
|
|
27668
|
+
},
|
|
27669
|
+
discardWarning: (payload) => {
|
|
27670
|
+
const instance = INSTANCES.get(payload.debugId);
|
|
27671
|
+
if (instance) {
|
|
27672
|
+
const dsWarningKey = payload.warning;
|
|
27673
|
+
const dsWarnings = instance.getDataSourceState().debugWarnings;
|
|
27674
|
+
const obj = dsWarnings.get(dsWarningKey);
|
|
27675
|
+
if (obj) {
|
|
27676
|
+
dsWarnings.delete(dsWarningKey);
|
|
27677
|
+
updateDevToolsForInstance(payload.debugId);
|
|
27678
|
+
} else {
|
|
27679
|
+
const itWarningKey = payload.warning;
|
|
27680
|
+
const infiniteWarnings = instance.getState().debugWarnings;
|
|
27681
|
+
const obj2 = infiniteWarnings.get(itWarningKey);
|
|
27682
|
+
if (obj2) {
|
|
27683
|
+
infiniteWarnings.delete(itWarningKey);
|
|
27684
|
+
updateDevToolsForInstance(payload.debugId);
|
|
27685
|
+
}
|
|
27686
|
+
}
|
|
27687
|
+
}
|
|
27688
|
+
},
|
|
27689
|
+
discardAllWarnings: (payload) => {
|
|
27690
|
+
const instance = INSTANCES.get(payload.debugId);
|
|
27691
|
+
if (instance) {
|
|
27692
|
+
instance.getDataSourceState().debugWarnings.clear();
|
|
27693
|
+
instance.getState().debugWarnings.clear();
|
|
27694
|
+
updateDevToolsForInstance(payload.debugId);
|
|
27695
|
+
}
|
|
27696
|
+
},
|
|
27697
|
+
setColumnVisibility: (payload) => {
|
|
27698
|
+
setDevToolInfinitePropertyOverride(
|
|
27699
|
+
payload.debugId,
|
|
27700
|
+
"columnVisibility",
|
|
27701
|
+
payload.columnVisibility
|
|
27702
|
+
);
|
|
27703
|
+
},
|
|
27704
|
+
setGroupBy: (payload) => {
|
|
27705
|
+
setDevToolDataSourcePropertyOverride(
|
|
27706
|
+
payload.debugId,
|
|
27707
|
+
"groupBy",
|
|
27708
|
+
payload.groupBy
|
|
27709
|
+
);
|
|
27710
|
+
},
|
|
27711
|
+
setGroupRenderStrategy: (payload) => {
|
|
27712
|
+
setDevToolInfinitePropertyOverride(
|
|
27713
|
+
payload.debugId,
|
|
27714
|
+
"groupRenderStrategy",
|
|
27715
|
+
payload.groupRenderStrategy
|
|
27716
|
+
);
|
|
27717
|
+
},
|
|
27718
|
+
setSortInfo: (payload) => {
|
|
27719
|
+
setDevToolDataSourcePropertyOverride(
|
|
27720
|
+
payload.debugId,
|
|
27721
|
+
"sortInfo",
|
|
27722
|
+
payload.sortInfo
|
|
27723
|
+
);
|
|
27724
|
+
},
|
|
27725
|
+
setMultiSort: (payload) => {
|
|
27726
|
+
setDevToolDataSourcePropertyOverride(
|
|
27727
|
+
payload.debugId,
|
|
27728
|
+
"multiSort",
|
|
27729
|
+
payload.multiSort
|
|
27730
|
+
);
|
|
27731
|
+
},
|
|
27732
|
+
highlight: (payload) => {
|
|
27733
|
+
const instance = INSTANCES.get(payload.debugId);
|
|
27734
|
+
if (instance) {
|
|
27735
|
+
const domNode = instance.getState().domRef.current;
|
|
27736
|
+
if (domNode) {
|
|
27737
|
+
const rect = domNode.getBoundingClientRect();
|
|
27738
|
+
let overlay = document.querySelector(
|
|
27739
|
+
`.${DevToolsOverlay.classNames.base}`
|
|
27740
|
+
);
|
|
27741
|
+
if (!overlay) {
|
|
27742
|
+
overlay = document.createElement("div");
|
|
27743
|
+
overlay.classList.add(DevToolsOverlay.classNames.base);
|
|
27744
|
+
overlay.innerHTML = [
|
|
27745
|
+
`<div class="${DevToolsOverlayText}"></div>`,
|
|
27746
|
+
`<div class="${DevToolsOverlayBg}"></div>`
|
|
27747
|
+
].join("");
|
|
27748
|
+
document.body.appendChild(overlay);
|
|
27749
|
+
}
|
|
27750
|
+
let textDiv = overlay.firstElementChild;
|
|
27751
|
+
if (overlay) {
|
|
27752
|
+
overlay.style.left = `${rect.left}px`;
|
|
27753
|
+
overlay.style.top = `${rect.top}px`;
|
|
27754
|
+
overlay.style.width = `${rect.width}px`;
|
|
27755
|
+
overlay.style.height = `${rect.height}px`;
|
|
27756
|
+
textDiv.innerHTML = payload.debugId;
|
|
27757
|
+
const overlayBg = overlay.lastElementChild;
|
|
27758
|
+
const handleAnimationEnd = () => {
|
|
27759
|
+
overlay.classList.remove(
|
|
27760
|
+
DevToolsOverlay.classNames.variants.active.true
|
|
27761
|
+
);
|
|
27762
|
+
overlayBg.removeEventListener("animationend", handleAnimationEnd);
|
|
27763
|
+
};
|
|
27764
|
+
overlayBg.addEventListener("animationend", handleAnimationEnd);
|
|
27765
|
+
overlay.classList.add(
|
|
27766
|
+
DevToolsOverlay.classNames.variants.active.true
|
|
27767
|
+
);
|
|
27768
|
+
}
|
|
27769
|
+
}
|
|
27770
|
+
}
|
|
27771
|
+
}
|
|
27772
|
+
};
|
|
27773
|
+
function listenForDevTools() {
|
|
27774
|
+
if (typeof window !== "undefined") {
|
|
27775
|
+
window.addEventListener("message", (event) => {
|
|
27776
|
+
if (event && event.data && typeof event.data.source === "string" && event.data.source.startsWith("infinite-table-devtools-contentscript") && event.data.target === "infinite-table-page") {
|
|
27777
|
+
if (!window.__INFINITE_TABLE_DEVTOOLS_HOOK__) {
|
|
27778
|
+
setupHook();
|
|
27779
|
+
HOOK_FN_SETUP_CALLBACK(
|
|
27780
|
+
window.__INFINITE_TABLE_DEVTOOLS_HOOK__
|
|
27781
|
+
);
|
|
27782
|
+
}
|
|
27783
|
+
if (typeof event.data.type === "string") {
|
|
27784
|
+
const eventType = event.data.type;
|
|
27785
|
+
const fn = DEVTOOLS_MESSAGES[eventType];
|
|
27786
|
+
if (fn) {
|
|
27787
|
+
fn(event.data.payload);
|
|
27788
|
+
}
|
|
27789
|
+
}
|
|
27790
|
+
}
|
|
27791
|
+
});
|
|
27792
|
+
}
|
|
27793
|
+
}
|
|
27794
|
+
listenForDevTools();
|
|
27795
|
+
function useDevTools() {
|
|
27796
|
+
const {
|
|
27797
|
+
getState,
|
|
27798
|
+
getComputed,
|
|
27799
|
+
getDataSourceState,
|
|
27800
|
+
dataSourceActions,
|
|
27801
|
+
actions,
|
|
27802
|
+
dataSourceApi,
|
|
27803
|
+
api
|
|
27804
|
+
} = useInfiniteTable();
|
|
27805
|
+
const state = getState();
|
|
27806
|
+
const debugId = state.debugId;
|
|
27807
|
+
const debugIdRef = useRef31(debugId);
|
|
27808
|
+
debugIdRef.current = debugId;
|
|
27809
|
+
useEffect39(() => {
|
|
27810
|
+
const debugId2 = debugIdRef.current;
|
|
27811
|
+
if (!debugId2) {
|
|
27812
|
+
return;
|
|
27813
|
+
}
|
|
27814
|
+
const withHookFn = (hookFn2) => {
|
|
27815
|
+
hookFn2(debugId2, {
|
|
27816
|
+
getState,
|
|
27817
|
+
getDataSourceState,
|
|
27818
|
+
getComputed,
|
|
27819
|
+
dataSourceActions,
|
|
27820
|
+
actions,
|
|
27821
|
+
api,
|
|
27822
|
+
dataSourceApi
|
|
27823
|
+
});
|
|
27824
|
+
};
|
|
27825
|
+
const hookFn = HOOK_FN_SETUP_CALLBACK.get();
|
|
27826
|
+
if (hookFn) {
|
|
27827
|
+
withHookFn(hookFn);
|
|
27828
|
+
return;
|
|
27829
|
+
}
|
|
27830
|
+
return HOOK_FN_SETUP_CALLBACK.onChange((hookFn2) => {
|
|
27831
|
+
if (!hookFn2) {
|
|
27832
|
+
return;
|
|
27833
|
+
}
|
|
27834
|
+
withHookFn(hookFn2);
|
|
27835
|
+
});
|
|
27836
|
+
}, []);
|
|
27837
|
+
useEffect39(() => {
|
|
27838
|
+
const debugId2 = debugIdRef.current;
|
|
27839
|
+
if (!debugId2) {
|
|
27840
|
+
return;
|
|
27841
|
+
}
|
|
27842
|
+
const hookFn = HOOK_FN_SETUP_CALLBACK.get();
|
|
27843
|
+
if (hookFn) {
|
|
27844
|
+
hookFn(debugId2, {
|
|
27845
|
+
getState,
|
|
27846
|
+
getDataSourceState,
|
|
27847
|
+
getComputed,
|
|
27848
|
+
dataSourceActions,
|
|
27849
|
+
actions,
|
|
27850
|
+
api,
|
|
27851
|
+
dataSourceApi
|
|
27852
|
+
});
|
|
27853
|
+
}
|
|
27854
|
+
});
|
|
27855
|
+
useEffect39(() => {
|
|
27856
|
+
if (!debugId) {
|
|
27857
|
+
return;
|
|
27858
|
+
}
|
|
27859
|
+
return () => {
|
|
27860
|
+
const devtoolsHookFn = globalThis.__INFINITE_TABLE_DEVTOOLS_HOOK__;
|
|
27861
|
+
if (devtoolsHookFn) {
|
|
27862
|
+
devtoolsHookFn(debugId, null);
|
|
27863
|
+
}
|
|
27864
|
+
};
|
|
27865
|
+
}, [debugId]);
|
|
27866
|
+
return debugId;
|
|
27166
27867
|
}
|
|
27167
27868
|
|
|
27168
27869
|
// src/components/InfiniteTable/hooks/useInfinitePortalContainer.ts
|
|
@@ -27195,14 +27896,16 @@ var { ManagedComponentContextProvider: InfiniteTableRoot } = buildManagedCompone
|
|
|
27195
27896
|
mappedCallbacks: getMappedCallbacks2(),
|
|
27196
27897
|
// @ts-ignore
|
|
27197
27898
|
getParentState: () => useDataSourceState(),
|
|
27198
|
-
debugName:
|
|
27899
|
+
debugName: (props) => {
|
|
27900
|
+
return getDebugChannel(props.debugId, DEBUG_NAME);
|
|
27901
|
+
}
|
|
27199
27902
|
});
|
|
27200
27903
|
function InfiniteTableHeader2() {
|
|
27201
27904
|
const context = useInfiniteTable();
|
|
27202
27905
|
const { state: componentState, getComputed } = context;
|
|
27203
27906
|
const { header, brain, headerBrain, wrapRowsHorizontally } = componentState;
|
|
27204
27907
|
const { scrollbars } = getComputed();
|
|
27205
|
-
return header ? /* @__PURE__ */
|
|
27908
|
+
return header ? /* @__PURE__ */ React70.createElement(
|
|
27206
27909
|
TableHeaderWrapper,
|
|
27207
27910
|
{
|
|
27208
27911
|
wrapRowsHorizontally: !!wrapRowsHorizontally,
|
|
@@ -27219,7 +27922,7 @@ var InfiniteTableBodyCls = join(
|
|
|
27219
27922
|
transformTranslateZero
|
|
27220
27923
|
);
|
|
27221
27924
|
function InfiniteTableBodyContainer(props) {
|
|
27222
|
-
return /* @__PURE__ */
|
|
27925
|
+
return /* @__PURE__ */ React70.createElement(
|
|
27223
27926
|
"div",
|
|
27224
27927
|
{
|
|
27225
27928
|
...props,
|
|
@@ -27257,7 +27960,7 @@ function InfiniteTableBody() {
|
|
|
27257
27960
|
const {
|
|
27258
27961
|
componentState: { loading }
|
|
27259
27962
|
} = useDataSourceContextValue();
|
|
27260
|
-
const onContextMenu =
|
|
27963
|
+
const onContextMenu = React70.useCallback((event) => {
|
|
27261
27964
|
const state = context.getState();
|
|
27262
27965
|
const target = event.target;
|
|
27263
27966
|
if (!masterContext && event._from_row_detail) {
|
|
@@ -27303,7 +28006,7 @@ function InfiniteTableBody() {
|
|
|
27303
28006
|
});
|
|
27304
28007
|
const { autoFocus, tabIndex } = domProps ?? {};
|
|
27305
28008
|
useToggleWrapRowsHorizontally();
|
|
27306
|
-
return /* @__PURE__ */
|
|
28009
|
+
return /* @__PURE__ */ React70.createElement(InfiniteTableBodyContainer, { onContextMenu }, /* @__PURE__ */ React70.createElement(
|
|
27307
28010
|
HeadlessTable,
|
|
27308
28011
|
{
|
|
27309
28012
|
forceRerenderTimestamp: componentState.forceBodyRerenderTimestamp,
|
|
@@ -27325,9 +28028,9 @@ function InfiniteTableBody() {
|
|
|
27325
28028
|
scrollerDOMRef,
|
|
27326
28029
|
scrollVarHostRef: domRef
|
|
27327
28030
|
}
|
|
27328
|
-
), /* @__PURE__ */
|
|
28031
|
+
), /* @__PURE__ */ React70.createElement(LoadMaskCmp, { visible: loading }, loadingText));
|
|
27329
28032
|
}
|
|
27330
|
-
var InfiniteTableComponent =
|
|
28033
|
+
var InfiniteTableComponent = React70.memo(
|
|
27331
28034
|
function InfiniteTableComponent2() {
|
|
27332
28035
|
const context = useInfiniteTable();
|
|
27333
28036
|
const masterContext = useMasterDetailContext();
|
|
@@ -27359,7 +28062,7 @@ var InfiniteTableComponent = React71.memo(
|
|
|
27359
28062
|
useScrollToActiveRow(activeRowIndex, dataArray.length, api);
|
|
27360
28063
|
useScrollToActiveCell(activeCellIndex, dataArray.length, api);
|
|
27361
28064
|
const { onKeyDown: onKeyDown2 } = useDOMEventHandlers();
|
|
27362
|
-
|
|
28065
|
+
React70.useEffect(() => {
|
|
27363
28066
|
const dataSourceState = getDataSourceState();
|
|
27364
28067
|
const onChange = debounce(
|
|
27365
28068
|
(renderRange) => {
|
|
@@ -27382,7 +28085,7 @@ var InfiniteTableComponent = React71.memo(
|
|
|
27382
28085
|
...initialDOMProps
|
|
27383
28086
|
} = componentState.domProps ?? {};
|
|
27384
28087
|
const domProps = useDOMProps(initialDOMProps);
|
|
27385
|
-
|
|
28088
|
+
React70.useEffect(() => {
|
|
27386
28089
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
27387
28090
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
27388
28091
|
}, [scrollStopDelay]);
|
|
@@ -27393,7 +28096,7 @@ var InfiniteTableComponent = React71.memo(
|
|
|
27393
28096
|
const { menuPortal: cellContextMenuPortal } = useCellContextMenu();
|
|
27394
28097
|
const { menuPortal: tableContextMenuPortal } = useTableContextMenu();
|
|
27395
28098
|
const { menuPortal: filterOperatorMenuPortal } = useColumnFilterOperatorMenu();
|
|
27396
|
-
|
|
28099
|
+
React70.useEffect(() => {
|
|
27397
28100
|
if (typeof globalThis.__DO_NOT_USE_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_IS_READY === "function") {
|
|
27398
28101
|
globalThis.__DO_NOT_USE_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_IS_READY(
|
|
27399
28102
|
componentState.id,
|
|
@@ -27406,59 +28109,75 @@ var InfiniteTableComponent = React71.memo(
|
|
|
27406
28109
|
globalThis.infiniteApi = context.api;
|
|
27407
28110
|
}
|
|
27408
28111
|
}, [componentState.ready]);
|
|
27409
|
-
useDebugMode();
|
|
27410
|
-
|
|
28112
|
+
const debugId = useDebugMode();
|
|
28113
|
+
React70.useEffect(() => {
|
|
27411
28114
|
if (masterContext) {
|
|
27412
28115
|
portalDOMRef.current = masterContext.getMasterState().portalDOMRef.current;
|
|
27413
28116
|
}
|
|
27414
28117
|
}, []);
|
|
27415
|
-
const children = initialChildren ?? /* @__PURE__ */
|
|
27416
|
-
return /* @__PURE__ */
|
|
28118
|
+
const children = initialChildren ?? /* @__PURE__ */ React70.createElement(React70.Fragment, null, /* @__PURE__ */ React70.createElement(InfiniteTableHeader2, null), /* @__PURE__ */ React70.createElement(InfiniteTableBody, null));
|
|
28119
|
+
return /* @__PURE__ */ React70.createElement(
|
|
27417
28120
|
"div",
|
|
27418
28121
|
{
|
|
27419
|
-
|
|
27420
|
-
|
|
27421
|
-
|
|
27422
|
-
|
|
27423
|
-
position.absolute,
|
|
27424
|
-
top[0],
|
|
27425
|
-
left[0]
|
|
27426
|
-
)
|
|
28122
|
+
"data-debug-id": debugId,
|
|
28123
|
+
onKeyDown: onKeyDown2,
|
|
28124
|
+
ref: domRef,
|
|
28125
|
+
...domProps
|
|
27427
28126
|
},
|
|
27428
|
-
|
|
27429
|
-
|
|
27430
|
-
|
|
27431
|
-
|
|
27432
|
-
|
|
27433
|
-
|
|
27434
|
-
|
|
27435
|
-
|
|
27436
|
-
|
|
27437
|
-
|
|
27438
|
-
|
|
27439
|
-
|
|
27440
|
-
|
|
27441
|
-
|
|
27442
|
-
|
|
27443
|
-
|
|
27444
|
-
|
|
27445
|
-
|
|
27446
|
-
|
|
27447
|
-
|
|
27448
|
-
|
|
27449
|
-
|
|
27450
|
-
|
|
27451
|
-
|
|
27452
|
-
|
|
27453
|
-
|
|
27454
|
-
|
|
27455
|
-
|
|
27456
|
-
|
|
27457
|
-
|
|
27458
|
-
|
|
27459
|
-
|
|
27460
|
-
|
|
27461
|
-
|
|
28127
|
+
children,
|
|
28128
|
+
/* @__PURE__ */ React70.createElement(
|
|
28129
|
+
"div",
|
|
28130
|
+
{
|
|
28131
|
+
ref: portalDOMRef,
|
|
28132
|
+
className: join(
|
|
28133
|
+
`${rootClassName2}Portal`,
|
|
28134
|
+
zIndex[1e7],
|
|
28135
|
+
position.absolute,
|
|
28136
|
+
top[0],
|
|
28137
|
+
left[0]
|
|
28138
|
+
)
|
|
28139
|
+
},
|
|
28140
|
+
menuPortal,
|
|
28141
|
+
cellContextMenuPortal,
|
|
28142
|
+
tableContextMenuPortal,
|
|
28143
|
+
filterOperatorMenuPortal
|
|
28144
|
+
),
|
|
28145
|
+
rowHeightCSSVar ? /* @__PURE__ */ React70.createElement(
|
|
28146
|
+
CSSNumericVariableWatch,
|
|
28147
|
+
{
|
|
28148
|
+
key: "row-height",
|
|
28149
|
+
varName: rowHeightCSSVar,
|
|
28150
|
+
onChange: onRowHeightCSSVarChange
|
|
28151
|
+
}
|
|
28152
|
+
) : null,
|
|
28153
|
+
/* @__PURE__ */ React70.createElement(
|
|
28154
|
+
CSSNumericVariableWatch,
|
|
28155
|
+
{
|
|
28156
|
+
key: "flashing-duration",
|
|
28157
|
+
allowInts: true,
|
|
28158
|
+
varName: ThemeVars.components.Cell.flashingDuration,
|
|
28159
|
+
onChange: onFlashingDurationCSSVarChange
|
|
28160
|
+
}
|
|
28161
|
+
),
|
|
28162
|
+
rowDetailHeightCSSVar ? /* @__PURE__ */ React70.createElement(
|
|
28163
|
+
CSSNumericVariableWatch,
|
|
28164
|
+
{
|
|
28165
|
+
key: "row-detail-height",
|
|
28166
|
+
varName: rowDetailHeightCSSVar,
|
|
28167
|
+
onChange: onRowDetailHeightCSSVarChange
|
|
28168
|
+
}
|
|
28169
|
+
) : null,
|
|
28170
|
+
columnHeaderHeightCSSVar ? /* @__PURE__ */ React70.createElement(
|
|
28171
|
+
CSSNumericVariableWatch,
|
|
28172
|
+
{
|
|
28173
|
+
key: "column-header-height",
|
|
28174
|
+
varName: columnHeaderHeightCSSVar,
|
|
28175
|
+
onChange: onColumnHeaderHeightCSSVarChange
|
|
28176
|
+
}
|
|
28177
|
+
) : null,
|
|
28178
|
+
licenseValid ? null : /* @__PURE__ */ React70.createElement(InfiniteTableLicenseFooter, null),
|
|
28179
|
+
/* @__PURE__ */ React70.createElement(FocusDetect, null)
|
|
28180
|
+
);
|
|
27462
28181
|
}
|
|
27463
28182
|
);
|
|
27464
28183
|
function InfiniteTableContextProvider({
|
|
@@ -27475,6 +28194,16 @@ function InfiniteTableContextProvider({
|
|
|
27475
28194
|
globalThis.getComputed = getComputed;
|
|
27476
28195
|
globalThis.componentActions = componentActions;
|
|
27477
28196
|
globalThis.masterBrain = componentState.brain;
|
|
28197
|
+
globalThis.INFINITE = globalThis.INFINITE || {};
|
|
28198
|
+
if (getState().debugId) {
|
|
28199
|
+
const debugId = getState().debugId;
|
|
28200
|
+
globalThis.INFINITE[debugId] = {
|
|
28201
|
+
// @ts-ignore
|
|
28202
|
+
...globalThis.INFINITE[debugId] || {},
|
|
28203
|
+
getState,
|
|
28204
|
+
actions: componentActions
|
|
28205
|
+
};
|
|
28206
|
+
}
|
|
27478
28207
|
}
|
|
27479
28208
|
const {
|
|
27480
28209
|
getState: getDataSourceState,
|
|
@@ -27482,7 +28211,7 @@ function InfiniteTableContextProvider({
|
|
|
27482
28211
|
getDataSourceMasterContext,
|
|
27483
28212
|
api: dataSourceApi
|
|
27484
28213
|
} = useDataSourceContextValue();
|
|
27485
|
-
const [imperativeApi] =
|
|
28214
|
+
const [imperativeApi] = React70.useState(() => {
|
|
27486
28215
|
return getImperativeApi({
|
|
27487
28216
|
getComputed,
|
|
27488
28217
|
getState,
|
|
@@ -27518,20 +28247,20 @@ function InfiniteTableContextProvider({
|
|
|
27518
28247
|
},
|
|
27519
28248
|
{ earlyAttach: true, debounce: 50 }
|
|
27520
28249
|
);
|
|
27521
|
-
|
|
28250
|
+
React70.useEffect(() => {
|
|
27522
28251
|
if (scrollerDOMRef.current) {
|
|
27523
28252
|
scrollerDOMRef.current.scrollTop = 0;
|
|
27524
28253
|
}
|
|
27525
28254
|
}, [scrollTopKey, scrollerDOMRef]);
|
|
27526
28255
|
const TableContext2 = getInfiniteTableContext();
|
|
27527
|
-
return /* @__PURE__ */
|
|
28256
|
+
return /* @__PURE__ */ React70.createElement(TableContext2.Provider, { value: contextValue }, /* @__PURE__ */ React70.createElement(InfiniteTableComponent, null));
|
|
27528
28257
|
}
|
|
27529
28258
|
var DEFAULT_ROW_HEIGHT = 40;
|
|
27530
28259
|
var DEFAULT_COLUMN_HEADER_HEIGHT = toCSSVarName(columnHeaderHeightName);
|
|
27531
28260
|
var InfiniteTable = function(props) {
|
|
27532
28261
|
const table = (
|
|
27533
28262
|
//@ts-ignore
|
|
27534
|
-
/* @__PURE__ */
|
|
28263
|
+
/* @__PURE__ */ React70.createElement(
|
|
27535
28264
|
InfiniteTableRoot,
|
|
27536
28265
|
{
|
|
27537
28266
|
repeatWrappedGroupRows: !!props.wrapRowsHorizontally,
|
|
@@ -27539,34 +28268,33 @@ var InfiniteTable = function(props) {
|
|
|
27539
28268
|
columnHeaderHeight: DEFAULT_COLUMN_HEADER_HEIGHT,
|
|
27540
28269
|
...props
|
|
27541
28270
|
},
|
|
27542
|
-
/* @__PURE__ */
|
|
28271
|
+
/* @__PURE__ */ React70.createElement(InfiniteTableContextProvider, { children: props.children })
|
|
27543
28272
|
)
|
|
27544
28273
|
);
|
|
27545
28274
|
if (false) {
|
|
27546
|
-
return /* @__PURE__ */
|
|
28275
|
+
return /* @__PURE__ */ React70.createElement(React70.StrictMode, null, table);
|
|
27547
28276
|
}
|
|
27548
28277
|
return table;
|
|
27549
28278
|
};
|
|
27550
28279
|
InfiniteTable.Header = InfiniteTableHeader2;
|
|
27551
28280
|
InfiniteTable.Body = InfiniteTableBody;
|
|
27552
28281
|
InfiniteTable.HScrollSyncContent = HScrollSyncContent;
|
|
27553
|
-
InfiniteTable.Footer = () => /* @__PURE__ */
|
|
28282
|
+
InfiniteTable.Footer = () => /* @__PURE__ */ React70.createElement(InfiniteTableFooter, null);
|
|
27554
28283
|
|
|
27555
28284
|
// src/components/TreeGrid/TreeDataSource.tsx
|
|
27556
|
-
import * as
|
|
28285
|
+
import * as React71 from "react";
|
|
27557
28286
|
function TreeDataSource(props) {
|
|
27558
28287
|
const { DataSource: DataSourceComponent } = useDataSourceInternal({ nodesKey: "children", ...props });
|
|
27559
|
-
return /* @__PURE__ */
|
|
28288
|
+
return /* @__PURE__ */ React71.createElement(DataSourceComponent, null, props.children ?? null);
|
|
27560
28289
|
}
|
|
27561
28290
|
|
|
27562
28291
|
// src/components/TreeGrid/TreeGrid.tsx
|
|
27563
|
-
import * as
|
|
28292
|
+
import * as React72 from "react";
|
|
27564
28293
|
function TreeGrid(props) {
|
|
27565
|
-
return /* @__PURE__ */
|
|
28294
|
+
return /* @__PURE__ */ React72.createElement(InfiniteTable, { ...props });
|
|
27566
28295
|
}
|
|
27567
28296
|
|
|
27568
28297
|
// src/components/DataSource/DataLoader/DataQuery.ts
|
|
27569
|
-
var logger2 = debug("InfiniteTable:DataQuery");
|
|
27570
28298
|
var DataQuery = class {
|
|
27571
28299
|
constructor(debugName) {
|
|
27572
28300
|
this.state = "idle";
|
|
@@ -27580,21 +28308,21 @@ var DataQuery = class {
|
|
|
27580
28308
|
let resolvePending = () => {
|
|
27581
28309
|
};
|
|
27582
28310
|
try {
|
|
27583
|
-
|
|
28311
|
+
this.logger(`Fetching query ${this.debugName}...`);
|
|
27584
28312
|
this.pendingPromise = new Promise((resolve) => {
|
|
27585
28313
|
resolvePending = resolve;
|
|
27586
28314
|
});
|
|
27587
28315
|
this.result = await loadFn(...key);
|
|
27588
28316
|
this.state = "success";
|
|
27589
|
-
} catch (
|
|
28317
|
+
} catch (error4) {
|
|
27590
28318
|
this.result = void 0;
|
|
27591
|
-
this.error =
|
|
28319
|
+
this.error = error4;
|
|
27592
28320
|
this.state = "error";
|
|
27593
28321
|
}
|
|
27594
28322
|
this.doneAt = Date.now();
|
|
27595
28323
|
this.pendingPromise = void 0;
|
|
27596
28324
|
resolvePending(this);
|
|
27597
|
-
|
|
28325
|
+
this.logger(`Fetched query ${this.debugName}. State: ${this.state}.`);
|
|
27598
28326
|
return this.getDoneSnapshot();
|
|
27599
28327
|
};
|
|
27600
28328
|
this.getCurrentSnapshot = () => {
|
|
@@ -27634,6 +28362,7 @@ var DataQuery = class {
|
|
|
27634
28362
|
this.isDone = () => this.state === "success" || this.state === "error";
|
|
27635
28363
|
this.isSuccess = () => this.state === "success";
|
|
27636
28364
|
this.debugName = debugName || "";
|
|
28365
|
+
this.logger = debug(`${debugName}:DataQuery`);
|
|
27637
28366
|
}
|
|
27638
28367
|
};
|
|
27639
28368
|
|
|
@@ -27692,7 +28421,7 @@ var _DataClient = class {
|
|
|
27692
28421
|
this.removeQueryIfErrored(cachedQuery, stringifiedCacheKey);
|
|
27693
28422
|
}
|
|
27694
28423
|
}
|
|
27695
|
-
const dataQuery = new DataQuery(options.name
|
|
28424
|
+
const dataQuery = new DataQuery(`${this.name}:${options.name}`);
|
|
27696
28425
|
this.queryCache.set(stringifiedCacheKey, dataQuery);
|
|
27697
28426
|
dataQuery.fetch(options.fn, options.key);
|
|
27698
28427
|
dataQuery.getCurrentSnapshot().promise?.then(() => {
|
|
@@ -27966,19 +28695,19 @@ var WeakFixedSizeSet = _WeakFixedSizeSet;
|
|
|
27966
28695
|
WeakFixedSizeSet.DEFAULT_SIZE = 10;
|
|
27967
28696
|
|
|
27968
28697
|
// src/components/hooks/useEffectWhenSameDeps.ts
|
|
27969
|
-
import { useEffect as useEffect42, useRef as
|
|
28698
|
+
import { useEffect as useEffect42, useRef as useRef32 } from "react";
|
|
27970
28699
|
var isSameDeps = (deps, prevDeps) => {
|
|
27971
28700
|
return deps.every((dep, index) => dep === prevDeps[index]);
|
|
27972
28701
|
};
|
|
27973
28702
|
var useEffectWhenSameDeps = (callback, deps) => {
|
|
27974
|
-
const depsRef =
|
|
28703
|
+
const depsRef = useRef32(deps);
|
|
27975
28704
|
const sameDeps = isSameDeps(deps, depsRef.current);
|
|
27976
|
-
const isInitialRef =
|
|
28705
|
+
const isInitialRef = useRef32(true);
|
|
27977
28706
|
depsRef.current = deps;
|
|
27978
|
-
const effectDepsRef =
|
|
28707
|
+
const effectDepsRef = useRef32(["same"]);
|
|
27979
28708
|
const effectDeps = sameDeps ? [Date.now()] : effectDepsRef.current;
|
|
27980
28709
|
effectDepsRef.current = effectDeps;
|
|
27981
|
-
const callbackRef =
|
|
28710
|
+
const callbackRef = useRef32(callback);
|
|
27982
28711
|
callbackRef.current = callback;
|
|
27983
28712
|
useEffect42(() => {
|
|
27984
28713
|
if (isInitialRef.current) {
|
|
@@ -27990,7 +28719,7 @@ var useEffectWhenSameDeps = (callback, deps) => {
|
|
|
27990
28719
|
};
|
|
27991
28720
|
|
|
27992
28721
|
// src/components/hooks/useEffectWhen.ts
|
|
27993
|
-
import { useEffect as useEffect43, useRef as
|
|
28722
|
+
import { useEffect as useEffect43, useRef as useRef33 } from "react";
|
|
27994
28723
|
var isSameDeps2 = (deps, prevDeps, compare) => {
|
|
27995
28724
|
return deps.every((dep, index) => {
|
|
27996
28725
|
if (compare) {
|
|
@@ -28001,21 +28730,21 @@ var isSameDeps2 = (deps, prevDeps, compare) => {
|
|
|
28001
28730
|
};
|
|
28002
28731
|
var useEffectWhen = (callback, options) => {
|
|
28003
28732
|
const { same: depsForSame, different: depsForDifferent, compare } = options;
|
|
28004
|
-
const sameDepsRef =
|
|
28005
|
-
const differentDepsRef =
|
|
28733
|
+
const sameDepsRef = useRef33(depsForSame);
|
|
28734
|
+
const differentDepsRef = useRef33(depsForDifferent);
|
|
28006
28735
|
const sameRespected = isSameDeps2(depsForSame, sameDepsRef.current, compare);
|
|
28007
28736
|
const differentRespected = !isSameDeps2(
|
|
28008
28737
|
depsForDifferent,
|
|
28009
28738
|
differentDepsRef.current,
|
|
28010
28739
|
compare
|
|
28011
28740
|
);
|
|
28012
|
-
const isInitialRef =
|
|
28741
|
+
const isInitialRef = useRef33(true);
|
|
28013
28742
|
sameDepsRef.current = depsForSame;
|
|
28014
28743
|
differentDepsRef.current = depsForDifferent;
|
|
28015
|
-
const effectDepsRef =
|
|
28744
|
+
const effectDepsRef = useRef33(["same"]);
|
|
28016
28745
|
const effectDeps = sameRespected && differentRespected ? [Date.now()] : effectDepsRef.current;
|
|
28017
28746
|
effectDepsRef.current = effectDeps;
|
|
28018
|
-
const callbackRef =
|
|
28747
|
+
const callbackRef = useRef33(callback);
|
|
28019
28748
|
callbackRef.current = callback;
|
|
28020
28749
|
if (sameRespected && differentRespected) {
|
|
28021
28750
|
isInitialRef.current = false;
|
|
@@ -28029,12 +28758,12 @@ var useEffectWhen = (callback, options) => {
|
|
|
28029
28758
|
};
|
|
28030
28759
|
|
|
28031
28760
|
// src/components/InfiniteTable/components/InfiniteTableRow/FlashingColumnCell.tsx
|
|
28032
|
-
import * as
|
|
28761
|
+
import * as React73 from "react";
|
|
28033
28762
|
var currentFlashingDurationVar = stripVar(
|
|
28034
28763
|
InternalVars.currentFlashingDuration
|
|
28035
28764
|
);
|
|
28036
28765
|
var defaultRender = ({ children }) => {
|
|
28037
|
-
return /* @__PURE__ */
|
|
28766
|
+
return /* @__PURE__ */ React73.createElement(React73.Fragment, null, children);
|
|
28038
28767
|
};
|
|
28039
28768
|
var DEFAULT_FLASH_DURATION = 1e3;
|
|
28040
28769
|
var INTERNAL_FLASH_CLS_FOR_DIRECTION = {
|
|
@@ -28056,7 +28785,7 @@ var createFlashingColumnCellComponent = (options = {}) => {
|
|
|
28056
28785
|
// fadeClassName,
|
|
28057
28786
|
render = defaultRender
|
|
28058
28787
|
} = options;
|
|
28059
|
-
const FlashingColumnCell2 =
|
|
28788
|
+
const FlashingColumnCell2 = React73.forwardRef(
|
|
28060
28789
|
(props, _ref) => {
|
|
28061
28790
|
const cellContext = useInfiniteColumnCell();
|
|
28062
28791
|
const {
|
|
@@ -28066,13 +28795,13 @@ var createFlashingColumnCellComponent = (options = {}) => {
|
|
|
28066
28795
|
const { domRef, value, column, rowInfo, htmlElementRef } = cellContext;
|
|
28067
28796
|
const rowId = rowInfo.id;
|
|
28068
28797
|
const columnId = column.id;
|
|
28069
|
-
const initialRef =
|
|
28070
|
-
const oldValueRef =
|
|
28798
|
+
const initialRef = React73.useRef(true);
|
|
28799
|
+
const oldValueRef = React73.useRef(value);
|
|
28071
28800
|
const oldValue = initialRef.current ? null : oldValueRef.current;
|
|
28072
28801
|
initialRef.current = false;
|
|
28073
|
-
const flashTimeoutIdRef =
|
|
28074
|
-
const flashDirectionRef =
|
|
28075
|
-
const fadeTimeoutIdRef =
|
|
28802
|
+
const flashTimeoutIdRef = React73.useRef();
|
|
28803
|
+
const flashDirectionRef = React73.useRef();
|
|
28804
|
+
const fadeTimeoutIdRef = React73.useRef();
|
|
28076
28805
|
useEffectWhen(
|
|
28077
28806
|
() => {
|
|
28078
28807
|
if (value === oldValueRef.current) {
|
|
@@ -28119,7 +28848,7 @@ var createFlashingColumnCellComponent = (options = {}) => {
|
|
|
28119
28848
|
different: [value]
|
|
28120
28849
|
}
|
|
28121
28850
|
);
|
|
28122
|
-
return /* @__PURE__ */
|
|
28851
|
+
return /* @__PURE__ */ React73.createElement("div", { ref: domRef, ...props, className: join(props.className) }, render({ children: props.children, oldValue }));
|
|
28123
28852
|
}
|
|
28124
28853
|
);
|
|
28125
28854
|
return FlashingColumnCell2;
|