footprint-explainable-ui 0.14.1 → 0.14.2
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/dist/index.cjs +24 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4091,9 +4091,15 @@ function detectKeyedSteps(data) {
|
|
|
4091
4091
|
const obj = data;
|
|
4092
4092
|
for (const val of Object.values(obj)) {
|
|
4093
4093
|
if (val && typeof val === "object" && !Array.isArray(val)) {
|
|
4094
|
-
const
|
|
4095
|
-
if (
|
|
4096
|
-
|
|
4094
|
+
const entries = Object.entries(val);
|
|
4095
|
+
if (entries.length === 0) continue;
|
|
4096
|
+
const allObjectsWithNumbers = entries.every(([, v2]) => {
|
|
4097
|
+
if (!v2 || typeof v2 !== "object" || Array.isArray(v2)) return false;
|
|
4098
|
+
return Object.values(v2).some((f) => typeof f === "number");
|
|
4099
|
+
});
|
|
4100
|
+
if (allObjectsWithNumbers) {
|
|
4101
|
+
const keyType = entries.some(([k]) => k.includes("#")) ? "runtimeStageId" : "stageName";
|
|
4102
|
+
return { steps: val, keyType };
|
|
4097
4103
|
}
|
|
4098
4104
|
}
|
|
4099
4105
|
}
|
|
@@ -4112,21 +4118,27 @@ function KeyedRecorderView({
|
|
|
4112
4118
|
selectedIndex
|
|
4113
4119
|
}) {
|
|
4114
4120
|
const [showAggregate, setShowAggregate] = (0, import_react19.useState)(false);
|
|
4115
|
-
const
|
|
4116
|
-
const
|
|
4117
|
-
const
|
|
4121
|
+
const detected = (0, import_react19.useMemo)(() => detectKeyedSteps(data), [data]);
|
|
4122
|
+
const visibleKeys = (0, import_react19.useMemo)(() => {
|
|
4123
|
+
const keys = /* @__PURE__ */ new Set();
|
|
4118
4124
|
for (let i = 0; i <= selectedIndex && i < snapshots.length; i++) {
|
|
4119
|
-
const
|
|
4120
|
-
if (
|
|
4125
|
+
const snap = snapshots[i];
|
|
4126
|
+
if (detected?.keyType === "runtimeStageId") {
|
|
4127
|
+
if (snap.runtimeStageId) keys.add(snap.runtimeStageId);
|
|
4128
|
+
} else {
|
|
4129
|
+
if (snap.stageName) keys.add(snap.stageName);
|
|
4130
|
+
if (snap.stageLabel) keys.add(snap.stageLabel);
|
|
4131
|
+
}
|
|
4121
4132
|
}
|
|
4122
|
-
return
|
|
4123
|
-
}, [snapshots, selectedIndex]);
|
|
4133
|
+
return keys;
|
|
4134
|
+
}, [snapshots, selectedIndex, detected?.keyType]);
|
|
4124
4135
|
const isAtEnd = selectedIndex >= snapshots.length - 1;
|
|
4125
|
-
if (!
|
|
4136
|
+
if (!detected) {
|
|
4126
4137
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { padding: 12, fontFamily: theme.fontMono, fontSize: 11, whiteSpace: "pre-wrap", overflow: "auto", height: "100%" }, children: typeof data === "string" ? data : JSON.stringify(data, null, 2) });
|
|
4127
4138
|
}
|
|
4139
|
+
const steps = detected.steps;
|
|
4128
4140
|
const allKeys = Object.keys(steps);
|
|
4129
|
-
const visibleEntries = allKeys.filter((k) =>
|
|
4141
|
+
const visibleEntries = allKeys.filter((k) => visibleKeys.has(k));
|
|
4130
4142
|
const numField = allKeys.length > 0 ? findNumericField(steps[allKeys[0]]) : null;
|
|
4131
4143
|
const numFieldKey = numField?.key ?? "";
|
|
4132
4144
|
let runningTotal = 0;
|