@inkindcards/semantic-layer 2.2.2 → 2.2.4
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/components.cjs +16 -8
- package/dist/components.cjs.map +1 -1
- package/dist/components.js +16 -8
- package/dist/components.js.map +1 -1
- package/package.json +1 -1
package/dist/components.cjs
CHANGED
|
@@ -863,22 +863,27 @@ function Inspectable({
|
|
|
863
863
|
const id = react.useId();
|
|
864
864
|
const wrapperRef = react.useRef(null);
|
|
865
865
|
const [rect, setRect] = react.useState(null);
|
|
866
|
+
const registryRef = react.useRef(registry);
|
|
867
|
+
registryRef.current = registry;
|
|
866
868
|
const inferredColumns = columns ?? (data?.[0] ? Object.keys(data[0]) : []);
|
|
867
869
|
const sampleValues = data?.slice(0, 3) ?? [];
|
|
870
|
+
const columnsKey = inferredColumns.join(",");
|
|
868
871
|
react.useEffect(() => {
|
|
869
|
-
|
|
870
|
-
|
|
872
|
+
const reg = registryRef.current;
|
|
873
|
+
if (!reg) return;
|
|
874
|
+
reg.register({
|
|
871
875
|
id,
|
|
872
876
|
label,
|
|
873
877
|
currentSource,
|
|
874
|
-
columns:
|
|
878
|
+
columns: columnsKey.split(",").filter(Boolean),
|
|
875
879
|
sampleValues,
|
|
876
880
|
element: wrapperRef.current
|
|
877
881
|
});
|
|
878
|
-
return () =>
|
|
879
|
-
}, [id, label, currentSource,
|
|
882
|
+
return () => reg.unregister(id);
|
|
883
|
+
}, [id, label, currentSource, columnsKey]);
|
|
884
|
+
const inspectActive = registry?.inspectActive ?? false;
|
|
880
885
|
react.useEffect(() => {
|
|
881
|
-
if (!
|
|
886
|
+
if (!inspectActive || !wrapperRef.current) {
|
|
882
887
|
setRect(null);
|
|
883
888
|
return;
|
|
884
889
|
}
|
|
@@ -896,8 +901,11 @@ function Inspectable({
|
|
|
896
901
|
window.removeEventListener("resize", measure);
|
|
897
902
|
clearInterval(interval);
|
|
898
903
|
};
|
|
899
|
-
}, [
|
|
904
|
+
}, [inspectActive]);
|
|
900
905
|
if (!registry) {
|
|
906
|
+
console.warn(
|
|
907
|
+
`[SemanticLayer] <Inspectable label="${label}"> has no <DataInspector> ancestor. Make sure <DataInspector> wraps your app content, not self-closing: <DataInspector>{children}</DataInspector>`
|
|
908
|
+
);
|
|
901
909
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
902
910
|
}
|
|
903
911
|
const isSelected = registry.selectedId === id;
|
|
@@ -1113,7 +1121,7 @@ function ToggleButton({
|
|
|
1113
1121
|
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
1114
1122
|
] }),
|
|
1115
1123
|
active ? "Inspecting" : "Inspect Data",
|
|
1116
|
-
|
|
1124
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1117
1125
|
"span",
|
|
1118
1126
|
{
|
|
1119
1127
|
style: {
|