@antv/gpt-vis 0.0.6 → 0.2.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/LICENSE +21 -0
- package/README.md +92 -50
- package/README.zh-CN.md +138 -0
- package/dist/cjs/Area/index.d.ts +8 -2
- package/dist/cjs/Area/index.js +17 -16
- package/dist/cjs/Bar/index.d.ts +11 -0
- package/dist/cjs/Bar/index.js +65 -0
- package/dist/cjs/ChartCodeRender/Loading.d.ts +3 -0
- package/dist/cjs/ChartCodeRender/Loading.js +54 -0
- package/dist/cjs/ChartCodeRender/VisChart.d.ts +11 -0
- package/dist/cjs/ChartCodeRender/VisChart.js +84 -0
- package/dist/cjs/ChartCodeRender/index.d.ts +3 -4
- package/dist/cjs/ChartCodeRender/index.js +24 -68
- package/dist/cjs/ChartCodeRender/type.d.ts +9 -11
- package/dist/cjs/Column/index.d.ts +8 -2
- package/dist/cjs/Column/index.js +19 -27
- package/dist/cjs/ConfigProvider/context.d.ts +3 -0
- package/dist/cjs/ConfigProvider/context.js +41 -0
- package/dist/cjs/ConfigProvider/hooks/index.d.ts +1 -0
- package/dist/cjs/ConfigProvider/hooks/index.js +23 -0
- package/dist/cjs/ConfigProvider/hooks/useConfig.d.ts +13 -0
- package/dist/cjs/ConfigProvider/hooks/useConfig.js +108 -0
- package/dist/cjs/ConfigProvider/index.d.ts +2 -5
- package/dist/cjs/ConfigProvider/index.js +15 -9
- package/dist/cjs/DualAxes/index.d.ts +15 -0
- package/dist/cjs/DualAxes/index.js +71 -0
- package/dist/cjs/DualAxes/util.d.ts +9 -0
- package/dist/cjs/DualAxes/util.js +73 -0
- package/dist/cjs/FlowDiagram/index.d.ts +6 -0
- package/dist/cjs/FlowDiagram/index.js +100 -0
- package/dist/cjs/GPTVis/Lite.d.ts +10 -0
- package/dist/cjs/GPTVis/Lite.js +54 -0
- package/dist/cjs/GPTVis/index.d.ts +4 -8
- package/dist/cjs/GPTVis/index.js +4 -4
- package/dist/cjs/HeatMap/index.d.ts +7 -7
- package/dist/cjs/HeatMap/index.js +13 -26
- package/dist/cjs/Histogram/index.d.ts +10 -0
- package/dist/cjs/Histogram/index.js +51 -0
- package/dist/cjs/IndentedTree/index.d.ts +6 -0
- package/dist/cjs/IndentedTree/index.js +63 -0
- package/dist/cjs/Line/index.d.ts +8 -6
- package/dist/cjs/Line/index.js +15 -16
- package/dist/cjs/Map/data.json +305 -0
- package/dist/cjs/Map/index.d.ts +5 -0
- package/dist/cjs/Map/index.js +68 -0
- package/dist/cjs/MindMap/index.d.ts +6 -0
- package/dist/cjs/MindMap/index.js +64 -0
- package/dist/cjs/NetworkGraph/index.d.ts +6 -0
- package/dist/cjs/NetworkGraph/index.js +72 -0
- package/dist/cjs/OrganizationChart/index.d.ts +6 -0
- package/dist/cjs/OrganizationChart/index.js +93 -0
- package/dist/cjs/PathMap/index.d.ts +3 -9
- package/dist/cjs/PathMap/index.js +19 -109
- package/dist/cjs/Pie/index.d.ts +7 -5
- package/dist/cjs/Pie/index.js +17 -13
- package/dist/cjs/PinMap/index.d.ts +3 -9
- package/dist/cjs/PinMap/index.js +6 -85
- package/dist/cjs/Radar/index.d.ts +11 -0
- package/dist/cjs/Radar/index.js +84 -0
- package/dist/cjs/Scatter/index.d.ts +11 -0
- package/dist/cjs/Scatter/index.js +57 -0
- package/dist/cjs/Text/VisText.d.ts +4 -0
- package/dist/cjs/Text/VisText.js +74 -0
- package/dist/cjs/Text/config.d.ts +18 -0
- package/dist/cjs/Text/config.js +91 -0
- package/dist/cjs/Text/constants.d.ts +9 -0
- package/dist/cjs/Text/constants.js +37 -0
- package/dist/cjs/Text/custom-icons/index.d.ts +3 -0
- package/dist/cjs/Text/custom-icons/index.js +66 -0
- package/dist/cjs/Text/index.d.ts +3 -0
- package/dist/cjs/Text/index.js +42 -0
- package/dist/cjs/Text/mini-charts/hooks/getElementFontSize.d.ts +1 -0
- package/dist/cjs/Text/mini-charts/hooks/getElementFontSize.js +65 -0
- package/dist/cjs/Text/mini-charts/hooks/index.d.ts +1 -0
- package/dist/cjs/Text/mini-charts/hooks/index.js +29 -0
- package/dist/cjs/Text/mini-charts/hooks/useSvgWrapper.d.ts +5 -0
- package/dist/cjs/Text/mini-charts/hooks/useSvgWrapper.js +65 -0
- package/dist/cjs/Text/mini-charts/index.d.ts +2 -0
- package/dist/cjs/Text/mini-charts/index.js +25 -0
- package/dist/cjs/Text/mini-charts/line/SingleLineChart.d.ts +3 -0
- package/dist/cjs/Text/mini-charts/line/SingleLineChart.js +63 -0
- package/dist/cjs/Text/mini-charts/line/index.d.ts +1 -0
- package/dist/cjs/Text/mini-charts/line/index.js +29 -0
- package/dist/cjs/Text/mini-charts/line/scaleLinear.d.ts +4 -0
- package/dist/cjs/Text/mini-charts/line/scaleLinear.js +35 -0
- package/dist/cjs/Text/mini-charts/line/useLineCompute.d.ts +6 -0
- package/dist/cjs/Text/mini-charts/line/useLineCompute.js +103 -0
- package/dist/cjs/Text/mini-charts/proportion/getArcPath.d.ts +1 -0
- package/dist/cjs/Text/mini-charts/proportion/getArcPath.js +51 -0
- package/dist/cjs/Text/mini-charts/proportion/index.d.ts +3 -0
- package/dist/cjs/Text/mini-charts/proportion/index.js +72 -0
- package/dist/cjs/Text/types.d.ts +20 -0
- package/dist/cjs/Text/types.js +17 -0
- package/dist/cjs/Treemap/index.d.ts +11 -0
- package/dist/cjs/Treemap/index.js +73 -0
- package/dist/cjs/WordCloud/index.d.ts +4 -5
- package/dist/cjs/WordCloud/index.js +7 -15
- package/dist/cjs/constants/index.d.ts +1 -3
- package/dist/cjs/constants/index.js +4 -35
- package/dist/cjs/export.d.ts +28 -0
- package/dist/cjs/export.js +116 -0
- package/dist/cjs/index.d.ts +10 -11
- package/dist/cjs/index.js +9 -25
- package/dist/cjs/types/chart.d.ts +49 -14
- package/dist/cjs/types/chart.js +12 -0
- package/dist/cjs/types/config.d.ts +16 -0
- package/dist/cjs/types/index.d.ts +1 -1
- package/dist/cjs/types/index.js +0 -9
- package/dist/cjs/types/map.d.ts +242 -0
- package/dist/cjs/types/map.js +17 -0
- package/dist/cjs/utils/config.d.ts +5 -5
- package/dist/cjs/utils/config.js +41 -24
- package/dist/cjs/utils/graph.d.ts +18 -0
- package/dist/cjs/utils/graph.js +64 -0
- package/dist/cjs/utils/index.d.ts +1 -1
- package/dist/cjs/utils/index.js +3 -13
- package/dist/cjs/utils/map/context.d.ts +3 -0
- package/dist/cjs/utils/map/context.js +42 -0
- package/dist/cjs/utils/map/controls.d.ts +0 -0
- package/dist/cjs/utils/map/controls.js +0 -0
- package/dist/cjs/utils/map/index.d.ts +6 -0
- package/dist/cjs/utils/map/index.js +33 -0
- package/dist/cjs/utils/map/markers.d.ts +2 -0
- package/dist/cjs/utils/map/markers.js +88 -0
- package/dist/cjs/utils/map/polyline.d.ts +2 -0
- package/dist/cjs/utils/map/polyline.js +52 -0
- package/dist/cjs/utils/map/style.d.ts +45 -0
- package/dist/cjs/utils/map/style.js +112 -0
- package/dist/cjs/utils/map/util.d.ts +1 -0
- package/dist/cjs/utils/map/util.js +38 -0
- package/dist/cjs/utils/map/view.d.ts +3 -0
- package/dist/cjs/utils/map/view.js +93 -0
- package/dist/cjs/utils/plot.d.ts +4 -0
- package/dist/cjs/utils/plot.js +69 -0
- package/dist/cjs/version.d.ts +2 -0
- package/dist/cjs/version.js +25 -0
- package/dist/esm/Area/index.d.ts +8 -2
- package/dist/esm/Area/index.js +21 -27
- package/dist/esm/Bar/index.d.ts +11 -0
- package/dist/esm/Bar/index.js +35 -0
- package/dist/esm/ChartCodeRender/Loading.d.ts +3 -0
- package/dist/esm/ChartCodeRender/Loading.js +20 -0
- package/dist/esm/ChartCodeRender/VisChart.d.ts +11 -0
- package/dist/esm/ChartCodeRender/VisChart.js +65 -0
- package/dist/esm/ChartCodeRender/index.d.ts +3 -4
- package/dist/esm/ChartCodeRender/index.js +28 -84
- package/dist/esm/ChartCodeRender/type.d.ts +9 -11
- package/dist/esm/Column/index.d.ts +8 -2
- package/dist/esm/Column/index.js +22 -27
- package/dist/esm/ConfigProvider/context.d.ts +3 -0
- package/dist/esm/ConfigProvider/context.js +3 -0
- package/dist/esm/ConfigProvider/hooks/index.d.ts +1 -0
- package/dist/esm/ConfigProvider/hooks/index.js +1 -0
- package/dist/esm/ConfigProvider/hooks/useConfig.d.ts +13 -0
- package/dist/esm/ConfigProvider/hooks/useConfig.js +57 -0
- package/dist/esm/ConfigProvider/index.d.ts +2 -5
- package/dist/esm/ConfigProvider/index.js +9 -9
- package/dist/esm/DualAxes/index.d.ts +15 -0
- package/dist/esm/DualAxes/index.js +44 -0
- package/dist/esm/DualAxes/util.d.ts +9 -0
- package/dist/esm/DualAxes/util.js +61 -0
- package/dist/esm/FlowDiagram/index.d.ts +6 -0
- package/dist/esm/FlowDiagram/index.js +75 -0
- package/dist/esm/GPTVis/Lite.d.ts +10 -0
- package/dist/esm/GPTVis/Lite.js +18 -0
- package/dist/esm/GPTVis/index.d.ts +4 -8
- package/dist/esm/GPTVis/index.js +5 -5
- package/dist/esm/HeatMap/index.d.ts +7 -7
- package/dist/esm/HeatMap/index.js +19 -27
- package/dist/esm/Histogram/index.d.ts +10 -0
- package/dist/esm/Histogram/index.js +25 -0
- package/dist/esm/IndentedTree/index.d.ts +6 -0
- package/dist/esm/IndentedTree/index.js +47 -0
- package/dist/esm/Line/index.d.ts +8 -6
- package/dist/esm/Line/index.js +17 -23
- package/dist/esm/Map/data.json +305 -0
- package/dist/esm/Map/index.d.ts +5 -0
- package/dist/esm/Map/index.js +60 -0
- package/dist/esm/MindMap/index.d.ts +6 -0
- package/dist/esm/MindMap/index.js +48 -0
- package/dist/esm/NetworkGraph/index.d.ts +6 -0
- package/dist/esm/NetworkGraph/index.js +57 -0
- package/dist/esm/OrganizationChart/index.d.ts +6 -0
- package/dist/esm/OrganizationChart/index.js +64 -0
- package/dist/esm/PathMap/index.d.ts +3 -9
- package/dist/esm/PathMap/index.js +32 -129
- package/dist/esm/Pie/index.d.ts +7 -5
- package/dist/esm/Pie/index.js +24 -20
- package/dist/esm/PinMap/index.d.ts +3 -9
- package/dist/esm/PinMap/index.js +18 -104
- package/dist/esm/Radar/index.d.ts +11 -0
- package/dist/esm/Radar/index.js +54 -0
- package/dist/esm/Scatter/index.d.ts +11 -0
- package/dist/esm/Scatter/index.js +30 -0
- package/dist/esm/Text/VisText.d.ts +4 -0
- package/dist/esm/Text/VisText.js +38 -0
- package/dist/esm/Text/config.d.ts +18 -0
- package/dist/esm/Text/config.js +79 -0
- package/dist/esm/Text/constants.d.ts +9 -0
- package/dist/esm/Text/constants.js +9 -0
- package/dist/esm/Text/custom-icons/index.d.ts +3 -0
- package/dist/esm/Text/custom-icons/index.js +37 -0
- package/dist/esm/Text/index.d.ts +3 -0
- package/dist/esm/Text/index.js +2 -0
- package/dist/esm/Text/mini-charts/hooks/getElementFontSize.d.ts +1 -0
- package/dist/esm/Text/mini-charts/hooks/getElementFontSize.js +32 -0
- package/dist/esm/Text/mini-charts/hooks/index.d.ts +1 -0
- package/dist/esm/Text/mini-charts/hooks/index.js +1 -0
- package/dist/esm/Text/mini-charts/hooks/useSvgWrapper.d.ts +5 -0
- package/dist/esm/Text/mini-charts/hooks/useSvgWrapper.js +31 -0
- package/dist/esm/Text/mini-charts/index.d.ts +2 -0
- package/dist/esm/Text/mini-charts/index.js +2 -0
- package/dist/esm/Text/mini-charts/line/SingleLineChart.d.ts +3 -0
- package/dist/esm/Text/mini-charts/line/SingleLineChart.js +57 -0
- package/dist/esm/Text/mini-charts/line/index.d.ts +1 -0
- package/dist/esm/Text/mini-charts/line/index.js +1 -0
- package/dist/esm/Text/mini-charts/line/scaleLinear.d.ts +4 -0
- package/dist/esm/Text/mini-charts/line/scaleLinear.js +14 -0
- package/dist/esm/Text/mini-charts/line/useLineCompute.d.ts +6 -0
- package/dist/esm/Text/mini-charts/line/useLineCompute.js +106 -0
- package/dist/esm/Text/mini-charts/proportion/getArcPath.d.ts +1 -0
- package/dist/esm/Text/mini-charts/proportion/getArcPath.js +19 -0
- package/dist/esm/Text/mini-charts/proportion/index.d.ts +3 -0
- package/dist/esm/Text/mini-charts/proportion/index.js +60 -0
- package/dist/esm/Text/types.d.ts +20 -0
- package/dist/esm/Text/types.js +1 -0
- package/dist/esm/Treemap/index.d.ts +11 -0
- package/dist/esm/Treemap/index.js +52 -0
- package/dist/esm/WordCloud/index.d.ts +4 -5
- package/dist/esm/WordCloud/index.js +8 -18
- package/dist/esm/constants/index.d.ts +1 -3
- package/dist/esm/constants/index.js +5 -14
- package/dist/esm/export.d.ts +28 -0
- package/dist/esm/export.js +33 -0
- package/dist/esm/index.d.ts +10 -11
- package/dist/esm/index.js +9 -9
- package/dist/esm/types/chart.d.ts +49 -14
- package/dist/esm/types/chart.js +12 -0
- package/dist/esm/types/config.d.ts +16 -0
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/esm/types/index.js +1 -1
- package/dist/esm/types/map.d.ts +242 -0
- package/dist/esm/types/map.js +1 -0
- package/dist/esm/utils/config.d.ts +5 -5
- package/dist/esm/utils/config.js +40 -18
- package/dist/esm/utils/graph.d.ts +18 -0
- package/dist/esm/utils/graph.js +49 -0
- package/dist/esm/utils/index.d.ts +1 -1
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/map/context.d.ts +3 -0
- package/dist/esm/utils/map/context.js +34 -0
- package/dist/esm/utils/map/controls.d.ts +0 -0
- package/dist/esm/utils/map/controls.js +0 -0
- package/dist/esm/utils/map/index.d.ts +6 -0
- package/dist/esm/utils/map/index.js +6 -0
- package/dist/esm/utils/map/markers.d.ts +2 -0
- package/dist/esm/utils/map/markers.js +64 -0
- package/dist/esm/utils/map/polyline.d.ts +2 -0
- package/dist/esm/utils/map/polyline.js +26 -0
- package/dist/esm/utils/map/style.d.ts +45 -0
- package/dist/esm/utils/map/style.js +76 -0
- package/dist/esm/utils/map/util.d.ts +1 -0
- package/dist/esm/utils/map/util.js +11 -0
- package/dist/esm/utils/map/view.d.ts +3 -0
- package/dist/esm/utils/map/view.js +81 -0
- package/dist/esm/utils/plot.d.ts +4 -0
- package/dist/esm/utils/plot.js +65 -0
- package/dist/esm/version.d.ts +2 -0
- package/dist/esm/version.js +1 -0
- package/dist/umd/895.async.js +1 -0
- package/dist/umd/index.min.js +1 -0
- package/package.json +97 -58
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/********** plot chart **********/
|
|
3
|
+
import { default as Area, type AreaProps } from './Area';
|
|
4
|
+
import { default as Bar, type BarProps } from './Bar';
|
|
5
|
+
import { default as Column, type ColumnProps } from './Column';
|
|
6
|
+
import { default as DualAxes, type DualAxesProps } from './DualAxes';
|
|
7
|
+
import { default as HeatMap, type HeatMapProps } from './HeatMap';
|
|
8
|
+
import { default as Histogram, type HistogramProps } from './Histogram';
|
|
9
|
+
import { default as Line, type LineProps } from './Line';
|
|
10
|
+
import { default as Pie, type PieProps } from './Pie';
|
|
11
|
+
import { default as Radar, type RadarProps } from './Radar';
|
|
12
|
+
import { default as Scatter, type ScatterProps } from './Scatter';
|
|
13
|
+
import { default as Treemap, type TreemapProps } from './Treemap';
|
|
14
|
+
import { default as WordCloud, type WordCloudProps } from './WordCloud';
|
|
15
|
+
/********** graph chart **********/
|
|
16
|
+
import { default as FlowDiagram, type FlowDiagramProps } from './FlowDiagram';
|
|
17
|
+
import { default as MindMap, type MindMapProps } from './MindMap';
|
|
18
|
+
import { default as NetworkGraph, type NetworkGraphProps } from './NetworkGraph';
|
|
19
|
+
import { default as PathMap, type PathMapProps } from './PathMap';
|
|
20
|
+
import { default as PinMap, type PinMapProps } from './PinMap';
|
|
21
|
+
export { default as IndentedTree, type IndentedTreeProps } from './IndentedTree';
|
|
22
|
+
export { default as OrganizationChart, type OrganizationChartProps } from './OrganizationChart';
|
|
23
|
+
/********** map chart **********/
|
|
24
|
+
export { default as Map, type MapProps } from './Map';
|
|
25
|
+
/********** NTV **********/
|
|
26
|
+
export { VisText, type VisTextProps } from './Text';
|
|
27
|
+
export { Area, Bar, Column, DualAxes, FlowDiagram, HeatMap, Histogram, Line, MindMap, NetworkGraph, PathMap, Pie, PinMap, Radar, Scatter, Treemap, WordCloud, type AreaProps, type BarProps, type ColumnProps, type DualAxesProps, type FlowDiagramProps, type HeatMapProps, type HistogramProps, type LineProps, type MindMapProps, type NetworkGraphProps, type PathMapProps, type PieProps, type PinMapProps, type RadarProps, type ScatterProps, type TreemapProps, type WordCloudProps, };
|
|
28
|
+
export declare const DEFAULT_CHART_COMPONENTS: Record<string, React.FC<any>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
var _DEFAULT_CHART_COMPON;
|
|
3
|
+
/********** plot chart **********/
|
|
4
|
+
import { default as Area } from "./Area";
|
|
5
|
+
import { default as Bar } from "./Bar";
|
|
6
|
+
import { default as Column } from "./Column";
|
|
7
|
+
import { default as DualAxes } from "./DualAxes";
|
|
8
|
+
import { default as HeatMap } from "./HeatMap";
|
|
9
|
+
import { default as Histogram } from "./Histogram";
|
|
10
|
+
import { default as Line } from "./Line";
|
|
11
|
+
import { default as Pie } from "./Pie";
|
|
12
|
+
import { default as Radar } from "./Radar";
|
|
13
|
+
import { default as Scatter } from "./Scatter";
|
|
14
|
+
import { default as Treemap } from "./Treemap";
|
|
15
|
+
import { default as WordCloud } from "./WordCloud";
|
|
16
|
+
|
|
17
|
+
/********** graph chart **********/
|
|
18
|
+
import { default as FlowDiagram } from "./FlowDiagram";
|
|
19
|
+
import { default as MindMap } from "./MindMap";
|
|
20
|
+
import { default as NetworkGraph } from "./NetworkGraph";
|
|
21
|
+
import { default as PathMap } from "./PathMap";
|
|
22
|
+
import { default as PinMap } from "./PinMap";
|
|
23
|
+
import { ChartType } from "./types";
|
|
24
|
+
export { default as IndentedTree } from "./IndentedTree";
|
|
25
|
+
export { default as OrganizationChart } from "./OrganizationChart";
|
|
26
|
+
|
|
27
|
+
/********** map chart **********/
|
|
28
|
+
export { default as Map } from "./Map";
|
|
29
|
+
|
|
30
|
+
/********** NTV **********/
|
|
31
|
+
export { VisText } from "./Text";
|
|
32
|
+
export { Area, Bar, Column, DualAxes, FlowDiagram, HeatMap, Histogram, Line, MindMap, NetworkGraph, PathMap, Pie, PinMap, Radar, Scatter, Treemap, WordCloud };
|
|
33
|
+
export var DEFAULT_CHART_COMPONENTS = (_DEFAULT_CHART_COMPON = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_DEFAULT_CHART_COMPON, ChartType.Line, Line), ChartType.Column, Column), ChartType.Pie, Pie), ChartType.Bar, Bar), ChartType.Area, Area), ChartType.Scatter, Scatter), ChartType.PinMap, PinMap), ChartType.PathMap, PathMap), ChartType.HeatMap, HeatMap), ChartType.MindMap, MindMap), _defineProperty(_defineProperty(_DEFAULT_CHART_COMPON, ChartType.FlowDiagram, FlowDiagram), ChartType.NetworkGraph, NetworkGraph));
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export { default as Pie, type PieProps } from './Pie';
|
|
5
|
-
export { default as WordCloud, type WordCloudProps } from './WordCloud';
|
|
6
|
-
export { default as HeatMap, type HeatMapProps } from './HeatMap';
|
|
7
|
-
export { default as PathMap, type PathMapProps } from './PathMap';
|
|
8
|
-
export { default as PinMap, type PinMapProps } from './PinMap';
|
|
9
|
-
export { withChartCode, withDefaultChartCode } from './ChartCodeRender';
|
|
10
|
-
export { default as ConfigProvider, type ConfigProviderProps, } from './ConfigProvider';
|
|
11
|
-
export { default as GPTVis } from './GPTVis';
|
|
1
|
+
/********** export chart **********/
|
|
2
|
+
export * from './export';
|
|
3
|
+
/********** export types **********/
|
|
12
4
|
export * from './types';
|
|
5
|
+
/********** export GPTVis **********/
|
|
6
|
+
export { withChartCode, withDefaultChartCode } from './ChartCodeRender';
|
|
7
|
+
export type { CodeBlockComponent, WithChartCodeOptions } from './ChartCodeRender/type';
|
|
8
|
+
export { default as ConfigProvider, type ConfigProviderProps } from './ConfigProvider';
|
|
9
|
+
export { default as GPTVis, type GPTVisProps } from './GPTVis';
|
|
10
|
+
export { default as GPTVisLite, type GPTVisLiteProps } from './GPTVis/Lite';
|
|
11
|
+
export { default as version } from './version';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
export { default as PinMap } from "./PinMap";
|
|
1
|
+
/********** export chart **********/
|
|
2
|
+
export * from "./export";
|
|
3
|
+
|
|
4
|
+
/********** export types **********/
|
|
5
|
+
export * from "./types";
|
|
6
|
+
|
|
7
|
+
/********** export GPTVis **********/
|
|
9
8
|
export { withChartCode, withDefaultChartCode } from "./ChartCodeRender";
|
|
10
9
|
export { default as ConfigProvider } from "./ConfigProvider";
|
|
11
10
|
export { default as GPTVis } from "./GPTVis";
|
|
12
|
-
export
|
|
11
|
+
export { default as GPTVisLite } from "./GPTVis/Lite";
|
|
12
|
+
export { default as version } from "./version";
|
|
@@ -1,30 +1,65 @@
|
|
|
1
1
|
import type { LarkMapProps } from '@antv/larkmap';
|
|
2
|
-
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import type { Map } from './map';
|
|
3
4
|
export type { LarkMapProps };
|
|
4
5
|
export declare enum ChartType {
|
|
5
6
|
Pie = "pie",
|
|
6
7
|
Column = "column",
|
|
7
8
|
Line = "line",
|
|
8
9
|
Area = "area",
|
|
10
|
+
Scatter = "scatter",
|
|
11
|
+
Histogram = "histogram",
|
|
12
|
+
Treemap = "treemap",
|
|
13
|
+
Bar = "bar",
|
|
9
14
|
WordCloud = "word-cloud",
|
|
15
|
+
DualAxes = "dual-axes",
|
|
16
|
+
Radar = "radar",
|
|
10
17
|
PinMap = "pin-map",
|
|
11
18
|
PathMap = "path-map",
|
|
12
|
-
HeatMap = "heat-map"
|
|
19
|
+
HeatMap = "heat-map",
|
|
20
|
+
MindMap = "mind-map",
|
|
21
|
+
NetworkGraph = "network-graph",
|
|
22
|
+
FlowDiagram = "flow-diagram",
|
|
23
|
+
OrganizationChart = "organization-chart",
|
|
24
|
+
IndentedTree = "indented-tree",
|
|
25
|
+
VisText = "vis-text"
|
|
13
26
|
}
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
export type Charts = keyof typeof ChartType;
|
|
28
|
+
export interface BaseChartProps {
|
|
29
|
+
containerStyle?: CSSProperties;
|
|
17
30
|
className?: string;
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
}
|
|
33
|
+
export interface BasePlotProps<T> extends BaseChartProps {
|
|
34
|
+
data: T[];
|
|
35
|
+
axisXTitle?: string;
|
|
36
|
+
axisYTitle?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface BaseMapProps<T> extends BaseChartProps, Map {
|
|
39
|
+
data: T[];
|
|
40
|
+
token?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface BaseGraphProps<T> extends BaseChartProps {
|
|
43
|
+
data: T;
|
|
44
|
+
}
|
|
45
|
+
interface GraphNode {
|
|
46
|
+
name: string;
|
|
47
|
+
}
|
|
48
|
+
interface GraphEdge {
|
|
49
|
+
source: string;
|
|
50
|
+
target: string;
|
|
51
|
+
name?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface GraphData {
|
|
54
|
+
nodes: GraphNode[];
|
|
55
|
+
edges: GraphEdge[];
|
|
18
56
|
}
|
|
19
|
-
export interface
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
[key: string]:
|
|
57
|
+
export interface TreeGraphData {
|
|
58
|
+
name: string;
|
|
59
|
+
children?: TreeGraphData[];
|
|
60
|
+
[key: string]: any;
|
|
23
61
|
}
|
|
24
|
-
export interface
|
|
25
|
-
xField?: string;
|
|
26
|
-
yField?: string;
|
|
27
|
-
stackField?: string;
|
|
62
|
+
export interface GraphProps extends BaseGraphProps<GraphData> {
|
|
28
63
|
}
|
|
29
|
-
export interface
|
|
64
|
+
export interface TreeGraphProps extends BaseGraphProps<TreeGraphData> {
|
|
30
65
|
}
|
package/dist/esm/types/chart.js
CHANGED
|
@@ -3,9 +3,21 @@ export var ChartType = /*#__PURE__*/function (ChartType) {
|
|
|
3
3
|
ChartType["Column"] = "column";
|
|
4
4
|
ChartType["Line"] = "line";
|
|
5
5
|
ChartType["Area"] = "area";
|
|
6
|
+
ChartType["Scatter"] = "scatter";
|
|
7
|
+
ChartType["Histogram"] = "histogram";
|
|
8
|
+
ChartType["Treemap"] = "treemap";
|
|
9
|
+
ChartType["Bar"] = "bar";
|
|
6
10
|
ChartType["WordCloud"] = "word-cloud";
|
|
11
|
+
ChartType["DualAxes"] = "dual-axes";
|
|
12
|
+
ChartType["Radar"] = "radar";
|
|
7
13
|
ChartType["PinMap"] = "pin-map";
|
|
8
14
|
ChartType["PathMap"] = "path-map";
|
|
9
15
|
ChartType["HeatMap"] = "heat-map";
|
|
16
|
+
ChartType["MindMap"] = "mind-map";
|
|
17
|
+
ChartType["NetworkGraph"] = "network-graph";
|
|
18
|
+
ChartType["FlowDiagram"] = "flow-diagram";
|
|
19
|
+
ChartType["OrganizationChart"] = "organization-chart";
|
|
20
|
+
ChartType["IndentedTree"] = "indented-tree";
|
|
21
|
+
ChartType["VisText"] = "vis-text";
|
|
10
22
|
return ChartType;
|
|
11
23
|
}({});
|
|
@@ -1,9 +1,25 @@
|
|
|
1
|
+
import type { GraphOptions as ADCGraphOptions } from '@ant-design/graphs';
|
|
2
|
+
import type { G2 } from '@ant-design/plots';
|
|
3
|
+
import type { Charts } from './chart';
|
|
4
|
+
type PlotGlobalConfig = {
|
|
5
|
+
theme?: G2.Theme;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
type GraphGlobalConfig = ADCGraphOptions & {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
1
11
|
type MapGlobalConfig = {
|
|
2
12
|
style?: 'normal' | 'light' | 'dark' | string;
|
|
3
13
|
token?: string;
|
|
14
|
+
enableZoom?: boolean;
|
|
15
|
+
enableRotate?: boolean;
|
|
4
16
|
[key: string]: any;
|
|
5
17
|
};
|
|
18
|
+
type ComponentsGlobalConfig = Partial<Record<Charts, Record<string, any>>>;
|
|
6
19
|
export type GlobalConfig = {
|
|
20
|
+
plot?: PlotGlobalConfig;
|
|
21
|
+
graph?: GraphGlobalConfig;
|
|
7
22
|
map?: MapGlobalConfig;
|
|
23
|
+
components?: ComponentsGlobalConfig;
|
|
8
24
|
};
|
|
9
25
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './chart';
|
|
2
|
-
export { GlobalConfig } from './config';
|
|
2
|
+
export type { GlobalConfig } from './config';
|
package/dist/esm/types/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./chart";
|
|
2
|
-
export {
|
|
2
|
+
export {};
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
type AsyncCall<T = {
|
|
2
|
+
[k: string | number | symbol]: any;
|
|
3
|
+
}, Success = any, Fail = any, Complete = any> = (params: T & {
|
|
4
|
+
success: (params: Success) => void;
|
|
5
|
+
fail: (params: Fail) => void;
|
|
6
|
+
complete?: (params: Complete) => void;
|
|
7
|
+
}) => void;
|
|
8
|
+
/**
|
|
9
|
+
* 地图组件上下文对象
|
|
10
|
+
*
|
|
11
|
+
* @see https://opendocs.alipay.com/mini/api/mapcontext
|
|
12
|
+
*/
|
|
13
|
+
export interface MapContext {
|
|
14
|
+
/**
|
|
15
|
+
* 设置地图底图类型
|
|
16
|
+
*
|
|
17
|
+
* @see https://opendocs.alipay.com/mini/api/setmaptype
|
|
18
|
+
*/
|
|
19
|
+
setMapType: AsyncCall<{
|
|
20
|
+
mapType: 0 | 1 | 2 | 3 | 4;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* 平移缩放到指定区域
|
|
24
|
+
*
|
|
25
|
+
* @see https://opendocs.alipay.com/mini/api/includepoints
|
|
26
|
+
*/
|
|
27
|
+
includePoints: AsyncCall<{
|
|
28
|
+
points: Array<{
|
|
29
|
+
longitude: number;
|
|
30
|
+
latitude: number;
|
|
31
|
+
}>;
|
|
32
|
+
padding?: [number, number, number, number];
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
export interface MapInstance {
|
|
36
|
+
getContext: () => MapContext;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 经纬度坐标点
|
|
40
|
+
*/
|
|
41
|
+
export interface LngLat {
|
|
42
|
+
longitude: number;
|
|
43
|
+
latitude: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 标记点
|
|
47
|
+
*
|
|
48
|
+
* 更多属性信息查看 @see https://opendocs.alipay.com/mini/component/map#markers
|
|
49
|
+
*/
|
|
50
|
+
export interface Marker extends LngLat {
|
|
51
|
+
id: string;
|
|
52
|
+
iconPath?: string;
|
|
53
|
+
width?: number;
|
|
54
|
+
height?: number;
|
|
55
|
+
alpha?: number;
|
|
56
|
+
anchorX?: number;
|
|
57
|
+
anchorY?: number;
|
|
58
|
+
label?: {
|
|
59
|
+
content?: string;
|
|
60
|
+
color?: string;
|
|
61
|
+
fontSize?: number;
|
|
62
|
+
borderRadius?: number;
|
|
63
|
+
bgColor?: string;
|
|
64
|
+
padding?: number;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 折线
|
|
69
|
+
*
|
|
70
|
+
* 更多属性信息查看 @see https://opendocs.alipay.com/mini/component/map#polyline
|
|
71
|
+
*/
|
|
72
|
+
export interface Polyline {
|
|
73
|
+
points: LngLat[];
|
|
74
|
+
width?: number;
|
|
75
|
+
color?: string;
|
|
76
|
+
dottedLine?: boolean;
|
|
77
|
+
iconPath?: string;
|
|
78
|
+
iconWidth?: number;
|
|
79
|
+
colorList?: string[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 面
|
|
83
|
+
*
|
|
84
|
+
* @see https://opendocs.alipay.com/mini/component/map?pathHash=c9886630#polygon
|
|
85
|
+
*/
|
|
86
|
+
export interface Polygon {
|
|
87
|
+
points: LngLat[];
|
|
88
|
+
color?: string;
|
|
89
|
+
fillColor?: string;
|
|
90
|
+
width?: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @see https://opendocs.alipay.com/mini/component/map
|
|
94
|
+
*/
|
|
95
|
+
export interface Map {
|
|
96
|
+
id?: string;
|
|
97
|
+
/**
|
|
98
|
+
* @title 地图类型
|
|
99
|
+
* @description 底图的样式
|
|
100
|
+
*
|
|
101
|
+
* - 0 标准地图
|
|
102
|
+
* - 1 卫星地图
|
|
103
|
+
* - 2 夜视地图
|
|
104
|
+
* - 3 导航地图
|
|
105
|
+
* - 4 公交地图
|
|
106
|
+
*/
|
|
107
|
+
mapType?: 0 | 1 | 2 | 3 | 4 | string;
|
|
108
|
+
/**
|
|
109
|
+
* @title 展示实时定位点
|
|
110
|
+
* @description 展示用户当前带箭头的实时定位点
|
|
111
|
+
*/
|
|
112
|
+
showLocation?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* @title 中心纬度
|
|
115
|
+
* @description
|
|
116
|
+
*/
|
|
117
|
+
latitude?: number;
|
|
118
|
+
/**
|
|
119
|
+
* @title 中心经度
|
|
120
|
+
* @description
|
|
121
|
+
*/
|
|
122
|
+
longitude?: number;
|
|
123
|
+
/**
|
|
124
|
+
* @title 缩放级别
|
|
125
|
+
* @description 取值范围为 5-18
|
|
126
|
+
* @default "16"
|
|
127
|
+
*/
|
|
128
|
+
scale?: number;
|
|
129
|
+
/**
|
|
130
|
+
* @title 倾斜角度
|
|
131
|
+
* @description 范围 0 ~ 40 , 关于 z 轴的倾
|
|
132
|
+
* @default "0"
|
|
133
|
+
*/
|
|
134
|
+
skew?: number;
|
|
135
|
+
/**
|
|
136
|
+
* @title 顺时针旋转的角度
|
|
137
|
+
* @description 范围 0 ~ 360
|
|
138
|
+
* @default "0"
|
|
139
|
+
*/
|
|
140
|
+
rotate?: number;
|
|
141
|
+
/**
|
|
142
|
+
* @title 视野范围
|
|
143
|
+
* @description 视野将进行小范围延伸包含传入的坐标
|
|
144
|
+
*/
|
|
145
|
+
includePoints?: LngLat[];
|
|
146
|
+
/**
|
|
147
|
+
* @title 视野边界
|
|
148
|
+
* @description 视野在地图 padding 范围内展示
|
|
149
|
+
*/
|
|
150
|
+
includePadding?: {
|
|
151
|
+
left: number;
|
|
152
|
+
right: number;
|
|
153
|
+
top: number;
|
|
154
|
+
bottom: number;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* @title 是否启用缩放
|
|
158
|
+
* @description 缩放交互开关
|
|
159
|
+
* @default true
|
|
160
|
+
*/
|
|
161
|
+
enableZoom?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* @title 是否启用拖动
|
|
164
|
+
* @description 拖动交互开关
|
|
165
|
+
* @default true
|
|
166
|
+
*/
|
|
167
|
+
enableScroll?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* @title 是否启用旋转
|
|
170
|
+
* @description 旋转交互开关
|
|
171
|
+
* @default true
|
|
172
|
+
*/
|
|
173
|
+
enableRotate?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* @title 标记点
|
|
176
|
+
* @description 可在地图上展示多个标记点
|
|
177
|
+
*/
|
|
178
|
+
markers?: Marker[];
|
|
179
|
+
/**
|
|
180
|
+
* @title 折线
|
|
181
|
+
* @description 可在地图上展示多个折线
|
|
182
|
+
*/
|
|
183
|
+
polyline?: Polyline[];
|
|
184
|
+
/**
|
|
185
|
+
* @title 面
|
|
186
|
+
* @description 可在地图上展示多个面
|
|
187
|
+
*/
|
|
188
|
+
polygon?: Polygon[];
|
|
189
|
+
/**
|
|
190
|
+
* @title 地图视野变化事件
|
|
191
|
+
* @description 拖动/旋转/缩放地图时触发
|
|
192
|
+
*/
|
|
193
|
+
onRegionChange?: (event: {
|
|
194
|
+
type: 'begin' | 'end';
|
|
195
|
+
latitude: number;
|
|
196
|
+
longitude: number;
|
|
197
|
+
scale: number;
|
|
198
|
+
skew: number;
|
|
199
|
+
rotate: number;
|
|
200
|
+
causedBy: 'update' | 'gesture';
|
|
201
|
+
}) => void;
|
|
202
|
+
/**
|
|
203
|
+
* @title 地图点击事件
|
|
204
|
+
* @description 点击地图时触发
|
|
205
|
+
*/
|
|
206
|
+
onTap?: (event: {
|
|
207
|
+
latitude: number;
|
|
208
|
+
longitude: number;
|
|
209
|
+
}) => void;
|
|
210
|
+
/**
|
|
211
|
+
* @title 标记点击事件
|
|
212
|
+
* @description 点击标记及其标签时触发
|
|
213
|
+
*/
|
|
214
|
+
onMarkerTap?: (event: {
|
|
215
|
+
markerId: string;
|
|
216
|
+
latitude: number;
|
|
217
|
+
longitude: number;
|
|
218
|
+
}) => void;
|
|
219
|
+
/**
|
|
220
|
+
* @title 地图初始化完成事件
|
|
221
|
+
* @description 地图初始化完成即将开始渲染第一帧时触发
|
|
222
|
+
*/
|
|
223
|
+
onInitComplete?: () => void;
|
|
224
|
+
}
|
|
225
|
+
export interface MarkerData extends Omit<Marker, 'id' | 'label'> {
|
|
226
|
+
id?: string;
|
|
227
|
+
label?: string | Marker['label'];
|
|
228
|
+
}
|
|
229
|
+
export interface PinMap extends Map {
|
|
230
|
+
data?: MarkerData[];
|
|
231
|
+
markerStyle?: Partial<Marker>;
|
|
232
|
+
}
|
|
233
|
+
export interface RouteData {
|
|
234
|
+
markers?: MarkerData[];
|
|
235
|
+
path?: Polyline;
|
|
236
|
+
}
|
|
237
|
+
export interface PathMap extends Map {
|
|
238
|
+
data?: RouteData[];
|
|
239
|
+
markerStyle?: Partial<Marker>;
|
|
240
|
+
pathStyle?: Partial<Polyline>;
|
|
241
|
+
}
|
|
242
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { GlobalConfig } from '../types';
|
|
2
|
+
export declare const mergeGlobalConfig: (config: GlobalConfig) => GlobalConfig;
|
|
3
|
+
export declare function mergeGraphOptions(...options: Record<string, any>[]): {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
};
|
package/dist/esm/utils/config.js
CHANGED
|
@@ -1,26 +1,48 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import { mergeWith } from 'lodash';
|
|
2
|
+
import { isPlainObject, mergeWith } from 'lodash';
|
|
3
3
|
import { DEFAULT_GLOBAL_CONFIG } from "../constants";
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
globalConfig = mergeWith(globalConfig, config, function (objValue) {
|
|
4
|
+
export var mergeGlobalConfig = function mergeGlobalConfig(config) {
|
|
5
|
+
var globalConfig = mergeWith({}, DEFAULT_GLOBAL_CONFIG, config, function (objValue) {
|
|
7
6
|
if (Array.isArray(objValue)) {
|
|
8
7
|
return objValue;
|
|
9
8
|
}
|
|
10
9
|
});
|
|
11
|
-
};
|
|
12
|
-
export var getGlobalConfig = function getGlobalConfig() {
|
|
13
10
|
return globalConfig;
|
|
14
11
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
12
|
+
function mergeGraphFunctions(key, currValue, prevValue) {
|
|
13
|
+
if (['plugins', 'behaviors', 'transforms'].includes(key)) {
|
|
14
|
+
return function (prev) {
|
|
15
|
+
return currValue(prev);
|
|
16
|
+
};
|
|
17
|
+
} else {
|
|
18
|
+
return function (datum) {
|
|
19
|
+
// @ts-ignore this refers to the graph instance
|
|
20
|
+
var value = currValue.call(this, datum);
|
|
21
|
+
if (isPlainObject(value)) return mergeGraphOptions(prevValue, value);
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function mergeGraphOptions() {
|
|
27
|
+
if (arguments.length === 0) return {};
|
|
28
|
+
var merged = _objectSpread({}, arguments.length <= 0 ? undefined : arguments[0]);
|
|
29
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
30
|
+
var currentOptions = i < 0 || arguments.length <= i ? undefined : arguments[i];
|
|
31
|
+
for (var key in currentOptions) {
|
|
32
|
+
if (currentOptions.hasOwnProperty(key)) {
|
|
33
|
+
var currValue = currentOptions[key];
|
|
34
|
+
var prevValue = merged[key];
|
|
35
|
+
if (['component', 'data'].includes(key)) {
|
|
36
|
+
merged[key] = currValue;
|
|
37
|
+
} else if (typeof currValue === 'function') {
|
|
38
|
+
merged[key] = mergeGraphFunctions(key, currValue, prevValue);
|
|
39
|
+
} else if (isPlainObject(currValue) && isPlainObject(prevValue)) {
|
|
40
|
+
merged[key] = mergeGraphOptions(prevValue, currValue);
|
|
41
|
+
} else {
|
|
42
|
+
merged[key] = currValue;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return merged;
|
|
48
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { G6 } from '@ant-design/graphs';
|
|
2
|
+
import type { GraphData, TreeGraphData } from '../types';
|
|
3
|
+
export declare function visTreeData2GraphData(data: TreeGraphData): G6.GraphData;
|
|
4
|
+
export declare function visGraphData2GraphData(data: GraphData): {
|
|
5
|
+
nodes: {
|
|
6
|
+
id: string;
|
|
7
|
+
style: {
|
|
8
|
+
labelText: string;
|
|
9
|
+
};
|
|
10
|
+
}[];
|
|
11
|
+
edges: {
|
|
12
|
+
source: string;
|
|
13
|
+
target: string;
|
|
14
|
+
style: {
|
|
15
|
+
labelText: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["children"];
|
|
4
|
+
// FIXME: 全量导入 G6 模块
|
|
5
|
+
import { G6 } from '@ant-design/graphs';
|
|
6
|
+
var treeToGraphData = G6.treeToGraphData;
|
|
7
|
+
export function visTreeData2GraphData(data) {
|
|
8
|
+
return treeToGraphData(data, {
|
|
9
|
+
getNodeData: function getNodeData(datum, depth) {
|
|
10
|
+
datum.id = datum.name;
|
|
11
|
+
datum.depth = depth;
|
|
12
|
+
if (!datum.children) return datum;
|
|
13
|
+
var children = datum.children,
|
|
14
|
+
restDatum = _objectWithoutProperties(datum, _excluded);
|
|
15
|
+
return _objectSpread(_objectSpread({}, restDatum), {}, {
|
|
16
|
+
children: children.map(function (child) {
|
|
17
|
+
return child.name;
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
getEdgeData: function getEdgeData(source, target) {
|
|
22
|
+
return {
|
|
23
|
+
source: source.name,
|
|
24
|
+
target: target.name
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export function visGraphData2GraphData(data) {
|
|
30
|
+
return {
|
|
31
|
+
nodes: data.nodes.map(function (node) {
|
|
32
|
+
return {
|
|
33
|
+
id: node.name,
|
|
34
|
+
style: {
|
|
35
|
+
labelText: node.name
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}),
|
|
39
|
+
edges: data.edges.map(function (edge) {
|
|
40
|
+
return {
|
|
41
|
+
source: edge.source,
|
|
42
|
+
target: edge.target,
|
|
43
|
+
style: {
|
|
44
|
+
labelText: edge.name
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './map';
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./map";
|