echarts-next-for-react
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -9,4 +9,4 @@ import React, { useEffect, useRef } from 'react'; | ||
import { use, dispose, getInstanceByDom, init } from 'echarts/core'; | ||
import isObject from 'lodash/isObject'; | ||
import { RadarChart, ParallelChart, GraphChart, LinesChart, LineChart, BarChart, PieChart, ScatterChart, EffectScatterChart, TreeChart, TreemapChart, SunburstChart, BoxplotChart, CandlestickChart, HeatmapChart, MapChart, SankeyChart, FunnelChart, GaugeChart, PictorialBarChart, ThemeRiverChart, CustomChart } from 'echarts/charts'; | ||
import isArray from 'lodash/isArray'; | ||
import { RadarChart, ParallelChart, GraphChart, LineChart, LinesChart, BarChart, PieChart, ScatterChart, EffectScatterChart, TreeChart, TreemapChart, SunburstChart, BoxplotChart, CandlestickChart, HeatmapChart, MapChart, SankeyChart, FunnelChart, GaugeChart, PictorialBarChart, ThemeRiverChart, CustomChart } from 'echarts/charts'; | ||
import { GridComponent, TitleComponent, LegendComponent, LegendPlainComponent, LegendScrollComponent, PolarComponent, RadarComponent, DataZoomComponent, DataZoomSliderComponent, DataZoomInsideComponent, VisualMapComponent, VisualMapContinuousComponent, VisualMapPiecewiseComponent, TooltipComponent, AxisPointerComponent, ToolboxComponent, GridSimpleComponent, BrushComponent, GeoComponent, ParallelComponent, SingleAxisComponent, TimelineComponent, GraphicComponent, CalendarComponent, TransformComponent, DatasetComponent, AriaComponent, MarkPointComponent, MarkLineComponent, MarkAreaComponent } from 'echarts/components'; | ||
@@ -137,13 +137,12 @@ import { CanvasRenderer, SVGRenderer } from 'echarts/renderers'; | ||
var enableComponentBySeriesType = function enableComponentBySeriesType(series, type) { | ||
return isObject(series) ? // @ts-ignore | ||
(series === null || series === void 0 ? void 0 : series.type) === type : // @ts-ignore | ||
(series === null || series === void 0 ? void 0 : series.length) > 0 && !!(series === null || series === void 0 ? void 0 : series.find(function (v) { | ||
return v.type === type; | ||
})); | ||
return (isArray(series) ? series : [series]).find(function (_ref) { | ||
var t = _ref.type; | ||
return t === type; | ||
}); | ||
}; | ||
var enableComponentBySeriesProp = function enableComponentBySeriesProp(series, prop) { | ||
return isObject(series) ? // @ts-ignore | ||
series === null || series === void 0 ? void 0 : series[prop] : // @ts-ignore | ||
(series === null || series === void 0 ? void 0 : series.length) > 0 && !!(series === null || series === void 0 ? void 0 : series.map(v.prop)); | ||
return (isArray(series) ? series : [series]).map(function (v) { | ||
return v[prop]; | ||
}); | ||
}; | ||
@@ -159,37 +158,37 @@ | ||
// register title component | ||
var _ref = option !== null && option !== void 0 ? option : {}, | ||
_ref$title = _ref.title, | ||
title = _ref$title === void 0 ? {} : _ref$title, | ||
_ref$legend = _ref.legend, | ||
legend = _ref$legend === void 0 ? {} : _ref$legend, | ||
polar = _ref.polar, | ||
radar = _ref.radar, | ||
dataZoom = _ref.dataZoom, | ||
visualMap = _ref.visualMap, | ||
_ref$tooltip = _ref.tooltip, | ||
tooltip = _ref$tooltip === void 0 ? {} : _ref$tooltip, | ||
_ref$axisPointer = _ref.axisPointer, | ||
axisPointer = _ref$axisPointer === void 0 ? {} : _ref$axisPointer, | ||
_ref$toolbox = _ref.toolbox, | ||
toolbox = _ref$toolbox === void 0 ? {} : _ref$toolbox, | ||
brush = _ref.brush, | ||
geo = _ref.geo, | ||
grid = _ref.grid, | ||
parallel = _ref.parallel, | ||
singleAxis = _ref.singleAxis, | ||
_ref$timeline = _ref.timeline, | ||
timeline = _ref$timeline === void 0 ? {} : _ref$timeline, | ||
graphic = _ref.graphic, | ||
calendar = _ref.calendar, | ||
dataset = _ref.dataset, | ||
_ref$aria = _ref.aria, | ||
aria = _ref$aria === void 0 ? {} : _ref$aria, | ||
_ref$series = _ref.series, | ||
series = _ref$series === void 0 ? [] : _ref$series; | ||
var _ref2 = option !== null && option !== void 0 ? option : {}, | ||
_ref2$title = _ref2.title, | ||
title = _ref2$title === void 0 ? {} : _ref2$title, | ||
_ref2$legend = _ref2.legend, | ||
legend = _ref2$legend === void 0 ? {} : _ref2$legend, | ||
polar = _ref2.polar, | ||
radar = _ref2.radar, | ||
dataZoom = _ref2.dataZoom, | ||
visualMap = _ref2.visualMap, | ||
_ref2$tooltip = _ref2.tooltip, | ||
tooltip = _ref2$tooltip === void 0 ? {} : _ref2$tooltip, | ||
_ref2$axisPointer = _ref2.axisPointer, | ||
axisPointer = _ref2$axisPointer === void 0 ? {} : _ref2$axisPointer, | ||
_ref2$toolbox = _ref2.toolbox, | ||
toolbox = _ref2$toolbox === void 0 ? {} : _ref2$toolbox, | ||
brush = _ref2.brush, | ||
geo = _ref2.geo, | ||
grid = _ref2.grid, | ||
parallel = _ref2.parallel, | ||
singleAxis = _ref2.singleAxis, | ||
_ref2$timeline = _ref2.timeline, | ||
timeline = _ref2$timeline === void 0 ? {} : _ref2$timeline, | ||
graphic = _ref2.graphic, | ||
calendar = _ref2.calendar, | ||
dataset = _ref2.dataset, | ||
_ref2$aria = _ref2.aria, | ||
aria = _ref2$aria === void 0 ? {} : _ref2$aria, | ||
_ref2$series = _ref2.series, | ||
series = _ref2$series === void 0 ? [] : _ref2$series; | ||
var titleOps = isEmpty(title) ? (_title$ = title[0]) !== null && _title$ !== void 0 ? _title$ : {} : title; | ||
var _ref2 = titleOps !== null && titleOps !== void 0 ? titleOps : {}, | ||
_ref2$show = _ref2.show, | ||
titleShow = _ref2$show === void 0 ? true : _ref2$show; | ||
var _ref3 = titleOps !== null && titleOps !== void 0 ? titleOps : {}, | ||
_ref3$show = _ref3.show, | ||
titleShow = _ref3$show === void 0 ? true : _ref3$show; | ||
@@ -203,5 +202,5 @@ if (titleShow) { | ||
var _ref3 = legendOps !== null && legendOps !== void 0 ? legendOps : {}, | ||
_ref3$show = _ref3.show, | ||
legendShow = _ref3$show === void 0 ? true : _ref3$show; | ||
var _ref4 = legendOps !== null && legendOps !== void 0 ? legendOps : {}, | ||
_ref4$show = _ref4.show, | ||
legendShow = _ref4$show === void 0 ? true : _ref4$show; | ||
@@ -213,7 +212,6 @@ if (legendShow) { | ||
if (polar && ( // @ts-ignore | ||
isObject(series) && (series === null || series === void 0 ? void 0 : series.coordinateSystem) === 'polar' || // @ts-ignore | ||
(series === null || series === void 0 ? void 0 : series.length) > 0 && (series === null || series === void 0 ? void 0 : series.find(function (v) { | ||
return v.coordinateSystem === 'polar'; | ||
})))) { | ||
if (polar || !!(isArray(series) ? series : [series]).find(function (_ref5) { | ||
var coordinateSystem = _ref5.coordinateSystem; | ||
return coordinateSystem === 'polar'; | ||
})) { | ||
registerComponents = [PolarComponent].concat(_toConsumableArray(registerComponents)); | ||
@@ -240,5 +238,5 @@ } // register radar Component | ||
var _ref4 = tooltipOps !== null && tooltipOps !== void 0 ? tooltipOps : {}, | ||
_ref4$show = _ref4.show, | ||
tooltipShow = _ref4$show === void 0 ? true : _ref4$show; | ||
var _ref6 = tooltipOps !== null && tooltipOps !== void 0 ? tooltipOps : {}, | ||
_ref6$show = _ref6.show, | ||
tooltipShow = _ref6$show === void 0 ? true : _ref6$show; | ||
@@ -252,4 +250,4 @@ if (tooltipShow) { | ||
var _ref5 = axisPointerOps !== null && axisPointerOps !== void 0 ? axisPointerOps : {}, | ||
axisPointerShow = _ref5.show; | ||
var _ref7 = axisPointerOps !== null && axisPointerOps !== void 0 ? axisPointerOps : {}, | ||
axisPointerShow = _ref7.show; | ||
@@ -263,5 +261,5 @@ if (axisPointerShow) { | ||
var _ref6 = toolboxOps !== null && toolboxOps !== void 0 ? toolboxOps : {}, | ||
_ref6$show = _ref6.show, | ||
toolboxShow = _ref6$show === void 0 ? true : _ref6$show; | ||
var _ref8 = toolboxOps !== null && toolboxOps !== void 0 ? toolboxOps : {}, | ||
_ref8$show = _ref8.show, | ||
toolboxShow = _ref8$show === void 0 ? true : _ref8$show; | ||
@@ -283,7 +281,6 @@ if (toolboxShow) { | ||
if (geo || // @ts-ignore | ||
isObject(series) && (series === null || series === void 0 ? void 0 : series.coordinateSystem) === 'geo' || // @ts-ignore | ||
(series === null || series === void 0 ? void 0 : series.length) > 0 && (series === null || series === void 0 ? void 0 : series.find(function (v) { | ||
return v.coordinateSystem === 'geo'; | ||
}))) { | ||
if (geo || !!(isArray(series) ? series : [series]).find(function (_ref9) { | ||
var coordinateSystem = _ref9.coordinateSystem; | ||
return coordinateSystem === 'geo'; | ||
})) { | ||
registerComponents = [GeoComponent].concat(_toConsumableArray(registerComponents)); | ||
@@ -294,6 +291,6 @@ } // register parallel Component | ||
if (parallel || enableComponentBySeriesType(series, 'parallel') || // @ts-ignore | ||
isObject(series) && (series === null || series === void 0 ? void 0 : series.coordinateSystem) === 'parallel' || // @ts-ignore | ||
(series === null || series === void 0 ? void 0 : series.length) > 0 && (series === null || series === void 0 ? void 0 : series.find(function (v) { | ||
return v.coordinateSystem === 'parallel'; | ||
}))) { | ||
!!(isArray(series) ? series : [series]).find(function (_ref10) { | ||
var coordinateSystem = _ref10.coordinateSystem; | ||
return coordinateSystem === 'parallel'; | ||
})) { | ||
registerComponents = [ParallelChart, ParallelComponent].concat(_toConsumableArray(registerComponents)); | ||
@@ -310,5 +307,5 @@ } // register singleAxis Component | ||
var _ref7 = timelineOps !== null && timelineOps !== void 0 ? timelineOps : {}, | ||
_ref7$show = _ref7.show, | ||
timelineShow = _ref7$show === void 0 ? true : _ref7$show; | ||
var _ref11 = timelineOps !== null && timelineOps !== void 0 ? timelineOps : {}, | ||
_ref11$show = _ref11.show, | ||
timelineShow = _ref11$show === void 0 ? true : _ref11$show; | ||
@@ -342,3 +339,8 @@ if (timelineShow) { | ||
if (enableComponentBySeriesType(series, 'line')) { | ||
registerComponents = [LinesChart, LineChart].concat(_toConsumableArray(registerComponents)); | ||
registerComponents = [LineChart, LinesChart].concat(_toConsumableArray(registerComponents)); | ||
} // register lines component | ||
if (enableComponentBySeriesType(series, 'lines')) { | ||
registerComponents = [LineChart, LinesChart].concat(_toConsumableArray(registerComponents)); | ||
} // register bar component | ||
@@ -399,7 +401,2 @@ | ||
registerComponents = [MapChart].concat(_toConsumableArray(registerComponents)); | ||
} // register lines component | ||
if (enableComponentBySeriesType(series, 'lines')) { | ||
registerComponents = [LineChart, LinesChart].concat(_toConsumableArray(registerComponents)); | ||
} // register sankey component | ||
@@ -468,4 +465,3 @@ | ||
_props$renderType = props.renderType, | ||
renderType = _props$renderType === void 0 ? 'canvas' : _props$renderType; // coordinateSystem 'polar': PolarComponent | ||
renderType = _props$renderType === void 0 ? 'canvas' : _props$renderType; | ||
var isCanvas = renderType === 'canvas'; // necessary Component | ||
@@ -472,0 +468,0 @@ |
@@ -11,3 +11,3 @@ 'use strict'; | ||
var echarts = require('echarts/core'); | ||
var isObject = require('lodash/isObject'); | ||
var isArray = require('lodash/isArray'); | ||
var charts = require('echarts/charts'); | ||
@@ -24,3 +24,3 @@ var components = require('echarts/components'); | ||
var isString__default = /*#__PURE__*/_interopDefaultLegacy(isString); | ||
var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject); | ||
var isArray__default = /*#__PURE__*/_interopDefaultLegacy(isArray); | ||
@@ -149,13 +149,12 @@ function _defineProperty(obj, key, value) { | ||
var enableComponentBySeriesType = function enableComponentBySeriesType(series, type) { | ||
return isObject__default['default'](series) ? // @ts-ignore | ||
(series === null || series === void 0 ? void 0 : series.type) === type : // @ts-ignore | ||
(series === null || series === void 0 ? void 0 : series.length) > 0 && !!(series === null || series === void 0 ? void 0 : series.find(function (v) { | ||
return v.type === type; | ||
})); | ||
return (isArray__default['default'](series) ? series : [series]).find(function (_ref) { | ||
var t = _ref.type; | ||
return t === type; | ||
}); | ||
}; | ||
var enableComponentBySeriesProp = function enableComponentBySeriesProp(series, prop) { | ||
return isObject__default['default'](series) ? // @ts-ignore | ||
series === null || series === void 0 ? void 0 : series[prop] : // @ts-ignore | ||
(series === null || series === void 0 ? void 0 : series.length) > 0 && !!(series === null || series === void 0 ? void 0 : series.map(v.prop)); | ||
return (isArray__default['default'](series) ? series : [series]).map(function (v) { | ||
return v[prop]; | ||
}); | ||
}; | ||
@@ -171,37 +170,37 @@ | ||
// register title component | ||
var _ref = option !== null && option !== void 0 ? option : {}, | ||
_ref$title = _ref.title, | ||
title = _ref$title === void 0 ? {} : _ref$title, | ||
_ref$legend = _ref.legend, | ||
legend = _ref$legend === void 0 ? {} : _ref$legend, | ||
polar = _ref.polar, | ||
radar = _ref.radar, | ||
dataZoom = _ref.dataZoom, | ||
visualMap = _ref.visualMap, | ||
_ref$tooltip = _ref.tooltip, | ||
tooltip = _ref$tooltip === void 0 ? {} : _ref$tooltip, | ||
_ref$axisPointer = _ref.axisPointer, | ||
axisPointer = _ref$axisPointer === void 0 ? {} : _ref$axisPointer, | ||
_ref$toolbox = _ref.toolbox, | ||
toolbox = _ref$toolbox === void 0 ? {} : _ref$toolbox, | ||
brush = _ref.brush, | ||
geo = _ref.geo, | ||
grid = _ref.grid, | ||
parallel = _ref.parallel, | ||
singleAxis = _ref.singleAxis, | ||
_ref$timeline = _ref.timeline, | ||
timeline = _ref$timeline === void 0 ? {} : _ref$timeline, | ||
graphic = _ref.graphic, | ||
calendar = _ref.calendar, | ||
dataset = _ref.dataset, | ||
_ref$aria = _ref.aria, | ||
aria = _ref$aria === void 0 ? {} : _ref$aria, | ||
_ref$series = _ref.series, | ||
series = _ref$series === void 0 ? [] : _ref$series; | ||
var _ref2 = option !== null && option !== void 0 ? option : {}, | ||
_ref2$title = _ref2.title, | ||
title = _ref2$title === void 0 ? {} : _ref2$title, | ||
_ref2$legend = _ref2.legend, | ||
legend = _ref2$legend === void 0 ? {} : _ref2$legend, | ||
polar = _ref2.polar, | ||
radar = _ref2.radar, | ||
dataZoom = _ref2.dataZoom, | ||
visualMap = _ref2.visualMap, | ||
_ref2$tooltip = _ref2.tooltip, | ||
tooltip = _ref2$tooltip === void 0 ? {} : _ref2$tooltip, | ||
_ref2$axisPointer = _ref2.axisPointer, | ||
axisPointer = _ref2$axisPointer === void 0 ? {} : _ref2$axisPointer, | ||
_ref2$toolbox = _ref2.toolbox, | ||
toolbox = _ref2$toolbox === void 0 ? {} : _ref2$toolbox, | ||
brush = _ref2.brush, | ||
geo = _ref2.geo, | ||
grid = _ref2.grid, | ||
parallel = _ref2.parallel, | ||
singleAxis = _ref2.singleAxis, | ||
_ref2$timeline = _ref2.timeline, | ||
timeline = _ref2$timeline === void 0 ? {} : _ref2$timeline, | ||
graphic = _ref2.graphic, | ||
calendar = _ref2.calendar, | ||
dataset = _ref2.dataset, | ||
_ref2$aria = _ref2.aria, | ||
aria = _ref2$aria === void 0 ? {} : _ref2$aria, | ||
_ref2$series = _ref2.series, | ||
series = _ref2$series === void 0 ? [] : _ref2$series; | ||
var titleOps = isEmpty__default['default'](title) ? (_title$ = title[0]) !== null && _title$ !== void 0 ? _title$ : {} : title; | ||
var _ref2 = titleOps !== null && titleOps !== void 0 ? titleOps : {}, | ||
_ref2$show = _ref2.show, | ||
titleShow = _ref2$show === void 0 ? true : _ref2$show; | ||
var _ref3 = titleOps !== null && titleOps !== void 0 ? titleOps : {}, | ||
_ref3$show = _ref3.show, | ||
titleShow = _ref3$show === void 0 ? true : _ref3$show; | ||
@@ -215,5 +214,5 @@ if (titleShow) { | ||
var _ref3 = legendOps !== null && legendOps !== void 0 ? legendOps : {}, | ||
_ref3$show = _ref3.show, | ||
legendShow = _ref3$show === void 0 ? true : _ref3$show; | ||
var _ref4 = legendOps !== null && legendOps !== void 0 ? legendOps : {}, | ||
_ref4$show = _ref4.show, | ||
legendShow = _ref4$show === void 0 ? true : _ref4$show; | ||
@@ -225,7 +224,6 @@ if (legendShow) { | ||
if (polar && ( // @ts-ignore | ||
isObject__default['default'](series) && (series === null || series === void 0 ? void 0 : series.coordinateSystem) === 'polar' || // @ts-ignore | ||
(series === null || series === void 0 ? void 0 : series.length) > 0 && (series === null || series === void 0 ? void 0 : series.find(function (v) { | ||
return v.coordinateSystem === 'polar'; | ||
})))) { | ||
if (polar || !!(isArray__default['default'](series) ? series : [series]).find(function (_ref5) { | ||
var coordinateSystem = _ref5.coordinateSystem; | ||
return coordinateSystem === 'polar'; | ||
})) { | ||
registerComponents = [components.PolarComponent].concat(_toConsumableArray(registerComponents)); | ||
@@ -252,5 +250,5 @@ } // register radar Component | ||
var _ref4 = tooltipOps !== null && tooltipOps !== void 0 ? tooltipOps : {}, | ||
_ref4$show = _ref4.show, | ||
tooltipShow = _ref4$show === void 0 ? true : _ref4$show; | ||
var _ref6 = tooltipOps !== null && tooltipOps !== void 0 ? tooltipOps : {}, | ||
_ref6$show = _ref6.show, | ||
tooltipShow = _ref6$show === void 0 ? true : _ref6$show; | ||
@@ -264,4 +262,4 @@ if (tooltipShow) { | ||
var _ref5 = axisPointerOps !== null && axisPointerOps !== void 0 ? axisPointerOps : {}, | ||
axisPointerShow = _ref5.show; | ||
var _ref7 = axisPointerOps !== null && axisPointerOps !== void 0 ? axisPointerOps : {}, | ||
axisPointerShow = _ref7.show; | ||
@@ -275,5 +273,5 @@ if (axisPointerShow) { | ||
var _ref6 = toolboxOps !== null && toolboxOps !== void 0 ? toolboxOps : {}, | ||
_ref6$show = _ref6.show, | ||
toolboxShow = _ref6$show === void 0 ? true : _ref6$show; | ||
var _ref8 = toolboxOps !== null && toolboxOps !== void 0 ? toolboxOps : {}, | ||
_ref8$show = _ref8.show, | ||
toolboxShow = _ref8$show === void 0 ? true : _ref8$show; | ||
@@ -295,7 +293,6 @@ if (toolboxShow) { | ||
if (geo || // @ts-ignore | ||
isObject__default['default'](series) && (series === null || series === void 0 ? void 0 : series.coordinateSystem) === 'geo' || // @ts-ignore | ||
(series === null || series === void 0 ? void 0 : series.length) > 0 && (series === null || series === void 0 ? void 0 : series.find(function (v) { | ||
return v.coordinateSystem === 'geo'; | ||
}))) { | ||
if (geo || !!(isArray__default['default'](series) ? series : [series]).find(function (_ref9) { | ||
var coordinateSystem = _ref9.coordinateSystem; | ||
return coordinateSystem === 'geo'; | ||
})) { | ||
registerComponents = [components.GeoComponent].concat(_toConsumableArray(registerComponents)); | ||
@@ -306,6 +303,6 @@ } // register parallel Component | ||
if (parallel || enableComponentBySeriesType(series, 'parallel') || // @ts-ignore | ||
isObject__default['default'](series) && (series === null || series === void 0 ? void 0 : series.coordinateSystem) === 'parallel' || // @ts-ignore | ||
(series === null || series === void 0 ? void 0 : series.length) > 0 && (series === null || series === void 0 ? void 0 : series.find(function (v) { | ||
return v.coordinateSystem === 'parallel'; | ||
}))) { | ||
!!(isArray__default['default'](series) ? series : [series]).find(function (_ref10) { | ||
var coordinateSystem = _ref10.coordinateSystem; | ||
return coordinateSystem === 'parallel'; | ||
})) { | ||
registerComponents = [charts.ParallelChart, components.ParallelComponent].concat(_toConsumableArray(registerComponents)); | ||
@@ -322,5 +319,5 @@ } // register singleAxis Component | ||
var _ref7 = timelineOps !== null && timelineOps !== void 0 ? timelineOps : {}, | ||
_ref7$show = _ref7.show, | ||
timelineShow = _ref7$show === void 0 ? true : _ref7$show; | ||
var _ref11 = timelineOps !== null && timelineOps !== void 0 ? timelineOps : {}, | ||
_ref11$show = _ref11.show, | ||
timelineShow = _ref11$show === void 0 ? true : _ref11$show; | ||
@@ -354,3 +351,8 @@ if (timelineShow) { | ||
if (enableComponentBySeriesType(series, 'line')) { | ||
registerComponents = [charts.LinesChart, charts.LineChart].concat(_toConsumableArray(registerComponents)); | ||
registerComponents = [charts.LineChart, charts.LinesChart].concat(_toConsumableArray(registerComponents)); | ||
} // register lines component | ||
if (enableComponentBySeriesType(series, 'lines')) { | ||
registerComponents = [charts.LineChart, charts.LinesChart].concat(_toConsumableArray(registerComponents)); | ||
} // register bar component | ||
@@ -411,7 +413,2 @@ | ||
registerComponents = [charts.MapChart].concat(_toConsumableArray(registerComponents)); | ||
} // register lines component | ||
if (enableComponentBySeriesType(series, 'lines')) { | ||
registerComponents = [charts.LineChart, charts.LinesChart].concat(_toConsumableArray(registerComponents)); | ||
} // register sankey component | ||
@@ -480,4 +477,3 @@ | ||
_props$renderType = props.renderType, | ||
renderType = _props$renderType === void 0 ? 'canvas' : _props$renderType; // coordinateSystem 'polar': PolarComponent | ||
renderType = _props$renderType === void 0 ? 'canvas' : _props$renderType; | ||
var isCanvas = renderType === 'canvas'; // necessary Component | ||
@@ -484,0 +480,0 @@ |
{ | ||
"name": "echarts-next-for-react", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Echarts(v5.x | next) components for react.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
import isEmpty from 'lodash/isEmpty'; | ||
import isObject from 'lodash/isObject'; | ||
import isArray from 'lodash/isArray'; | ||
import { | ||
@@ -65,14 +65,6 @@ BarChart, | ||
const enableComponentBySeriesType = (series: object | any[], type: any) => | ||
isObject(series) | ||
? // @ts-ignore | ||
series?.type === type | ||
: // @ts-ignore | ||
series?.length > 0 && !!series?.find((v) => v.type === type); | ||
(isArray(series) ? series : [series]).find(({ type: t }) => t === type); | ||
const enableComponentBySeriesProp = (series: object | any[], prop: any) => | ||
isObject(series) | ||
? // @ts-ignore | ||
series?.[prop] | ||
: // @ts-ignore | ||
series?.length > 0 && !!series?.map(v.prop); | ||
(isArray(series) ? series : [series]).map((v) => v[prop]); | ||
@@ -124,7 +116,6 @@ export const getRegisterComponents = (option: EChartsOption, isCanvas: boolean) => { | ||
if ( | ||
polar && | ||
// @ts-ignore | ||
((isObject(series) && series?.coordinateSystem === 'polar') || | ||
// @ts-ignore | ||
(series?.length > 0 && series?.find((v) => v.coordinateSystem === 'polar'))) | ||
polar || | ||
!!(isArray(series) ? series : [series]).find( | ||
({ coordinateSystem }) => coordinateSystem === 'polar', | ||
) | ||
) { | ||
@@ -183,6 +174,6 @@ registerComponents = [PolarComponent, ...registerComponents]; | ||
if ( | ||
geo || // @ts-ignore | ||
(isObject(series) && series?.coordinateSystem === 'geo') || | ||
// @ts-ignore | ||
(series?.length > 0 && series?.find((v) => v.coordinateSystem === 'geo')) | ||
geo || | ||
!!(isArray(series) ? series : [series]).find( | ||
({ coordinateSystem }) => coordinateSystem === 'geo', | ||
) | ||
) { | ||
@@ -195,5 +186,5 @@ registerComponents = [GeoComponent, ...registerComponents]; | ||
enableComponentBySeriesType(series, 'parallel') || // @ts-ignore | ||
(isObject(series) && series?.coordinateSystem === 'parallel') || | ||
// @ts-ignore | ||
(series?.length > 0 && series?.find((v) => v.coordinateSystem === 'parallel')) | ||
!!(isArray(series) ? series : [series]).find( | ||
({ coordinateSystem }) => coordinateSystem === 'parallel', | ||
) | ||
) { | ||
@@ -231,4 +222,8 @@ registerComponents = [ParallelChart, ParallelComponent, ...registerComponents]; | ||
if (enableComponentBySeriesType(series, 'line')) { | ||
registerComponents = [LinesChart, LineChart, ...registerComponents]; | ||
registerComponents = [LineChart, LinesChart, ...registerComponents]; | ||
} | ||
// register lines component | ||
if (enableComponentBySeriesType(series, 'lines')) { | ||
registerComponents = [LineChart, LinesChart, ...registerComponents]; | ||
} | ||
// register bar component | ||
@@ -278,6 +273,2 @@ if (enableComponentBySeriesType(series, 'bar')) { | ||
} | ||
// register lines component | ||
if (enableComponentBySeriesType(series, 'lines')) { | ||
registerComponents = [LineChart, LinesChart, ...registerComponents]; | ||
} | ||
// register sankey component | ||
@@ -284,0 +275,0 @@ if (enableComponentBySeriesType(series, 'sankey')) { |
Sorry, the diff of this file is not supported yet
104489
1501