@inkindcards/semantic-layer 2.2.2 → 2.2.3
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 +12 -7
- package/dist/components.cjs.map +1 -1
- package/dist/components.js +12 -7
- 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,7 +901,7 @@ function Inspectable({
|
|
|
896
901
|
window.removeEventListener("resize", measure);
|
|
897
902
|
clearInterval(interval);
|
|
898
903
|
};
|
|
899
|
-
}, [
|
|
904
|
+
}, [inspectActive]);
|
|
900
905
|
if (!registry) {
|
|
901
906
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
902
907
|
}
|