@antv/gpt-vis 0.0.5 → 0.0.6
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/Column/index.js +2 -2
- package/dist/cjs/ConfigProvider/index.d.ts +10 -0
- package/dist/cjs/ConfigProvider/index.js +37 -0
- package/dist/cjs/GPTVis/index.js +2 -16
- package/dist/cjs/HeatMap/index.d.ts +2 -2
- package/dist/cjs/HeatMap/index.js +6 -16
- package/dist/cjs/Line/index.d.ts +6 -2
- package/dist/cjs/Line/index.js +2 -3
- package/dist/cjs/PathMap/index.d.ts +2 -2
- package/dist/cjs/PathMap/index.js +16 -18
- package/dist/cjs/Pie/index.js +0 -3
- package/dist/cjs/PinMap/index.d.ts +2 -2
- package/dist/cjs/PinMap/index.js +16 -18
- package/dist/cjs/constants/index.d.ts +2 -0
- package/dist/cjs/constants/index.js +18 -6
- package/dist/cjs/index.d.ts +4 -5
- package/dist/cjs/index.js +12 -3
- package/dist/cjs/types/chart.d.ts +30 -0
- package/dist/cjs/types/chart.js +39 -0
- package/dist/cjs/types/config.d.ts +9 -0
- package/dist/cjs/types/config.js +17 -0
- package/dist/cjs/types/index.d.ts +2 -26
- package/dist/cjs/types/index.js +6 -13
- package/dist/cjs/utils/config.d.ts +5 -0
- package/dist/cjs/utils/config.js +59 -0
- package/dist/cjs/utils/index.d.ts +1 -0
- package/dist/cjs/utils/index.js +33 -0
- package/dist/esm/Column/index.js +2 -2
- package/dist/esm/ConfigProvider/index.d.ts +10 -0
- package/dist/esm/ConfigProvider/index.js +16 -0
- package/dist/esm/GPTVis/index.js +2 -6
- package/dist/esm/HeatMap/index.d.ts +2 -2
- package/dist/esm/HeatMap/index.js +9 -16
- package/dist/esm/Line/index.d.ts +6 -2
- package/dist/esm/Line/index.js +4 -5
- package/dist/esm/PathMap/index.d.ts +2 -2
- package/dist/esm/PathMap/index.js +13 -18
- package/dist/esm/Pie/index.js +0 -5
- package/dist/esm/PinMap/index.d.ts +2 -2
- package/dist/esm/PinMap/index.js +13 -18
- package/dist/esm/constants/index.d.ts +2 -0
- package/dist/esm/constants/index.js +11 -1
- package/dist/esm/index.d.ts +4 -5
- package/dist/esm/index.js +4 -10
- package/dist/esm/types/chart.d.ts +30 -0
- package/dist/esm/types/chart.js +11 -0
- package/dist/esm/types/config.d.ts +9 -0
- package/dist/esm/types/config.js +1 -0
- package/dist/esm/types/index.d.ts +2 -26
- package/dist/esm/types/index.js +2 -11
- package/dist/esm/utils/config.d.ts +5 -0
- package/dist/esm/utils/config.js +26 -0
- package/dist/esm/utils/index.d.ts +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/package.json +2 -3
|
@@ -0,0 +1,59 @@
|
|
|
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/utils/config.ts
|
|
20
|
+
var config_exports = {};
|
|
21
|
+
__export(config_exports, {
|
|
22
|
+
getGlobalConfig: () => getGlobalConfig,
|
|
23
|
+
getMapConfig: () => getMapConfig,
|
|
24
|
+
setGlobalConfig: () => setGlobalConfig
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(config_exports);
|
|
27
|
+
var import_lodash = require("lodash");
|
|
28
|
+
var import_constants = require("../constants");
|
|
29
|
+
var globalConfig = import_constants.DEFAULT_GLOBAL_CONFIG;
|
|
30
|
+
var setGlobalConfig = (config) => {
|
|
31
|
+
globalConfig = (0, import_lodash.mergeWith)(globalConfig, config, (objValue) => {
|
|
32
|
+
if (Array.isArray(objValue)) {
|
|
33
|
+
return objValue;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var getGlobalConfig = () => {
|
|
38
|
+
return globalConfig;
|
|
39
|
+
};
|
|
40
|
+
var getMapConfig = (props) => {
|
|
41
|
+
const { map: mapConfig } = getGlobalConfig();
|
|
42
|
+
const config = {
|
|
43
|
+
...props,
|
|
44
|
+
mapOptions: {
|
|
45
|
+
center: [120.210792, 30.246026],
|
|
46
|
+
zoom: 12,
|
|
47
|
+
maxZoom: 18,
|
|
48
|
+
...mapConfig,
|
|
49
|
+
...props.mapOptions
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return config;
|
|
53
|
+
};
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
getGlobalConfig,
|
|
57
|
+
getMapConfig,
|
|
58
|
+
setGlobalConfig
|
|
59
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getGlobalConfig, getMapConfig, setGlobalConfig } from './config';
|
|
@@ -0,0 +1,33 @@
|
|
|
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/utils/index.ts
|
|
20
|
+
var utils_exports = {};
|
|
21
|
+
__export(utils_exports, {
|
|
22
|
+
getGlobalConfig: () => import_config.getGlobalConfig,
|
|
23
|
+
getMapConfig: () => import_config.getMapConfig,
|
|
24
|
+
setGlobalConfig: () => import_config.setGlobalConfig
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(utils_exports);
|
|
27
|
+
var import_config = require("./config");
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
getGlobalConfig,
|
|
31
|
+
getMapConfig,
|
|
32
|
+
setGlobalConfig
|
|
33
|
+
});
|
package/dist/esm/Column/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GlobalConfig } from '../types';
|
|
3
|
+
import { setGlobalConfig } from '../utils';
|
|
4
|
+
export type ConfigProviderProps = {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
} & GlobalConfig;
|
|
7
|
+
declare const ConfigProvider: React.FC<ConfigProviderProps> & {
|
|
8
|
+
config: typeof setGlobalConfig;
|
|
9
|
+
};
|
|
10
|
+
export default ConfigProvider;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
var _excluded = ["children"];
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { setGlobalConfig } from "../utils";
|
|
5
|
+
var ConfigProvider = function ConfigProvider(props) {
|
|
6
|
+
var children = props.children,
|
|
7
|
+
config = _objectWithoutProperties(props, _excluded);
|
|
8
|
+
var firstRef = useRef(true);
|
|
9
|
+
if (firstRef.current) {
|
|
10
|
+
setGlobalConfig(config);
|
|
11
|
+
firstRef.current = false;
|
|
12
|
+
}
|
|
13
|
+
return children;
|
|
14
|
+
};
|
|
15
|
+
ConfigProvider.config = setGlobalConfig;
|
|
16
|
+
export default ConfigProvider;
|
package/dist/esm/GPTVis/index.js
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["children", "components"
|
|
4
|
+
var _excluded = ["children", "components"];
|
|
6
5
|
import React from 'react';
|
|
7
6
|
import Markdown from 'react-markdown';
|
|
8
|
-
import rehypeRaw from 'rehype-raw';
|
|
9
7
|
import { withDefaultChartCode } from "../ChartCodeRender";
|
|
10
8
|
var GPTVis = function GPTVis(_ref) {
|
|
11
9
|
var children = _ref.children,
|
|
12
10
|
components = _ref.components,
|
|
13
|
-
rehypePlugins = _ref.rehypePlugins,
|
|
14
11
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
15
12
|
var CodeBlock = withDefaultChartCode();
|
|
16
13
|
return /*#__PURE__*/React.createElement(Markdown, _extends({
|
|
17
14
|
components: _objectSpread({
|
|
18
15
|
code: CodeBlock
|
|
19
|
-
}, components)
|
|
20
|
-
rehypePlugins: [rehypeRaw].concat(_toConsumableArray(rehypePlugins || []))
|
|
16
|
+
}, components)
|
|
21
17
|
}, rest), children);
|
|
22
18
|
};
|
|
23
19
|
export default GPTVis;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseMapProps } from '../types';
|
|
3
3
|
type GeoData = {
|
|
4
4
|
lng: number;
|
|
5
5
|
lat: number;
|
|
6
6
|
size: number;
|
|
7
7
|
};
|
|
8
|
-
export interface HeatMapProps extends
|
|
8
|
+
export interface HeatMapProps extends BaseMapProps<GeoData> {
|
|
9
9
|
className?: string;
|
|
10
10
|
}
|
|
11
11
|
declare const HeatMap: FC<HeatMapProps>;
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["className", "style", "children", "data"];
|
|
4
6
|
import { HeatmapLayer, LarkMap } from '@antv/larkmap';
|
|
5
7
|
import React, { useState } from 'react';
|
|
6
|
-
|
|
7
|
-
securityJsCode: '8803c38931b6fddc9bbfeee69df8824d'
|
|
8
|
-
};
|
|
9
|
-
var CONFIG = {
|
|
10
|
-
mapType: 'Gaode',
|
|
11
|
-
mapOptions: {
|
|
12
|
-
style: 'normal',
|
|
13
|
-
center: [120.210792, 30.246026],
|
|
14
|
-
zoom: 12,
|
|
15
|
-
maxZoom: 18,
|
|
16
|
-
token: 'f0230f884bbd54e2913c890cdf45aa7e'
|
|
17
|
-
}
|
|
18
|
-
};
|
|
8
|
+
import { getMapConfig } from "../utils/config";
|
|
19
9
|
var heapLayerOptions = {
|
|
20
10
|
autoFit: true,
|
|
21
11
|
shape: 'heatmap',
|
|
@@ -36,8 +26,10 @@ var heapLayerOptions = {
|
|
|
36
26
|
var HeatMap = function HeatMap(props) {
|
|
37
27
|
var className = props.className,
|
|
38
28
|
style = props.style,
|
|
29
|
+
children = props.children,
|
|
39
30
|
_props$data = props.data,
|
|
40
|
-
data = _props$data === void 0 ? [] : _props$data
|
|
31
|
+
data = _props$data === void 0 ? [] : _props$data,
|
|
32
|
+
mapConfigRest = _objectWithoutProperties(props, _excluded);
|
|
41
33
|
var _useState = useState({
|
|
42
34
|
data: data,
|
|
43
35
|
parser: {
|
|
@@ -48,13 +40,14 @@ var HeatMap = function HeatMap(props) {
|
|
|
48
40
|
}),
|
|
49
41
|
_useState2 = _slicedToArray(_useState, 1),
|
|
50
42
|
heapSource = _useState2[0];
|
|
43
|
+
var mapConfig = getMapConfig(mapConfigRest);
|
|
51
44
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LarkMap, _extends({
|
|
52
45
|
className: className,
|
|
53
46
|
style: _objectSpread({
|
|
54
47
|
height: '300px'
|
|
55
48
|
}, style)
|
|
56
|
-
},
|
|
49
|
+
}, mapConfig), /*#__PURE__*/React.createElement(HeatmapLayer, _extends({}, heapLayerOptions, {
|
|
57
50
|
source: heapSource
|
|
58
|
-
}))));
|
|
51
|
+
})), children));
|
|
59
52
|
};
|
|
60
53
|
export default HeatMap;
|
package/dist/esm/Line/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
2
|
+
import { BaseChartProps, XYAxis } from '../types';
|
|
3
|
+
export interface LineProps extends BaseChartProps<XYAxis> {
|
|
4
|
+
xField?: string;
|
|
5
|
+
yField?: string;
|
|
6
|
+
categoryFiled?: string;
|
|
7
|
+
}
|
|
4
8
|
declare const Line: (props: LineProps) => React.JSX.Element;
|
|
5
9
|
export default Line;
|
package/dist/esm/Line/index.js
CHANGED
|
@@ -9,13 +9,13 @@ var Line = function Line(props) {
|
|
|
9
9
|
xField = _props$xField === void 0 ? 'x' : _props$xField,
|
|
10
10
|
_props$yField = props.yField,
|
|
11
11
|
yField = _props$yField === void 0 ? 'y' : _props$yField,
|
|
12
|
-
|
|
12
|
+
categoryFiled = props.categoryFiled,
|
|
13
13
|
className = props.className,
|
|
14
14
|
style = props.style;
|
|
15
15
|
|
|
16
16
|
// 如果有 stackField,则使用 seriesField 进行分组显示,否则不分组
|
|
17
|
-
var stackConfig =
|
|
18
|
-
colorField:
|
|
17
|
+
var stackConfig = categoryFiled ? {
|
|
18
|
+
colorField: categoryFiled
|
|
19
19
|
} : {};
|
|
20
20
|
var config = _objectSpread({
|
|
21
21
|
data: data,
|
|
@@ -26,8 +26,7 @@ var Line = function Line(props) {
|
|
|
26
26
|
name: d[xField],
|
|
27
27
|
value: d[yField]
|
|
28
28
|
};
|
|
29
|
-
}
|
|
30
|
-
smooth: true
|
|
29
|
+
}
|
|
31
30
|
}, stackConfig);
|
|
32
31
|
return /*#__PURE__*/React.createElement(ADCLine, _extends({
|
|
33
32
|
className: className,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseMapProps } from '../types';
|
|
3
3
|
type GeoData = {
|
|
4
4
|
originName?: string;
|
|
5
5
|
destinationName?: string;
|
|
6
6
|
coordinates: [number, number][];
|
|
7
7
|
};
|
|
8
|
-
export interface PathMapProps extends
|
|
8
|
+
export interface PathMapProps extends BaseMapProps<GeoData> {
|
|
9
9
|
className?: string;
|
|
10
10
|
}
|
|
11
11
|
declare const PathMap: FC<PathMapProps>;
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
|
+
var _excluded = ["className", "style", "data", "children", "onSceneLoaded"];
|
|
4
6
|
import { LarkMap, LineLayer, PointLayer, TextLayer } from '@antv/larkmap';
|
|
5
7
|
import React, { useState } from 'react';
|
|
6
|
-
|
|
7
|
-
securityJsCode: '8803c38931b6fddc9bbfeee69df8824d'
|
|
8
|
-
};
|
|
9
|
-
var CONFIG = {
|
|
10
|
-
mapType: 'Gaode',
|
|
11
|
-
mapOptions: {
|
|
12
|
-
style: 'normal',
|
|
13
|
-
center: [120.210792, 30.246026],
|
|
14
|
-
zoom: 12,
|
|
15
|
-
maxZoom: 18,
|
|
16
|
-
token: 'f0230f884bbd54e2913c890cdf45aa7e'
|
|
17
|
-
}
|
|
18
|
-
};
|
|
8
|
+
import { getMapConfig } from "../utils/config";
|
|
19
9
|
var lineLayerOptions = {
|
|
20
10
|
autoFit: false,
|
|
21
11
|
shape: 'line',
|
|
@@ -81,7 +71,10 @@ var PathMap = function PathMap(props) {
|
|
|
81
71
|
var className = props.className,
|
|
82
72
|
style = props.style,
|
|
83
73
|
_props$data = props.data,
|
|
84
|
-
data = _props$data === void 0 ? [] : _props$data
|
|
74
|
+
data = _props$data === void 0 ? [] : _props$data,
|
|
75
|
+
children = props.children,
|
|
76
|
+
onSceneLoaded = props.onSceneLoaded,
|
|
77
|
+
mapConfigRest = _objectWithoutProperties(props, _excluded);
|
|
85
78
|
var _useState = useState({
|
|
86
79
|
data: data,
|
|
87
80
|
parser: {
|
|
@@ -112,7 +105,9 @@ var PathMap = function PathMap(props) {
|
|
|
112
105
|
}),
|
|
113
106
|
_useState4 = _slicedToArray(_useState3, 1),
|
|
114
107
|
dotSource = _useState4[0];
|
|
115
|
-
var
|
|
108
|
+
var mapConfig = getMapConfig(mapConfigRest);
|
|
109
|
+
var onMapSceneLoaded = function onMapSceneLoaded(scene) {
|
|
110
|
+
onSceneLoaded === null || onSceneLoaded === void 0 || onSceneLoaded(scene);
|
|
116
111
|
if (!data.length) return;
|
|
117
112
|
var bounds = bbox(data);
|
|
118
113
|
if (scene.getType() === 'amap') {
|
|
@@ -127,14 +122,14 @@ var PathMap = function PathMap(props) {
|
|
|
127
122
|
style: _objectSpread({
|
|
128
123
|
height: 300
|
|
129
124
|
}, style)
|
|
130
|
-
},
|
|
131
|
-
onSceneLoaded:
|
|
125
|
+
}, mapConfig, {
|
|
126
|
+
onSceneLoaded: onMapSceneLoaded
|
|
132
127
|
}), /*#__PURE__*/React.createElement(LineLayer, _extends({}, lineLayerOptions, {
|
|
133
128
|
source: lineSource
|
|
134
129
|
})), /*#__PURE__*/React.createElement(PointLayer, _extends({}, makerLayerOptions, {
|
|
135
130
|
source: dotSource
|
|
136
131
|
})), /*#__PURE__*/React.createElement(TextLayer, _extends({}, labelLayerOptions, {
|
|
137
132
|
source: dotSource
|
|
138
|
-
}))));
|
|
133
|
+
})), children));
|
|
139
134
|
};
|
|
140
135
|
export default PathMap;
|
package/dist/esm/Pie/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseMapProps } from '../types';
|
|
3
3
|
type GeoData = {
|
|
4
4
|
address: string;
|
|
5
5
|
lng: number;
|
|
6
6
|
lat: number;
|
|
7
7
|
};
|
|
8
|
-
export interface PinMapProps extends
|
|
8
|
+
export interface PinMapProps extends BaseMapProps<GeoData> {
|
|
9
9
|
className?: string;
|
|
10
10
|
}
|
|
11
11
|
declare const PinMap: FC<PinMapProps>;
|
package/dist/esm/PinMap/index.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["className", "style", "onSceneLoaded", "children", "data"];
|
|
4
6
|
import { LarkMap, PointLayer, TextLayer } from '@antv/larkmap';
|
|
5
7
|
import React, { useState } from 'react';
|
|
6
|
-
|
|
7
|
-
securityJsCode: '8803c38931b6fddc9bbfeee69df8824d'
|
|
8
|
-
};
|
|
9
|
-
var CONFIG = {
|
|
10
|
-
mapType: 'Gaode',
|
|
11
|
-
mapOptions: {
|
|
12
|
-
style: 'normal',
|
|
13
|
-
center: [120.210792, 30.246026],
|
|
14
|
-
zoom: 12,
|
|
15
|
-
maxZoom: 18,
|
|
16
|
-
token: 'f0230f884bbd54e2913c890cdf45aa7e'
|
|
17
|
-
}
|
|
18
|
-
};
|
|
8
|
+
import { getMapConfig } from "../utils";
|
|
19
9
|
|
|
20
10
|
// const SVG_BLOB = new Blob(
|
|
21
11
|
// [
|
|
@@ -69,8 +59,11 @@ function bbox(data) {
|
|
|
69
59
|
var PinMap = function PinMap(props) {
|
|
70
60
|
var className = props.className,
|
|
71
61
|
style = props.style,
|
|
62
|
+
onSceneLoaded = props.onSceneLoaded,
|
|
63
|
+
children = props.children,
|
|
72
64
|
_props$data = props.data,
|
|
73
|
-
data = _props$data === void 0 ? [] : _props$data
|
|
65
|
+
data = _props$data === void 0 ? [] : _props$data,
|
|
66
|
+
mapConfigRest = _objectWithoutProperties(props, _excluded);
|
|
74
67
|
var _useState = useState(false),
|
|
75
68
|
_useState2 = _slicedToArray(_useState, 2),
|
|
76
69
|
loadedImages = _useState2[0],
|
|
@@ -85,7 +78,9 @@ var PinMap = function PinMap(props) {
|
|
|
85
78
|
}),
|
|
86
79
|
_useState4 = _slicedToArray(_useState3, 1),
|
|
87
80
|
source = _useState4[0];
|
|
88
|
-
var
|
|
81
|
+
var mapConfig = getMapConfig(mapConfigRest);
|
|
82
|
+
var onMapSceneLoaded = function onMapSceneLoaded(scene) {
|
|
83
|
+
onSceneLoaded === null || onSceneLoaded === void 0 || onSceneLoaded(scene);
|
|
89
84
|
scene.addImage('marker', SVG_URL).then(function () {
|
|
90
85
|
setLoadedImages(true);
|
|
91
86
|
});
|
|
@@ -103,12 +98,12 @@ var PinMap = function PinMap(props) {
|
|
|
103
98
|
style: _objectSpread({
|
|
104
99
|
height: 300
|
|
105
100
|
}, style)
|
|
106
|
-
},
|
|
107
|
-
onSceneLoaded:
|
|
101
|
+
}, mapConfig, {
|
|
102
|
+
onSceneLoaded: onMapSceneLoaded
|
|
108
103
|
}), loadedImages && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PointLayer, _extends({}, makerLayerOptions, {
|
|
109
104
|
source: source
|
|
110
105
|
})), /*#__PURE__*/React.createElement(TextLayer, _extends({}, labelLayerOptions, {
|
|
111
106
|
source: source
|
|
112
|
-
})))));
|
|
107
|
+
}))), children));
|
|
113
108
|
};
|
|
114
109
|
export default PinMap;
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import Area from "../Area";
|
|
3
3
|
import Column from "../Column";
|
|
4
|
+
import HeatMap from "../HeatMap";
|
|
4
5
|
import Line from "../Line";
|
|
6
|
+
import PathMap from "../PathMap";
|
|
5
7
|
import Pie from "../Pie";
|
|
8
|
+
import PinMap from "../PinMap";
|
|
6
9
|
import { ChartType } from "../types";
|
|
7
10
|
import WordCloud from "../WordCloud";
|
|
8
|
-
export var DEFAULT_CHART_COMPONENTS = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ChartType.Pie, Pie), ChartType.Area, Area), ChartType.Column, Column), ChartType.Line, Line), ChartType.WordCloud, WordCloud);
|
|
11
|
+
export var DEFAULT_CHART_COMPONENTS = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ChartType.Pie, Pie), ChartType.Area, Area), ChartType.Column, Column), ChartType.Line, Line), ChartType.WordCloud, WordCloud), ChartType.PinMap, PinMap), ChartType.PathMap, PathMap), ChartType.HeatMap, HeatMap);
|
|
12
|
+
export var DEFAULT_GLOBAL_CONFIG = {
|
|
13
|
+
map: {
|
|
14
|
+
style: 'normal',
|
|
15
|
+
// TODO: next step remove
|
|
16
|
+
token: 'f0230f884bbd54e2913c890cdf45aa7e'
|
|
17
|
+
}
|
|
18
|
+
};
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -3,11 +3,10 @@ export { default as Column, type ColumnProps } from './Column';
|
|
|
3
3
|
export { default as Line, type LineProps } from './Line';
|
|
4
4
|
export { default as Pie, type PieProps } from './Pie';
|
|
5
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';
|
|
6
9
|
export { withChartCode, withDefaultChartCode } from './ChartCodeRender';
|
|
10
|
+
export { default as ConfigProvider, type ConfigProviderProps, } from './ConfigProvider';
|
|
7
11
|
export { default as GPTVis } from './GPTVis';
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated
|
|
10
|
-
* 请使用 GPTVis
|
|
11
|
-
*/
|
|
12
|
-
export { default as MarkdownVis } from './GPTVis';
|
|
13
12
|
export * from './types';
|
package/dist/esm/index.js
CHANGED
|
@@ -3,16 +3,10 @@ export { default as Column } from "./Column";
|
|
|
3
3
|
export { default as Line } from "./Line";
|
|
4
4
|
export { default as Pie } from "./Pie";
|
|
5
5
|
export { default as WordCloud } from "./WordCloud";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// export { default as PinMap, type PinMapProps } from './PinMap';
|
|
10
|
-
|
|
6
|
+
export { default as HeatMap } from "./HeatMap";
|
|
7
|
+
export { default as PathMap } from "./PathMap";
|
|
8
|
+
export { default as PinMap } from "./PinMap";
|
|
11
9
|
export { withChartCode, withDefaultChartCode } from "./ChartCodeRender";
|
|
10
|
+
export { default as ConfigProvider } from "./ConfigProvider";
|
|
12
11
|
export { default as GPTVis } from "./GPTVis";
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated
|
|
15
|
-
* 请使用 GPTVis
|
|
16
|
-
*/
|
|
17
|
-
export { default as MarkdownVis } from "./GPTVis";
|
|
18
12
|
export * from "./types";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { LarkMapProps } from '@antv/larkmap';
|
|
2
|
+
import type { CSSProperties } from 'react';
|
|
3
|
+
export type { LarkMapProps };
|
|
4
|
+
export declare enum ChartType {
|
|
5
|
+
Pie = "pie",
|
|
6
|
+
Column = "column",
|
|
7
|
+
Line = "line",
|
|
8
|
+
Area = "area",
|
|
9
|
+
WordCloud = "word-cloud",
|
|
10
|
+
PinMap = "pin-map",
|
|
11
|
+
PathMap = "path-map",
|
|
12
|
+
HeatMap = "heat-map"
|
|
13
|
+
}
|
|
14
|
+
export interface BaseChartProps<T> {
|
|
15
|
+
data: T[];
|
|
16
|
+
style?: CSSProperties;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface XYAxis {
|
|
20
|
+
x: string | number;
|
|
21
|
+
y: number;
|
|
22
|
+
[key: string]: string | number;
|
|
23
|
+
}
|
|
24
|
+
export interface StackableChartProps extends BaseChartProps<XYAxis> {
|
|
25
|
+
xField?: string;
|
|
26
|
+
yField?: string;
|
|
27
|
+
stackField?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface BaseMapProps<T> extends BaseChartProps<T>, LarkMapProps {
|
|
30
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var ChartType = /*#__PURE__*/function (ChartType) {
|
|
2
|
+
ChartType["Pie"] = "pie";
|
|
3
|
+
ChartType["Column"] = "column";
|
|
4
|
+
ChartType["Line"] = "line";
|
|
5
|
+
ChartType["Area"] = "area";
|
|
6
|
+
ChartType["WordCloud"] = "word-cloud";
|
|
7
|
+
ChartType["PinMap"] = "pin-map";
|
|
8
|
+
ChartType["PathMap"] = "path-map";
|
|
9
|
+
ChartType["HeatMap"] = "heat-map";
|
|
10
|
+
return ChartType;
|
|
11
|
+
}({});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,26 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
Pie = "pie",
|
|
4
|
-
Column = "column",
|
|
5
|
-
Line = "line",
|
|
6
|
-
Area = "area",
|
|
7
|
-
WordCloud = "word-cloud",
|
|
8
|
-
PinMap = "pin-map",
|
|
9
|
-
PathMap = "path-map",
|
|
10
|
-
HeatMap = "heat-map"
|
|
11
|
-
}
|
|
12
|
-
export interface BaseChartProps<T> {
|
|
13
|
-
data: T[];
|
|
14
|
-
style?: CSSProperties;
|
|
15
|
-
className?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface XYAxis {
|
|
18
|
-
x: string | number;
|
|
19
|
-
y: number;
|
|
20
|
-
[key: string]: string | number;
|
|
21
|
-
}
|
|
22
|
-
export interface StackableChartProps extends BaseChartProps<XYAxis> {
|
|
23
|
-
xField?: string;
|
|
24
|
-
yField?: string;
|
|
25
|
-
stackField?: string;
|
|
26
|
-
}
|
|
1
|
+
export * from './chart';
|
|
2
|
+
export { GlobalConfig } from './config';
|
package/dist/esm/types/index.js
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
ChartType["Column"] = "column";
|
|
4
|
-
ChartType["Line"] = "line";
|
|
5
|
-
ChartType["Area"] = "area";
|
|
6
|
-
ChartType["WordCloud"] = "word-cloud";
|
|
7
|
-
ChartType["PinMap"] = "pin-map";
|
|
8
|
-
ChartType["PathMap"] = "path-map";
|
|
9
|
-
ChartType["HeatMap"] = "heat-map";
|
|
10
|
-
return ChartType;
|
|
11
|
-
}({});
|
|
1
|
+
export * from "./chart";
|
|
2
|
+
export { GlobalConfig } from "./config";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LarkMapProps } from '../types';
|
|
2
|
+
import { GlobalConfig } from '../types';
|
|
3
|
+
export declare const setGlobalConfig: (config: GlobalConfig) => void;
|
|
4
|
+
export declare const getGlobalConfig: () => GlobalConfig;
|
|
5
|
+
export declare const getMapConfig: (props: LarkMapProps) => LarkMapProps;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import { mergeWith } from 'lodash';
|
|
3
|
+
import { DEFAULT_GLOBAL_CONFIG } from "../constants";
|
|
4
|
+
var globalConfig = DEFAULT_GLOBAL_CONFIG;
|
|
5
|
+
export var setGlobalConfig = function setGlobalConfig(config) {
|
|
6
|
+
globalConfig = mergeWith(globalConfig, config, function (objValue) {
|
|
7
|
+
if (Array.isArray(objValue)) {
|
|
8
|
+
return objValue;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export var getGlobalConfig = function getGlobalConfig() {
|
|
13
|
+
return globalConfig;
|
|
14
|
+
};
|
|
15
|
+
export var getMapConfig = function getMapConfig(props) {
|
|
16
|
+
var _getGlobalConfig = getGlobalConfig(),
|
|
17
|
+
mapConfig = _getGlobalConfig.map;
|
|
18
|
+
var config = _objectSpread(_objectSpread({}, props), {}, {
|
|
19
|
+
mapOptions: _objectSpread(_objectSpread({
|
|
20
|
+
center: [120.210792, 30.246026],
|
|
21
|
+
zoom: 12,
|
|
22
|
+
maxZoom: 18
|
|
23
|
+
}, mapConfig), props.mapOptions)
|
|
24
|
+
});
|
|
25
|
+
return config;
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getGlobalConfig, getMapConfig, setGlobalConfig } from './config';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getGlobalConfig, getMapConfig, setGlobalConfig } from "./config";
|