@antv/gpt-vis 0.0.2 → 0.0.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/README.md +3 -3
- package/dist/cjs/Area/index.js +61 -0
- package/dist/cjs/ChartCodeRender/index.js +121 -0
- package/dist/cjs/ChartCodeRender/type.js +17 -0
- package/dist/cjs/Column/index.js +73 -0
- package/dist/cjs/GPTVis/index.js +56 -0
- package/dist/cjs/HeatMap/index.js +90 -0
- package/dist/cjs/Line/index.js +62 -0
- package/dist/cjs/PathMap/index.js +150 -0
- package/dist/cjs/Pie/index.js +72 -0
- package/dist/cjs/PinMap/index.js +125 -0
- package/dist/cjs/WordCloud/index.js +57 -0
- package/dist/cjs/constants/index.js +54 -0
- package/dist/{index.d.ts → cjs/index.d.ts} +2 -2
- package/dist/cjs/index.js +65 -0
- package/dist/cjs/types/index.js +39 -0
- package/dist/esm/Area/index.d.ts +5 -0
- package/dist/esm/ChartCodeRender/index.css +19 -0
- package/dist/esm/ChartCodeRender/index.d.ts +10 -0
- package/dist/{ChartCodeRender → esm/ChartCodeRender}/index.js +1 -1
- package/dist/esm/ChartCodeRender/type.d.ts +55 -0
- package/dist/esm/Column/index.d.ts +5 -0
- package/dist/esm/GPTVis/index.d.ts +10 -0
- package/dist/esm/HeatMap/index.d.ts +12 -0
- package/dist/esm/Line/index.d.ts +5 -0
- package/dist/esm/PathMap/index.d.ts +12 -0
- package/dist/esm/Pie/index.d.ts +19 -0
- package/dist/esm/Pie/index.text.d.ts +0 -0
- package/dist/esm/Pie/index.text.js +0 -0
- package/dist/esm/PinMap/index.d.ts +12 -0
- package/dist/esm/PinMap/maker.svg +1 -0
- package/dist/esm/WordCloud/index.d.ts +11 -0
- package/dist/esm/constants/index.d.ts +2 -0
- package/dist/esm/index.d.ts +13 -0
- package/dist/{index.js → esm/index.js} +4 -3
- package/dist/esm/types/index.d.ts +26 -0
- package/package.json +7 -7
- package/dist/Message/index.d.ts +0 -18
- package/dist/Message/index.js +0 -14
- /package/dist/{Area → cjs/Area}/index.d.ts +0 -0
- /package/dist/{ChartCodeRender → cjs/ChartCodeRender}/index.css +0 -0
- /package/dist/{ChartCodeRender → cjs/ChartCodeRender}/index.d.ts +0 -0
- /package/dist/{ChartCodeRender → cjs/ChartCodeRender}/type.d.ts +0 -0
- /package/dist/{Column → cjs/Column}/index.d.ts +0 -0
- /package/dist/{GPTVis → cjs/GPTVis}/index.d.ts +0 -0
- /package/dist/{HeatMap → cjs/HeatMap}/index.d.ts +0 -0
- /package/dist/{Line → cjs/Line}/index.d.ts +0 -0
- /package/dist/{PathMap → cjs/PathMap}/index.d.ts +0 -0
- /package/dist/{Pie → cjs/Pie}/index.d.ts +0 -0
- /package/dist/{Pie → cjs/Pie}/index.text.d.ts +0 -0
- /package/dist/{Pie → cjs/Pie}/index.text.js +0 -0
- /package/dist/{PinMap → cjs/PinMap}/index.d.ts +0 -0
- /package/dist/{PinMap → cjs/PinMap}/maker.svg +0 -0
- /package/dist/{WordCloud → cjs/WordCloud}/index.d.ts +0 -0
- /package/dist/{constants → cjs/constants}/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/index.d.ts +0 -0
- /package/dist/{Area → esm/Area}/index.js +0 -0
- /package/dist/{ChartCodeRender → esm/ChartCodeRender}/type.js +0 -0
- /package/dist/{Column → esm/Column}/index.js +0 -0
- /package/dist/{GPTVis → esm/GPTVis}/index.js +0 -0
- /package/dist/{HeatMap → esm/HeatMap}/index.js +0 -0
- /package/dist/{Line → esm/Line}/index.js +0 -0
- /package/dist/{PathMap → esm/PathMap}/index.js +0 -0
- /package/dist/{Pie → esm/Pie}/index.js +0 -0
- /package/dist/{PinMap → esm/PinMap}/index.js +0 -0
- /package/dist/{WordCloud → esm/WordCloud}/index.js +0 -0
- /package/dist/{constants → esm/constants}/index.js +0 -0
- /package/dist/{types → esm/types}/index.js +0 -0
package/README.md
CHANGED
|
@@ -32,11 +32,11 @@ export default () => {
|
|
|
32
32
|
|
|
33
33
|
### 📝 Markdown 中使用
|
|
34
34
|
|
|
35
|
-
#### 方式一:使用
|
|
35
|
+
#### 方式一:使用 GPTVis 组件
|
|
36
36
|
|
|
37
37
|
```tsx | pure
|
|
38
38
|
import React from 'react';
|
|
39
|
-
import {
|
|
39
|
+
import { GPTVis } from '@antv/gpt-vis';
|
|
40
40
|
|
|
41
41
|
const markdownContent = `
|
|
42
42
|
# GPT-VIS \n\nComponents for GPTs, generative AI, and LLM projects. Not only UI Components.
|
|
@@ -57,7 +57,7 @@ const markdownContent = `
|
|
|
57
57
|
`;
|
|
58
58
|
|
|
59
59
|
export default () => {
|
|
60
|
-
return <
|
|
60
|
+
return <GPTVis>{markdownContent}</GPTVis>;
|
|
61
61
|
};
|
|
62
62
|
```
|
|
63
63
|
|
|
@@ -0,0 +1,61 @@
|
|
|
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/Area/index.tsx
|
|
30
|
+
var Area_exports = {};
|
|
31
|
+
__export(Area_exports, {
|
|
32
|
+
default: () => Area_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Area_exports);
|
|
35
|
+
var import_plots = require("@ant-design/plots");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var Area = (props) => {
|
|
38
|
+
const {
|
|
39
|
+
data = [],
|
|
40
|
+
xField = "x",
|
|
41
|
+
yField = "y",
|
|
42
|
+
stackField,
|
|
43
|
+
className,
|
|
44
|
+
style
|
|
45
|
+
} = props;
|
|
46
|
+
const stackConfig = stackField ? { colorField: stackField, isStack: true } : {};
|
|
47
|
+
const config = {
|
|
48
|
+
data,
|
|
49
|
+
xField,
|
|
50
|
+
yField,
|
|
51
|
+
tooltip: (d) => {
|
|
52
|
+
return {
|
|
53
|
+
name: d[xField],
|
|
54
|
+
value: d[yField]
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
...stackConfig
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */ import_react.default.createElement(import_plots.Area, { className, containerStyle: { ...style }, ...config });
|
|
60
|
+
};
|
|
61
|
+
var Area_default = Area;
|
|
@@ -0,0 +1,121 @@
|
|
|
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/ChartCodeRender/index.tsx
|
|
30
|
+
var ChartCodeRender_exports = {};
|
|
31
|
+
__export(ChartCodeRender_exports, {
|
|
32
|
+
withChartCode: () => withChartCode,
|
|
33
|
+
withDefaultChartCode: () => withDefaultChartCode
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(ChartCodeRender_exports);
|
|
36
|
+
var import_icons = require("@ant-design/icons");
|
|
37
|
+
var import_lodash = require("lodash");
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
39
|
+
var import_constants = require("../constants");
|
|
40
|
+
var import_index = require("./index.css");
|
|
41
|
+
var Loading = () => {
|
|
42
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "gpt-vis-loading" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "gpt-vis-loading-icon" }, /* @__PURE__ */ import_react.default.createElement(
|
|
43
|
+
import_icons.LoadingOutlined,
|
|
44
|
+
{
|
|
45
|
+
style: { fontSize: "24px", color: "rgb(56, 177, 246)" }
|
|
46
|
+
}
|
|
47
|
+
)), /* @__PURE__ */ import_react.default.createElement("p", null, "数据生成中"));
|
|
48
|
+
};
|
|
49
|
+
var withCodeBlock = (options) => {
|
|
50
|
+
return function CodeBlock(props) {
|
|
51
|
+
var _a;
|
|
52
|
+
const { children, className = "", node, ...rest } = props;
|
|
53
|
+
const content = String(children).trim();
|
|
54
|
+
const isVisChart = className.includes("language-vis-chart");
|
|
55
|
+
const {
|
|
56
|
+
components,
|
|
57
|
+
extraRenderers,
|
|
58
|
+
languageRenderers,
|
|
59
|
+
defaultRenderer: DefaultRenderer,
|
|
60
|
+
debug,
|
|
61
|
+
loadingTimeout = 5e3
|
|
62
|
+
} = options;
|
|
63
|
+
const timeoutRef = (0, import_react.useRef)();
|
|
64
|
+
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
65
|
+
if (isVisChart) {
|
|
66
|
+
let chartJson;
|
|
67
|
+
try {
|
|
68
|
+
chartJson = JSON.parse(content);
|
|
69
|
+
} catch (e) {
|
|
70
|
+
if (timeoutRef.current) {
|
|
71
|
+
clearTimeout(timeoutRef.current);
|
|
72
|
+
if (debug) {
|
|
73
|
+
console.log("GPT-Vis withChartCode parse content timeout");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
timeoutRef.current = setTimeout(() => {
|
|
77
|
+
setLoading(false);
|
|
78
|
+
}, loadingTimeout);
|
|
79
|
+
return loading ? /* @__PURE__ */ import_react.default.createElement(Loading, null) : /* @__PURE__ */ import_react.default.createElement("code", null, content.toString());
|
|
80
|
+
}
|
|
81
|
+
const { type } = chartJson;
|
|
82
|
+
const ChartComponent = components[type];
|
|
83
|
+
if (debug) {
|
|
84
|
+
console.log(
|
|
85
|
+
"GPT-Vis withChartCode get chartJson parse from vis-chart code block",
|
|
86
|
+
chartJson
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
if (!ChartComponent) {
|
|
90
|
+
return /* @__PURE__ */ import_react.default.createElement("code", null, `Chart type "${type}" is not supported.`);
|
|
91
|
+
}
|
|
92
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "gpt-vis" }, /* @__PURE__ */ import_react.default.createElement(ChartComponent, { ...chartJson }));
|
|
93
|
+
}
|
|
94
|
+
const languageName = ((_a = className.match(/language-(.*)/)) == null ? void 0 : _a[1]) || "";
|
|
95
|
+
const extraLanguageRenderers = extraRenderers || languageRenderers;
|
|
96
|
+
const ExtraRendererComponent = extraLanguageRenderers && extraLanguageRenderers[languageName];
|
|
97
|
+
if (ExtraRendererComponent) {
|
|
98
|
+
return /* @__PURE__ */ import_react.default.createElement(ExtraRendererComponent, { ...props });
|
|
99
|
+
}
|
|
100
|
+
return DefaultRenderer ? /* @__PURE__ */ import_react.default.createElement(DefaultRenderer, { ...props }) : /* @__PURE__ */ import_react.default.createElement("code", { ...rest, className }, children);
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
var withChartCode = (options) => {
|
|
104
|
+
var _a;
|
|
105
|
+
const components = ((_a = options.components) == null ? void 0 : _a.reduce((acc, obj) => ({ ...acc, ...obj }), {})) || [];
|
|
106
|
+
return withCodeBlock({
|
|
107
|
+
...options,
|
|
108
|
+
components
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
var withDefaultChartCode = (options) => {
|
|
112
|
+
return withChartCode({
|
|
113
|
+
...options,
|
|
114
|
+
components: [import_constants.DEFAULT_CHART_COMPONENTS, ...(0, import_lodash.get)(options, "components", [])]
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
withChartCode,
|
|
120
|
+
withDefaultChartCode
|
|
121
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/ChartCodeRender/type.ts
|
|
16
|
+
var type_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(type_exports);
|
|
@@ -0,0 +1,73 @@
|
|
|
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/Column/index.tsx
|
|
30
|
+
var Column_exports = {};
|
|
31
|
+
__export(Column_exports, {
|
|
32
|
+
default: () => Column_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Column_exports);
|
|
35
|
+
var import_plots = require("@ant-design/plots");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var Column = (props) => {
|
|
38
|
+
const {
|
|
39
|
+
data = [],
|
|
40
|
+
xField = "x",
|
|
41
|
+
yField = "y",
|
|
42
|
+
stackField,
|
|
43
|
+
style,
|
|
44
|
+
className
|
|
45
|
+
} = props;
|
|
46
|
+
const stackConfig = stackField ? { colorField: stackField, stack: true } : {};
|
|
47
|
+
const config = {
|
|
48
|
+
data,
|
|
49
|
+
xField: xField || "x",
|
|
50
|
+
yField: yField || "y",
|
|
51
|
+
style: {
|
|
52
|
+
// 圆角样式
|
|
53
|
+
radiusTopLeft: 10,
|
|
54
|
+
radiusTopRight: 10
|
|
55
|
+
},
|
|
56
|
+
tooltip: (d) => {
|
|
57
|
+
return {
|
|
58
|
+
name: d[xField],
|
|
59
|
+
value: d[yField]
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
...stackConfig
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
65
|
+
import_plots.Column,
|
|
66
|
+
{
|
|
67
|
+
className,
|
|
68
|
+
containerStyle: { ...style },
|
|
69
|
+
...config
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
var Column_default = Column;
|
|
@@ -0,0 +1,56 @@
|
|
|
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/GPTVis/index.tsx
|
|
30
|
+
var GPTVis_exports = {};
|
|
31
|
+
__export(GPTVis_exports, {
|
|
32
|
+
default: () => GPTVis_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(GPTVis_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_react_markdown = __toESM(require("react-markdown"));
|
|
37
|
+
var import_rehype_raw = __toESM(require("rehype-raw"));
|
|
38
|
+
var import_ChartCodeRender = require("../ChartCodeRender");
|
|
39
|
+
var GPTVis = ({
|
|
40
|
+
children,
|
|
41
|
+
components,
|
|
42
|
+
rehypePlugins,
|
|
43
|
+
...rest
|
|
44
|
+
}) => {
|
|
45
|
+
const CodeBlock = (0, import_ChartCodeRender.withDefaultChartCode)();
|
|
46
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
47
|
+
import_react_markdown.default,
|
|
48
|
+
{
|
|
49
|
+
components: { code: CodeBlock, ...components },
|
|
50
|
+
rehypePlugins: [import_rehype_raw.default, ...rehypePlugins || []],
|
|
51
|
+
...rest
|
|
52
|
+
},
|
|
53
|
+
children
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
var GPTVis_default = GPTVis;
|
|
@@ -0,0 +1,90 @@
|
|
|
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/HeatMap/index.tsx
|
|
30
|
+
var HeatMap_exports = {};
|
|
31
|
+
__export(HeatMap_exports, {
|
|
32
|
+
default: () => HeatMap_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(HeatMap_exports);
|
|
35
|
+
var import_larkmap = require("@antv/larkmap");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
window._AMapSecurityConfig = {
|
|
38
|
+
securityJsCode: "8803c38931b6fddc9bbfeee69df8824d"
|
|
39
|
+
};
|
|
40
|
+
var CONFIG = {
|
|
41
|
+
mapType: "Gaode",
|
|
42
|
+
mapOptions: {
|
|
43
|
+
style: "normal",
|
|
44
|
+
center: [120.210792, 30.246026],
|
|
45
|
+
zoom: 12,
|
|
46
|
+
maxZoom: 18,
|
|
47
|
+
token: "f0230f884bbd54e2913c890cdf45aa7e"
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var heapLayerOptions = {
|
|
51
|
+
autoFit: true,
|
|
52
|
+
shape: "heatmap",
|
|
53
|
+
size: {
|
|
54
|
+
field: "size",
|
|
55
|
+
value: [0, 1]
|
|
56
|
+
},
|
|
57
|
+
style: {
|
|
58
|
+
intensity: 3,
|
|
59
|
+
radius: 20,
|
|
60
|
+
opacity: 1,
|
|
61
|
+
rampColors: {
|
|
62
|
+
colors: [
|
|
63
|
+
"#FF4818",
|
|
64
|
+
"#F7B74A",
|
|
65
|
+
"#FFF598",
|
|
66
|
+
"#F27DEB",
|
|
67
|
+
"#8C1EB2",
|
|
68
|
+
"#421EB2"
|
|
69
|
+
],
|
|
70
|
+
positions: [0, 0.2, 0.4, 0.6, 0.8, 1]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var HeatMap = (props) => {
|
|
75
|
+
const { className, style, data = [] } = props;
|
|
76
|
+
const [heapSource] = (0, import_react.useState)({
|
|
77
|
+
data,
|
|
78
|
+
parser: { type: "json", x: "lng", y: "lat" }
|
|
79
|
+
});
|
|
80
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
81
|
+
import_larkmap.LarkMap,
|
|
82
|
+
{
|
|
83
|
+
className,
|
|
84
|
+
style: { height: "300px", ...style },
|
|
85
|
+
...CONFIG
|
|
86
|
+
},
|
|
87
|
+
/* @__PURE__ */ import_react.default.createElement(import_larkmap.HeatmapLayer, { ...heapLayerOptions, source: heapSource })
|
|
88
|
+
));
|
|
89
|
+
};
|
|
90
|
+
var HeatMap_default = HeatMap;
|
|
@@ -0,0 +1,62 @@
|
|
|
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/Line/index.tsx
|
|
30
|
+
var Line_exports = {};
|
|
31
|
+
__export(Line_exports, {
|
|
32
|
+
default: () => Line_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Line_exports);
|
|
35
|
+
var import_plots = require("@ant-design/plots");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var Line = (props) => {
|
|
38
|
+
const {
|
|
39
|
+
data = [],
|
|
40
|
+
xField = "x",
|
|
41
|
+
yField = "y",
|
|
42
|
+
stackField,
|
|
43
|
+
className,
|
|
44
|
+
style
|
|
45
|
+
} = props;
|
|
46
|
+
const stackConfig = stackField ? { colorField: stackField } : {};
|
|
47
|
+
const config = {
|
|
48
|
+
data,
|
|
49
|
+
xField,
|
|
50
|
+
yField,
|
|
51
|
+
tooltip: (d) => {
|
|
52
|
+
return {
|
|
53
|
+
name: d[xField],
|
|
54
|
+
value: d[yField]
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
smooth: true,
|
|
58
|
+
...stackConfig
|
|
59
|
+
};
|
|
60
|
+
return /* @__PURE__ */ import_react.default.createElement(import_plots.Line, { className, containerStyle: { ...style }, ...config });
|
|
61
|
+
};
|
|
62
|
+
var Line_default = Line;
|
|
@@ -0,0 +1,150 @@
|
|
|
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/PathMap/index.tsx
|
|
30
|
+
var PathMap_exports = {};
|
|
31
|
+
__export(PathMap_exports, {
|
|
32
|
+
default: () => PathMap_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(PathMap_exports);
|
|
35
|
+
var import_larkmap = require("@antv/larkmap");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
window._AMapSecurityConfig = {
|
|
38
|
+
securityJsCode: "8803c38931b6fddc9bbfeee69df8824d"
|
|
39
|
+
};
|
|
40
|
+
var CONFIG = {
|
|
41
|
+
mapType: "Gaode",
|
|
42
|
+
mapOptions: {
|
|
43
|
+
style: "normal",
|
|
44
|
+
center: [120.210792, 30.246026],
|
|
45
|
+
zoom: 12,
|
|
46
|
+
maxZoom: 18,
|
|
47
|
+
token: "f0230f884bbd54e2913c890cdf45aa7e"
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var lineLayerOptions = {
|
|
51
|
+
autoFit: false,
|
|
52
|
+
shape: "line",
|
|
53
|
+
size: 3,
|
|
54
|
+
color: "#6808fed1",
|
|
55
|
+
style: {
|
|
56
|
+
opacity: 1,
|
|
57
|
+
lineType: "solid",
|
|
58
|
+
stroke: "#6808FE",
|
|
59
|
+
strokeWidth: 1
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var makerLayerOptions = {
|
|
63
|
+
autoFit: false,
|
|
64
|
+
shape: "circle",
|
|
65
|
+
color: "#fff",
|
|
66
|
+
size: 4,
|
|
67
|
+
style: {
|
|
68
|
+
stroke: "#6808FE",
|
|
69
|
+
strokeWidth: 3
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var labelLayerOptions = {
|
|
73
|
+
autoFit: false,
|
|
74
|
+
field: "address",
|
|
75
|
+
style: {
|
|
76
|
+
fill: "#fff",
|
|
77
|
+
opacity: 1,
|
|
78
|
+
fontSize: 16,
|
|
79
|
+
fontWeight: "bold",
|
|
80
|
+
stroke: "#6808FE",
|
|
81
|
+
strokeWidth: 8,
|
|
82
|
+
textAllowOverlap: false,
|
|
83
|
+
padding: [5, 5],
|
|
84
|
+
textOffset: [0, 30]
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
function bbox(data) {
|
|
88
|
+
const bounds = [Infinity, Infinity, -Infinity, -Infinity];
|
|
89
|
+
data.forEach(({ coordinates }) => {
|
|
90
|
+
coordinates.forEach(([lng, lat]) => {
|
|
91
|
+
if (bounds[0] > lng) {
|
|
92
|
+
bounds[0] = lng;
|
|
93
|
+
}
|
|
94
|
+
if (bounds[1] > lat) {
|
|
95
|
+
bounds[1] = lat;
|
|
96
|
+
}
|
|
97
|
+
if (bounds[2] < lng) {
|
|
98
|
+
bounds[2] = lng;
|
|
99
|
+
}
|
|
100
|
+
if (bounds[3] < lat) {
|
|
101
|
+
bounds[3] = lat;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
return bounds;
|
|
106
|
+
}
|
|
107
|
+
var PathMap = (props) => {
|
|
108
|
+
const { className, style, data = [] } = props;
|
|
109
|
+
const [lineSource] = (0, import_react.useState)({
|
|
110
|
+
data,
|
|
111
|
+
parser: { type: "json", coordinates: "coordinates" }
|
|
112
|
+
});
|
|
113
|
+
const [dotSource] = (0, import_react.useState)(() => ({
|
|
114
|
+
data: data.map((item) => [
|
|
115
|
+
{ lngLat: item.coordinates[0], address: item == null ? void 0 : item.originName },
|
|
116
|
+
{
|
|
117
|
+
lngLat: item.coordinates[item.coordinates.length - 1],
|
|
118
|
+
address: item == null ? void 0 : item.destinationName
|
|
119
|
+
}
|
|
120
|
+
]).flat().filter((item) => item.address),
|
|
121
|
+
parser: { type: "json", coordinates: "lngLat" }
|
|
122
|
+
}));
|
|
123
|
+
const onSceneLoaded = (scene) => {
|
|
124
|
+
var _a;
|
|
125
|
+
if (!data.length)
|
|
126
|
+
return;
|
|
127
|
+
const bounds = bbox(data);
|
|
128
|
+
if (scene.getType() === "amap") {
|
|
129
|
+
(_a = scene.map) == null ? void 0 : _a.setBounds(bounds, true, [60, 60, 60, 60]);
|
|
130
|
+
} else {
|
|
131
|
+
scene.fitBounds([
|
|
132
|
+
[bounds[0], bounds[1]],
|
|
133
|
+
[bounds[2], bounds[3]]
|
|
134
|
+
]);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
138
|
+
import_larkmap.LarkMap,
|
|
139
|
+
{
|
|
140
|
+
className,
|
|
141
|
+
style: { height: 300, ...style },
|
|
142
|
+
...CONFIG,
|
|
143
|
+
onSceneLoaded
|
|
144
|
+
},
|
|
145
|
+
/* @__PURE__ */ import_react.default.createElement(import_larkmap.LineLayer, { ...lineLayerOptions, source: lineSource }),
|
|
146
|
+
/* @__PURE__ */ import_react.default.createElement(import_larkmap.PointLayer, { ...makerLayerOptions, source: dotSource }),
|
|
147
|
+
/* @__PURE__ */ import_react.default.createElement(import_larkmap.TextLayer, { ...labelLayerOptions, source: dotSource })
|
|
148
|
+
));
|
|
149
|
+
};
|
|
150
|
+
var PathMap_default = PathMap;
|