@unovis/react 1.4.0-alpha.11 → 1.4.0-alpha.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.
|
@@ -9,11 +9,10 @@ function VisGraphFC(props, fRef) {
|
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
var _a;
|
|
11
11
|
const element = ref.current;
|
|
12
|
-
|
|
13
|
-
element.__component__ =
|
|
12
|
+
const component = (_a = componentRef.current) !== null && _a !== void 0 ? _a : new Graph(props);
|
|
13
|
+
element.__component__ = component;
|
|
14
14
|
return () => {
|
|
15
|
-
|
|
16
|
-
(_a = componentRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
15
|
+
component.destroy();
|
|
17
16
|
componentRef.current = undefined;
|
|
18
17
|
};
|
|
19
18
|
}, []);
|
|
@@ -23,7 +22,7 @@ function VisGraphFC(props, fRef) {
|
|
|
23
22
|
component === null || component === void 0 ? void 0 : component.setData(props.data);
|
|
24
23
|
component === null || component === void 0 ? void 0 : component.setConfig(props);
|
|
25
24
|
});
|
|
26
|
-
useImperativeHandle(fRef, () => ({ component
|
|
25
|
+
useImperativeHandle(fRef, () => ({ get component() { return componentRef.current; } }), []);
|
|
27
26
|
return React.createElement("vis-component", { ref: ref });
|
|
28
27
|
}
|
|
29
28
|
const VisGraph = React.memo(React.forwardRef(VisGraphFC), arePropsEqual);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/graph/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Graph, GraphConfigInterface, GraphInputNode, GraphInputLink } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisGraphRef<N extends GraphInputNode, L extends GraphInputLink> = {\n component?: Graph<N, L>;\n}\n\nexport type VisGraphProps<N extends GraphInputNode, L extends GraphInputLink> = GraphConfigInterface<N, L> & {\n data?: { nodes: N[]; links?: L[] };\n ref?: Ref<VisGraphRef<N, L>>;\n}\n\nexport const VisGraphSelectors = Graph.selectors\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisGraphFC<N extends GraphInputNode, L extends GraphInputLink> (props: VisGraphProps<N, L>, fRef: ForwardedRef<VisGraphRef<N, L>>): JSX.Element {\n const ref = useRef<VisComponentElement<Graph<N, L>>>(null)\n const componentRef = useRef<Graph<N, L> | undefined>(new Graph<N, L>(props))\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Graph<N, L>>)\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/graph/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Graph, GraphConfigInterface, GraphInputNode, GraphInputLink } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisGraphRef<N extends GraphInputNode, L extends GraphInputLink> = {\n component?: Graph<N, L>;\n}\n\nexport type VisGraphProps<N extends GraphInputNode, L extends GraphInputLink> = GraphConfigInterface<N, L> & {\n data?: { nodes: N[]; links?: L[] };\n ref?: Ref<VisGraphRef<N, L>>;\n}\n\nexport const VisGraphSelectors = Graph.selectors\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisGraphFC<N extends GraphInputNode, L extends GraphInputLink> (props: VisGraphProps<N, L>, fRef: ForwardedRef<VisGraphRef<N, L>>): JSX.Element {\n const ref = useRef<VisComponentElement<Graph<N, L>>>(null)\n const componentRef = useRef<Graph<N, L> | undefined>(new Graph<N, L>(props))\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Graph<N, L>>)\n const component = componentRef.current ?? new Graph<N, L>(props)\n element.__component__ = component\n\n return () => {\n component.destroy()\n componentRef.current = undefined\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = componentRef.current\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ get component () { return componentRef.current } }), [])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisGraph: (<N extends GraphInputNode, L extends GraphInputLink>(props: VisGraphProps<N, L>) => JSX.Element | null) = React.memo(React.forwardRef(VisGraphFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAmBa,MAAA,iBAAiB,GAAG,KAAK,CAAC,UAAS;AAGhD,SAAS,UAAU,CAAsD,KAA0B,EAAE,IAAqC,EAAA;AACxI,IAAA,MAAM,GAAG,GAAG,MAAM,CAAmC,IAAI,CAAC,CAAA;IAC1D,MAAM,YAAY,GAAG,MAAM,CAA0B,IAAI,KAAK,CAAO,KAAK,CAAC,CAAC,CAAA;IAG5E,SAAS,CAAC,MAAK;;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA4C,CAAA;AACjE,QAAA,MAAM,SAAS,GAAG,CAAA,EAAA,GAAA,YAAY,CAAC,OAAO,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,IAAI,KAAK,CAAO,KAAK,CAAC,CAAA;AAChE,QAAA,OAAO,CAAC,aAAa,GAAG,SAAS,CAAA;AAEjC,QAAA,OAAO,MAAK;YACV,SAAS,CAAC,OAAO,EAAE,CAAA;AACnB,YAAA,YAAY,CAAC,OAAO,GAAG,SAAS,CAAA;AAClC,SAAC,CAAA;KACF,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAA;QACtC,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;IAEF,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,SAAS,GAAA,EAAM,OAAO,YAAY,CAAC,OAAO,CAAA,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;AAC3F,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,QAAQ,GAA6G,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,aAAa;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unovis/react",
|
|
3
3
|
"description": "Modular data visualization framework for React, Angular, Svelte, and vanilla TypeScript or JavaScript",
|
|
4
|
-
"version": "1.4.0-alpha.
|
|
4
|
+
"version": "1.4.0-alpha.12",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/f5/unovis.git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"publish:dist": "rm -rf dist/.cache; cp ./{LICENSE,README.md,package.json} ./dist; cd ./dist; npm publish"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@unovis/ts": "1.4.0-alpha.
|
|
38
|
+
"@unovis/ts": "1.4.0-alpha.12",
|
|
39
39
|
"react": ">=16.8.0 || ^17 || ^18",
|
|
40
40
|
"react-dom": ">=16.8.0 || ^17 || ^18"
|
|
41
41
|
},
|