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