@antv/gpt-vis 0.4.5 → 0.4.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/README.md CHANGED
@@ -18,7 +18,8 @@ Components for GPTs, generative AI, and LLM projects. **Not only UI Components**
18
18
  </div>
19
19
 
20
20
  <div align="center">
21
- <video src="https://github.com/user-attachments/assets/b8eb4a89-b0ed-4a39-8fab-316161949446" />
21
+ <video src="https://github.com/user-attachments/assets/24b0d820-ebf8-4351-bc5b-4fa607a76e17" />
22
+
22
23
  <!-- <a href="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*ut_RSJxdBMoAAAAAAAAAAAAADmJ7AQ/original" target="_blank"><img src="https://github.com/user-attachments/assets/d6e90e58-9bf7-4c40-a2db-96cbd68ed818" width="800"></a> -->
23
24
  </div>
24
25
 
@@ -54,10 +54,10 @@ var heapLayerOptions = {
54
54
  }
55
55
  };
56
56
  var HeatMap = (props) => {
57
- const { children, data = [], ...mapConfigRest } = (0, import_hooks.useMapConfig)("HeatMap", props);
57
+ const { children, data, ...mapConfigRest } = (0, import_hooks.useMapConfig)("HeatMap", props);
58
58
  const source = (0, import_react.useMemo)(
59
59
  () => ({
60
- data,
60
+ data: data || [],
61
61
  parser: { type: "json", x: "longitude", y: "latitude" }
62
62
  }),
63
63
  [data]
@@ -37,10 +37,10 @@ var import_hooks = require("../ConfigProvider/hooks");
37
37
  var import_Map = __toESM(require("../Map"));
38
38
  var import_map = require("../utils/map");
39
39
  var PathMap = (props) => {
40
- const { data = [], markerStyle = {}, pathStyle = {}, ...rest } = (0, import_hooks.useMapConfig)("PathMap", props);
40
+ const { data, markerStyle, pathStyle, ...rest } = (0, import_hooks.useMapConfig)("PathMap", props);
41
41
  const markerdata = (0, import_react.useMemo)(() => {
42
42
  const markers = [];
43
- data.forEach((item) => {
43
+ (data || []).forEach((item) => {
44
44
  if (item.markers) {
45
45
  markers.push(...item.markers);
46
46
  }
@@ -48,7 +48,7 @@ var PathMap = (props) => {
48
48
  return (0, import_map.formatMakerStyle)(markers, markerStyle);
49
49
  }, [data, markerStyle]);
50
50
  const linedata = (0, import_react.useMemo)(() => {
51
- const lines = data.map((item) => {
51
+ const lines = (data || []).map((item) => {
52
52
  return item.path;
53
53
  });
54
54
  return (0, import_map.formatPolylineStyle)(lines, pathStyle);
@@ -37,8 +37,8 @@ var import_hooks = require("../ConfigProvider/hooks");
37
37
  var import_Map = __toESM(require("../Map"));
38
38
  var import_map = require("../utils/map");
39
39
  var PinMap = (props) => {
40
- const { data = [], markerStyle = {}, ...rest } = (0, import_hooks.useMapConfig)("PinMap", props);
41
- const markerdata = (0, import_react.useMemo)(() => (0, import_map.formatMakerStyle)(data, markerStyle), [data, markerStyle]);
40
+ const { data, markerStyle, ...rest } = (0, import_hooks.useMapConfig)("PinMap", props);
41
+ const markerdata = (0, import_react.useMemo)(() => (0, import_map.formatMakerStyle)(data || [], markerStyle), [data, markerStyle]);
42
42
  return /* @__PURE__ */ import_react.default.createElement(import_Map.default, { markers: markerdata, includePoints: markerdata, ...rest });
43
43
  };
44
44
  var PinMap_default = PinMap;
@@ -16,7 +16,7 @@ declare const DefaultMarkerStyle: {
16
16
  };
17
17
  iconPath: string;
18
18
  };
19
- declare const formatMakerStyle: (data: MarkerData[], markerStyle: Partial<Marker>) => {
19
+ declare const formatMakerStyle: (data: MarkerData[], markerStyle?: Partial<Marker>) => {
20
20
  label: {
21
21
  content: string;
22
22
  color: string;
@@ -41,5 +41,5 @@ declare const DefaultPolylineStyle: {
41
41
  dottedLine: boolean;
42
42
  zIndex: number;
43
43
  };
44
- declare const formatPolylineStyle: (data: Polyline[] | undefined, polylineStyle: Partial<Marker>) => any[];
44
+ declare const formatPolylineStyle: (data: Polyline[], polylineStyle?: Partial<Marker>) => any[];
45
45
  export { DefaultMarkerStyle, DefaultPolylineStyle, formatMakerStyle, formatMapStyle, formatPolylineStyle, };
@@ -93,7 +93,7 @@ var DefaultPolylineStyle = {
93
93
  dottedLine: false,
94
94
  zIndex: 1
95
95
  };
96
- var formatPolylineStyle = (data = [], polylineStyle) => {
96
+ var formatPolylineStyle = (data, polylineStyle) => {
97
97
  return data.map((item) => {
98
98
  return {
99
99
  ...DefaultPolylineStyle,
@@ -1,2 +1,2 @@
1
- declare const _default: "0.4.5";
1
+ declare const _default: "0.4.6";
2
2
  export default _default;
@@ -22,4 +22,4 @@ __export(version_exports, {
22
22
  default: () => version_default
23
23
  });
24
24
  module.exports = __toCommonJS(version_exports);
25
- var version_default = "0.4.5";
25
+ var version_default = "0.4.6";
@@ -25,12 +25,11 @@ var heapLayerOptions = {
25
25
  var HeatMap = function HeatMap(props) {
26
26
  var _useMapConfig = useMapConfig('HeatMap', props),
27
27
  children = _useMapConfig.children,
28
- _useMapConfig$data = _useMapConfig.data,
29
- data = _useMapConfig$data === void 0 ? [] : _useMapConfig$data,
28
+ data = _useMapConfig.data,
30
29
  mapConfigRest = _objectWithoutProperties(_useMapConfig, _excluded);
31
30
  var source = useMemo(function () {
32
31
  return {
33
- data: data,
32
+ data: data || [],
34
33
  parser: {
35
34
  type: 'json',
36
35
  x: 'longitude',
@@ -8,16 +8,13 @@ import Map from "../Map";
8
8
  import { formatMakerStyle, formatPolylineStyle } from "../utils/map";
9
9
  var PathMap = function PathMap(props) {
10
10
  var _useMapConfig = useMapConfig('PathMap', props),
11
- _useMapConfig$data = _useMapConfig.data,
12
- data = _useMapConfig$data === void 0 ? [] : _useMapConfig$data,
13
- _useMapConfig$markerS = _useMapConfig.markerStyle,
14
- markerStyle = _useMapConfig$markerS === void 0 ? {} : _useMapConfig$markerS,
15
- _useMapConfig$pathSty = _useMapConfig.pathStyle,
16
- pathStyle = _useMapConfig$pathSty === void 0 ? {} : _useMapConfig$pathSty,
11
+ data = _useMapConfig.data,
12
+ markerStyle = _useMapConfig.markerStyle,
13
+ pathStyle = _useMapConfig.pathStyle,
17
14
  rest = _objectWithoutProperties(_useMapConfig, _excluded);
18
15
  var markerdata = useMemo(function () {
19
16
  var markers = [];
20
- data.forEach(function (item) {
17
+ (data || []).forEach(function (item) {
21
18
  if (item.markers) {
22
19
  markers.push.apply(markers, _toConsumableArray(item.markers));
23
20
  }
@@ -25,7 +22,7 @@ var PathMap = function PathMap(props) {
25
22
  return formatMakerStyle(markers, markerStyle);
26
23
  }, [data, markerStyle]);
27
24
  var linedata = useMemo(function () {
28
- var lines = data.map(function (item) {
25
+ var lines = (data || []).map(function (item) {
29
26
  return item.path;
30
27
  });
31
28
  return formatPolylineStyle(lines, pathStyle);
@@ -7,13 +7,11 @@ import Map from "../Map";
7
7
  import { formatMakerStyle } from "../utils/map";
8
8
  var PinMap = function PinMap(props) {
9
9
  var _useMapConfig = useMapConfig('PinMap', props),
10
- _useMapConfig$data = _useMapConfig.data,
11
- data = _useMapConfig$data === void 0 ? [] : _useMapConfig$data,
12
- _useMapConfig$markerS = _useMapConfig.markerStyle,
13
- markerStyle = _useMapConfig$markerS === void 0 ? {} : _useMapConfig$markerS,
10
+ data = _useMapConfig.data,
11
+ markerStyle = _useMapConfig.markerStyle,
14
12
  rest = _objectWithoutProperties(_useMapConfig, _excluded);
15
13
  var markerdata = useMemo(function () {
16
- return formatMakerStyle(data, markerStyle);
14
+ return formatMakerStyle(data || [], markerStyle);
17
15
  }, [data, markerStyle]);
18
16
  return /*#__PURE__*/React.createElement(Map, _extends({
19
17
  markers: markerdata,
@@ -16,7 +16,7 @@ declare const DefaultMarkerStyle: {
16
16
  };
17
17
  iconPath: string;
18
18
  };
19
- declare const formatMakerStyle: (data: MarkerData[], markerStyle: Partial<Marker>) => {
19
+ declare const formatMakerStyle: (data: MarkerData[], markerStyle?: Partial<Marker>) => {
20
20
  label: {
21
21
  content: string;
22
22
  color: string;
@@ -41,5 +41,5 @@ declare const DefaultPolylineStyle: {
41
41
  dottedLine: boolean;
42
42
  zIndex: number;
43
43
  };
44
- declare const formatPolylineStyle: (data: Polyline[] | undefined, polylineStyle: Partial<Marker>) => any[];
44
+ declare const formatPolylineStyle: (data: Polyline[], polylineStyle?: Partial<Marker>) => any[];
45
45
  export { DefaultMarkerStyle, DefaultPolylineStyle, formatMakerStyle, formatMapStyle, formatPolylineStyle, };
@@ -66,9 +66,7 @@ var DefaultPolylineStyle = {
66
66
  dottedLine: false,
67
67
  zIndex: 1
68
68
  };
69
- var formatPolylineStyle = function formatPolylineStyle() {
70
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
71
- var polylineStyle = arguments.length > 1 ? arguments[1] : undefined;
69
+ var formatPolylineStyle = function formatPolylineStyle(data, polylineStyle) {
72
70
  return data.map(function (item) {
73
71
  return _objectSpread(_objectSpread(_objectSpread({}, DefaultPolylineStyle), polylineStyle), item);
74
72
  });
@@ -1,2 +1,2 @@
1
- declare const _default: "0.4.5";
1
+ declare const _default: "0.4.6";
2
2
  export default _default;
@@ -1 +1 @@
1
- export default '0.4.5';
1
+ export default '0.4.6';