@unovis/react 1.5.1-ql.2 → 1.5.1-xplg.0
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/components/graph/index.d.ts +1 -0
- package/components/treemap/index.d.ts +11 -0
- package/components/treemap/index.js +31 -0
- package/components/treemap/index.js.map +1 -0
- package/components.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +2 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
import { Treemap, TreemapConfigInterface } from '@unovis/ts';
|
|
3
|
+
export declare type VisTreemapRef<Datum> = {
|
|
4
|
+
component?: Treemap<Datum>;
|
|
5
|
+
};
|
|
6
|
+
export declare type VisTreemapProps<Datum> = TreemapConfigInterface<Datum> & {
|
|
7
|
+
data?: Datum[];
|
|
8
|
+
ref?: Ref<VisTreemapRef<Datum>>;
|
|
9
|
+
};
|
|
10
|
+
export declare const VisTreemapSelectors: typeof import("@unovis/ts/lib/components/treemap/style");
|
|
11
|
+
export declare const VisTreemap: (<Datum>(props: VisTreemapProps<Datum>) => JSX.Element | null);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useImperativeHandle } from 'react';
|
|
2
|
+
import { Treemap } from '@unovis/ts';
|
|
3
|
+
import { arePropsEqual } from '../../utils/react.js';
|
|
4
|
+
|
|
5
|
+
const VisTreemapSelectors = Treemap.selectors;
|
|
6
|
+
function VisTreemapFC(props, fRef) {
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
const componentRef = useRef(undefined);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const element = ref.current;
|
|
11
|
+
const c = new Treemap(props);
|
|
12
|
+
componentRef.current = c;
|
|
13
|
+
element.__component__ = c;
|
|
14
|
+
return () => {
|
|
15
|
+
componentRef.current = undefined;
|
|
16
|
+
c.destroy();
|
|
17
|
+
};
|
|
18
|
+
}, []);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const component = componentRef.current;
|
|
21
|
+
if (props.data)
|
|
22
|
+
component === null || component === void 0 ? void 0 : component.setData(props.data);
|
|
23
|
+
component === null || component === void 0 ? void 0 : component.setConfig(props);
|
|
24
|
+
});
|
|
25
|
+
useImperativeHandle(fRef, () => ({ get component() { return componentRef.current; } }), []);
|
|
26
|
+
return React.createElement("vis-component", { ref: ref });
|
|
27
|
+
}
|
|
28
|
+
const VisTreemap = React.memo(React.forwardRef(VisTreemapFC), arePropsEqual);
|
|
29
|
+
|
|
30
|
+
export { VisTreemap, VisTreemapSelectors };
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/treemap/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Treemap, TreemapConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisTreemapRef<Datum> = {\n component?: Treemap<Datum>;\n}\n\nexport type VisTreemapProps<Datum> = TreemapConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisTreemapRef<Datum>>;\n}\n\nexport const VisTreemapSelectors = Treemap.selectors\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisTreemapFC<Datum> (props: VisTreemapProps<Datum>, fRef: ForwardedRef<VisTreemapRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Treemap<Datum>>>(null)\n const componentRef = useRef<Treemap<Datum> | undefined>(undefined)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Treemap<Datum>>)\n\n const c = new Treemap<Datum>(props)\n componentRef.current = c\n element.__component__ = c\n\n return () => {\n componentRef.current = undefined\n c.destroy()\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 VisTreemap: (<Datum>(props: VisTreemapProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisTreemapFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAmBa,MAAA,mBAAmB,GAAG,OAAO,CAAC,UAAS;AAGpD,SAAS,YAAY,CAAS,KAA6B,EAAE,IAAwC,EAAA;AACnG,IAAA,MAAM,GAAG,GAAG,MAAM,CAAsC,IAAI,CAAC,CAAA;AAC7D,IAAA,MAAM,YAAY,GAAG,MAAM,CAA6B,SAAS,CAAC,CAAA;IAGlE,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA+C,CAAA;AAEpE,QAAA,MAAM,CAAC,GAAG,IAAI,OAAO,CAAQ,KAAK,CAAC,CAAA;AACnC,QAAA,YAAY,CAAC,OAAO,GAAG,CAAC,CAAA;AACxB,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAK;AACV,YAAA,YAAY,CAAC,OAAO,GAAG,SAAS,CAAA;YAChC,CAAC,CAAC,OAAO,EAAE,CAAA;AACb,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,UAAU,GAAmE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,aAAa;;;;"}
|
package/components.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './components/timeline/';
|
|
|
17
17
|
export * from './components/topojson-map/';
|
|
18
18
|
export * from './components/xy-labels';
|
|
19
19
|
export * from './components/annotations';
|
|
20
|
+
export * from './components/treemap';
|
|
20
21
|
export * from './html-components/bullet-legend';
|
|
21
22
|
export * from './html-components/leaflet-map';
|
|
22
23
|
export * from './html-components/leaflet-flow-map';
|
package/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export { VisTimeline, VisTimelineSelectors } from './components/timeline/index.j
|
|
|
19
19
|
export { VisTopoJSONMap, VisTopoJSONMapSelectors } from './components/topojson-map/index.js';
|
|
20
20
|
export { VisXYLabels, VisXYLabelsSelectors } from './components/xy-labels/index.js';
|
|
21
21
|
export { VisAnnotations, VisAnnotationsSelectors } from './components/annotations/index.js';
|
|
22
|
+
export { VisTreemap, VisTreemapSelectors } from './components/treemap/index.js';
|
|
22
23
|
export { VisBulletLegend, VisBulletLegendSelectors } from './html-components/bullet-legend/index.js';
|
|
23
24
|
export { VisLeafletMap, VisLeafletMapSelectors } from './html-components/leaflet-map/index.js';
|
|
24
25
|
export { VisLeafletFlowMap, VisLeafletFlowMapSelectors } from './html-components/leaflet-flow-map/index.js';
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unovis/react",
|
|
3
3
|
"description": "Modular data visualization framework for React, Angular, Svelte, Vue, Solid, and vanilla TypeScript or JavaScript",
|
|
4
|
-
"version": "1.5.1-
|
|
5
|
-
"packageManager": "npm@10.9.1",
|
|
4
|
+
"version": "1.5.1-xplg.0",
|
|
6
5
|
"repository": {
|
|
7
6
|
"type": "git",
|
|
8
7
|
"url": "https://github.com/f5/unovis.git",
|
|
@@ -36,7 +35,7 @@
|
|
|
36
35
|
"publish:dist": "rm -rf dist/.cache; cp ./{LICENSE,README.md,package.json} ./dist; cd ./dist; npm publish"
|
|
37
36
|
},
|
|
38
37
|
"peerDependencies": {
|
|
39
|
-
"@unovis/ts": "1.5.0",
|
|
38
|
+
"@unovis/ts": "1.5.1-xplg.0",
|
|
40
39
|
"react": ">=16.8.0 || ^17 || ^18 || ^19",
|
|
41
40
|
"react-dom": ">=16.8.0 || ^17 || ^18 || ^19"
|
|
42
41
|
},
|