@visactor/react-vchart 1.1.0-beta.6 → 1.1.0-beta.8
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/cjs/VChart.d.ts +1 -1
- package/cjs/charts/AreaChart.d.ts +4 -1
- package/cjs/charts/AreaChart.js.map +1 -1
- package/cjs/charts/BarChart.d.ts +4 -1
- package/cjs/charts/BarChart.js.map +1 -1
- package/cjs/charts/BaseChart.d.ts +6 -5
- package/cjs/charts/BaseChart.js +24 -10
- package/cjs/charts/BaseChart.js.map +1 -1
- package/cjs/charts/BoxPlotChart.d.ts +4 -1
- package/cjs/charts/BoxPlotChart.js.map +1 -1
- package/cjs/charts/CircularProgressChart.d.ts +4 -1
- package/cjs/charts/CircularProgressChart.js.map +1 -1
- package/cjs/charts/CommonChart.d.ts +4 -1
- package/cjs/charts/CommonChart.js.map +1 -1
- package/cjs/charts/FunnelChart.d.ts +4 -1
- package/cjs/charts/FunnelChart.js.map +1 -1
- package/cjs/charts/HistogramChart.d.ts +4 -1
- package/cjs/charts/HistogramChart.js.map +1 -1
- package/cjs/charts/LineChart.d.ts +4 -1
- package/cjs/charts/LineChart.js.map +1 -1
- package/cjs/charts/LinearProgressChart.d.ts +4 -1
- package/cjs/charts/LinearProgressChart.js.map +1 -1
- package/cjs/charts/MapChart.d.ts +4 -1
- package/cjs/charts/MapChart.js.map +1 -1
- package/cjs/charts/PieChart.d.ts +4 -1
- package/cjs/charts/PieChart.js.map +1 -1
- package/cjs/charts/RadarChart.d.ts +4 -1
- package/cjs/charts/RadarChart.js.map +1 -1
- package/cjs/charts/RangeColumnChart.d.ts +4 -1
- package/cjs/charts/RangeColumnChart.js +1 -2
- package/cjs/charts/RangeColumnChart.js.map +1 -1
- package/cjs/charts/RoseChart.d.ts +4 -1
- package/cjs/charts/RoseChart.js.map +1 -1
- package/cjs/charts/ScatterChart.d.ts +4 -1
- package/cjs/charts/ScatterChart.js +2 -1
- package/cjs/charts/ScatterChart.js.map +1 -1
- package/cjs/charts/SequenceChart.d.ts +4 -1
- package/cjs/charts/SequenceChart.js.map +1 -1
- package/cjs/charts/WordCloudChart.d.ts +4 -1
- package/cjs/charts/WordCloudChart.js.map +1 -1
- package/cjs/charts/index.js +1 -1
- package/cjs/components/Axis.d.ts +4 -5
- package/cjs/components/Axis.js.map +1 -1
- package/cjs/components/Brush.d.ts +5 -0
- package/cjs/components/Brush.js +10 -0
- package/cjs/components/Brush.js.map +1 -0
- package/cjs/components/Crosshair.d.ts +4 -0
- package/cjs/components/Crosshair.js +10 -0
- package/cjs/components/Crosshair.js.map +1 -0
- package/cjs/components/DataZoom.d.ts +5 -0
- package/cjs/components/DataZoom.js +10 -0
- package/cjs/components/DataZoom.js.map +1 -0
- package/cjs/components/Legend.d.ts +4 -8
- package/cjs/components/Legend.js.map +1 -1
- package/cjs/components/Mark.d.ts +1 -1
- package/cjs/components/Mark.js.map +1 -1
- package/cjs/components/MarkArea.d.ts +4 -0
- package/cjs/components/MarkArea.js +10 -0
- package/cjs/components/MarkArea.js.map +1 -0
- package/cjs/components/MarkLine.d.ts +4 -0
- package/cjs/components/MarkLine.js +10 -0
- package/cjs/components/MarkLine.js.map +1 -0
- package/cjs/components/MarkPoint.d.ts +4 -0
- package/cjs/components/MarkPoint.js +10 -0
- package/cjs/components/MarkPoint.js.map +1 -0
- package/cjs/components/Player.d.ts +5 -0
- package/cjs/components/Player.js +10 -0
- package/cjs/components/Player.js.map +1 -0
- package/cjs/components/Region.d.ts +4 -4
- package/cjs/components/Region.js.map +1 -1
- package/cjs/components/Scrollbar.d.ts +5 -0
- package/cjs/components/Scrollbar.js +10 -0
- package/cjs/components/Scrollbar.js.map +1 -0
- package/cjs/components/Tooltip.d.ts +4 -0
- package/cjs/components/Tooltip.js +10 -0
- package/cjs/components/Tooltip.js.map +1 -0
- package/cjs/components/index.d.ts +9 -0
- package/cjs/components/index.js +7 -2
- package/cjs/components/index.js.map +1 -1
- package/cjs/containers/withContainer.d.ts +2 -2
- package/cjs/containers/withContainer.js.map +1 -1
- package/cjs/context/chart.js +1 -2
- package/cjs/eventsUtils.d.ts +107 -47
- package/cjs/eventsUtils.js +21 -4
- package/cjs/eventsUtils.js.map +1 -1
- package/cjs/index.js +2 -1
- package/cjs/series/Area.d.ts +5 -5
- package/cjs/series/Area.js.map +1 -1
- package/cjs/series/Bar.d.ts +5 -5
- package/cjs/series/Bar.js.map +1 -1
- package/cjs/series/BaseSeries.d.ts +1 -1
- package/cjs/series/BaseSeries.js.map +1 -1
- package/cjs/series/BoxPlot.d.ts +5 -5
- package/cjs/series/BoxPlot.js.map +1 -1
- package/cjs/series/CircularProgress.d.ts +5 -5
- package/cjs/series/CircularProgress.js +2 -1
- package/cjs/series/CircularProgress.js.map +1 -1
- package/cjs/series/Dot.d.ts +5 -5
- package/cjs/series/Dot.js.map +1 -1
- package/cjs/series/Funnel.d.ts +5 -5
- package/cjs/series/Funnel.js.map +1 -1
- package/cjs/series/Line.d.ts +5 -5
- package/cjs/series/Line.js.map +1 -1
- package/cjs/series/LinearProgress.d.ts +5 -5
- package/cjs/series/LinearProgress.js.map +1 -1
- package/cjs/series/Link.d.ts +5 -5
- package/cjs/series/Link.js.map +1 -1
- package/cjs/series/Map.d.ts +5 -5
- package/cjs/series/Map.js.map +1 -1
- package/cjs/series/Pie.d.ts +5 -5
- package/cjs/series/Pie.js +1 -2
- package/cjs/series/Pie.js.map +1 -1
- package/cjs/series/Radar.d.ts +5 -5
- package/cjs/series/Radar.js.map +1 -1
- package/cjs/series/RangeColumn.d.ts +5 -5
- package/cjs/series/RangeColumn.js.map +1 -1
- package/cjs/series/Rose.d.ts +5 -5
- package/cjs/series/Rose.js.map +1 -1
- package/cjs/series/Scatter.d.ts +5 -5
- package/cjs/series/Scatter.js.map +1 -1
- package/cjs/series/Series.d.ts +5 -6
- package/cjs/series/Series.js.map +1 -1
- package/cjs/series/WordCloud.d.ts +5 -5
- package/cjs/series/WordCloud.js.map +1 -1
- package/cjs/series/index.js +1 -1
- package/cjs/util.js +1 -1
- package/esm/VChart.d.ts +1 -1
- package/esm/charts/AreaChart.d.ts +4 -1
- package/esm/charts/AreaChart.js.map +1 -1
- package/esm/charts/BarChart.d.ts +4 -1
- package/esm/charts/BarChart.js.map +1 -1
- package/esm/charts/BaseChart.d.ts +6 -5
- package/esm/charts/BaseChart.js +25 -10
- package/esm/charts/BaseChart.js.map +1 -1
- package/esm/charts/BoxPlotChart.d.ts +4 -1
- package/esm/charts/BoxPlotChart.js.map +1 -1
- package/esm/charts/CircularProgressChart.d.ts +4 -1
- package/esm/charts/CircularProgressChart.js.map +1 -1
- package/esm/charts/CommonChart.d.ts +4 -1
- package/esm/charts/CommonChart.js.map +1 -1
- package/esm/charts/FunnelChart.d.ts +4 -1
- package/esm/charts/FunnelChart.js.map +1 -1
- package/esm/charts/HistogramChart.d.ts +4 -1
- package/esm/charts/HistogramChart.js.map +1 -1
- package/esm/charts/LineChart.d.ts +4 -1
- package/esm/charts/LineChart.js.map +1 -1
- package/esm/charts/LinearProgressChart.d.ts +4 -1
- package/esm/charts/LinearProgressChart.js.map +1 -1
- package/esm/charts/MapChart.d.ts +4 -1
- package/esm/charts/MapChart.js.map +1 -1
- package/esm/charts/PieChart.d.ts +4 -1
- package/esm/charts/PieChart.js.map +1 -1
- package/esm/charts/RadarChart.d.ts +4 -1
- package/esm/charts/RadarChart.js.map +1 -1
- package/esm/charts/RangeColumnChart.d.ts +4 -1
- package/esm/charts/RangeColumnChart.js +1 -2
- package/esm/charts/RangeColumnChart.js.map +1 -1
- package/esm/charts/RoseChart.d.ts +4 -1
- package/esm/charts/RoseChart.js.map +1 -1
- package/esm/charts/ScatterChart.d.ts +4 -1
- package/esm/charts/ScatterChart.js +2 -1
- package/esm/charts/ScatterChart.js.map +1 -1
- package/esm/charts/SequenceChart.d.ts +4 -1
- package/esm/charts/SequenceChart.js.map +1 -1
- package/esm/charts/WordCloudChart.d.ts +4 -1
- package/esm/charts/WordCloudChart.js.map +1 -1
- package/esm/charts/index.js +1 -1
- package/esm/components/Axis.d.ts +4 -5
- package/esm/components/Axis.js.map +1 -1
- package/esm/components/Brush.d.ts +5 -0
- package/esm/components/Brush.js +6 -0
- package/esm/components/Brush.js.map +1 -0
- package/esm/components/Crosshair.d.ts +4 -0
- package/esm/components/Crosshair.js +4 -0
- package/esm/components/Crosshair.js.map +1 -0
- package/esm/components/DataZoom.d.ts +5 -0
- package/esm/components/DataZoom.js +6 -0
- package/esm/components/DataZoom.js.map +1 -0
- package/esm/components/Legend.d.ts +4 -8
- package/esm/components/Legend.js.map +1 -1
- package/esm/components/Mark.d.ts +1 -1
- package/esm/components/Mark.js.map +1 -1
- package/esm/components/MarkArea.d.ts +4 -0
- package/esm/components/MarkArea.js +4 -0
- package/esm/components/MarkArea.js.map +1 -0
- package/esm/components/MarkLine.d.ts +4 -0
- package/esm/components/MarkLine.js +4 -0
- package/esm/components/MarkLine.js.map +1 -0
- package/esm/components/MarkPoint.d.ts +4 -0
- package/esm/components/MarkPoint.js +4 -0
- package/esm/components/MarkPoint.js.map +1 -0
- package/esm/components/Player.d.ts +5 -0
- package/esm/components/Player.js +6 -0
- package/esm/components/Player.js.map +1 -0
- package/esm/components/Region.d.ts +4 -4
- package/esm/components/Region.js.map +1 -1
- package/esm/components/Scrollbar.d.ts +5 -0
- package/esm/components/Scrollbar.js +6 -0
- package/esm/components/Scrollbar.js.map +1 -0
- package/esm/components/Tooltip.d.ts +4 -0
- package/esm/components/Tooltip.js +4 -0
- package/esm/components/Tooltip.js.map +1 -0
- package/esm/components/index.d.ts +9 -0
- package/esm/components/index.js +19 -1
- package/esm/components/index.js.map +1 -1
- package/esm/containers/withContainer.d.ts +2 -2
- package/esm/containers/withContainer.js.map +1 -1
- package/esm/context/chart.js +1 -2
- package/esm/eventsUtils.d.ts +107 -47
- package/esm/eventsUtils.js +28 -3
- package/esm/eventsUtils.js.map +1 -1
- package/esm/index.js +2 -1
- package/esm/series/Area.d.ts +5 -5
- package/esm/series/Area.js.map +1 -1
- package/esm/series/Bar.d.ts +5 -5
- package/esm/series/Bar.js.map +1 -1
- package/esm/series/BaseSeries.d.ts +1 -1
- package/esm/series/BaseSeries.js.map +1 -1
- package/esm/series/BoxPlot.d.ts +5 -5
- package/esm/series/BoxPlot.js.map +1 -1
- package/esm/series/CircularProgress.d.ts +5 -5
- package/esm/series/CircularProgress.js +2 -1
- package/esm/series/CircularProgress.js.map +1 -1
- package/esm/series/Dot.d.ts +5 -5
- package/esm/series/Dot.js.map +1 -1
- package/esm/series/Funnel.d.ts +5 -5
- package/esm/series/Funnel.js.map +1 -1
- package/esm/series/Line.d.ts +5 -5
- package/esm/series/Line.js.map +1 -1
- package/esm/series/LinearProgress.d.ts +5 -5
- package/esm/series/LinearProgress.js.map +1 -1
- package/esm/series/Link.d.ts +5 -5
- package/esm/series/Link.js.map +1 -1
- package/esm/series/Map.d.ts +5 -5
- package/esm/series/Map.js.map +1 -1
- package/esm/series/Pie.d.ts +5 -5
- package/esm/series/Pie.js +1 -2
- package/esm/series/Pie.js.map +1 -1
- package/esm/series/Radar.d.ts +5 -5
- package/esm/series/Radar.js.map +1 -1
- package/esm/series/RangeColumn.d.ts +5 -5
- package/esm/series/RangeColumn.js.map +1 -1
- package/esm/series/Rose.d.ts +5 -5
- package/esm/series/Rose.js.map +1 -1
- package/esm/series/Scatter.d.ts +5 -5
- package/esm/series/Scatter.js.map +1 -1
- package/esm/series/Series.d.ts +5 -6
- package/esm/series/Series.js.map +1 -1
- package/esm/series/WordCloud.d.ts +5 -5
- package/esm/series/WordCloud.js.map +1 -1
- package/esm/series/index.js +1 -1
- package/esm/util.js +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/BaseSeries.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,6CAA+D;AAC/D,6DAAgD;AAChD,gDAMwB;AACxB,kCAA8B;AAMvB,MAAM,YAAY,GAAG,CAA4B,aAAqB,EAAE,S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,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC7E,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAAC;gBAC5C,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;aAClC;QACH,CAAC,CAAC;QAEF,YAAY,CAAC,IAAA,4BAAc,EAAC,KAAK,CAAC,CAAC,CAAC;QACpC,IAAI,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,OAAO,EAAE;YAEvC,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC;SACnC;aAAM;YACL,MAAM,aAAa,GAAG,IAAA,oBAAW,EAAI,KAAK,EAAE,WAAW,CAAC,CAAC;YACzD,IAAI,CAAC,IAAA,gBAAO,EAAC,aAAa,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE;gBAC/C,UAAU,CAAC,OAAO,GAAG,aAAa,CAAC;gBACnC,eAAe,CAAC,aAAa,CAAC,CAAC;aAChC;SACF;QAED,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YACnB,OAAO,GAAG,EAAE;gBACV,eAAe,EAAE,CAAC;gBAClB,eAAe,EAAE,CAAC;YACpB,CAAC,CAAC;QACJ,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,IAAI,CAAC,WAAW,GAAG,aAAa,CAAC;IACjC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAxIW,QAAA,YAAY,gBAwIvB","file":"BaseSeries.js","sourcesContent":["import React from 'react';\nimport { isNil, isEqual, pickWithout } from '@visactor/vutils';\nimport RootChartContext from '../context/chart';\nimport {\n REACT_TO_VCHART_EVENTS,\n EventsProps,\n findEventProps,\n COMMON_EVENTK_KEYS,\n VCHART_TO_REACT_EVENTS\n} from '../eventsUtils';\nimport { uid } from '../util';\n\nexport interface BaseSeriesProps extends EventsProps {\n id?: string | number;\n}\n\nexport const createSeries = <T extends BaseSeriesProps>(componentName: string, markNames: string[], type?: string) => {\n const ignoreKeys = ['id', 'updateId'];\n const notSpecKeys = COMMON_EVENTK_KEYS.concat(ignoreKeys);\n\n const Comp: React.FC<T & { updateId?: number }> = props => {\n const context = React.useContext(RootChartContext);\n\n const id = React.useRef<string | number>(isNil(props.id) ? uid(type ?? 'series') : props.id);\n\n const seriesSpec = React.useRef<Partial<T>>();\n const bindedEvents = React.useRef<Record<string, boolean>>({});\n const updateId = React.useRef<number>(props.updateId);\n\n const handleEvent = (e: any) => {\n const markIds = markNames.map(markName => `${id.current}-${markName}`);\n if (e?.mark && markIds.includes(e.mark.getUserId())) {\n props[VCHART_TO_REACT_EVENTS[e.event.type]](e);\n }\n };\n\n const addMarkEvent = (events: EventsProps) => {\n if (!events || !context.chart) {\n return;\n }\n\n if (bindedEvents) {\n Object.keys(bindedEvents).forEach(eventKey => {\n if (!events[eventKey]) {\n context.chart.off(REACT_TO_VCHART_EVENTS[eventKey], handleEvent);\n }\n bindedEvents.current[eventKey] = false;\n });\n }\n\n Object.keys(events).forEach(eventKey => {\n if (!bindedEvents?.[eventKey]) {\n context.chart.on(REACT_TO_VCHART_EVENTS[eventKey], handleEvent);\n\n if (!bindedEvents) {\n bindedEvents.current = {};\n }\n bindedEvents.current[eventKey] = true;\n }\n });\n };\n\n const removeMarkEvent = () => {\n addMarkEvent({});\n };\n\n const addMarkId = (seriesSpec: any) => {\n markNames.forEach(markName => {\n const defaultMarkId = `${id.current}-${markName}`;\n\n if (isNil(seriesSpec[markName])) {\n seriesSpec[markName] = { id: defaultMarkId };\n } else if (isNil(seriesSpec[markName].id)) {\n seriesSpec[markName].id = defaultMarkId;\n }\n });\n };\n\n const insertToContext = (props: Partial<T>) => {\n if (context.specFromChildren) {\n if (!context.specFromChildren.series) {\n context.specFromChildren.series = [];\n }\n\n const seriesSpec = isNil(type) ? { ...props, id: id.current } : { ...props, id: id.current, type };\n\n addMarkId(seriesSpec);\n context.specFromChildren.series.push(seriesSpec);\n context.isChildrenUpdated = true;\n }\n };\n\n const updateToContext = (props: Partial<T>) => {\n if (!context.specFromChildren) {\n return;\n }\n\n if (!context.specFromChildren.series) {\n insertToContext(props);\n return;\n }\n\n const series = context.specFromChildren.series;\n const index = series.findIndex((entry: any) => entry.id === id.current);\n\n if (index >= 0) {\n series[index] = isNil(type) ? { ...props, id: id.current } : { ...props, id: id.current, type };\n addMarkId(series[index]);\n } else {\n insertToContext(props);\n }\n context.isChildrenUpdated = true;\n };\n\n const deleteToContext = () => {\n if (!context.specFromChildren) {\n return;\n }\n const series = context.specFromChildren.series ?? [];\n const index = series.findIndex((entry: any) => entry.id === id.current);\n\n if (index >= 0) {\n const newSeries = series.slice(0, index - 1).concat(series.slice(index + 1));\n context.specFromChildren.series = newSeries;\n context.isChildrenUpdated = true;\n }\n };\n\n addMarkEvent(findEventProps(props));\n if (props.updateId !== updateId.current) {\n // chart render\n updateId.current = props.updateId;\n } else {\n const newSeriesSpec = pickWithout<T>(props, notSpecKeys);\n if (!isEqual(newSeriesSpec, seriesSpec.current)) {\n seriesSpec.current = newSeriesSpec;\n updateToContext(newSeriesSpec);\n }\n }\n\n React.useEffect(() => {\n return () => {\n deleteToContext();\n removeMarkEvent();\n };\n }, []);\n\n return null;\n };\n\n Comp.displayName = componentName;\n return Comp;\n};\n"]}
|
package/cjs/series/BoxPlot.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const BoxPlot: import("react").FC<BaseSeriesProps & {
|
|
5
|
-
updateId
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { IBoxPlotSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type BoxPlotProps = BaseSeriesProps & Omit<IBoxPlotSeriesSpec, 'type'>;
|
|
4
|
+
export declare const BoxPlot: import("react").FC<BaseSeriesProps & Omit<IBoxPlotSeriesSpec, "type"> & {
|
|
5
|
+
updateId?: number;
|
|
6
6
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/BoxPlot.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/BoxPlot.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAKhD,QAAA,OAAO,GAAG,IAAA,yBAAY,EAAe,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC","file":"BoxPlot.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport { IBoxPlotSeriesSpec } from '@visactor/vchart';\n\nexport type BoxPlotProps = BaseSeriesProps & Omit<IBoxPlotSeriesSpec, 'type'>;\n\nexport const BoxPlot = createSeries<BoxPlotProps>('BoxPlot', ['boxPlot'], 'boxPlot');\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const CircularProgress: import("react").FC<BaseSeriesProps & {
|
|
5
|
-
updateId
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { ICircularProgressSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type CircularProgressProps = BaseSeriesProps & Omit<ICircularProgressSeriesSpec, 'type'>;
|
|
4
|
+
export declare const CircularProgress: import("react").FC<BaseSeriesProps & Omit<ICircularProgressSeriesSpec, "type"> & {
|
|
5
|
+
updateId?: number;
|
|
6
6
|
}>;
|
|
@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
|
|
7
7
|
const BaseSeries_1 = require("./BaseSeries");
|
|
8
8
|
|
|
9
|
-
exports.CircularProgress = (0, BaseSeries_1.createSeries)("CircularProgress", [ "circularProgress" ], "circularProgress");
|
|
9
|
+
exports.CircularProgress = (0, BaseSeries_1.createSeries)("CircularProgress", [ "circularProgress" ], "circularProgress");
|
|
10
|
+
//# sourceMappingURL=CircularProgress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/CircularProgress.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/CircularProgress.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAKhD,QAAA,gBAAgB,GAAG,IAAA,yBAAY,EAC1C,kBAAkB,EAClB,CAAC,kBAAkB,CAAC,EACpB,kBAAkB,CACnB,CAAC","file":"CircularProgress.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport { ICircularProgressSeriesSpec } from '@visactor/vchart';\n\nexport type CircularProgressProps = BaseSeriesProps & Omit<ICircularProgressSeriesSpec, 'type'>;\n\nexport const CircularProgress = createSeries<CircularProgressProps>(\n 'CircularProgress',\n ['circularProgress'],\n 'circularProgress'\n);\n"]}
|
package/cjs/series/Dot.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const Dot: import("react").FC<BaseSeriesProps & {
|
|
5
|
-
updateId
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { IDotSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type DotProps = BaseSeriesProps & Omit<IDotSeriesSpec, 'type'>;
|
|
4
|
+
export declare const Dot: import("react").FC<BaseSeriesProps & Omit<IDotSeriesSpec, "type"> & {
|
|
5
|
+
updateId?: number;
|
|
6
6
|
}>;
|
package/cjs/series/Dot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/Dot.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/Dot.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAKhD,QAAA,GAAG,GAAG,IAAA,yBAAY,EAAW,KAAK,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC","file":"Dot.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport { IDotSeriesSpec } from '@visactor/vchart';\n\nexport type DotProps = BaseSeriesProps & Omit<IDotSeriesSpec, 'type'>;\n\nexport const Dot = createSeries<DotProps>('Dot', ['dot'], 'dot');\n"]}
|
package/cjs/series/Funnel.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const Funnel: import("react").FC<BaseSeriesProps & {
|
|
5
|
-
updateId
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { IFunnelSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type FunnelProps = BaseSeriesProps & Omit<IFunnelSeriesSpec, 'type'>;
|
|
4
|
+
export declare const Funnel: import("react").FC<BaseSeriesProps & Omit<IFunnelSeriesSpec, "type"> & {
|
|
5
|
+
updateId?: number;
|
|
6
6
|
}>;
|
package/cjs/series/Funnel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/Funnel.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/Funnel.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAKhD,QAAA,MAAM,GAAG,IAAA,yBAAY,EAAc,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC","file":"Funnel.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport { IFunnelSeriesSpec } from '@visactor/vchart';\n\nexport type FunnelProps = BaseSeriesProps & Omit<IFunnelSeriesSpec, 'type'>;\n\nexport const Funnel = createSeries<FunnelProps>('Funnel', ['funnel'], 'funnel');\n"]}
|
package/cjs/series/Line.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const Line: import("react").FC<BaseSeriesProps & {
|
|
5
|
-
updateId
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { ILineSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type LineProps = BaseSeriesProps & Omit<ILineSeriesSpec, 'type'>;
|
|
4
|
+
export declare const Line: import("react").FC<BaseSeriesProps & Omit<ILineSeriesSpec, "type"> & {
|
|
5
|
+
updateId?: number;
|
|
6
6
|
}>;
|
package/cjs/series/Line.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/Line.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/Line.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAKhD,QAAA,IAAI,GAAG,IAAA,yBAAY,EAAY,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC","file":"Line.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport { ILineSeriesSpec } from '@visactor/vchart';\n\nexport type LineProps = BaseSeriesProps & Omit<ILineSeriesSpec, 'type'>;\n\nexport const Line = createSeries<LineProps>('Line', ['line'], 'line');\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const LinearProgress: import("react").FC<BaseSeriesProps & {
|
|
5
|
-
updateId
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { ILinearProgressSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type LinearProgressProps = BaseSeriesProps & Omit<ILinearProgressSeriesSpec, 'type'>;
|
|
4
|
+
export declare const LinearProgress: import("react").FC<BaseSeriesProps & Omit<ILinearProgressSeriesSpec, "type"> & {
|
|
5
|
+
updateId?: number;
|
|
6
6
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/LinearProgress.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/LinearProgress.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAKhD,QAAA,cAAc,GAAG,IAAA,yBAAY,EAAsB,gBAAgB,EAAE,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,CAAC","file":"LinearProgress.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport { ILinearProgressSeriesSpec } from '@visactor/vchart';\n\nexport type LinearProgressProps = BaseSeriesProps & Omit<ILinearProgressSeriesSpec, 'type'>;\n\nexport const LinearProgress = createSeries<LinearProgressProps>('LinearProgress', ['linearProgress'], 'linearProgress');\n"]}
|
package/cjs/series/Link.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const Link: import("react").FC<BaseSeriesProps & {
|
|
5
|
-
updateId
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { ILinkSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type LinkProps = BaseSeriesProps & Omit<ILinkSeriesSpec, 'type'>;
|
|
4
|
+
export declare const Link: import("react").FC<BaseSeriesProps & Omit<ILinkSeriesSpec, "type"> & {
|
|
5
|
+
updateId?: number;
|
|
6
6
|
}>;
|
package/cjs/series/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/Link.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/Link.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAKhD,QAAA,IAAI,GAAG,IAAA,yBAAY,EAAY,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC","file":"Link.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport { ILinkSeriesSpec } from '@visactor/vchart';\n\nexport type LinkProps = BaseSeriesProps & Omit<ILinkSeriesSpec, 'type'>;\n\nexport const Link = createSeries<LinkProps>('Link', ['link'], 'link');\n"]}
|
package/cjs/series/Map.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const Map: import("react").FC<BaseSeriesProps & {
|
|
5
|
-
updateId
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { IMapSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type MapProps = BaseSeriesProps & Omit<IMapSeriesSpec, 'type'>;
|
|
4
|
+
export declare const Map: import("react").FC<BaseSeriesProps & Omit<IMapSeriesSpec, "type"> & {
|
|
5
|
+
updateId?: number;
|
|
6
6
|
}>;
|
package/cjs/series/Map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/Map.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/Map.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAKhD,QAAA,GAAG,GAAG,IAAA,yBAAY,EAAW,KAAK,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC","file":"Map.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport { IMapSeriesSpec } from '@visactor/vchart';\n\nexport type MapProps = BaseSeriesProps & Omit<IMapSeriesSpec, 'type'>;\n\nexport const Map = createSeries<MapProps>('Map', ['map'], 'map');\n"]}
|
package/cjs/series/Pie.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const Pie: import("react").FC<BaseSeriesProps & {
|
|
5
|
-
updateId
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { IPieSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type PieProps = BaseSeriesProps & Omit<IPieSeriesSpec, 'type'>;
|
|
4
|
+
export declare const Pie: import("react").FC<BaseSeriesProps & Omit<IPieSeriesSpec, "type"> & {
|
|
5
|
+
updateId?: number;
|
|
6
6
|
}>;
|
package/cjs/series/Pie.js
CHANGED
|
@@ -6,5 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
|
|
7
7
|
const BaseSeries_1 = require("./BaseSeries");
|
|
8
8
|
|
|
9
|
-
exports.Pie = (0, BaseSeries_1.createSeries)("Pie", [ "pie" ], "pie");
|
|
10
|
-
//# sourceMappingURL=Pie.js.map
|
|
9
|
+
exports.Pie = (0, BaseSeries_1.createSeries)("Pie", [ "pie" ], "pie");
|
package/cjs/series/Pie.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/Pie.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/Pie.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAKhD,QAAA,GAAG,GAAG,IAAA,yBAAY,EAAW,KAAK,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC","file":"Pie.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport { IPieSeriesSpec } from '@visactor/vchart';\n\nexport type PieProps = BaseSeriesProps & Omit<IPieSeriesSpec, 'type'>;\n\nexport const Pie = createSeries<PieProps>('Pie', ['pie'], 'pie');\n"]}
|
package/cjs/series/Radar.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const Radar: import("react").FC<BaseSeriesProps & {
|
|
5
|
-
updateId
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { IRadarSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type RadarProps = BaseSeriesProps & Omit<IRadarSeriesSpec, 'type'>;
|
|
4
|
+
export declare const Radar: import("react").FC<BaseSeriesProps & Omit<IRadarSeriesSpec, "type"> & {
|
|
5
|
+
updateId?: number;
|
|
6
6
|
}>;
|
package/cjs/series/Radar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/Radar.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/Radar.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAKhD,QAAA,KAAK,GAAG,IAAA,yBAAY,EAAa,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC","file":"Radar.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport { IRadarSeriesSpec } from '@visactor/vchart';\n\nexport type RadarProps = BaseSeriesProps & Omit<IRadarSeriesSpec, 'type'>;\n\nexport const Radar = createSeries<RadarProps>('Radar', ['radar'], 'radar');\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const RangeColumn: import("react").FC<BaseSeriesProps & {
|
|
5
|
-
updateId
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { IRangeColumnSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type RangeColumnProps = BaseSeriesProps & Omit<IRangeColumnSeriesSpec, 'type'>;
|
|
4
|
+
export declare const RangeColumn: import("react").FC<BaseSeriesProps & Omit<IRangeColumnSeriesSpec, "type"> & {
|
|
5
|
+
updateId?: number;
|
|
6
6
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/RangeColumn.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/RangeColumn.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAKhD,QAAA,WAAW,GAAG,IAAA,yBAAY,EAAmB,aAAa,EAAE,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC,CAAC","file":"RangeColumn.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport { IRangeColumnSeriesSpec } from '@visactor/vchart';\n\nexport type RangeColumnProps = BaseSeriesProps & Omit<IRangeColumnSeriesSpec, 'type'>;\n\nexport const RangeColumn = createSeries<RangeColumnProps>('RangeColumn', ['rangeColumn'], 'rangeColumn');\n"]}
|
package/cjs/series/Rose.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const Rose: import("react").FC<BaseSeriesProps & {
|
|
5
|
-
updateId
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { IRoseSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type RoseProps = BaseSeriesProps & Omit<IRoseSeriesSpec, 'type'>;
|
|
4
|
+
export declare const Rose: import("react").FC<BaseSeriesProps & Omit<IRoseSeriesSpec, "type"> & {
|
|
5
|
+
updateId?: number;
|
|
6
6
|
}>;
|
package/cjs/series/Rose.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/Rose.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/Rose.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAKhD,QAAA,IAAI,GAAG,IAAA,yBAAY,EAAY,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC","file":"Rose.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport { IRoseSeriesSpec } from '@visactor/vchart';\n\nexport type RoseProps = BaseSeriesProps & Omit<IRoseSeriesSpec, 'type'>;\n\nexport const Rose = createSeries<RoseProps>('Rose', ['rose'], 'rose');\n"]}
|
package/cjs/series/Scatter.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const Scatter: import("react").FC<BaseSeriesProps & {
|
|
5
|
-
updateId
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { IScatterSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type ScatterProps = BaseSeriesProps & Omit<IScatterSeriesSpec, 'type'>;
|
|
4
|
+
export declare const Scatter: import("react").FC<BaseSeriesProps & Omit<IScatterSeriesSpec, "type"> & {
|
|
5
|
+
updateId?: number;
|
|
6
6
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/Scatter.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/Scatter.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAKhD,QAAA,OAAO,GAAG,IAAA,yBAAY,EAAe,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC","file":"Scatter.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport { IScatterSeriesSpec } from '@visactor/vchart';\n\nexport type ScatterProps = BaseSeriesProps & Omit<IScatterSeriesSpec, 'type'>;\n\nexport const Scatter = createSeries<ScatterProps>('Scatter', ['scatter'], 'scatter');\n"]}
|
package/cjs/series/Series.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
updateId: number;
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { IBarSeriesSpec, IAreaSeriesSpec, IBoxPlotSeriesSpec, ICircularProgressSeriesSpec, IDotSeriesSpec, IFunnelSeriesSpec, ILineSeriesSpec, ILinearProgressSeriesSpec, ILinkSeriesSpec, IMapSeriesSpec, IPieSeriesSpec, IRadarSeriesSpec, IRangeColumnSeriesSpec, IRoseSeriesSpec, IScatterSeriesSpec, IWordCloudSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type SeriesProps = (IBarSeriesSpec | IAreaSeriesSpec | IBoxPlotSeriesSpec | ICircularProgressSeriesSpec | IDotSeriesSpec | IFunnelSeriesSpec | ILineSeriesSpec | ILinearProgressSeriesSpec | ILinkSeriesSpec | IMapSeriesSpec | IPieSeriesSpec | IRadarSeriesSpec | IRangeColumnSeriesSpec | IRoseSeriesSpec | IScatterSeriesSpec | IWordCloudSeriesSpec) & BaseSeriesProps;
|
|
4
|
+
export declare const Series: import("react").FC<SeriesProps & {
|
|
5
|
+
updateId?: number;
|
|
7
6
|
}>;
|
package/cjs/series/Series.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/Series.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/Series.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAuChD,QAAA,MAAM,GAAG,IAAA,yBAAY,EAAc,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC","file":"Series.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport {\n IBarSeriesSpec,\n IAreaSeriesSpec,\n IBoxPlotSeriesSpec,\n ICircularProgressSeriesSpec,\n IDotSeriesSpec,\n IFunnelSeriesSpec,\n ILineSeriesSpec,\n ILinearProgressSeriesSpec,\n ILinkSeriesSpec,\n IMapSeriesSpec,\n IPieSeriesSpec,\n IRadarSeriesSpec,\n IRangeColumnSeriesSpec,\n IRoseSeriesSpec,\n IScatterSeriesSpec,\n IWordCloudSeriesSpec\n} from '@visactor/vchart';\nexport type SeriesProps = (\n | IBarSeriesSpec\n | IAreaSeriesSpec\n | IBoxPlotSeriesSpec\n | ICircularProgressSeriesSpec\n | IDotSeriesSpec\n | IFunnelSeriesSpec\n | ILineSeriesSpec\n | ILinearProgressSeriesSpec\n | ILinkSeriesSpec\n | IMapSeriesSpec\n | IPieSeriesSpec\n | IRadarSeriesSpec\n | IRangeColumnSeriesSpec\n | IRoseSeriesSpec\n | IScatterSeriesSpec\n | IWordCloudSeriesSpec\n) &\n BaseSeriesProps;\n\nexport const Series = createSeries<SeriesProps>('Series', ['bar', 'line', 'area']);\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseSeriesProps } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const WordCloud: import("react").FC<BaseSeriesProps & {
|
|
5
|
-
updateId
|
|
1
|
+
import { BaseSeriesProps } from './BaseSeries';
|
|
2
|
+
import { IWordCloudSeriesSpec } from '@visactor/vchart';
|
|
3
|
+
export type WordCloudProps = BaseSeriesProps & Omit<IWordCloudSeriesSpec, 'type'>;
|
|
4
|
+
export declare const WordCloud: import("react").FC<BaseSeriesProps & Omit<IWordCloudSeriesSpec, "type"> & {
|
|
5
|
+
updateId?: number;
|
|
6
6
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["series/WordCloud.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;
|
|
1
|
+
{"version":3,"sources":["series/WordCloud.tsx"],"names":[],"mappings":";;;AAAA,6CAA6D;AAKhD,QAAA,SAAS,GAAG,IAAA,yBAAY,EAAiB,WAAW,EAAE,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,CAAC","file":"WordCloud.js","sourcesContent":["import { BaseSeriesProps, createSeries } from './BaseSeries';\nimport { IWordCloudSeriesSpec } from '@visactor/vchart';\n\nexport type WordCloudProps = BaseSeriesProps & Omit<IWordCloudSeriesSpec, 'type'>;\n\nexport const WordCloud = createSeries<WordCloudProps>('WordCloud', ['wordCloud'], 'wordCloud');\n"]}
|
package/cjs/series/index.js
CHANGED
|
@@ -26,4 +26,4 @@ __exportStar(require("./Link"), exports), __exportStar(require("./CircularProgre
|
|
|
26
26
|
__exportStar(require("./WordCloud"), exports), __exportStar(require("./Funnel"), exports),
|
|
27
27
|
__exportStar(require("./LinearProgress"), exports), __exportStar(require("./RangeColumn"), exports),
|
|
28
28
|
__exportStar(require("./BoxPlot"), exports);
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/util.js
CHANGED
package/esm/VChart.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BaseChartProps } from './charts/BaseChart';
|
|
2
2
|
export type VChartProps = Omit<BaseChartProps, 'container'>;
|
|
3
|
-
export declare const VChart: import("react").ForwardRefExoticComponent<import("./containers/withContainer").ContainerProps & import("react").RefAttributes<any>>;
|
|
3
|
+
export declare const VChart: import("react").ForwardRefExoticComponent<VChartProps & import("./containers/withContainer").ContainerProps & import("react").RefAttributes<any>>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { IAreaChartSpec } from '@visactor/vchart';
|
|
2
3
|
import { BaseChartProps } from './BaseChart';
|
|
3
4
|
export interface AreaChartProps extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>, Omit<IAreaChartSpec, 'type'> {
|
|
4
5
|
}
|
|
5
|
-
export declare const AreaChart:
|
|
6
|
+
export declare const AreaChart: React.ForwardRefExoticComponent<AreaChartProps & {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
} & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["charts/AreaChart.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["charts/AreaChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAA0C,WAAW,EAAE,MAAM,CAAC,CAAC","file":"AreaChart.js","sourcesContent":["import React from 'react';\nimport { IAreaChartSpec } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface AreaChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<IAreaChartSpec, 'type'> {}\n\nexport const AreaChart = createChart<React.PropsWithChildren<AreaChartProps>>('AreaChart', 'area');\n"]}
|
package/esm/charts/BarChart.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { IBarChartSpec } from '@visactor/vchart';
|
|
2
3
|
import { BaseChartProps } from './BaseChart';
|
|
3
4
|
export interface BarChartProps extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>, Omit<IBarChartSpec, 'type'> {
|
|
4
5
|
}
|
|
5
|
-
export declare const BarChart:
|
|
6
|
+
export declare const BarChart: React.ForwardRefExoticComponent<BarChartProps & {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
} & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["charts/BarChart.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["charts/BarChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAQ1D,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,CAAyC,UAAU,EAAE,KAAK,CAAC,CAAC","file":"BarChart.js","sourcesContent":["import React from 'react';\nimport { IBarChartSpec } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface BarChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<IBarChartSpec, 'type'> {\n //\n}\n\nexport const BarChart = createChart<React.PropsWithChildren<BarChartProps>>('BarChart', 'bar');\n"]}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import VChart, { IData, IInitOption } from '@visactor/vchart';
|
|
1
|
+
import VChart, { IData, IInitOption, IChartSpec } from '@visactor/vchart';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ContainerProps } from '../containers/withContainer';
|
|
4
|
-
import { EventsProps } from '../eventsUtils';
|
|
4
|
+
import { EventsProps, LegendEventProps, ScrollBarEventProps, BrushEventProps, DataZoomEventProps, PlayerEventProps } from '../eventsUtils';
|
|
5
5
|
export type ChartOptions = Omit<IInitOption, 'dom'>;
|
|
6
|
-
export interface BaseChartProps extends EventsProps {
|
|
6
|
+
export interface BaseChartProps extends EventsProps, LegendEventProps, ScrollBarEventProps, BrushEventProps, DataZoomEventProps, PlayerEventProps {
|
|
7
7
|
type?: string;
|
|
8
8
|
container?: HTMLDivElement;
|
|
9
|
-
spec?:
|
|
9
|
+
spec?: IChartSpec;
|
|
10
10
|
data?: IData;
|
|
11
11
|
width?: number;
|
|
12
12
|
height?: number;
|
|
13
13
|
options?: ChartOptions;
|
|
14
14
|
onReady?: (instance: VChart, isInitial: boolean) => void;
|
|
15
|
+
onError?: () => void;
|
|
15
16
|
}
|
|
16
17
|
type Props = React.PropsWithChildren<BaseChartProps>;
|
|
17
|
-
export declare const createChart: <T extends Props>(componentName: string, type?: string, callback?: (props: T) => T) => React.ForwardRefExoticComponent<ContainerProps & React.RefAttributes<any>>;
|
|
18
|
+
export declare const createChart: <T extends Props>(componentName: string, type?: string, callback?: (props: T) => T) => React.ForwardRefExoticComponent<React.PropsWithoutRef<T & ContainerProps> & React.RefAttributes<any>>;
|
|
18
19
|
export {};
|
package/esm/charts/BaseChart.js
CHANGED
|
@@ -16,7 +16,7 @@ import { REACT_PRIVATE_PROPS } from "../constants";
|
|
|
16
16
|
|
|
17
17
|
import { bindEventsToChart, CHART_EVENTS_KEYS, CHART_EVENTS } from "../eventsUtils";
|
|
18
18
|
|
|
19
|
-
const notSpecKeys = [ ...REACT_PRIVATE_PROPS, ...CHART_EVENTS_KEYS, "spec", "container", "options" ], BaseChart = React.forwardRef(((props, ref) => {
|
|
19
|
+
const notSpecKeys = [ ...REACT_PRIVATE_PROPS, ...CHART_EVENTS_KEYS, "onError", "onReady", "spec", "container", "options" ], BaseChart = React.forwardRef(((props, ref) => {
|
|
20
20
|
const [updateId, setUpdateId] = useState(0), chartContext = useRef({
|
|
21
21
|
specFromChildren: {}
|
|
22
22
|
});
|
|
@@ -37,18 +37,33 @@ const notSpecKeys = [ ...REACT_PRIVATE_PROPS, ...CHART_EVENTS_KEYS, "spec", "con
|
|
|
37
37
|
chartContext.current = Object.assign(Object.assign({}, chartContext.current), {
|
|
38
38
|
chart: cs
|
|
39
39
|
});
|
|
40
|
-
})(props),
|
|
41
|
-
|
|
40
|
+
})(props), (() => {
|
|
41
|
+
if (chartContext.current.chart) {
|
|
42
|
+
const renderPromise = chartContext.current.chart.renderAsync().then(handleChartRender);
|
|
43
|
+
props.onError && renderPromise.catch(props.onError);
|
|
44
|
+
}
|
|
45
|
+
})(), bindEventsToChart(chartContext.current.chart, props, null, CHART_EVENTS),
|
|
46
|
+
chartContext.current = Object.assign(Object.assign({}, chartContext.current), {
|
|
42
47
|
isChildrenUpdated: !1
|
|
43
48
|
}), void (eventsBinded.current = props);
|
|
44
|
-
if (hasSpec)
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
if (hasSpec) {
|
|
50
|
+
if (!isEqual(eventsBinded.current.spec, props.spec)) {
|
|
51
|
+
const updatePromise = chartContext.current.chart.updateSpec(parseSpec(props), void 0, {
|
|
52
|
+
morph: !1
|
|
53
|
+
}).then(handleChartRender);
|
|
54
|
+
props.onError && updatePromise.catch(props.onError);
|
|
55
|
+
}
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
47
58
|
const newSpec = pickWithout(props, notSpecKeys);
|
|
48
|
-
isEqual(newSpec, prevSpec.current)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
if (!isEqual(newSpec, prevSpec.current) || chartContext.current.isChildrenUpdated) {
|
|
60
|
+
prevSpec.current = newSpec;
|
|
61
|
+
const updatePromise = chartContext.current.chart.updateSpec(parseSpec(props), void 0, {
|
|
62
|
+
morph: !1
|
|
63
|
+
}).then(handleChartRender);
|
|
64
|
+
props.onError && updatePromise.catch(props.onError);
|
|
65
|
+
}
|
|
66
|
+
chartContext.current = Object.assign(Object.assign({}, chartContext.current), {
|
|
52
67
|
isChildrenUpdated: !1
|
|
53
68
|
});
|
|
54
69
|
}), [ props ]), useEffect((() => () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["charts/BaseChart.tsx"],"names":[],"mappings":"AAAA,OAAO,MAA8B,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,aAAiC,MAAM,6BAA6B,CAAC;AAC5E,OAAO,gBAAsC,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAe,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA2BjG,MAAM,WAAW,GAAG,CAAC,GAAG,mBAAmB,EAAE,GAAG,iBAAiB,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAEnG,MAAM,SAAS,GAAoB,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACjE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAS,CAAC,CAAC,CAAC;IACpD,MAAM,YAAY,GAAG,MAAM,CAAmB;QAC5C,gBAAgB,EAAE,EAAE;KACrB,CAAC,CAAC;IAEH,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAE3D,MAAM,OAAO,GAAG,CA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AAC,KAAqB,EAAE;gBACzC,QAAQ,EAAE,QAAQ;aACnB,CAAC,CACa,CAClB,CAAC;QACJ,CAAC,CAAC,CACmB,CACG,CAC7B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAkB,aAAqB,EAAE,IAAa,EAAE,QAA0B,EAAE,EAAE;IAC/G,MAAM,GAAG,GAAG,aAAa,CAAoB,SAAgB,EAAE,aAAa,EAAE,CAAC,KAAU,EAAE,EAAE;QAC3F,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAElB,IAAI,QAAQ,EAAE;YACZ,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;QAED,IAAI,IAAI,EAAE;YACR,uCAAY,KAAK,KAAE,IAAI,IAAG;SAC3B;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC","file":"BaseChart.js","sourcesContent":["import VChart, { IData, IInitOption } from '@visactor/vchart';\nimport React, { useState, useEffect, useRef, useImperativeHandle } from 'react';\nimport withContainer, { ContainerProps } from '../containers/withContainer';\nimport RootChartContext, { ChartContextType } from '../context/chart';\nimport type { IView } from '@visactor/vgrammar';\nimport { isEqual, pickWithout } from '@visactor/vutils';\nimport ViewContext from '../context/view';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport { IMarkElement } from '../components';\nimport { bindEventsToChart, EventsProps, CHART_EVENTS_KEYS, CHART_EVENTS } from '../eventsUtils';\n\nexport type ChartOptions = Omit<IInitOption, 'dom'>;\n\nexport interface BaseChartProps extends EventsProps {\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /**\n * used only by <VChart />\n */\n spec?: any;\n /** 数据 */\n data?: IData;\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n /** 图表配置 */\n options?: ChartOptions;\n\n /** 图表渲染完成事件 */\n onReady?: (instance: VChart, isInitial: boolean) => void;\n}\n\ntype Props = React.PropsWithChildren<BaseChartProps>;\n\nconst notSpecKeys = [...REACT_PRIVATE_PROPS, ...CHART_EVENTS_KEYS, 'spec', 'container', 'options'];\n\nconst BaseChart: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const chartContext = useRef<ChartContextType>({\n specFromChildren: {}\n });\n\n useImperativeHandle(ref, () => chartContext.current.chart);\n\n const hasSpec = !!props.spec;\n const [view, setView] = useState<IView>(null);\n const isUnmount = useRef<boolean>(false);\n const prevSpec = useRef(pickWithout(props, notSpecKeys));\n const eventsBinded = React.useRef<BaseChartProps>(null);\n\n const parseSpec = (props: Props) => {\n if (hasSpec && props.spec) {\n return props.spec;\n }\n\n return {\n ...prevSpec.current,\n ...chartContext.current.specFromChildren\n };\n };\n\n const createChart = (props: Props) => {\n const cs = new VChart(parseSpec(props), {\n ...props.options,\n autoFit: true,\n mode: 'desktop-browser',\n dom: props.container\n });\n chartContext.current = { ...chartContext.current, chart: cs };\n };\n\n const handleChartRender = () => {\n // rebind events after render\n bindEventsToChart(chartContext.current.chart, props, eventsBinded.current, CHART_EVENTS);\n\n const newView = chartContext.current.chart.getCompiler().getVGrammarView();\n if (!isUnmount.current) {\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(chartContext.current.chart, updateId === 0);\n }\n }\n setView(newView);\n };\n\n const renderChart = () => {\n if (chartContext.current.chart) {\n // eslint-disable-next-line promise/catch-or-return\n chartContext.current.chart.renderAsync().then(handleChartRender);\n }\n };\n\n useEffect(() => {\n if (!chartContext.current.chart) {\n createChart(props);\n renderChart();\n bindEventsToChart(chartContext.current.chart, props, null, CHART_EVENTS);\n chartContext.current = {\n ...chartContext.current,\n isChildrenUpdated: false\n };\n eventsBinded.current = props;\n return;\n }\n\n if (hasSpec) {\n if (!isEqual(eventsBinded.current.spec, props.spec)) {\n // eslint-disable-next-line promise/catch-or-return\n chartContext.current.chart\n .updateSpec(parseSpec(props), undefined, { morph: false }) // morph临时关掉\n .then(handleChartRender);\n }\n return;\n }\n\n const newSpec = pickWithout(props, notSpecKeys);\n\n if (!isEqual(newSpec, prevSpec.current) || chartContext.current.isChildrenUpdated) {\n prevSpec.current = newSpec;\n // eslint-disable-next-line promise/catch-or-return\n chartContext.current.chart\n .updateSpec(parseSpec(props), undefined, { morph: false }) // morph临时关掉\n .then(handleChartRender);\n }\n chartContext.current = {\n ...chartContext.current,\n isChildrenUpdated: false\n };\n }, [props]);\n\n useEffect(() => {\n return () => {\n if (chartContext) {\n if (chartContext.current.chart) {\n chartContext.current.chart.release();\n }\n chartContext.current = null;\n }\n isUnmount.current = true;\n };\n }, []);\n\n return (\n <RootChartContext.Provider value={chartContext.current}>\n <ViewContext.Provider value={view}>\n {toArray(props.children).map((child, index) => {\n return (\n <React.Fragment key={(child as any)?.props?.id ?? (child as any)?.id ?? `child-${index}`}>\n {React.cloneElement(child as IMarkElement, {\n updateId: updateId\n })}\n </React.Fragment>\n );\n })}\n </ViewContext.Provider>\n </RootChartContext.Provider>\n );\n});\n\nexport const createChart = <T extends Props>(componentName: string, type?: string, callback?: (props: T) => T) => {\n const Com = withContainer<ContainerProps, T>(BaseChart as any, componentName, (props: any) => {\n props.type = type;\n\n if (callback) {\n return callback(props);\n }\n\n if (type) {\n return { ...props, type };\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["charts/BaseChart.tsx"],"names":[],"mappings":"AAAA,OAAO,MAA0C,MAAM,kBAAkB,CAAC;AAC1E,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,aAAiC,MAAM,6BAA6B,CAAC;AAC5E,OAAO,gBAAsC,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,k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AC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAkB,aAAqB,EAAE,IAAa,EAAE,QAA0B,EAAE,EAAE;IAC/G,MAAM,GAAG,GAAG,aAAa,CAAoB,SAAgB,EAAE,aAAa,EAAE,CAAC,KAAQ,EAAE,EAAE;QACzF,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAElB,IAAI,QAAQ,EAAE;YACZ,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;QAED,IAAI,IAAI,EAAE;YACR,uCAAY,KAAK,KAAE,IAAI,IAAG;SAC3B;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC","file":"BaseChart.js","sourcesContent":["import VChart, { IData, IInitOption, IChartSpec } from '@visactor/vchart';\nimport React, { useState, useEffect, useRef, useImperativeHandle } from 'react';\nimport withContainer, { ContainerProps } from '../containers/withContainer';\nimport RootChartContext, { ChartContextType } from '../context/chart';\nimport type { IView } from '@visactor/vgrammar';\nimport { isEqual, pickWithout } from '@visactor/vutils';\nimport ViewContext from '../context/view';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport { IMarkElement } from '../components';\nimport {\n bindEventsToChart,\n EventsProps,\n CHART_EVENTS_KEYS,\n CHART_EVENTS,\n LegendEventProps,\n ScrollBarEventProps,\n BrushEventProps,\n DataZoomEventProps,\n PlayerEventProps\n} from '../eventsUtils';\n\nexport type ChartOptions = Omit<IInitOption, 'dom'>;\n\nexport interface BaseChartProps\n extends EventsProps,\n LegendEventProps,\n ScrollBarEventProps,\n BrushEventProps,\n DataZoomEventProps,\n PlayerEventProps {\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /**\n * used only by <VChart />\n */\n spec?: IChartSpec;\n /** 数据 */\n data?: IData;\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n /** 图表配置 */\n options?: ChartOptions;\n\n /** 图表渲染完成事件 */\n onReady?: (instance: VChart, isInitial: boolean) => void;\n /** throw error when chart run into an error */\n onError?: () => void;\n}\n\ntype Props = React.PropsWithChildren<BaseChartProps>;\n\nconst notSpecKeys = [\n ...REACT_PRIVATE_PROPS,\n ...CHART_EVENTS_KEYS,\n 'onError',\n 'onReady',\n 'spec',\n 'container',\n 'options'\n];\n\nconst BaseChart: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const chartContext = useRef<ChartContextType>({\n specFromChildren: {}\n });\n useImperativeHandle(ref, () => chartContext.current.chart);\n const hasSpec = !!props.spec;\n const [view, setView] = useState<IView>(null);\n const isUnmount = useRef<boolean>(false);\n const prevSpec = useRef(pickWithout(props, notSpecKeys));\n const eventsBinded = React.useRef<BaseChartProps>(null);\n\n const parseSpec = (props: Props) => {\n if (hasSpec && props.spec) {\n return props.spec;\n }\n\n return {\n ...prevSpec.current,\n ...chartContext.current.specFromChildren\n };\n };\n\n const createChart = (props: Props) => {\n const cs = new VChart(parseSpec(props), {\n ...props.options,\n autoFit: true,\n mode: 'desktop-browser',\n dom: props.container\n });\n chartContext.current = { ...chartContext.current, chart: cs };\n };\n\n const handleChartRender = () => {\n // rebind events after render\n bindEventsToChart(chartContext.current.chart, props, eventsBinded.current, CHART_EVENTS);\n\n const newView = chartContext.current.chart.getCompiler().getVGrammarView();\n if (!isUnmount.current) {\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(chartContext.current.chart, updateId === 0);\n }\n }\n setView(newView);\n };\n\n const renderChart = () => {\n if (chartContext.current.chart) {\n // eslint-disable-next-line promise/catch-or-return\n const renderPromise = chartContext.current.chart.renderAsync().then(handleChartRender);\n\n if (props.onError) {\n renderPromise.catch(props.onError);\n }\n }\n };\n\n useEffect(() => {\n if (!chartContext.current.chart) {\n createChart(props);\n renderChart();\n bindEventsToChart(chartContext.current.chart, props, null, CHART_EVENTS);\n chartContext.current = {\n ...chartContext.current,\n isChildrenUpdated: false\n };\n eventsBinded.current = props;\n return;\n }\n\n if (hasSpec) {\n if (!isEqual(eventsBinded.current.spec, props.spec)) {\n // eslint-disable-next-line promise/catch-or-return\n const updatePromise = chartContext.current.chart\n .updateSpec(parseSpec(props), undefined, { morph: false }) // morph临时关掉\n .then(handleChartRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\n }\n return;\n }\n\n const newSpec = pickWithout(props, notSpecKeys);\n\n if (!isEqual(newSpec, prevSpec.current) || chartContext.current.isChildrenUpdated) {\n prevSpec.current = newSpec;\n // eslint-disable-next-line promise/catch-or-return\n const updatePromise = chartContext.current.chart\n .updateSpec(parseSpec(props), undefined, { morph: false }) // morph临时关掉\n .then(handleChartRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\n }\n chartContext.current = {\n ...chartContext.current,\n isChildrenUpdated: false\n };\n }, [props]);\n\n useEffect(() => {\n return () => {\n if (chartContext) {\n if (chartContext.current.chart) {\n chartContext.current.chart.release();\n }\n chartContext.current = null;\n }\n isUnmount.current = true;\n };\n }, []);\n\n return (\n <RootChartContext.Provider value={chartContext.current}>\n <ViewContext.Provider value={view}>\n {toArray(props.children).map((child, index) => {\n return (\n <React.Fragment key={(child as any)?.props?.id ?? (child as any)?.id ?? `child-${index}`}>\n {React.cloneElement(child as IMarkElement, {\n updateId: updateId\n })}\n </React.Fragment>\n );\n })}\n </ViewContext.Provider>\n </RootChartContext.Provider>\n );\n});\n\nexport const createChart = <T extends Props>(componentName: string, type?: string, callback?: (props: T) => T) => {\n const Com = withContainer<ContainerProps, T>(BaseChart as any, componentName, (props: T) => {\n props.type = type;\n\n if (callback) {\n return callback(props);\n }\n\n if (type) {\n return { ...props, type };\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { IBoxPlotChartSpec } from '@visactor/vchart';
|
|
2
3
|
import { BaseChartProps } from './BaseChart';
|
|
3
4
|
export interface BoxPlotChartProps extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>, Omit<IBoxPlotChartSpec, 'type'> {
|
|
4
5
|
}
|
|
5
|
-
export declare const BoxPlotChart:
|
|
6
|
+
export declare const BoxPlotChart: React.ForwardRefExoticComponent<BoxPlotChartProps & {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
} & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
|