@antv/gpt-vis 0.3.2 → 0.3.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/cjs/ConfigProvider/hooks/useConfig.d.ts +1 -1
- package/dist/cjs/ConfigProvider/hooks/useConfig.js +5 -5
- package/dist/cjs/FlowDiagram/index.js +5 -7
- package/dist/cjs/Map/Component/MapView.d.ts +3 -0
- package/dist/cjs/Map/Component/MapView.js +40 -0
- package/dist/cjs/Map/Component/Marker.d.ts +3 -0
- package/dist/cjs/Map/Component/Marker.js +53 -0
- package/dist/cjs/Map/Component/Polyline.d.ts +3 -0
- package/dist/cjs/Map/Component/Polyline.js +50 -0
- package/dist/cjs/Map/Component/index.d.ts +4 -0
- package/dist/cjs/Map/Component/index.js +45 -0
- package/dist/cjs/Map/index.js +8 -15
- package/dist/cjs/utils/map/context.js +3 -0
- package/dist/cjs/utils/map/view.d.ts +2 -0
- package/dist/cjs/utils/map/view.js +10 -4
- package/dist/cjs/utils/plot.js +11 -5
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/ConfigProvider/hooks/useConfig.d.ts +1 -1
- package/dist/esm/ConfigProvider/hooks/useConfig.js +6 -8
- package/dist/esm/FlowDiagram/index.js +3 -8
- package/dist/esm/Map/Component/MapView.d.ts +3 -0
- package/dist/esm/Map/Component/MapView.js +18 -0
- package/dist/esm/Map/Component/Marker.d.ts +3 -0
- package/dist/esm/Map/Component/Marker.js +35 -0
- package/dist/esm/Map/Component/Polyline.d.ts +3 -0
- package/dist/esm/Map/Component/Polyline.js +30 -0
- package/dist/esm/Map/Component/index.d.ts +4 -0
- package/dist/esm/Map/Component/index.js +4 -0
- package/dist/esm/Map/index.js +12 -29
- package/dist/esm/utils/map/context.js +9 -3
- package/dist/esm/utils/map/view.d.ts +2 -0
- package/dist/esm/utils/map/view.js +6 -5
- package/dist/esm/utils/plot.js +16 -12
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/index.min.js +1 -1
- package/package.json +23 -23
|
@@ -8,6 +8,6 @@ export declare function useMapConfig<T extends MapProps>(name: Charts, props: T)
|
|
|
8
8
|
mapType: string | undefined;
|
|
9
9
|
token: string | undefined;
|
|
10
10
|
} & T;
|
|
11
|
-
export declare function useGraphConfig<T extends GraphOptions>(name: Charts,
|
|
11
|
+
export declare function useGraphConfig<T extends GraphOptions>(name: Charts, defaultConfig: Partial<T>, props: Partial<T>): {
|
|
12
12
|
[x: string]: any;
|
|
13
13
|
};
|
|
@@ -59,12 +59,12 @@ function usePlotGlobalConfig(name) {
|
|
|
59
59
|
return config;
|
|
60
60
|
}
|
|
61
61
|
function usePlotConfig(name, defaultConfig, props) {
|
|
62
|
-
const transformedProps = (0, import_plot.transform2ADCProps)(props);
|
|
63
|
-
const _defaultConfig = typeof defaultConfig === "function" ? defaultConfig(transformedProps) : defaultConfig;
|
|
64
62
|
const globalConfig = usePlotGlobalConfig(name);
|
|
63
|
+
const mergedProps = { ...globalConfig, ...props };
|
|
64
|
+
const transformedProps = (0, import_plot.transform2ADCProps)(mergedProps);
|
|
65
|
+
const _defaultConfig = typeof defaultConfig === "function" ? defaultConfig(transformedProps) : defaultConfig;
|
|
65
66
|
const config = {
|
|
66
67
|
..._defaultConfig,
|
|
67
|
-
...globalConfig,
|
|
68
68
|
...transformedProps
|
|
69
69
|
};
|
|
70
70
|
return config;
|
|
@@ -95,9 +95,9 @@ function useGraphGlobalConfig(name) {
|
|
|
95
95
|
const componentConfig = useComponentGlobalConfig(name);
|
|
96
96
|
return (0, import_config.mergeGraphOptions)(graphConfig, componentConfig || {});
|
|
97
97
|
}
|
|
98
|
-
function useGraphConfig(name,
|
|
98
|
+
function useGraphConfig(name, defaultConfig, props) {
|
|
99
99
|
const globalConfig = useGraphGlobalConfig(name);
|
|
100
|
-
return (0, import_config.mergeGraphOptions)(globalConfig,
|
|
100
|
+
return (0, import_config.mergeGraphOptions)(defaultConfig, globalConfig, props);
|
|
101
101
|
}
|
|
102
102
|
// Annotate the CommonJS export names for ESM import in node:
|
|
103
103
|
0 && (module.exports = {
|
|
@@ -35,12 +35,13 @@ module.exports = __toCommonJS(FlowDiagram_exports);
|
|
|
35
35
|
var import_graphs = require("@ant-design/graphs");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_hooks = require("../ConfigProvider/hooks");
|
|
38
|
+
var import_config = require("../utils/config");
|
|
38
39
|
var import_graph = require("../utils/graph");
|
|
39
40
|
var import_helper = require("./helper");
|
|
40
41
|
var { TextNode } = import_graphs.RCNode;
|
|
41
42
|
var defaultConfig = {
|
|
42
43
|
autoResize: true,
|
|
43
|
-
autoFit: "
|
|
44
|
+
autoFit: "view",
|
|
44
45
|
node: {
|
|
45
46
|
style: {
|
|
46
47
|
component: (d) => {
|
|
@@ -61,8 +62,7 @@ var defaultConfig = {
|
|
|
61
62
|
);
|
|
62
63
|
},
|
|
63
64
|
size: [140, 32]
|
|
64
|
-
}
|
|
65
|
-
animation: { enter: false }
|
|
65
|
+
}
|
|
66
66
|
},
|
|
67
67
|
edge: {
|
|
68
68
|
style: {
|
|
@@ -78,8 +78,7 @@ var defaultConfig = {
|
|
|
78
78
|
labelWordWrap: false,
|
|
79
79
|
stroke: "#001f98"
|
|
80
80
|
}
|
|
81
|
-
}
|
|
82
|
-
animation: { enter: false }
|
|
81
|
+
}
|
|
83
82
|
},
|
|
84
83
|
behaviors: (prev) => [
|
|
85
84
|
...prev,
|
|
@@ -99,8 +98,7 @@ var FlowDiagram = (props) => {
|
|
|
99
98
|
const data = (0, import_react.useMemo)(() => (0, import_graph.visGraphData2GraphData)(propsData), [propsData]);
|
|
100
99
|
const config = (0, import_hooks.useGraphConfig)(
|
|
101
100
|
"FlowDiagram",
|
|
102
|
-
defaultConfig,
|
|
103
|
-
(0, import_helper.getGraphOptionsByData)(data),
|
|
101
|
+
(0, import_config.mergeGraphOptions)(defaultConfig, (0, import_helper.getGraphOptionsByData)(data)),
|
|
104
102
|
restProps
|
|
105
103
|
);
|
|
106
104
|
return /* @__PURE__ */ import_react.default.createElement(import_graphs.FlowGraph, { data, ...config });
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/Map/Component/MapView.tsx
|
|
20
|
+
var MapView_exports = {};
|
|
21
|
+
__export(MapView_exports, {
|
|
22
|
+
default: () => MapView_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(MapView_exports);
|
|
25
|
+
var import_larkmap = require("@antv/larkmap");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_map = require("../../utils/map");
|
|
28
|
+
var MapView_default = (props) => {
|
|
29
|
+
const scene = (0, import_larkmap.useScene)();
|
|
30
|
+
(0, import_react.useEffect)(() => {
|
|
31
|
+
(0, import_map.setMapView)(props, scene);
|
|
32
|
+
}, []);
|
|
33
|
+
(0, import_react.useEffect)(() => {
|
|
34
|
+
(0, import_map.setMapStatus)(props, scene);
|
|
35
|
+
}, [props.enableRotate, props.enableScroll, props.enableZoom]);
|
|
36
|
+
(0, import_react.useEffect)(() => {
|
|
37
|
+
(0, import_map.fitBounds)(props, scene);
|
|
38
|
+
}, [props.includePoints, props.markers, props.polyline, props.includePadding]);
|
|
39
|
+
return null;
|
|
40
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/Map/Component/Marker.tsx
|
|
20
|
+
var Marker_exports = {};
|
|
21
|
+
__export(Marker_exports, {
|
|
22
|
+
default: () => Marker_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(Marker_exports);
|
|
25
|
+
var import_larkmap = require("@antv/larkmap");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_map = require("../../utils/map");
|
|
28
|
+
var Marker_default = (props) => {
|
|
29
|
+
const scene = (0, import_larkmap.useScene)();
|
|
30
|
+
const [layers, setLayers] = (0, import_react.useState)([]);
|
|
31
|
+
const removeLayers = () => {
|
|
32
|
+
layers.forEach((item) => {
|
|
33
|
+
scene.removeLayer(item);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
(0, import_react.useEffect)(() => {
|
|
37
|
+
var _a;
|
|
38
|
+
if (!props.markers)
|
|
39
|
+
return;
|
|
40
|
+
(_a = (0, import_map.setMapContext)(props, scene)) == null ? void 0 : _a.then(() => {
|
|
41
|
+
const markerLayer = (0, import_map.setMarkers)(props.markers || []);
|
|
42
|
+
removeLayers();
|
|
43
|
+
markerLayer.forEach((item) => {
|
|
44
|
+
scene.addLayer(item);
|
|
45
|
+
});
|
|
46
|
+
setLayers(markerLayer);
|
|
47
|
+
});
|
|
48
|
+
return () => {
|
|
49
|
+
removeLayers();
|
|
50
|
+
};
|
|
51
|
+
}, [props.markers]);
|
|
52
|
+
return null;
|
|
53
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/Map/Component/Polyline.tsx
|
|
20
|
+
var Polyline_exports = {};
|
|
21
|
+
__export(Polyline_exports, {
|
|
22
|
+
default: () => Polyline_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(Polyline_exports);
|
|
25
|
+
var import_larkmap = require("@antv/larkmap");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_map = require("../../utils/map");
|
|
28
|
+
var Polyline_default = (props) => {
|
|
29
|
+
const scene = (0, import_larkmap.useScene)();
|
|
30
|
+
const [layers, setLayers] = (0, import_react.useState)([]);
|
|
31
|
+
const removeLayers = () => {
|
|
32
|
+
layers.forEach((item) => {
|
|
33
|
+
scene.removeLayer(item);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
(0, import_react.useEffect)(() => {
|
|
37
|
+
if (!props.polyline)
|
|
38
|
+
return;
|
|
39
|
+
const lineLayers = (0, import_map.setPolyline)(props.polyline || []);
|
|
40
|
+
removeLayers();
|
|
41
|
+
lineLayers.forEach((item) => {
|
|
42
|
+
scene.addLayer(item);
|
|
43
|
+
});
|
|
44
|
+
setLayers(lineLayers);
|
|
45
|
+
return () => {
|
|
46
|
+
removeLayers();
|
|
47
|
+
};
|
|
48
|
+
}, [props.polyline]);
|
|
49
|
+
return null;
|
|
50
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/Map/Component/index.tsx
|
|
30
|
+
var Component_exports = {};
|
|
31
|
+
__export(Component_exports, {
|
|
32
|
+
MapView: () => import_MapView.default,
|
|
33
|
+
Marker: () => import_Marker.default,
|
|
34
|
+
Polyline: () => import_Polyline.default
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(Component_exports);
|
|
37
|
+
var import_MapView = __toESM(require("./MapView"));
|
|
38
|
+
var import_Marker = __toESM(require("./Marker"));
|
|
39
|
+
var import_Polyline = __toESM(require("./Polyline"));
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
MapView,
|
|
43
|
+
Marker,
|
|
44
|
+
Polyline
|
|
45
|
+
});
|
package/dist/cjs/Map/index.js
CHANGED
|
@@ -35,24 +35,14 @@ module.exports = __toCommonJS(Map_exports);
|
|
|
35
35
|
var import_larkmap = require("@antv/larkmap");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_map = require("../utils/map");
|
|
38
|
+
var import_Component = require("./Component/");
|
|
38
39
|
var Map = (props) => {
|
|
39
40
|
const { className, containerStyle, children } = props;
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
await (0, import_map.setMapContext)(props, scene);
|
|
45
|
-
if (props.polyline) {
|
|
46
|
-
const polylineLayer = (0, import_map.setPolyline)(props.polyline || []);
|
|
47
|
-
allLayers.push(...polylineLayer);
|
|
41
|
+
const mapConfig = (0, import_react.useMemo)(() => (0, import_map.formatMapStyle)(props), [props]);
|
|
42
|
+
const onSceneLoaded = async () => {
|
|
43
|
+
if (props.onInitComplete) {
|
|
44
|
+
props.onInitComplete();
|
|
48
45
|
}
|
|
49
|
-
if (props.markers) {
|
|
50
|
-
const markerLayer = (0, import_map.setMarkers)(props.markers || []);
|
|
51
|
-
allLayers.push(...markerLayer);
|
|
52
|
-
}
|
|
53
|
-
allLayers.forEach((item) => {
|
|
54
|
-
scene.addLayer(item);
|
|
55
|
-
});
|
|
56
46
|
};
|
|
57
47
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
58
48
|
import_larkmap.LarkMap,
|
|
@@ -62,6 +52,9 @@ var Map = (props) => {
|
|
|
62
52
|
...mapConfig,
|
|
63
53
|
onSceneLoaded
|
|
64
54
|
},
|
|
55
|
+
/* @__PURE__ */ import_react.default.createElement(import_Component.MapView, { ...props }),
|
|
56
|
+
/* @__PURE__ */ import_react.default.createElement(import_Component.Marker, { ...props }),
|
|
57
|
+
/* @__PURE__ */ import_react.default.createElement(import_Component.Polyline, { ...props }),
|
|
65
58
|
children
|
|
66
59
|
);
|
|
67
60
|
};
|
|
@@ -31,6 +31,9 @@ function setMapContext(props, scene) {
|
|
|
31
31
|
return Promise.all(
|
|
32
32
|
Array.from(icons.values()).map(async (url) => {
|
|
33
33
|
const id = (0, import_util.urlToMarkerId)(url);
|
|
34
|
+
if (scene.hasImage(id)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
34
37
|
return await scene.addImage(id, url);
|
|
35
38
|
})
|
|
36
39
|
);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { Scene } from '@antv/l7';
|
|
2
2
|
import type { Map } from '../../types/map';
|
|
3
3
|
export declare const setMapView: (props: Map, scene: Scene) => void;
|
|
4
|
+
export declare const fitBounds: (props: Map, scene: Scene) => void;
|
|
5
|
+
export declare const setMapStatus: (props: Map, scene: Scene) => void;
|
|
@@ -19,6 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/utils/map/view.ts
|
|
20
20
|
var view_exports = {};
|
|
21
21
|
__export(view_exports, {
|
|
22
|
+
fitBounds: () => fitBounds,
|
|
23
|
+
setMapStatus: () => setMapStatus,
|
|
22
24
|
setMapView: () => setMapView
|
|
23
25
|
});
|
|
24
26
|
module.exports = __toCommonJS(view_exports);
|
|
@@ -47,6 +49,10 @@ function fitIncludePoints(includePoints, scene, includePadding) {
|
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
var setMapView = (props, scene) => {
|
|
52
|
+
fitBounds(props, scene);
|
|
53
|
+
setMapStatus(props, scene);
|
|
54
|
+
};
|
|
55
|
+
var fitBounds = (props, scene) => {
|
|
50
56
|
if (props.includePoints) {
|
|
51
57
|
fitIncludePoints(props.includePoints, scene, props.includePadding);
|
|
52
58
|
} else {
|
|
@@ -67,6 +73,8 @@ var setMapView = (props, scene) => {
|
|
|
67
73
|
fitIncludePoints(points, scene, props.includePadding);
|
|
68
74
|
}
|
|
69
75
|
}
|
|
76
|
+
};
|
|
77
|
+
var setMapStatus = (props, scene) => {
|
|
70
78
|
if (props.enableZoom !== void 0) {
|
|
71
79
|
scene.setMapStatus({
|
|
72
80
|
zoomEnable: props.enableZoom
|
|
@@ -82,12 +90,10 @@ var setMapView = (props, scene) => {
|
|
|
82
90
|
dragEnable: props.enableScroll
|
|
83
91
|
});
|
|
84
92
|
}
|
|
85
|
-
if (props.onInitComplete) {
|
|
86
|
-
scene.off("loaded", props.onInitComplete);
|
|
87
|
-
scene.on("loaded", props.onInitComplete);
|
|
88
|
-
}
|
|
89
93
|
};
|
|
90
94
|
// Annotate the CommonJS export names for ESM import in node:
|
|
91
95
|
0 && (module.exports = {
|
|
96
|
+
fitBounds,
|
|
97
|
+
setMapStatus,
|
|
92
98
|
setMapView
|
|
93
99
|
});
|
package/dist/cjs/utils/plot.js
CHANGED
|
@@ -46,15 +46,21 @@ function visG2Encode2ADCEncode(config) {
|
|
|
46
46
|
return _config;
|
|
47
47
|
}
|
|
48
48
|
function axisTitle2G2axis(config) {
|
|
49
|
-
const { axisXTitle, axisYTitle
|
|
50
|
-
if (!(0, import_lodash.isUndefined)(axis))
|
|
51
|
-
return config;
|
|
49
|
+
const { axisXTitle, axisYTitle } = config;
|
|
52
50
|
const _config = { axis: {}, ...config };
|
|
53
51
|
if (axisXTitle) {
|
|
54
|
-
_config
|
|
52
|
+
if ((0, import_lodash.get)(_config, "axis.x")) {
|
|
53
|
+
_config.axis.x.title = axisXTitle;
|
|
54
|
+
} else {
|
|
55
|
+
_config.axis.x = { title: axisXTitle };
|
|
56
|
+
}
|
|
55
57
|
}
|
|
56
58
|
if (axisYTitle) {
|
|
57
|
-
_config
|
|
59
|
+
if ((0, import_lodash.get)(_config, "axis.y")) {
|
|
60
|
+
_config.axis.y.title = axisYTitle;
|
|
61
|
+
} else {
|
|
62
|
+
_config.axis.y = { title: axisYTitle };
|
|
63
|
+
}
|
|
58
64
|
}
|
|
59
65
|
return _config;
|
|
60
66
|
}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.3.
|
|
1
|
+
declare const _default: "0.3.4";
|
|
2
2
|
export default _default;
|
package/dist/cjs/version.js
CHANGED
|
@@ -8,6 +8,6 @@ export declare function useMapConfig<T extends MapProps>(name: Charts, props: T)
|
|
|
8
8
|
mapType: string | undefined;
|
|
9
9
|
token: string | undefined;
|
|
10
10
|
} & T;
|
|
11
|
-
export declare function useGraphConfig<T extends GraphOptions>(name: Charts,
|
|
11
|
+
export declare function useGraphConfig<T extends GraphOptions>(name: Charts, defaultConfig: Partial<T>, props: Partial<T>): {
|
|
12
12
|
[x: string]: any;
|
|
13
13
|
};
|
|
@@ -22,10 +22,11 @@ function usePlotGlobalConfig(name) {
|
|
|
22
22
|
return config;
|
|
23
23
|
}
|
|
24
24
|
export function usePlotConfig(name, defaultConfig, props) {
|
|
25
|
-
var transformedProps = transform2ADCProps(props);
|
|
26
|
-
var _defaultConfig = typeof defaultConfig === 'function' ? defaultConfig(transformedProps) : defaultConfig;
|
|
27
25
|
var globalConfig = usePlotGlobalConfig(name);
|
|
28
|
-
var
|
|
26
|
+
var mergedProps = _objectSpread(_objectSpread({}, globalConfig), props);
|
|
27
|
+
var transformedProps = transform2ADCProps(mergedProps);
|
|
28
|
+
var _defaultConfig = typeof defaultConfig === 'function' ? defaultConfig(transformedProps) : defaultConfig;
|
|
29
|
+
var config = _objectSpread(_objectSpread({}, _defaultConfig), transformedProps);
|
|
29
30
|
return config;
|
|
30
31
|
}
|
|
31
32
|
function useMapGlobalConfig(name) {
|
|
@@ -51,10 +52,7 @@ function useGraphGlobalConfig(name) {
|
|
|
51
52
|
var componentConfig = useComponentGlobalConfig(name);
|
|
52
53
|
return mergeGraphOptions(graphConfig, componentConfig || {});
|
|
53
54
|
}
|
|
54
|
-
export function useGraphConfig(name) {
|
|
55
|
+
export function useGraphConfig(name, defaultConfig, props) {
|
|
55
56
|
var globalConfig = useGraphGlobalConfig(name);
|
|
56
|
-
|
|
57
|
-
configs[_key - 1] = arguments[_key];
|
|
58
|
-
}
|
|
59
|
-
return mergeGraphOptions.apply(void 0, [globalConfig].concat(configs));
|
|
57
|
+
return mergeGraphOptions(defaultConfig, globalConfig, props);
|
|
60
58
|
}
|
|
@@ -5,12 +5,13 @@ var _excluded = ["data"];
|
|
|
5
5
|
import { FlowGraph as ADCFlowGraph, RCNode } from '@ant-design/graphs';
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
7
7
|
import { useGraphConfig } from "../ConfigProvider/hooks";
|
|
8
|
+
import { mergeGraphOptions } from "../utils/config";
|
|
8
9
|
import { visGraphData2GraphData } from "../utils/graph";
|
|
9
10
|
import { getGraphOptionsByData } from "./helper";
|
|
10
11
|
var TextNode = RCNode.TextNode;
|
|
11
12
|
var defaultConfig = {
|
|
12
13
|
autoResize: true,
|
|
13
|
-
autoFit: '
|
|
14
|
+
autoFit: 'view',
|
|
14
15
|
node: {
|
|
15
16
|
style: {
|
|
16
17
|
component: function component(d) {
|
|
@@ -28,9 +29,6 @@ var defaultConfig = {
|
|
|
28
29
|
});
|
|
29
30
|
},
|
|
30
31
|
size: [140, 32]
|
|
31
|
-
},
|
|
32
|
-
animation: {
|
|
33
|
-
enter: false
|
|
34
32
|
}
|
|
35
33
|
},
|
|
36
34
|
edge: {
|
|
@@ -47,9 +45,6 @@ var defaultConfig = {
|
|
|
47
45
|
labelWordWrap: false,
|
|
48
46
|
stroke: '#001f98'
|
|
49
47
|
}
|
|
50
|
-
},
|
|
51
|
-
animation: {
|
|
52
|
-
enter: false
|
|
53
48
|
}
|
|
54
49
|
},
|
|
55
50
|
behaviors: function behaviors(prev) {
|
|
@@ -70,7 +65,7 @@ var FlowDiagram = function FlowDiagram(props) {
|
|
|
70
65
|
var data = useMemo(function () {
|
|
71
66
|
return visGraphData2GraphData(propsData);
|
|
72
67
|
}, [propsData]);
|
|
73
|
-
var config = useGraphConfig('FlowDiagram', defaultConfig, getGraphOptionsByData(data), restProps);
|
|
68
|
+
var config = useGraphConfig('FlowDiagram', mergeGraphOptions(defaultConfig, getGraphOptionsByData(data)), restProps);
|
|
74
69
|
return /*#__PURE__*/React.createElement(ADCFlowGraph, _extends({
|
|
75
70
|
data: data
|
|
76
71
|
}, config));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useScene } from '@antv/larkmap';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { fitBounds, setMapStatus, setMapView } from "../../utils/map";
|
|
4
|
+
|
|
5
|
+
// 更新地图视野
|
|
6
|
+
export default (function (props) {
|
|
7
|
+
var scene = useScene();
|
|
8
|
+
useEffect(function () {
|
|
9
|
+
setMapView(props, scene);
|
|
10
|
+
}, []);
|
|
11
|
+
useEffect(function () {
|
|
12
|
+
setMapStatus(props, scene);
|
|
13
|
+
}, [props.enableRotate, props.enableScroll, props.enableZoom]);
|
|
14
|
+
useEffect(function () {
|
|
15
|
+
fitBounds(props, scene);
|
|
16
|
+
}, [props.includePoints, props.markers, props.polyline, props.includePadding]);
|
|
17
|
+
return null;
|
|
18
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import { useScene } from '@antv/larkmap';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { setMapContext, setMarkers } from "../../utils/map";
|
|
5
|
+
// 渲染标记点
|
|
6
|
+
export default (function (props) {
|
|
7
|
+
var scene = useScene();
|
|
8
|
+
var _useState = useState([]),
|
|
9
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
10
|
+
layers = _useState2[0],
|
|
11
|
+
setLayers = _useState2[1];
|
|
12
|
+
var removeLayers = function removeLayers() {
|
|
13
|
+
layers.forEach(function (item) {
|
|
14
|
+
scene.removeLayer(item);
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
useEffect(function () {
|
|
18
|
+
var _setMapContext;
|
|
19
|
+
if (!props.markers) return;
|
|
20
|
+
// 异步调用
|
|
21
|
+
(_setMapContext = setMapContext(props, scene)) === null || _setMapContext === void 0 || _setMapContext.then(function () {
|
|
22
|
+
// 初始化资源
|
|
23
|
+
var markerLayer = setMarkers(props.markers || []);
|
|
24
|
+
removeLayers();
|
|
25
|
+
markerLayer.forEach(function (item) {
|
|
26
|
+
scene.addLayer(item);
|
|
27
|
+
});
|
|
28
|
+
setLayers(markerLayer);
|
|
29
|
+
});
|
|
30
|
+
return function () {
|
|
31
|
+
removeLayers();
|
|
32
|
+
};
|
|
33
|
+
}, [props.markers]);
|
|
34
|
+
return null;
|
|
35
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import { useScene } from '@antv/larkmap';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { setPolyline } from "../../utils/map";
|
|
5
|
+
// 渲染线图层
|
|
6
|
+
export default (function (props) {
|
|
7
|
+
var scene = useScene();
|
|
8
|
+
var _useState = useState([]),
|
|
9
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
10
|
+
layers = _useState2[0],
|
|
11
|
+
setLayers = _useState2[1];
|
|
12
|
+
var removeLayers = function removeLayers() {
|
|
13
|
+
layers.forEach(function (item) {
|
|
14
|
+
scene.removeLayer(item);
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
useEffect(function () {
|
|
18
|
+
if (!props.polyline) return;
|
|
19
|
+
var lineLayers = setPolyline(props.polyline || []);
|
|
20
|
+
removeLayers();
|
|
21
|
+
lineLayers.forEach(function (item) {
|
|
22
|
+
scene.addLayer(item);
|
|
23
|
+
});
|
|
24
|
+
setLayers(lineLayers);
|
|
25
|
+
return function () {
|
|
26
|
+
removeLayers();
|
|
27
|
+
};
|
|
28
|
+
}, [props.polyline]);
|
|
29
|
+
return null;
|
|
30
|
+
});
|