@antv/gpt-vis 0.5.9 → 0.5.10
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/export.d.ts +38 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/render.d.ts +2 -0
- package/dist/cjs/render.js +67 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/export.d.ts +38 -0
- package/dist/esm/export.js +5 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/render.d.ts +2 -0
- package/dist/esm/render.js +32 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/208.async.js +1 -0
- package/dist/umd/index.min.js +1 -1
- package/package.json +5 -2
- package/dist/umd/330.async.js +0 -1
package/dist/cjs/export.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ChartType } from './types';
|
|
2
3
|
/********** plot chart **********/
|
|
3
4
|
import { default as Area, type AreaProps } from './Area';
|
|
4
5
|
import { default as Bar, type BarProps } from './Bar';
|
|
@@ -31,4 +32,41 @@ import { PinMap, type PinMapProps, HeatMap, type HeatMapProps, PathMap, type Pat
|
|
|
31
32
|
import { default as Table, type TableProps } from './Table';
|
|
32
33
|
export { VisText, type VisTextProps } from './Text';
|
|
33
34
|
export { Area, Bar, Boxplot, Column, DualAxes, FishboneDiagram, FlowDiagram, Funnel, HeatMap, Histogram, IndentedTree, Line, Liquid, MindMap, NetworkGraph, OrganizationChart, PathMap, Pie, PinMap, Radar, Sankey, Scatter, Treemap, Venn, Violin, Table, WordCloud, type AreaProps, type BarProps, type BoxplotProps, type ColumnProps, type DualAxesProps, type FishboneDiagramProps, type FlowDiagramProps, type FunnelProps, type HeatMapProps, type HistogramProps, type IndentedTreeProps, type LineProps, type LiquidProps, type MindMapProps, type NetworkGraphProps, type OrganizationChartProps, type PathMapProps, type PieProps, type PinMapProps, type RadarProps, type SankeyProps, type ScatterProps, type TreemapProps, type VennProps, type ViolinProps, type TableProps, type WordCloudProps, };
|
|
35
|
+
export type VisOptionMap = {
|
|
36
|
+
[ChartType.Area]: AreaProps;
|
|
37
|
+
[ChartType.Bar]: BarProps;
|
|
38
|
+
[ChartType.Boxplot]: BoxplotProps;
|
|
39
|
+
[ChartType.Column]: ColumnProps;
|
|
40
|
+
[ChartType.DualAxes]: DualAxesProps;
|
|
41
|
+
[ChartType.FishboneDiagram]: FishboneDiagramProps;
|
|
42
|
+
[ChartType.FlowDiagram]: FlowDiagramProps;
|
|
43
|
+
[ChartType.Funnel]: FunnelProps;
|
|
44
|
+
[ChartType.HeatMap]: HeatMapProps;
|
|
45
|
+
[ChartType.Histogram]: HistogramProps;
|
|
46
|
+
[ChartType.IndentedTree]: IndentedTreeProps;
|
|
47
|
+
[ChartType.Line]: LineProps;
|
|
48
|
+
[ChartType.Liquid]: LiquidProps;
|
|
49
|
+
[ChartType.MindMap]: MindMapProps;
|
|
50
|
+
[ChartType.NetworkGraph]: NetworkGraphProps;
|
|
51
|
+
[ChartType.OrganizationChart]: OrganizationChartProps;
|
|
52
|
+
[ChartType.PathMap]: PathMapProps;
|
|
53
|
+
[ChartType.Pie]: PieProps;
|
|
54
|
+
[ChartType.PinMap]: PinMapProps;
|
|
55
|
+
[ChartType.Radar]: RadarProps;
|
|
56
|
+
[ChartType.Sankey]: SankeyProps;
|
|
57
|
+
[ChartType.Scatter]: ScatterProps;
|
|
58
|
+
[ChartType.Table]: TableProps;
|
|
59
|
+
[ChartType.Treemap]: TreemapProps;
|
|
60
|
+
[ChartType.Venn]: VennProps;
|
|
61
|
+
[ChartType.Violin]: ViolinProps;
|
|
62
|
+
[ChartType.WordCloud]: WordCloudProps;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* 所有的 Vis 类型的类型定义
|
|
66
|
+
*/
|
|
67
|
+
export type Spec = {
|
|
68
|
+
[K in keyof VisOptionMap]: {
|
|
69
|
+
type: K;
|
|
70
|
+
} & VisOptionMap[K];
|
|
71
|
+
}[keyof VisOptionMap];
|
|
34
72
|
export declare const DEFAULT_CHART_COMPONENTS: Record<string, React.FC<any>>;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
export * from './export';
|
|
3
3
|
/********** export types **********/
|
|
4
4
|
export * from './types';
|
|
5
|
+
/********** export render **********/
|
|
6
|
+
export * from './render';
|
|
5
7
|
/********** export GPTVis **********/
|
|
6
8
|
export { withChartCode, withDefaultChartCode } from './ChartCodeRender';
|
|
7
9
|
export type { CodeBlockComponent, ErrorRender, WithChartCodeOptions } from './ChartCodeRender/type';
|
package/dist/cjs/index.js
CHANGED
|
@@ -41,6 +41,7 @@ __export(src_exports, {
|
|
|
41
41
|
module.exports = __toCommonJS(src_exports);
|
|
42
42
|
__reExport(src_exports, require("./export"), module.exports);
|
|
43
43
|
__reExport(src_exports, require("./types"), module.exports);
|
|
44
|
+
__reExport(src_exports, require("./render"), module.exports);
|
|
44
45
|
var import_ChartCodeRender = require("./ChartCodeRender");
|
|
45
46
|
var import_ConfigProvider = __toESM(require("./ConfigProvider"));
|
|
46
47
|
var import_GPTVis = __toESM(require("./GPTVis"));
|
|
@@ -56,5 +57,6 @@ var import_version = __toESM(require("./version"));
|
|
|
56
57
|
withChartCode,
|
|
57
58
|
withDefaultChartCode,
|
|
58
59
|
...require("./export"),
|
|
59
|
-
...require("./types")
|
|
60
|
+
...require("./types"),
|
|
61
|
+
...require("./render")
|
|
60
62
|
});
|
|
@@ -0,0 +1,67 @@
|
|
|
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/render.tsx
|
|
30
|
+
var render_exports = {};
|
|
31
|
+
__export(render_exports, {
|
|
32
|
+
render: () => render
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(render_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_react_dom = __toESM(require("react-dom"));
|
|
37
|
+
var import_export = require("./export");
|
|
38
|
+
var roots = /* @__PURE__ */ new Map();
|
|
39
|
+
function getRoot(container) {
|
|
40
|
+
if (roots.has(container)) {
|
|
41
|
+
return roots.get(container);
|
|
42
|
+
}
|
|
43
|
+
const root = import_react_dom.default.createRoot(container);
|
|
44
|
+
roots.set(container, root);
|
|
45
|
+
return root;
|
|
46
|
+
}
|
|
47
|
+
function render(container, spec) {
|
|
48
|
+
const mount = typeof container === "string" ? document.querySelector(container) : container;
|
|
49
|
+
if (!mount)
|
|
50
|
+
throw new Error("Target container not found: " + container);
|
|
51
|
+
const { type, ...chartProps } = spec;
|
|
52
|
+
const ChartComp = import_export.DEFAULT_CHART_COMPONENTS[type];
|
|
53
|
+
if (!ChartComp) {
|
|
54
|
+
throw new Error(`Unknown chart type: ${type}`);
|
|
55
|
+
}
|
|
56
|
+
const chartElement = import_react.default.createElement(ChartComp, chartProps);
|
|
57
|
+
if (import_react_dom.default.createRoot) {
|
|
58
|
+
const root = getRoot(mount);
|
|
59
|
+
root.render(chartElement);
|
|
60
|
+
} else {
|
|
61
|
+
import_react_dom.default.render(chartElement, mount);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
render
|
|
67
|
+
});
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.5.
|
|
1
|
+
declare const _default: "0.5.10";
|
|
2
2
|
export default _default;
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/export.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ChartType } from './types';
|
|
2
3
|
/********** plot chart **********/
|
|
3
4
|
import { default as Area, type AreaProps } from './Area';
|
|
4
5
|
import { default as Bar, type BarProps } from './Bar';
|
|
@@ -31,4 +32,41 @@ import { PinMap, type PinMapProps, HeatMap, type HeatMapProps, PathMap, type Pat
|
|
|
31
32
|
import { default as Table, type TableProps } from './Table';
|
|
32
33
|
export { VisText, type VisTextProps } from './Text';
|
|
33
34
|
export { Area, Bar, Boxplot, Column, DualAxes, FishboneDiagram, FlowDiagram, Funnel, HeatMap, Histogram, IndentedTree, Line, Liquid, MindMap, NetworkGraph, OrganizationChart, PathMap, Pie, PinMap, Radar, Sankey, Scatter, Treemap, Venn, Violin, Table, WordCloud, type AreaProps, type BarProps, type BoxplotProps, type ColumnProps, type DualAxesProps, type FishboneDiagramProps, type FlowDiagramProps, type FunnelProps, type HeatMapProps, type HistogramProps, type IndentedTreeProps, type LineProps, type LiquidProps, type MindMapProps, type NetworkGraphProps, type OrganizationChartProps, type PathMapProps, type PieProps, type PinMapProps, type RadarProps, type SankeyProps, type ScatterProps, type TreemapProps, type VennProps, type ViolinProps, type TableProps, type WordCloudProps, };
|
|
35
|
+
export type VisOptionMap = {
|
|
36
|
+
[ChartType.Area]: AreaProps;
|
|
37
|
+
[ChartType.Bar]: BarProps;
|
|
38
|
+
[ChartType.Boxplot]: BoxplotProps;
|
|
39
|
+
[ChartType.Column]: ColumnProps;
|
|
40
|
+
[ChartType.DualAxes]: DualAxesProps;
|
|
41
|
+
[ChartType.FishboneDiagram]: FishboneDiagramProps;
|
|
42
|
+
[ChartType.FlowDiagram]: FlowDiagramProps;
|
|
43
|
+
[ChartType.Funnel]: FunnelProps;
|
|
44
|
+
[ChartType.HeatMap]: HeatMapProps;
|
|
45
|
+
[ChartType.Histogram]: HistogramProps;
|
|
46
|
+
[ChartType.IndentedTree]: IndentedTreeProps;
|
|
47
|
+
[ChartType.Line]: LineProps;
|
|
48
|
+
[ChartType.Liquid]: LiquidProps;
|
|
49
|
+
[ChartType.MindMap]: MindMapProps;
|
|
50
|
+
[ChartType.NetworkGraph]: NetworkGraphProps;
|
|
51
|
+
[ChartType.OrganizationChart]: OrganizationChartProps;
|
|
52
|
+
[ChartType.PathMap]: PathMapProps;
|
|
53
|
+
[ChartType.Pie]: PieProps;
|
|
54
|
+
[ChartType.PinMap]: PinMapProps;
|
|
55
|
+
[ChartType.Radar]: RadarProps;
|
|
56
|
+
[ChartType.Sankey]: SankeyProps;
|
|
57
|
+
[ChartType.Scatter]: ScatterProps;
|
|
58
|
+
[ChartType.Table]: TableProps;
|
|
59
|
+
[ChartType.Treemap]: TreemapProps;
|
|
60
|
+
[ChartType.Venn]: VennProps;
|
|
61
|
+
[ChartType.Violin]: ViolinProps;
|
|
62
|
+
[ChartType.WordCloud]: WordCloudProps;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* 所有的 Vis 类型的类型定义
|
|
66
|
+
*/
|
|
67
|
+
export type Spec = {
|
|
68
|
+
[K in keyof VisOptionMap]: {
|
|
69
|
+
type: K;
|
|
70
|
+
} & VisOptionMap[K];
|
|
71
|
+
}[keyof VisOptionMap];
|
|
34
72
|
export declare const DEFAULT_CHART_COMPONENTS: Record<string, React.FC<any>>;
|
package/dist/esm/export.js
CHANGED
|
@@ -41,4 +41,9 @@ import { PinMap, HeatMap, PathMap } from "./export-map";
|
|
|
41
41
|
import { default as Table } from "./Table";
|
|
42
42
|
export { VisText } from "./Text";
|
|
43
43
|
export { Area, Bar, Boxplot, Column, DualAxes, FishboneDiagram, FlowDiagram, Funnel, HeatMap, Histogram, IndentedTree, Line, Liquid, MindMap, NetworkGraph, OrganizationChart, PathMap, Pie, PinMap, Radar, Sankey, Scatter, Treemap, Venn, Violin, Table, WordCloud };
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 所有的 Vis 类型的类型定义
|
|
47
|
+
*/
|
|
48
|
+
|
|
44
49
|
export var DEFAULT_CHART_COMPONENTS = (_DEFAULT_CHART_COMPON = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_DEFAULT_CHART_COMPON, ChartType.Area, Area), ChartType.Bar, Bar), ChartType.Boxplot, Boxplot), ChartType.Column, Column), ChartType.DualAxes, DualAxes), ChartType.FishboneDiagram, FishboneDiagram), ChartType.FlowDiagram, FlowDiagram), ChartType.Funnel, Funnel), ChartType.HeatMap, HeatMap), ChartType.Histogram, Histogram), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_DEFAULT_CHART_COMPON, ChartType.IndentedTree, IndentedTree), ChartType.Line, Line), ChartType.Liquid, Liquid), ChartType.MindMap, MindMap), ChartType.NetworkGraph, NetworkGraph), ChartType.Pie, Pie), ChartType.PinMap, PinMap), ChartType.Radar, Radar), ChartType.Sankey, Sankey), ChartType.Scatter, Scatter), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_DEFAULT_CHART_COMPON, ChartType.Treemap, Treemap), ChartType.Venn, Venn), ChartType.Violin, Violin), ChartType.Table, Table), ChartType.WordCloud, WordCloud), ChartType.OrganizationChart, OrganizationChart));
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
export * from './export';
|
|
3
3
|
/********** export types **********/
|
|
4
4
|
export * from './types';
|
|
5
|
+
/********** export render **********/
|
|
6
|
+
export * from './render';
|
|
5
7
|
/********** export GPTVis **********/
|
|
6
8
|
export { withChartCode, withDefaultChartCode } from './ChartCodeRender';
|
|
7
9
|
export type { CodeBlockComponent, ErrorRender, WithChartCodeOptions } from './ChartCodeRender/type';
|
package/dist/esm/index.js
CHANGED
|
@@ -4,6 +4,9 @@ export * from "./export";
|
|
|
4
4
|
/********** export types **********/
|
|
5
5
|
export * from "./types";
|
|
6
6
|
|
|
7
|
+
/********** export render **********/
|
|
8
|
+
export * from "./render";
|
|
9
|
+
|
|
7
10
|
/********** export GPTVis **********/
|
|
8
11
|
export { withChartCode, withDefaultChartCode } from "./ChartCodeRender";
|
|
9
12
|
export { default as ConfigProvider } from "./ConfigProvider";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var _excluded = ["type"];
|
|
2
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
3
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import ReactDOM from 'react-dom';
|
|
6
|
+
import { DEFAULT_CHART_COMPONENTS } from "./export";
|
|
7
|
+
var roots = new Map();
|
|
8
|
+
function getRoot(container) {
|
|
9
|
+
if (roots.has(container)) {
|
|
10
|
+
return roots.get(container);
|
|
11
|
+
}
|
|
12
|
+
var root = ReactDOM.createRoot(container);
|
|
13
|
+
roots.set(container, root);
|
|
14
|
+
return root;
|
|
15
|
+
}
|
|
16
|
+
export function render(container, spec) {
|
|
17
|
+
var mount = typeof container === 'string' ? document.querySelector(container) : container;
|
|
18
|
+
if (!mount) throw new Error('Target container not found: ' + container);
|
|
19
|
+
var type = spec.type,
|
|
20
|
+
chartProps = _objectWithoutProperties(spec, _excluded);
|
|
21
|
+
var ChartComp = DEFAULT_CHART_COMPONENTS[type];
|
|
22
|
+
if (!ChartComp) {
|
|
23
|
+
throw new Error("Unknown chart type: ".concat(type));
|
|
24
|
+
}
|
|
25
|
+
var chartElement = /*#__PURE__*/React.createElement(ChartComp, chartProps);
|
|
26
|
+
if (ReactDOM.createRoot) {
|
|
27
|
+
var root = getRoot(mount);
|
|
28
|
+
root.render(chartElement);
|
|
29
|
+
} else {
|
|
30
|
+
ReactDOM.render(chartElement, mount);
|
|
31
|
+
}
|
|
32
|
+
}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.5.
|
|
1
|
+
declare const _default: "0.5.10";
|
|
2
2
|
export default _default;
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '0.5.
|
|
1
|
+
export default '0.5.10';
|