@antv/gpt-vis 0.5.13 → 0.5.14
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/ChartCodeRender/VisChart.js +1 -2
- package/dist/cjs/Sankey/index.d.ts +2 -0
- package/dist/cjs/Sankey/index.js +9 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/ChartCodeRender/VisChart.js +6 -7
- package/dist/esm/Sankey/index.d.ts +2 -0
- package/dist/esm/Sankey/index.js +17 -4
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/436.async.js +1 -0
- package/dist/umd/index.min.js +1 -1
- package/package.json +1 -1
- package/dist/umd/604.async.js +0 -1
|
@@ -167,8 +167,7 @@ var RenderVisChart = (0, import_react.memo)(
|
|
|
167
167
|
}
|
|
168
168
|
return /* @__PURE__ */ import_react.default.createElement("div", null, message);
|
|
169
169
|
}
|
|
170
|
-
const FallbackComponent = (
|
|
171
|
-
const { error } = fallbackProps;
|
|
170
|
+
const FallbackComponent = ({ error }) => {
|
|
172
171
|
if (!hasRenderError) {
|
|
173
172
|
setHasRenderError(true);
|
|
174
173
|
if (showCodeTab && showTabs) {
|
|
@@ -7,6 +7,8 @@ type SankeyDatum = {
|
|
|
7
7
|
};
|
|
8
8
|
export type SankeyProps = BasePlotProps<SankeyDatum> & Theme & Style & {
|
|
9
9
|
nodeAlign?: 'left' | 'center' | 'right' | 'justify';
|
|
10
|
+
width?: number;
|
|
11
|
+
height?: number;
|
|
10
12
|
};
|
|
11
13
|
declare const Sankey: (props: SankeyProps) => React.JSX.Element;
|
|
12
14
|
export default Sankey;
|
package/dist/cjs/Sankey/index.js
CHANGED
|
@@ -79,6 +79,7 @@ var defaultConfig = (props) => {
|
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
81
|
var Sankey = (props) => {
|
|
82
|
+
const { width, height } = props;
|
|
82
83
|
const containerRef = (0, import_react.useRef)(null);
|
|
83
84
|
const chartRef = (0, import_react.useRef)(null);
|
|
84
85
|
(0, import_react.useEffect)(() => {
|
|
@@ -86,7 +87,9 @@ var Sankey = (props) => {
|
|
|
86
87
|
return;
|
|
87
88
|
const chart = new import_g2.Chart({
|
|
88
89
|
container: containerRef.current,
|
|
89
|
-
autoFit:
|
|
90
|
+
autoFit: !(width && height),
|
|
91
|
+
...width ? { width } : {},
|
|
92
|
+
...height ? { height } : {},
|
|
90
93
|
padding: "auto"
|
|
91
94
|
});
|
|
92
95
|
const config = defaultConfig(props);
|
|
@@ -98,6 +101,10 @@ var Sankey = (props) => {
|
|
|
98
101
|
chartRef.current = null;
|
|
99
102
|
};
|
|
100
103
|
}, [props]);
|
|
101
|
-
|
|
104
|
+
const containerStyle = {
|
|
105
|
+
...width ? { width: `${width}px` } : {},
|
|
106
|
+
...height ? { height: `${height}px` } : {}
|
|
107
|
+
};
|
|
108
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { ref: containerRef, style: containerStyle });
|
|
102
109
|
};
|
|
103
110
|
var Sankey_default = Sankey;
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.5.
|
|
1
|
+
declare const _default: "0.5.14";
|
|
2
2
|
export default _default;
|
package/dist/cjs/version.js
CHANGED
|
@@ -188,9 +188,8 @@ export var RenderVisChart = /*#__PURE__*/memo(function (_ref) {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
// Error fallback component for chart rendering errors
|
|
191
|
-
var FallbackComponent = function FallbackComponent(
|
|
192
|
-
var error =
|
|
193
|
-
|
|
191
|
+
var FallbackComponent = function FallbackComponent(_ref2) {
|
|
192
|
+
var error = _ref2.error;
|
|
194
193
|
// Set render error state and switch to code tab
|
|
195
194
|
if (!hasRenderError) {
|
|
196
195
|
setHasRenderError(true);
|
|
@@ -211,7 +210,7 @@ export var RenderVisChart = /*#__PURE__*/memo(function (_ref) {
|
|
|
211
210
|
|
|
212
211
|
// Handle copy functionality
|
|
213
212
|
var handleCopy = /*#__PURE__*/function () {
|
|
214
|
-
var
|
|
213
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
215
214
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
216
215
|
while (1) switch (_context.prev = _context.next) {
|
|
217
216
|
case 0:
|
|
@@ -243,13 +242,13 @@ export var RenderVisChart = /*#__PURE__*/memo(function (_ref) {
|
|
|
243
242
|
}, _callee, null, [[0, 8]]);
|
|
244
243
|
}));
|
|
245
244
|
return function handleCopy() {
|
|
246
|
-
return
|
|
245
|
+
return _ref3.apply(this, arguments);
|
|
247
246
|
};
|
|
248
247
|
}();
|
|
249
248
|
|
|
250
249
|
// Handle download functionality
|
|
251
250
|
var handleDownload = /*#__PURE__*/function () {
|
|
252
|
-
var
|
|
251
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
253
252
|
var result;
|
|
254
253
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
255
254
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -284,7 +283,7 @@ export var RenderVisChart = /*#__PURE__*/memo(function (_ref) {
|
|
|
284
283
|
}, _callee2, null, [[0, 9]]);
|
|
285
284
|
}));
|
|
286
285
|
return function handleDownload() {
|
|
287
|
-
return
|
|
286
|
+
return _ref4.apply(this, arguments);
|
|
288
287
|
};
|
|
289
288
|
}();
|
|
290
289
|
|
|
@@ -7,6 +7,8 @@ type SankeyDatum = {
|
|
|
7
7
|
};
|
|
8
8
|
export type SankeyProps = BasePlotProps<SankeyDatum> & Theme & Style & {
|
|
9
9
|
nodeAlign?: 'left' | 'center' | 'right' | 'justify';
|
|
10
|
+
width?: number;
|
|
11
|
+
height?: number;
|
|
10
12
|
};
|
|
11
13
|
declare const Sankey: (props: SankeyProps) => React.JSX.Element;
|
|
12
14
|
export default Sankey;
|
package/dist/esm/Sankey/index.js
CHANGED
|
@@ -60,15 +60,22 @@ var defaultConfig = function defaultConfig(props) {
|
|
|
60
60
|
} : {});
|
|
61
61
|
};
|
|
62
62
|
var Sankey = function Sankey(props) {
|
|
63
|
+
var width = props.width,
|
|
64
|
+
height = props.height;
|
|
63
65
|
var containerRef = useRef(null);
|
|
64
66
|
var chartRef = useRef(null);
|
|
65
67
|
useEffect(function () {
|
|
66
68
|
if (!containerRef.current) return;
|
|
67
|
-
var chart = new Chart({
|
|
69
|
+
var chart = new Chart(_objectSpread(_objectSpread(_objectSpread({
|
|
68
70
|
container: containerRef.current,
|
|
69
|
-
autoFit:
|
|
71
|
+
autoFit: !(width && height)
|
|
72
|
+
}, width ? {
|
|
73
|
+
width: width
|
|
74
|
+
} : {}), height ? {
|
|
75
|
+
height: height
|
|
76
|
+
} : {}), {}, {
|
|
70
77
|
padding: 'auto'
|
|
71
|
-
});
|
|
78
|
+
}));
|
|
72
79
|
var config = defaultConfig(props);
|
|
73
80
|
chart.options(config);
|
|
74
81
|
chart.render();
|
|
@@ -78,8 +85,14 @@ var Sankey = function Sankey(props) {
|
|
|
78
85
|
chartRef.current = null;
|
|
79
86
|
};
|
|
80
87
|
}, [props]);
|
|
88
|
+
var containerStyle = _objectSpread(_objectSpread({}, width ? {
|
|
89
|
+
width: "".concat(width, "px")
|
|
90
|
+
} : {}), height ? {
|
|
91
|
+
height: "".concat(height, "px")
|
|
92
|
+
} : {});
|
|
81
93
|
return /*#__PURE__*/React.createElement("div", {
|
|
82
|
-
ref: containerRef
|
|
94
|
+
ref: containerRef,
|
|
95
|
+
style: containerStyle
|
|
83
96
|
});
|
|
84
97
|
};
|
|
85
98
|
export default Sankey;
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.5.
|
|
1
|
+
declare const _default: "0.5.14";
|
|
2
2
|
export default _default;
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '0.5.
|
|
1
|
+
export default '0.5.14';
|