@visactor/react-vchart 1.6.0 → 1.6.1

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.
Files changed (45) hide show
  1. package/cjs/charts/BaseChart.d.ts +2 -2
  2. package/cjs/charts/BaseChart.js.map +1 -1
  3. package/cjs/components/Indicator.d.ts +4 -0
  4. package/cjs/components/Indicator.js +10 -0
  5. package/cjs/components/Indicator.js.map +1 -0
  6. package/cjs/components/{Scrollbar.js → ScrollBar.js} +1 -2
  7. package/cjs/components/{Scrollbar.js.map → ScrollBar.js.map} +1 -1
  8. package/cjs/components/Title.d.ts +4 -0
  9. package/cjs/components/Title.js +10 -0
  10. package/cjs/components/Title.js.map +1 -0
  11. package/cjs/components/Tooltip.js +2 -1
  12. package/cjs/components/index.d.ts +3 -1
  13. package/cjs/components/index.js +3 -2
  14. package/cjs/components/index.js.map +1 -1
  15. package/cjs/constants.js +1 -1
  16. package/cjs/eventsUtils.d.ts +39 -0
  17. package/cjs/eventsUtils.js +14 -2
  18. package/cjs/eventsUtils.js.map +1 -1
  19. package/cjs/series/Link.js +1 -2
  20. package/cjs/series/Pie.js +2 -1
  21. package/cjs/series/WordCloud.js +1 -1
  22. package/esm/charts/BaseChart.d.ts +2 -2
  23. package/esm/charts/BaseChart.js.map +1 -1
  24. package/esm/components/Indicator.d.ts +4 -0
  25. package/esm/components/Indicator.js +4 -0
  26. package/esm/components/Indicator.js.map +1 -0
  27. package/esm/components/{Scrollbar.js → ScrollBar.js} +1 -2
  28. package/esm/components/{Scrollbar.js.map → ScrollBar.js.map} +1 -1
  29. package/esm/components/Title.d.ts +4 -0
  30. package/esm/components/Title.js +4 -0
  31. package/esm/components/Title.js.map +1 -0
  32. package/esm/components/Tooltip.js +2 -1
  33. package/esm/components/index.d.ts +3 -1
  34. package/esm/components/index.js +5 -1
  35. package/esm/components/index.js.map +1 -1
  36. package/esm/constants.js +1 -1
  37. package/esm/eventsUtils.d.ts +39 -0
  38. package/esm/eventsUtils.js +19 -1
  39. package/esm/eventsUtils.js.map +1 -1
  40. package/esm/series/Link.js +1 -2
  41. package/esm/series/Pie.js +2 -1
  42. package/esm/series/WordCloud.js +1 -1
  43. package/package.json +8 -8
  44. /package/cjs/components/{Scrollbar.d.ts → ScrollBar.d.ts} +0 -0
  45. /package/esm/components/{Scrollbar.d.ts → ScrollBar.d.ts} +0 -0
@@ -1,9 +1,9 @@
1
1
  import VChart, { IData, IInitOption, ISpec } from '@visactor/vchart';
2
2
  import React from 'react';
3
3
  import { ContainerProps } from '../containers/withContainer';
4
- import { EventsProps, LegendEventProps, ScrollBarEventProps, BrushEventProps, DataZoomEventProps, PlayerEventProps } from '../eventsUtils';
4
+ import { EventsProps, LegendEventProps, ScrollBarEventProps, BrushEventProps, DataZoomEventProps, PlayerEventProps, DimensionEventProps, HierarchyEventProps, ChartLifeCycleEventProps } from '../eventsUtils';
5
5
  export type ChartOptions = Omit<IInitOption, 'dom'>;
6
- export interface BaseChartProps extends EventsProps, LegendEventProps, ScrollBarEventProps, BrushEventProps, DataZoomEventProps, PlayerEventProps {
6
+ export interface BaseChartProps extends EventsProps, LegendEventProps, ScrollBarEventProps, BrushEventProps, DataZoomEventProps, PlayerEventProps, DimensionEventProps, HierarchyEventProps, ChartLifeCycleEventProps {
7
7
  type?: string;
8
8
  container?: HTMLDivElement;
9
9
  spec?: ISpec;
@@ -1 +1 @@
1
- {"version":3,"sources":["charts/BaseChart.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAqE;AACrE,+CAAgF;AAChF,gFAA4E;AAC5E,6DAAsE;AAEtE,6CAAwD;AACxD,2DAA0C;AAC1C,kCAAkC;AAClC,4CAAmD;AAEnD,gDAUwB;AAmCxB,MAAM,WAAW,GAAG;IAClB,GAAG,+BAAmB;IACtB,GAAG,+BAAiB;IACpB,SAAS;IACT,SAAS;IACT,MAAM;IACN,WAAW;IACX,SAAS;CACV,CAAC;AAEF,MAAM,S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AAG,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;AAfW,QAAA,WAAW,eAetB","file":"BaseChart.js","sourcesContent":["import VChart, { IData, IInitOption, ISpec } 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-core';\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?: ISpec;\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?: (err: Error) => 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 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 eventsBinded.current = props;\n // eslint-disable-next-line promise/catch-or-return\n const updatePromise = chartContext.current.chart\n .updateSpec(parseSpec(props), undefined, { morph: false, enableExitAnimation: 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, enableExitAnimation: 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
+ {"version":3,"sources":["charts/BaseChart.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAqE;AACrE,+CAAgF;AAChF,gFAA4E;AAC5E,6DAAsE;AAEtE,6CAAwD;AACxD,2DAA0C;AAC1C,kCAAkC;AAClC,4CAAmD;AAEnD,gDAawB;AAsCxB,MAAM,WAAW,GAAG;IAClB,GAAG,+BAA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,GAAG,IAAA,uBAAa,EAAoB,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;AAfW,QAAA,WAAW,eAetB","file":"BaseChart.js","sourcesContent":["import VChart, { IData, IInitOption, ISpec } 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-core';\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 DimensionEventProps,\n HierarchyEventProps,\n ChartLifeCycleEventProps\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 DimensionEventProps,\n HierarchyEventProps,\n ChartLifeCycleEventProps {\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /**\n * used only by <VChart />\n */\n spec?: ISpec;\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?: (err: Error) => 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 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 eventsBinded.current = props;\n // eslint-disable-next-line promise/catch-or-return\n const updatePromise = chartContext.current.chart\n .updateSpec(parseSpec(props), undefined, { morph: false, enableExitAnimation: 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, enableExitAnimation: 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"]}
@@ -0,0 +1,4 @@
1
+ import { BaseComponentProps } from './BaseComponent';
2
+ import type { IIndicatorSpec } from '@visactor/vchart';
3
+ export type IndicatorProps = IIndicatorSpec & BaseComponentProps;
4
+ export declare const Indicator: import("react").FC<IndicatorProps>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.Indicator = void 0;
6
+
7
+ const BaseComponent_1 = require("./BaseComponent");
8
+
9
+ exports.Indicator = (0, BaseComponent_1.createComponent)("Indicator", "indicator", null, !0);
10
+ //# sourceMappingURL=Indicator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Indicator.tsx"],"names":[],"mappings":";;;AAAA,mDAAsE;AAKzD,QAAA,SAAS,GAAG,IAAA,+BAAe,EAAiB,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC","file":"Indicator.js","sourcesContent":["import { BaseComponentProps, createComponent } from './BaseComponent';\nimport type { IIndicatorSpec } from '@visactor/vchart';\n\nexport type IndicatorProps = IIndicatorSpec & BaseComponentProps;\n\nexport const Indicator = createComponent<IndicatorProps>('Indicator', 'indicator', null, true);\n"]}
@@ -6,5 +6,4 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  const eventsUtils_1 = require("../eventsUtils"), BaseComponent_1 = require("./BaseComponent");
8
8
 
9
- exports.ScrollBar = (0, BaseComponent_1.createComponent)("ScrollBar", "scrollBar", eventsUtils_1.SCROLLBAR_CUSTOMIZED_EVENTS);
10
- //# sourceMappingURL=Scrollbar.js.map
9
+ exports.ScrollBar = (0, BaseComponent_1.createComponent)("ScrollBar", "scrollBar", eventsUtils_1.SCROLLBAR_CUSTOMIZED_EVENTS);
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Scrollbar.tsx"],"names":[],"mappings":";;;AAAA,gDAAkF;AAClF,mDAAsE;AAKzD,QAAA,SAAS,GAAG,IAAA,+BAAe,EAAiB,WAAW,EAAE,WAAW,EAAE,yCAA2B,CAAC,CAAC","file":"Scrollbar.js","sourcesContent":["import { SCROLLBAR_CUSTOMIZED_EVENTS, ScrollBarEventProps } from '../eventsUtils';\nimport { BaseComponentProps, createComponent } from './BaseComponent';\nimport type { IScrollBarSpec } from '@visactor/vchart';\n\nexport type ScrollBarProps = IScrollBarSpec & BaseComponentProps & ScrollBarEventProps;\n\nexport const ScrollBar = createComponent<ScrollBarProps>('ScrollBar', 'scrollBar', SCROLLBAR_CUSTOMIZED_EVENTS);\n"]}
1
+ {"version":3,"sources":["components/ScrollBar.tsx"],"names":[],"mappings":";;;AAAA,gDAAkF;AAClF,mDAAsE;AAKzD,QAAA,SAAS,GAAG,IAAA,+BAAe,EAAiB,WAAW,EAAE,WAAW,EAAE,yCAA2B,CAAC,CAAC","file":"ScrollBar.js","sourcesContent":["import { SCROLLBAR_CUSTOMIZED_EVENTS, ScrollBarEventProps } from '../eventsUtils';\nimport { BaseComponentProps, createComponent } from './BaseComponent';\nimport type { IScrollBarSpec } from '@visactor/vchart';\n\nexport type ScrollBarProps = IScrollBarSpec & BaseComponentProps & ScrollBarEventProps;\n\nexport const ScrollBar = createComponent<ScrollBarProps>('ScrollBar', 'scrollBar', SCROLLBAR_CUSTOMIZED_EVENTS);\n"]}
@@ -0,0 +1,4 @@
1
+ import { BaseComponentProps } from './BaseComponent';
2
+ import type { ITitleSpec } from '@visactor/vchart';
3
+ export type TitleProps = ITitleSpec & BaseComponentProps;
4
+ export declare const Title: import("react").FC<TitleProps>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.Title = void 0;
6
+
7
+ const BaseComponent_1 = require("./BaseComponent");
8
+
9
+ exports.Title = (0, BaseComponent_1.createComponent)("Title", "title", null, !0);
10
+ //# sourceMappingURL=Title.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Title.tsx"],"names":[],"mappings":";;;AAAA,mDAAsE;AAKzD,QAAA,KAAK,GAAG,IAAA,+BAAe,EAAa,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC","file":"Title.js","sourcesContent":["import { BaseComponentProps, createComponent } from './BaseComponent';\nimport type { ITitleSpec } from '@visactor/vchart';\n\nexport type TitleProps = ITitleSpec & BaseComponentProps;\n\nexport const Title = createComponent<TitleProps>('Title', 'title', null, true);\n"]}
@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  const BaseComponent_1 = require("./BaseComponent");
8
8
 
9
- exports.Tooltip = (0, BaseComponent_1.createComponent)("Tooltip", "tooltip", null, !0);
9
+ exports.Tooltip = (0, BaseComponent_1.createComponent)("Tooltip", "tooltip", null, !0);
10
+ //# sourceMappingURL=Tooltip.js.map
@@ -8,6 +8,8 @@ export * from './DataZoom';
8
8
  export * from './MarkLine';
9
9
  export * from './MarkArea';
10
10
  export * from './MarkPoint';
11
- export * from './Scrollbar';
11
+ export * from './ScrollBar';
12
12
  export * from './Tooltip';
13
13
  export * from './Player';
14
+ export * from './Indicator';
15
+ export * from './Title';
@@ -22,6 +22,7 @@ __exportStar(require("./Region"), exports), __exportStar(require("./Legend"), ex
22
22
  __exportStar(require("./Brush"), exports), __exportStar(require("./Crosshair"), exports),
23
23
  __exportStar(require("./DataZoom"), exports), __exportStar(require("./MarkLine"), exports),
24
24
  __exportStar(require("./MarkArea"), exports), __exportStar(require("./MarkPoint"), exports),
25
- __exportStar(require("./Scrollbar"), exports), __exportStar(require("./Tooltip"), exports),
26
- __exportStar(require("./Player"), exports);
25
+ __exportStar(require("./ScrollBar"), exports), __exportStar(require("./Tooltip"), exports),
26
+ __exportStar(require("./Player"), exports), __exportStar(require("./Indicator"), exports),
27
+ __exportStar(require("./Title"), exports);
27
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,yCAAuB;AACvB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,6CAA2B;AAC3B,6CAA2B;AAC3B,6CAA2B;AAC3B,8CAA4B;AAC5B,8CAA4B;AAC5B,4CAA0B;AAC1B,2CAAyB","file":"index.js","sourcesContent":["export * from './Axis';\nexport * from './Mark';\nexport * from './Region';\nexport * from './Legend';\nexport * from './Brush';\nexport * from './Crosshair';\nexport * from './DataZoom';\nexport * from './MarkLine';\nexport * from './MarkArea';\nexport * from './MarkPoint';\nexport * from './Scrollbar';\nexport * from './Tooltip';\nexport * from './Player';\n"]}
1
+ {"version":3,"sources":["components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,yCAAuB;AACvB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,6CAA2B;AAC3B,6CAA2B;AAC3B,6CAA2B;AAC3B,8CAA4B;AAC5B,8CAA4B;AAC5B,4CAA0B;AAC1B,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB","file":"index.js","sourcesContent":["export * from './Axis';\nexport * from './Mark';\nexport * from './Region';\nexport * from './Legend';\nexport * from './Brush';\nexport * from './Crosshair';\nexport * from './DataZoom';\nexport * from './MarkLine';\nexport * from './MarkArea';\nexport * from './MarkPoint';\nexport * from './ScrollBar';\nexport * from './Tooltip';\nexport * from './Player';\nexport * from './Indicator';\nexport * from './Title';\n"]}
package/cjs/constants.js CHANGED
@@ -3,4 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.REACT_PRIVATE_PROPS = void 0, exports.REACT_PRIVATE_PROPS = [ "children", "hooks", "ref" ];
6
- //# sourceMappingURL=constants.js.map
6
+ //# sourceMappingURL=constants.js.map
@@ -25,6 +25,21 @@ export interface PlayerEventProps {
25
25
  export interface ScrollBarEventProps {
26
26
  onScrollBarChange?: (e: any) => void;
27
27
  }
28
+ export interface DimensionEventProps {
29
+ onDimensionHover?: (e: any) => void;
30
+ onDimensionClick?: (e: any) => void;
31
+ }
32
+ export interface HierarchyEventProps {
33
+ onDrill?: (e: any) => void;
34
+ }
35
+ export interface ChartLifeCycleEventProps {
36
+ onInitialized?: (e: any) => void;
37
+ onRendered?: (e: any) => void;
38
+ onRenderFinished?: (e: any) => void;
39
+ onAnimationFinished?: (e: any) => void;
40
+ onLayoutStart?: (e: any) => void;
41
+ onLayoutEnd?: (e: any) => void;
42
+ }
28
43
  export interface EventsProps {
29
44
  onPointerDown?: EventCallback<EventParamsDefinition['pointerdown']>;
30
45
  onPointerUp?: EventCallback<EventParamsDefinition['pointerup']>;
@@ -145,6 +160,21 @@ export declare const PLAYER_CUSTOMIZED_EVENTS: {
145
160
  export declare const SCROLLBAR_CUSTOMIZED_EVENTS: {
146
161
  onScrollBarChange: string;
147
162
  };
163
+ export declare const DIMENSION_EVENTS: {
164
+ onDimensionHover: string;
165
+ onDimensionClick: string;
166
+ };
167
+ export declare const HIERARCHY_EVENTS: {
168
+ onDrill: string;
169
+ };
170
+ export declare const CHART_LIFECYCLE_EVENTS: {
171
+ onInitialized: string;
172
+ onRendered: string;
173
+ onRenderFinished: string;
174
+ onAnimationFinished: string;
175
+ onLayoutStart: string;
176
+ onLayoutEnd: string;
177
+ };
148
178
  export declare const CHART_EVENTS: {
149
179
  onPointerDown: string;
150
180
  onPointerUp: string;
@@ -191,6 +221,15 @@ export declare const CHART_EVENTS: {
191
221
  onWeel: string;
192
222
  onClick: string;
193
223
  onDblClick: string;
224
+ onDrill: string;
225
+ onInitialized: string;
226
+ onRendered: string;
227
+ onRenderFinished: string;
228
+ onAnimationFinished: string;
229
+ onLayoutStart: string;
230
+ onLayoutEnd: string;
231
+ onDimensionHover: string;
232
+ onDimensionClick: string;
194
233
  onScrollBarChange: string;
195
234
  onDataZoomChange: string;
196
235
  onPlayerPlay: string;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.bindEventsToChart = exports.findEventProps = exports.VCHART_TO_REACT_EVENTS = exports.COMMON_EVENTK_KEYS = exports.CHART_EVENTS_KEYS = exports.CHART_EVENTS = exports.SCROLLBAR_CUSTOMIZED_EVENTS = exports.PLAYER_CUSTOMIZED_EVENTS = exports.DATAZOOM_CUSTOMIZED_EVENTS = exports.BRUSH_CUSTOMIZED_EVENTS = exports.LEGEND_CUSTOMIZED_EVENTS = exports.REACT_TO_VCHART_EVENTS = void 0,
5
+ }), exports.bindEventsToChart = exports.findEventProps = exports.VCHART_TO_REACT_EVENTS = exports.COMMON_EVENTK_KEYS = exports.CHART_EVENTS_KEYS = exports.CHART_EVENTS = exports.CHART_LIFECYCLE_EVENTS = exports.HIERARCHY_EVENTS = exports.DIMENSION_EVENTS = exports.SCROLLBAR_CUSTOMIZED_EVENTS = exports.PLAYER_CUSTOMIZED_EVENTS = exports.DATAZOOM_CUSTOMIZED_EVENTS = exports.BRUSH_CUSTOMIZED_EVENTS = exports.LEGEND_CUSTOMIZED_EVENTS = exports.REACT_TO_VCHART_EVENTS = void 0,
6
6
  exports.REACT_TO_VCHART_EVENTS = {
7
7
  onPointerDown: "pointerdown",
8
8
  onPointerUp: "pointerup",
@@ -70,7 +70,19 @@ exports.REACT_TO_VCHART_EVENTS = {
70
70
  onPlayerBackward: "playerBackward"
71
71
  }, exports.SCROLLBAR_CUSTOMIZED_EVENTS = {
72
72
  onScrollBarChange: "scrollBarChange"
73
- }, exports.CHART_EVENTS = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, exports.LEGEND_CUSTOMIZED_EVENTS), exports.BRUSH_CUSTOMIZED_EVENTS), exports.PLAYER_CUSTOMIZED_EVENTS), exports.DATAZOOM_CUSTOMIZED_EVENTS), exports.SCROLLBAR_CUSTOMIZED_EVENTS), exports.REACT_TO_VCHART_EVENTS),
73
+ }, exports.DIMENSION_EVENTS = {
74
+ onDimensionHover: "dimensionHover",
75
+ onDimensionClick: "dimensionClick"
76
+ }, exports.HIERARCHY_EVENTS = {
77
+ onDrill: "drill"
78
+ }, exports.CHART_LIFECYCLE_EVENTS = {
79
+ onInitialized: "initialized",
80
+ onRendered: "rendered",
81
+ onRenderFinished: "renderFinished",
82
+ onAnimationFinished: "animationFinished",
83
+ onLayoutStart: "layoutStart",
84
+ onLayoutEnd: "layoutEnd"
85
+ }, exports.CHART_EVENTS = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, exports.LEGEND_CUSTOMIZED_EVENTS), exports.BRUSH_CUSTOMIZED_EVENTS), exports.PLAYER_CUSTOMIZED_EVENTS), exports.DATAZOOM_CUSTOMIZED_EVENTS), exports.SCROLLBAR_CUSTOMIZED_EVENTS), exports.DIMENSION_EVENTS), exports.CHART_LIFECYCLE_EVENTS), exports.HIERARCHY_EVENTS), exports.REACT_TO_VCHART_EVENTS),
74
86
  exports.CHART_EVENTS_KEYS = Object.keys(exports.CHART_EVENTS), exports.COMMON_EVENTK_KEYS = Object.keys(exports.REACT_TO_VCHART_EVENTS),
75
87
  exports.VCHART_TO_REACT_EVENTS = Object.keys(exports.REACT_TO_VCHART_EVENTS).reduce(((res, key) => (res[exports.REACT_TO_VCHART_EVENTS[key]] = key,
76
88
  res)), {});
@@ -1 +1 @@
1
- {"version":3,"sources":["eventsUtils.ts"],"names":[],"mappings":";;;AAiFa,QAAA,sBAAsB,GAAG;IACpC,aAAa,EAAE,aAAa;IAC5B,WAAW,EAAE,WAAW;IACxB,kBAAkB,EAAE,kBAAkB;IACtC,YAAY,EAAE,YAAY;IAC1B,aAAa,EAAE,aAAa;IAC5B,aAAa,EAAE,aAAa;IAC5B,cAAc,EAAE,cAAc;IAC9B,cAAc,EAAE,cAAc;IAC9B,YAAY,EAAE,YAAY;IAC1B,WAAW,EAAE,WAAW;IACxB,SAAS,EAAE,SAAS;IACpB,gBAAgB,EAAE,gBAAgB;IAClC,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,WAAW;IACxB,UAAU,EAAE,UAAU;IACtB,YAAY,EAAE,YAAY;IAC1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AG,SAAS,CAAC,CAAC,CAAC,IAAA,sBAAc,EAAC,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACrF,MAAM,aAAa,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAA,sBAAc,EAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAElF,IAAI,cAAc,EAAE;QAClB,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC7C,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,KAAK,cAAc,CAAC,QAAQ,CAAC,EAAE;gBACtG,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;aACvE;QACH,CAAC,CAAC,CAAC;KACJ;IAED,IAAI,aAAa,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC5C,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,QAAQ,CAAC,EAAE;gBACxG,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC9D;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA9BW,QAAA,iBAAiB,qBA8B5B","file":"eventsUtils.js","sourcesContent":["import type { IVChart, EventCallback, EventParamsDefinition } from '@visactor/vchart';\n\nexport interface LegendEventProps {\n onLegendItemHover?: (e: any) => void;\n onLegendItemUnHover?: (e: any) => void;\n onLegendItemClick?: (e: any) => void;\n onLegendFilter?: (e: any) => void;\n onLegendSelectedDataChange?: (e: any) => void;\n}\n\nexport interface BrushEventProps {\n onBrushStart?: (e: any) => void;\n onBrushChange?: (e: any) => void;\n onBrushEnd?: (e: any) => void;\n}\n\nexport interface DataZoomEventProps {\n onDataZoomChange?: (e: any) => void;\n}\n\nexport interface PlayerEventProps {\n onPlayerPlay?: (e: any) => void;\n onPlayerPause?: (e: any) => void;\n onPlayerEnd?: (e: any) => void;\n onPlayerChange?: (e: any) => void;\n onPlayerForward?: (e: any) => void;\n onPlayerBackward?: (e: any) => void;\n}\n\nexport interface ScrollBarEventProps {\n onScrollBarChange?: (e: any) => void;\n}\n\nexport interface EventsProps {\n onPointerDown?: EventCallback<EventParamsDefinition['pointerdown']>;\n onPointerUp?: EventCallback<EventParamsDefinition['pointerup']>;\n onPointerUpOutside?: EventCallback<EventParamsDefinition['pointerupoutside']>;\n onPointerTap?: EventCallback<EventParamsDefinition['pointertap']>;\n onPointerOver?: EventCallback<EventParamsDefinition['pointerover']>;\n onPointerMove?: EventCallback<EventParamsDefinition['pointermove']>;\n onPointerEnter?: EventCallback<EventParamsDefinition['pointerenter']>;\n onPointerLeave?: EventCallback<EventParamsDefinition['pointerleave']>;\n onPointerOut?: EventCallback<EventParamsDefinition['pointerout']>;\n onMouseDown?: EventCallback<EventParamsDefinition['mousedown']>;\n onMouseUp?: EventCallback<EventParamsDefinition['mouseup']>;\n onMouseUpOutside?: EventCallback<EventParamsDefinition['mouseupoutside']>;\n onMouseMove?: EventCallback<EventParamsDefinition['mousemove']>;\n onMouseOver?: EventCallback<EventParamsDefinition['mouseover']>;\n onMouseOut?: EventCallback<EventParamsDefinition['mouseout']>;\n onMouseEnter?: EventCallback<EventParamsDefinition['mouseenter']>;\n onMouseLeave?: EventCallback<EventParamsDefinition['mouseleave']>;\n onPinch?: EventCallback<EventParamsDefinition['pinch']>;\n onPinchStart?: EventCallback<EventParamsDefinition['pinchstart']>;\n onPinchEnd?: EventCallback<EventParamsDefinition['pinchend']>;\n onPan?: EventCallback<EventParamsDefinition['pan']>;\n onPanStart?: EventCallback<EventParamsDefinition['panstart']>;\n onPanEnd?: EventCallback<EventParamsDefinition['panend']>;\n onDrag?: EventCallback<EventParamsDefinition['drag']>;\n onDragStart?: EventCallback<EventParamsDefinition['dragstart']>;\n onDragEnter?: EventCallback<EventParamsDefinition['dragenter']>;\n onDragLeave?: EventCallback<EventParamsDefinition['dragleave']>;\n onDragOver?: EventCallback<EventParamsDefinition['dragover']>;\n onDragEnd?: EventCallback<EventParamsDefinition['dragend']>;\n onRightDown?: EventCallback<EventParamsDefinition['rightdown']>;\n onRightUp?: EventCallback<EventParamsDefinition['rightup']>;\n onRightUpOutside?: EventCallback<EventParamsDefinition['rightupoutside']>;\n onTouchStart?: EventCallback<EventParamsDefinition['touchstart']>;\n onTouchEnd?: EventCallback<EventParamsDefinition['touchend']>;\n onTouchEndOutside?: EventCallback<EventParamsDefinition['touchendoutside']>;\n onTouchMove?: EventCallback<EventParamsDefinition['touchmove']>;\n onTouchCancel?: EventCallback<EventParamsDefinition['touchcancel']>;\n onPress?: EventCallback<EventParamsDefinition['press']>;\n onPressUp?: EventCallback<EventParamsDefinition['pressup']>;\n onPressEnd?: EventCallback<EventParamsDefinition['pressend']>;\n onSwipe?: EventCallback<EventParamsDefinition['swipe']>;\n onDrop?: EventCallback<EventParamsDefinition['drop']>;\n onWeel?: EventCallback<EventParamsDefinition['weel']>;\n onClick?: EventCallback<EventParamsDefinition['click']>;\n onDblClick?: EventCallback<EventParamsDefinition['dblclick']>;\n}\n\nexport const REACT_TO_VCHART_EVENTS = {\n onPointerDown: 'pointerdown',\n onPointerUp: 'pointerup',\n onPointerUpOutside: 'pointerupoutside',\n onPointerTap: 'pointertap',\n onPointerOver: 'pointerover',\n onPointerMove: 'pointermove',\n onPointerEnter: 'pointerenter',\n onPointerLeave: 'pointerleave',\n onPointerOut: 'pointerout',\n onMouseDown: 'mousedown',\n onMouseUp: 'mouseup',\n onMouseUpOutside: 'mouseupoutside',\n onMouseMove: 'mousemove',\n onMouseOver: 'mouseover',\n onMouseOut: 'mouseout',\n onMouseEnter: 'mouseenter',\n onMouseLeave: 'mouseleave',\n onPinch: 'pinch',\n onPinchStart: 'pinchstart',\n onPinchEnd: 'pinchend',\n onPan: 'pan',\n onPanStart: 'panstart',\n onPanEnd: 'panend',\n onDrag: 'drag',\n onDragStart: 'dragstart',\n onDragEnter: 'dragenter',\n onDragLeave: 'dragleave',\n onDragOver: 'dragover',\n onDragEnd: 'dragend',\n onRightDown: 'rightdown',\n onRightUp: 'rightup',\n onRightUpOutside: 'rightupoutside',\n onTouchStart: 'touchstart',\n onTouchEnd: 'touchend',\n onTouchEndOutside: 'touchendoutside',\n onTouchMove: 'touchmove',\n onTouchCancel: 'touchcancel',\n onPress: 'press',\n onPressUp: 'pressup',\n onPressEnd: 'pressend',\n onSwipe: 'swipe',\n onDrop: 'drop',\n onWeel: 'wheel',\n onClick: 'click',\n onDblClick: 'dblclick'\n};\n\nexport const LEGEND_CUSTOMIZED_EVENTS = {\n onLegendItemHover: 'legendItemHover',\n onLegendItemUnHover: 'legendItemUnHover',\n onLegendItemClick: 'legendItemClick',\n onLegendFilter: 'legendFilter',\n onLegendSelectedDataChange: 'legendSelectedDataChange'\n};\nexport const BRUSH_CUSTOMIZED_EVENTS = {\n onBrushStart: 'brushStart',\n onBrushChange: 'brushChange',\n onBrushEnd: 'brushEnd'\n};\n\nexport const DATAZOOM_CUSTOMIZED_EVENTS = {\n onDataZoomChange: 'dataZoomChange'\n};\n\nexport const PLAYER_CUSTOMIZED_EVENTS = {\n onPlayerPlay: 'playerPlay',\n onPlayerPause: 'playerPause',\n onPlayerEnd: 'playerEnd',\n onPlayerChange: 'playerChange',\n onPlayerForward: 'playerForward',\n onPlayerBackward: 'playerBackward'\n};\n\nexport const SCROLLBAR_CUSTOMIZED_EVENTS = {\n onScrollBarChange: 'scrollBarChange'\n};\n\nexport const CHART_EVENTS = {\n ...LEGEND_CUSTOMIZED_EVENTS,\n ...BRUSH_CUSTOMIZED_EVENTS,\n ...PLAYER_CUSTOMIZED_EVENTS,\n ...DATAZOOM_CUSTOMIZED_EVENTS,\n ...SCROLLBAR_CUSTOMIZED_EVENTS,\n ...REACT_TO_VCHART_EVENTS\n};\n\nexport const CHART_EVENTS_KEYS = Object.keys(CHART_EVENTS);\n\nexport const COMMON_EVENTK_KEYS = Object.keys(REACT_TO_VCHART_EVENTS);\n\nexport const VCHART_TO_REACT_EVENTS = Object.keys(REACT_TO_VCHART_EVENTS).reduce((res, key) => {\n res[REACT_TO_VCHART_EVENTS[key]] = key;\n\n return res;\n}, {});\n\nexport const findEventProps = <T extends EventsProps>(\n props: T,\n supportedEvents: Record<string, string> = REACT_TO_VCHART_EVENTS\n): EventsProps => {\n const result: EventsProps = {};\n\n Object.keys(props).forEach(key => {\n if (supportedEvents[key]) {\n result[key] = props[key];\n }\n });\n\n return result;\n};\n\nexport const bindEventsToChart = <T>(\n chart: IVChart,\n newProps?: T | null,\n prevProps?: T | null,\n supportedEvents: Record<string, string> = REACT_TO_VCHART_EVENTS\n) => {\n if ((!newProps && !prevProps) || !chart) {\n return false;\n }\n\n const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;\n const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;\n\n if (prevEventProps) {\n Object.keys(prevEventProps).forEach(eventKey => {\n if (!newEventProps || !newEventProps[eventKey] || newEventProps[eventKey] !== prevEventProps[eventKey]) {\n const res = chart.off(supportedEvents[eventKey], prevProps[eventKey]);\n }\n });\n }\n\n if (newEventProps) {\n Object.keys(newEventProps).forEach(eventKey => {\n if (!prevEventProps || !prevEventProps[eventKey] || prevEventProps[eventKey] !== newEventProps[eventKey]) {\n chart.on(supportedEvents[eventKey], newEventProps[eventKey]);\n }\n });\n }\n\n return true;\n};\n"]}
1
+ {"version":3,"sources":["eventsUtils.ts"],"names":[],"mappings":";;;AAmGa,QAAA,sBAAsB,GAAG;IACpC,aAAa,EAAE,aAAa;IAC5B,W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E;gBACtG,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;aACvE;QACH,CAAC,CAAC,CAAC;KACJ;IAED,IAAI,aAAa,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC5C,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,QAAQ,CAAC,EAAE;gBACxG,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC9D;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA9BW,QAAA,iBAAiB,qBA8B5B","file":"eventsUtils.js","sourcesContent":["import type { IVChart, EventCallback, EventParamsDefinition } from '@visactor/vchart';\n\nexport interface LegendEventProps {\n onLegendItemHover?: (e: any) => void;\n onLegendItemUnHover?: (e: any) => void;\n onLegendItemClick?: (e: any) => void;\n onLegendFilter?: (e: any) => void;\n onLegendSelectedDataChange?: (e: any) => void;\n}\n\nexport interface BrushEventProps {\n onBrushStart?: (e: any) => void;\n onBrushChange?: (e: any) => void;\n onBrushEnd?: (e: any) => void;\n}\n\nexport interface DataZoomEventProps {\n onDataZoomChange?: (e: any) => void;\n}\n\nexport interface PlayerEventProps {\n onPlayerPlay?: (e: any) => void;\n onPlayerPause?: (e: any) => void;\n onPlayerEnd?: (e: any) => void;\n onPlayerChange?: (e: any) => void;\n onPlayerForward?: (e: any) => void;\n onPlayerBackward?: (e: any) => void;\n}\n\nexport interface ScrollBarEventProps {\n onScrollBarChange?: (e: any) => void;\n}\n\nexport interface DimensionEventProps {\n onDimensionHover?: (e: any) => void;\n onDimensionClick?: (e: any) => void;\n}\n\nexport interface HierarchyEventProps {\n onDrill?: (e: any) => void;\n}\n\nexport interface ChartLifeCycleEventProps {\n onInitialized?: (e: any) => void;\n onRendered?: (e: any) => void;\n onRenderFinished?: (e: any) => void;\n onAnimationFinished?: (e: any) => void;\n onLayoutStart?: (e: any) => void;\n onLayoutEnd?: (e: any) => void;\n}\n\nexport interface EventsProps {\n onPointerDown?: EventCallback<EventParamsDefinition['pointerdown']>;\n onPointerUp?: EventCallback<EventParamsDefinition['pointerup']>;\n onPointerUpOutside?: EventCallback<EventParamsDefinition['pointerupoutside']>;\n onPointerTap?: EventCallback<EventParamsDefinition['pointertap']>;\n onPointerOver?: EventCallback<EventParamsDefinition['pointerover']>;\n onPointerMove?: EventCallback<EventParamsDefinition['pointermove']>;\n onPointerEnter?: EventCallback<EventParamsDefinition['pointerenter']>;\n onPointerLeave?: EventCallback<EventParamsDefinition['pointerleave']>;\n onPointerOut?: EventCallback<EventParamsDefinition['pointerout']>;\n onMouseDown?: EventCallback<EventParamsDefinition['mousedown']>;\n onMouseUp?: EventCallback<EventParamsDefinition['mouseup']>;\n onMouseUpOutside?: EventCallback<EventParamsDefinition['mouseupoutside']>;\n onMouseMove?: EventCallback<EventParamsDefinition['mousemove']>;\n onMouseOver?: EventCallback<EventParamsDefinition['mouseover']>;\n onMouseOut?: EventCallback<EventParamsDefinition['mouseout']>;\n onMouseEnter?: EventCallback<EventParamsDefinition['mouseenter']>;\n onMouseLeave?: EventCallback<EventParamsDefinition['mouseleave']>;\n onPinch?: EventCallback<EventParamsDefinition['pinch']>;\n onPinchStart?: EventCallback<EventParamsDefinition['pinchstart']>;\n onPinchEnd?: EventCallback<EventParamsDefinition['pinchend']>;\n onPan?: EventCallback<EventParamsDefinition['pan']>;\n onPanStart?: EventCallback<EventParamsDefinition['panstart']>;\n onPanEnd?: EventCallback<EventParamsDefinition['panend']>;\n onDrag?: EventCallback<EventParamsDefinition['drag']>;\n onDragStart?: EventCallback<EventParamsDefinition['dragstart']>;\n onDragEnter?: EventCallback<EventParamsDefinition['dragenter']>;\n onDragLeave?: EventCallback<EventParamsDefinition['dragleave']>;\n onDragOver?: EventCallback<EventParamsDefinition['dragover']>;\n onDragEnd?: EventCallback<EventParamsDefinition['dragend']>;\n onRightDown?: EventCallback<EventParamsDefinition['rightdown']>;\n onRightUp?: EventCallback<EventParamsDefinition['rightup']>;\n onRightUpOutside?: EventCallback<EventParamsDefinition['rightupoutside']>;\n onTouchStart?: EventCallback<EventParamsDefinition['touchstart']>;\n onTouchEnd?: EventCallback<EventParamsDefinition['touchend']>;\n onTouchEndOutside?: EventCallback<EventParamsDefinition['touchendoutside']>;\n onTouchMove?: EventCallback<EventParamsDefinition['touchmove']>;\n onTouchCancel?: EventCallback<EventParamsDefinition['touchcancel']>;\n onPress?: EventCallback<EventParamsDefinition['press']>;\n onPressUp?: EventCallback<EventParamsDefinition['pressup']>;\n onPressEnd?: EventCallback<EventParamsDefinition['pressend']>;\n onSwipe?: EventCallback<EventParamsDefinition['swipe']>;\n onDrop?: EventCallback<EventParamsDefinition['drop']>;\n onWeel?: EventCallback<EventParamsDefinition['weel']>;\n onClick?: EventCallback<EventParamsDefinition['click']>;\n onDblClick?: EventCallback<EventParamsDefinition['dblclick']>;\n}\n\nexport const REACT_TO_VCHART_EVENTS = {\n onPointerDown: 'pointerdown',\n onPointerUp: 'pointerup',\n onPointerUpOutside: 'pointerupoutside',\n onPointerTap: 'pointertap',\n onPointerOver: 'pointerover',\n onPointerMove: 'pointermove',\n onPointerEnter: 'pointerenter',\n onPointerLeave: 'pointerleave',\n onPointerOut: 'pointerout',\n onMouseDown: 'mousedown',\n onMouseUp: 'mouseup',\n onMouseUpOutside: 'mouseupoutside',\n onMouseMove: 'mousemove',\n onMouseOver: 'mouseover',\n onMouseOut: 'mouseout',\n onMouseEnter: 'mouseenter',\n onMouseLeave: 'mouseleave',\n onPinch: 'pinch',\n onPinchStart: 'pinchstart',\n onPinchEnd: 'pinchend',\n onPan: 'pan',\n onPanStart: 'panstart',\n onPanEnd: 'panend',\n onDrag: 'drag',\n onDragStart: 'dragstart',\n onDragEnter: 'dragenter',\n onDragLeave: 'dragleave',\n onDragOver: 'dragover',\n onDragEnd: 'dragend',\n onRightDown: 'rightdown',\n onRightUp: 'rightup',\n onRightUpOutside: 'rightupoutside',\n onTouchStart: 'touchstart',\n onTouchEnd: 'touchend',\n onTouchEndOutside: 'touchendoutside',\n onTouchMove: 'touchmove',\n onTouchCancel: 'touchcancel',\n onPress: 'press',\n onPressUp: 'pressup',\n onPressEnd: 'pressend',\n onSwipe: 'swipe',\n onDrop: 'drop',\n onWeel: 'wheel',\n onClick: 'click',\n onDblClick: 'dblclick'\n};\n\nexport const LEGEND_CUSTOMIZED_EVENTS = {\n onLegendItemHover: 'legendItemHover',\n onLegendItemUnHover: 'legendItemUnHover',\n onLegendItemClick: 'legendItemClick',\n onLegendFilter: 'legendFilter',\n onLegendSelectedDataChange: 'legendSelectedDataChange'\n};\nexport const BRUSH_CUSTOMIZED_EVENTS = {\n onBrushStart: 'brushStart',\n onBrushChange: 'brushChange',\n onBrushEnd: 'brushEnd'\n};\n\nexport const DATAZOOM_CUSTOMIZED_EVENTS = {\n onDataZoomChange: 'dataZoomChange'\n};\n\nexport const PLAYER_CUSTOMIZED_EVENTS = {\n onPlayerPlay: 'playerPlay',\n onPlayerPause: 'playerPause',\n onPlayerEnd: 'playerEnd',\n onPlayerChange: 'playerChange',\n onPlayerForward: 'playerForward',\n onPlayerBackward: 'playerBackward'\n};\n\nexport const SCROLLBAR_CUSTOMIZED_EVENTS = {\n onScrollBarChange: 'scrollBarChange'\n};\n\nexport const DIMENSION_EVENTS = {\n onDimensionHover: 'dimensionHover',\n onDimensionClick: 'dimensionClick'\n};\n\nexport const HIERARCHY_EVENTS = {\n onDrill: 'drill'\n};\n\nexport const CHART_LIFECYCLE_EVENTS = {\n onInitialized: 'initialized',\n onRendered: 'rendered',\n onRenderFinished: 'renderFinished',\n onAnimationFinished: 'animationFinished',\n onLayoutStart: 'layoutStart',\n onLayoutEnd: 'layoutEnd'\n};\n\nexport const CHART_EVENTS = {\n ...LEGEND_CUSTOMIZED_EVENTS,\n ...BRUSH_CUSTOMIZED_EVENTS,\n ...PLAYER_CUSTOMIZED_EVENTS,\n ...DATAZOOM_CUSTOMIZED_EVENTS,\n ...SCROLLBAR_CUSTOMIZED_EVENTS,\n ...DIMENSION_EVENTS,\n ...CHART_LIFECYCLE_EVENTS,\n ...HIERARCHY_EVENTS,\n ...REACT_TO_VCHART_EVENTS\n};\n\nexport const CHART_EVENTS_KEYS = Object.keys(CHART_EVENTS);\n\nexport const COMMON_EVENTK_KEYS = Object.keys(REACT_TO_VCHART_EVENTS);\n\nexport const VCHART_TO_REACT_EVENTS = Object.keys(REACT_TO_VCHART_EVENTS).reduce((res, key) => {\n res[REACT_TO_VCHART_EVENTS[key]] = key;\n\n return res;\n}, {});\n\nexport const findEventProps = <T extends EventsProps>(\n props: T,\n supportedEvents: Record<string, string> = REACT_TO_VCHART_EVENTS\n): EventsProps => {\n const result: EventsProps = {};\n\n Object.keys(props).forEach(key => {\n if (supportedEvents[key]) {\n result[key] = props[key];\n }\n });\n\n return result;\n};\n\nexport const bindEventsToChart = <T>(\n chart: IVChart,\n newProps?: T | null,\n prevProps?: T | null,\n supportedEvents: Record<string, string> = REACT_TO_VCHART_EVENTS\n) => {\n if ((!newProps && !prevProps) || !chart) {\n return false;\n }\n\n const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;\n const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;\n\n if (prevEventProps) {\n Object.keys(prevEventProps).forEach(eventKey => {\n if (!newEventProps || !newEventProps[eventKey] || newEventProps[eventKey] !== prevEventProps[eventKey]) {\n const res = chart.off(supportedEvents[eventKey], prevProps[eventKey]);\n }\n });\n }\n\n if (newEventProps) {\n Object.keys(newEventProps).forEach(eventKey => {\n if (!prevEventProps || !prevEventProps[eventKey] || prevEventProps[eventKey] !== newEventProps[eventKey]) {\n chart.on(supportedEvents[eventKey], newEventProps[eventKey]);\n }\n });\n }\n\n return true;\n};\n"]}
@@ -6,5 +6,4 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  const BaseSeries_1 = require("./BaseSeries");
8
8
 
9
- exports.Link = (0, BaseSeries_1.createSeries)("Link", [ "link" ], "link");
10
- //# sourceMappingURL=Link.js.map
9
+ exports.Link = (0, BaseSeries_1.createSeries)("Link", [ "link" ], "link");
package/cjs/series/Pie.js CHANGED
@@ -6,4 +6,5 @@ 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");
9
+ exports.Pie = (0, BaseSeries_1.createSeries)("Pie", [ "pie" ], "pie");
10
+ //# sourceMappingURL=Pie.js.map
@@ -7,4 +7,4 @@ Object.defineProperty(exports, "__esModule", {
7
7
  const BaseSeries_1 = require("./BaseSeries");
8
8
 
9
9
  exports.WordCloud = (0, BaseSeries_1.createSeries)("WordCloud", [ "wordCloud" ], "wordCloud");
10
- //# sourceMappingURL=WordCloud.js.map
10
+ //# sourceMappingURL=WordCloud.js.map
@@ -1,9 +1,9 @@
1
1
  import VChart, { IData, IInitOption, ISpec } from '@visactor/vchart';
2
2
  import React from 'react';
3
3
  import { ContainerProps } from '../containers/withContainer';
4
- import { EventsProps, LegendEventProps, ScrollBarEventProps, BrushEventProps, DataZoomEventProps, PlayerEventProps } from '../eventsUtils';
4
+ import { EventsProps, LegendEventProps, ScrollBarEventProps, BrushEventProps, DataZoomEventProps, PlayerEventProps, DimensionEventProps, HierarchyEventProps, ChartLifeCycleEventProps } from '../eventsUtils';
5
5
  export type ChartOptions = Omit<IInitOption, 'dom'>;
6
- export interface BaseChartProps extends EventsProps, LegendEventProps, ScrollBarEventProps, BrushEventProps, DataZoomEventProps, PlayerEventProps {
6
+ export interface BaseChartProps extends EventsProps, LegendEventProps, ScrollBarEventProps, BrushEventProps, DataZoomEventProps, PlayerEventProps, DimensionEventProps, HierarchyEventProps, ChartLifeCycleEventProps {
7
7
  type?: string;
8
8
  container?: HTMLDivElement;
9
9
  spec?: ISpec;
@@ -1 +1 @@
1
- {"version":3,"sources":["charts/BaseChart.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAqC,MAAM,kBAAkB,CAAC;AACrE,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,EACL,iBAAiB,EAEjB,iBAAiB,EACjB,YAAY,EAMb,MAAM,gBAAgB,CAAC;AAmCxB,MAAM,WAAW,GAAG;IAClB,GAAG,mBAAmB;IACtB,GAAG,iBAAiB;IACpB,SAAS;IACT,SAAS;IACT,MAAM;IACN,WAAW;IACX,SAAS;CACV,CAAC;AAEF,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;IACH,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;IAC7B,MAAM,C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oBAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,IAC9B,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;;YAC5C,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,MAAA,MAAA,MAAC,KAAa,aAAb,KAAK,uBAAL,KAAK,CAAU,KAAK,0CAAE,EAAE,mCAAK,KAAa,aAAb,KAAK,uBAAL,KAAK,CAAU,EAAE,mCAAI,SAAS,KAAK,EAAE,IACrF,KAAK,CAAC,YAAY,CAAC,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,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, ISpec } 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-core';\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?: ISpec;\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?: (err: Error) => 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 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 eventsBinded.current = props;\n // eslint-disable-next-line promise/catch-or-return\n const updatePromise = chartContext.current.chart\n .updateSpec(parseSpec(props), undefined, { morph: false, enableExitAnimation: 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, enableExitAnimation: 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
+ {"version":3,"sources":["charts/BaseChart.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAqC,MAAM,kBAAkB,CAAC;AACrE,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,EACL,iBAAiB,EAEjB,iBAAiB,EACjB,YAAY,EASb,MAAM,gBAAgB,CAAC;AAsCxB,MAAM,WAAW,GAAG;IAClB,GAAG,mBAAmB;IACtB,GAAG,iBAAiB;IACpB,SAAS;IACT,SAAS;IACT,MAAM;IACN,WAAW;IACX,SAAS;CACV,CAAC;AAEF,MAAM,SAAS,GAAoB,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACjE,MAAM,C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f,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, ISpec } 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-core';\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 DimensionEventProps,\n HierarchyEventProps,\n ChartLifeCycleEventProps\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 DimensionEventProps,\n HierarchyEventProps,\n ChartLifeCycleEventProps {\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /**\n * used only by <VChart />\n */\n spec?: ISpec;\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?: (err: Error) => 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 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 eventsBinded.current = props;\n // eslint-disable-next-line promise/catch-or-return\n const updatePromise = chartContext.current.chart\n .updateSpec(parseSpec(props), undefined, { morph: false, enableExitAnimation: 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, enableExitAnimation: 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"]}
@@ -0,0 +1,4 @@
1
+ import { BaseComponentProps } from './BaseComponent';
2
+ import type { IIndicatorSpec } from '@visactor/vchart';
3
+ export type IndicatorProps = IIndicatorSpec & BaseComponentProps;
4
+ export declare const Indicator: import("react").FC<IndicatorProps>;
@@ -0,0 +1,4 @@
1
+ import { createComponent } from "./BaseComponent";
2
+
3
+ export const Indicator = createComponent("Indicator", "indicator", null, !0);
4
+ //# sourceMappingURL=Indicator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Indicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAKtE,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAiB,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC","file":"Indicator.js","sourcesContent":["import { BaseComponentProps, createComponent } from './BaseComponent';\nimport type { IIndicatorSpec } from '@visactor/vchart';\n\nexport type IndicatorProps = IIndicatorSpec & BaseComponentProps;\n\nexport const Indicator = createComponent<IndicatorProps>('Indicator', 'indicator', null, true);\n"]}
@@ -2,5 +2,4 @@ import { SCROLLBAR_CUSTOMIZED_EVENTS } from "../eventsUtils";
2
2
 
3
3
  import { createComponent } from "./BaseComponent";
4
4
 
5
- export const ScrollBar = createComponent("ScrollBar", "scrollBar", SCROLLBAR_CUSTOMIZED_EVENTS);
6
- //# sourceMappingURL=Scrollbar.js.map
5
+ export const ScrollBar = createComponent("ScrollBar", "scrollBar", SCROLLBAR_CUSTOMIZED_EVENTS);
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Scrollbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAuB,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAsB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAKtE,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAiB,WAAW,EAAE,WAAW,EAAE,2BAA2B,CAAC,CAAC","file":"Scrollbar.js","sourcesContent":["import { SCROLLBAR_CUSTOMIZED_EVENTS, ScrollBarEventProps } from '../eventsUtils';\nimport { BaseComponentProps, createComponent } from './BaseComponent';\nimport type { IScrollBarSpec } from '@visactor/vchart';\n\nexport type ScrollBarProps = IScrollBarSpec & BaseComponentProps & ScrollBarEventProps;\n\nexport const ScrollBar = createComponent<ScrollBarProps>('ScrollBar', 'scrollBar', SCROLLBAR_CUSTOMIZED_EVENTS);\n"]}
1
+ {"version":3,"sources":["components/ScrollBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAuB,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAsB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAKtE,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAiB,WAAW,EAAE,WAAW,EAAE,2BAA2B,CAAC,CAAC","file":"ScrollBar.js","sourcesContent":["import { SCROLLBAR_CUSTOMIZED_EVENTS, ScrollBarEventProps } from '../eventsUtils';\nimport { BaseComponentProps, createComponent } from './BaseComponent';\nimport type { IScrollBarSpec } from '@visactor/vchart';\n\nexport type ScrollBarProps = IScrollBarSpec & BaseComponentProps & ScrollBarEventProps;\n\nexport const ScrollBar = createComponent<ScrollBarProps>('ScrollBar', 'scrollBar', SCROLLBAR_CUSTOMIZED_EVENTS);\n"]}
@@ -0,0 +1,4 @@
1
+ import { BaseComponentProps } from './BaseComponent';
2
+ import type { ITitleSpec } from '@visactor/vchart';
3
+ export type TitleProps = ITitleSpec & BaseComponentProps;
4
+ export declare const Title: import("react").FC<TitleProps>;
@@ -0,0 +1,4 @@
1
+ import { createComponent } from "./BaseComponent";
2
+
3
+ export const Title = createComponent("Title", "title", null, !0);
4
+ //# sourceMappingURL=Title.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Title.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAKtE,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAa,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC","file":"Title.js","sourcesContent":["import { BaseComponentProps, createComponent } from './BaseComponent';\nimport type { ITitleSpec } from '@visactor/vchart';\n\nexport type TitleProps = ITitleSpec & BaseComponentProps;\n\nexport const Title = createComponent<TitleProps>('Title', 'title', null, true);\n"]}
@@ -1,3 +1,4 @@
1
1
  import { createComponent } from "./BaseComponent";
2
2
 
3
- export const Tooltip = createComponent("Tooltip", "tooltip", null, !0);
3
+ export const Tooltip = createComponent("Tooltip", "tooltip", null, !0);
4
+ //# sourceMappingURL=Tooltip.js.map
@@ -8,6 +8,8 @@ export * from './DataZoom';
8
8
  export * from './MarkLine';
9
9
  export * from './MarkArea';
10
10
  export * from './MarkPoint';
11
- export * from './Scrollbar';
11
+ export * from './ScrollBar';
12
12
  export * from './Tooltip';
13
13
  export * from './Player';
14
+ export * from './Indicator';
15
+ export * from './Title';
@@ -18,9 +18,13 @@ export * from "./MarkArea";
18
18
 
19
19
  export * from "./MarkPoint";
20
20
 
21
- export * from "./Scrollbar";
21
+ export * from "./ScrollBar";
22
22
 
23
23
  export * from "./Tooltip";
24
24
 
25
25
  export * from "./Player";
26
+
27
+ export * from "./Indicator";
28
+
29
+ export * from "./Title";
26
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC","file":"index.js","sourcesContent":["export * from './Axis';\nexport * from './Mark';\nexport * from './Region';\nexport * from './Legend';\nexport * from './Brush';\nexport * from './Crosshair';\nexport * from './DataZoom';\nexport * from './MarkLine';\nexport * from './MarkArea';\nexport * from './MarkPoint';\nexport * from './Scrollbar';\nexport * from './Tooltip';\nexport * from './Player';\n"]}
1
+ {"version":3,"sources":["components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC","file":"index.js","sourcesContent":["export * from './Axis';\nexport * from './Mark';\nexport * from './Region';\nexport * from './Legend';\nexport * from './Brush';\nexport * from './Crosshair';\nexport * from './DataZoom';\nexport * from './MarkLine';\nexport * from './MarkArea';\nexport * from './MarkPoint';\nexport * from './ScrollBar';\nexport * from './Tooltip';\nexport * from './Player';\nexport * from './Indicator';\nexport * from './Title';\n"]}
package/esm/constants.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const REACT_PRIVATE_PROPS = [ "children", "hooks", "ref" ];
2
- //# sourceMappingURL=constants.js.map
2
+ //# sourceMappingURL=constants.js.map
@@ -25,6 +25,21 @@ export interface PlayerEventProps {
25
25
  export interface ScrollBarEventProps {
26
26
  onScrollBarChange?: (e: any) => void;
27
27
  }
28
+ export interface DimensionEventProps {
29
+ onDimensionHover?: (e: any) => void;
30
+ onDimensionClick?: (e: any) => void;
31
+ }
32
+ export interface HierarchyEventProps {
33
+ onDrill?: (e: any) => void;
34
+ }
35
+ export interface ChartLifeCycleEventProps {
36
+ onInitialized?: (e: any) => void;
37
+ onRendered?: (e: any) => void;
38
+ onRenderFinished?: (e: any) => void;
39
+ onAnimationFinished?: (e: any) => void;
40
+ onLayoutStart?: (e: any) => void;
41
+ onLayoutEnd?: (e: any) => void;
42
+ }
28
43
  export interface EventsProps {
29
44
  onPointerDown?: EventCallback<EventParamsDefinition['pointerdown']>;
30
45
  onPointerUp?: EventCallback<EventParamsDefinition['pointerup']>;
@@ -145,6 +160,21 @@ export declare const PLAYER_CUSTOMIZED_EVENTS: {
145
160
  export declare const SCROLLBAR_CUSTOMIZED_EVENTS: {
146
161
  onScrollBarChange: string;
147
162
  };
163
+ export declare const DIMENSION_EVENTS: {
164
+ onDimensionHover: string;
165
+ onDimensionClick: string;
166
+ };
167
+ export declare const HIERARCHY_EVENTS: {
168
+ onDrill: string;
169
+ };
170
+ export declare const CHART_LIFECYCLE_EVENTS: {
171
+ onInitialized: string;
172
+ onRendered: string;
173
+ onRenderFinished: string;
174
+ onAnimationFinished: string;
175
+ onLayoutStart: string;
176
+ onLayoutEnd: string;
177
+ };
148
178
  export declare const CHART_EVENTS: {
149
179
  onPointerDown: string;
150
180
  onPointerUp: string;
@@ -191,6 +221,15 @@ export declare const CHART_EVENTS: {
191
221
  onWeel: string;
192
222
  onClick: string;
193
223
  onDblClick: string;
224
+ onDrill: string;
225
+ onInitialized: string;
226
+ onRendered: string;
227
+ onRenderFinished: string;
228
+ onAnimationFinished: string;
229
+ onLayoutStart: string;
230
+ onLayoutEnd: string;
231
+ onDimensionHover: string;
232
+ onDimensionClick: string;
194
233
  onScrollBarChange: string;
195
234
  onDataZoomChange: string;
196
235
  onPlayerPlay: string;
@@ -77,7 +77,25 @@ export const SCROLLBAR_CUSTOMIZED_EVENTS = {
77
77
  onScrollBarChange: "scrollBarChange"
78
78
  };
79
79
 
80
- export const CHART_EVENTS = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, LEGEND_CUSTOMIZED_EVENTS), BRUSH_CUSTOMIZED_EVENTS), PLAYER_CUSTOMIZED_EVENTS), DATAZOOM_CUSTOMIZED_EVENTS), SCROLLBAR_CUSTOMIZED_EVENTS), REACT_TO_VCHART_EVENTS);
80
+ export const DIMENSION_EVENTS = {
81
+ onDimensionHover: "dimensionHover",
82
+ onDimensionClick: "dimensionClick"
83
+ };
84
+
85
+ export const HIERARCHY_EVENTS = {
86
+ onDrill: "drill"
87
+ };
88
+
89
+ export const CHART_LIFECYCLE_EVENTS = {
90
+ onInitialized: "initialized",
91
+ onRendered: "rendered",
92
+ onRenderFinished: "renderFinished",
93
+ onAnimationFinished: "animationFinished",
94
+ onLayoutStart: "layoutStart",
95
+ onLayoutEnd: "layoutEnd"
96
+ };
97
+
98
+ export const CHART_EVENTS = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, LEGEND_CUSTOMIZED_EVENTS), BRUSH_CUSTOMIZED_EVENTS), PLAYER_CUSTOMIZED_EVENTS), DATAZOOM_CUSTOMIZED_EVENTS), SCROLLBAR_CUSTOMIZED_EVENTS), DIMENSION_EVENTS), CHART_LIFECYCLE_EVENTS), HIERARCHY_EVENTS), REACT_TO_VCHART_EVENTS);
81
99
 
82
100
  export const CHART_EVENTS_KEYS = Object.keys(CHART_EVENTS);
83
101
 
@@ -1 +1 @@
1
- {"version":3,"sources":["eventsUtils.ts"],"names":[],"mappings":"AAiFA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,aAAa,EAAE,aAAa;IAC5B,WAAW,EAAE,WAAW;IACxB,kBAAkB,EAAE,kBAAkB;IACtC,YAAY,EAAE,YAAY;IAC1B,aAAa,EAAE,aAAa;IAC5B,aAAa,EAAE,aAAa;IAC5B,cAAc,EAAE,cAAc;IAC9B,cAAc,EAAE,cAAc;IAC9B,YAAY,EAAE,YAAY;IAC1B,WAAW,EAAE,WAAW;IACxB,SAAS,EAAE,SAAS;IACpB,gBAAgB,EAAE,gBAAgB;IAClC,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,WAAW;IACxB,UAAU,EAAE,UAAU;IACtB,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,OAAO,EAAE,OAAO;IAChB,YAAY,EAAE,YAAY;IAC1B,UAAU,EAAE,UAAU;IACtB,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE,UAAU;IACtB,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,WAAW;IACxB,UAAU,EAAE,UAAU;IACtB,SAAS,EAA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,CAAC,IAAI,CAAC;IAElF,IAAI,cAAc,EAAE;QAClB,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC7C,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,KAAK,cAAc,CAAC,QAAQ,CAAC,EAAE;gBACtG,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;aACvE;QACH,CAAC,CAAC,CAAC;KACJ;IAED,IAAI,aAAa,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC5C,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,QAAQ,CAAC,EAAE;gBACxG,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC9D;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","file":"eventsUtils.js","sourcesContent":["import type { IVChart, EventCallback, EventParamsDefinition } from '@visactor/vchart';\n\nexport interface LegendEventProps {\n onLegendItemHover?: (e: any) => void;\n onLegendItemUnHover?: (e: any) => void;\n onLegendItemClick?: (e: any) => void;\n onLegendFilter?: (e: any) => void;\n onLegendSelectedDataChange?: (e: any) => void;\n}\n\nexport interface BrushEventProps {\n onBrushStart?: (e: any) => void;\n onBrushChange?: (e: any) => void;\n onBrushEnd?: (e: any) => void;\n}\n\nexport interface DataZoomEventProps {\n onDataZoomChange?: (e: any) => void;\n}\n\nexport interface PlayerEventProps {\n onPlayerPlay?: (e: any) => void;\n onPlayerPause?: (e: any) => void;\n onPlayerEnd?: (e: any) => void;\n onPlayerChange?: (e: any) => void;\n onPlayerForward?: (e: any) => void;\n onPlayerBackward?: (e: any) => void;\n}\n\nexport interface ScrollBarEventProps {\n onScrollBarChange?: (e: any) => void;\n}\n\nexport interface EventsProps {\n onPointerDown?: EventCallback<EventParamsDefinition['pointerdown']>;\n onPointerUp?: EventCallback<EventParamsDefinition['pointerup']>;\n onPointerUpOutside?: EventCallback<EventParamsDefinition['pointerupoutside']>;\n onPointerTap?: EventCallback<EventParamsDefinition['pointertap']>;\n onPointerOver?: EventCallback<EventParamsDefinition['pointerover']>;\n onPointerMove?: EventCallback<EventParamsDefinition['pointermove']>;\n onPointerEnter?: EventCallback<EventParamsDefinition['pointerenter']>;\n onPointerLeave?: EventCallback<EventParamsDefinition['pointerleave']>;\n onPointerOut?: EventCallback<EventParamsDefinition['pointerout']>;\n onMouseDown?: EventCallback<EventParamsDefinition['mousedown']>;\n onMouseUp?: EventCallback<EventParamsDefinition['mouseup']>;\n onMouseUpOutside?: EventCallback<EventParamsDefinition['mouseupoutside']>;\n onMouseMove?: EventCallback<EventParamsDefinition['mousemove']>;\n onMouseOver?: EventCallback<EventParamsDefinition['mouseover']>;\n onMouseOut?: EventCallback<EventParamsDefinition['mouseout']>;\n onMouseEnter?: EventCallback<EventParamsDefinition['mouseenter']>;\n onMouseLeave?: EventCallback<EventParamsDefinition['mouseleave']>;\n onPinch?: EventCallback<EventParamsDefinition['pinch']>;\n onPinchStart?: EventCallback<EventParamsDefinition['pinchstart']>;\n onPinchEnd?: EventCallback<EventParamsDefinition['pinchend']>;\n onPan?: EventCallback<EventParamsDefinition['pan']>;\n onPanStart?: EventCallback<EventParamsDefinition['panstart']>;\n onPanEnd?: EventCallback<EventParamsDefinition['panend']>;\n onDrag?: EventCallback<EventParamsDefinition['drag']>;\n onDragStart?: EventCallback<EventParamsDefinition['dragstart']>;\n onDragEnter?: EventCallback<EventParamsDefinition['dragenter']>;\n onDragLeave?: EventCallback<EventParamsDefinition['dragleave']>;\n onDragOver?: EventCallback<EventParamsDefinition['dragover']>;\n onDragEnd?: EventCallback<EventParamsDefinition['dragend']>;\n onRightDown?: EventCallback<EventParamsDefinition['rightdown']>;\n onRightUp?: EventCallback<EventParamsDefinition['rightup']>;\n onRightUpOutside?: EventCallback<EventParamsDefinition['rightupoutside']>;\n onTouchStart?: EventCallback<EventParamsDefinition['touchstart']>;\n onTouchEnd?: EventCallback<EventParamsDefinition['touchend']>;\n onTouchEndOutside?: EventCallback<EventParamsDefinition['touchendoutside']>;\n onTouchMove?: EventCallback<EventParamsDefinition['touchmove']>;\n onTouchCancel?: EventCallback<EventParamsDefinition['touchcancel']>;\n onPress?: EventCallback<EventParamsDefinition['press']>;\n onPressUp?: EventCallback<EventParamsDefinition['pressup']>;\n onPressEnd?: EventCallback<EventParamsDefinition['pressend']>;\n onSwipe?: EventCallback<EventParamsDefinition['swipe']>;\n onDrop?: EventCallback<EventParamsDefinition['drop']>;\n onWeel?: EventCallback<EventParamsDefinition['weel']>;\n onClick?: EventCallback<EventParamsDefinition['click']>;\n onDblClick?: EventCallback<EventParamsDefinition['dblclick']>;\n}\n\nexport const REACT_TO_VCHART_EVENTS = {\n onPointerDown: 'pointerdown',\n onPointerUp: 'pointerup',\n onPointerUpOutside: 'pointerupoutside',\n onPointerTap: 'pointertap',\n onPointerOver: 'pointerover',\n onPointerMove: 'pointermove',\n onPointerEnter: 'pointerenter',\n onPointerLeave: 'pointerleave',\n onPointerOut: 'pointerout',\n onMouseDown: 'mousedown',\n onMouseUp: 'mouseup',\n onMouseUpOutside: 'mouseupoutside',\n onMouseMove: 'mousemove',\n onMouseOver: 'mouseover',\n onMouseOut: 'mouseout',\n onMouseEnter: 'mouseenter',\n onMouseLeave: 'mouseleave',\n onPinch: 'pinch',\n onPinchStart: 'pinchstart',\n onPinchEnd: 'pinchend',\n onPan: 'pan',\n onPanStart: 'panstart',\n onPanEnd: 'panend',\n onDrag: 'drag',\n onDragStart: 'dragstart',\n onDragEnter: 'dragenter',\n onDragLeave: 'dragleave',\n onDragOver: 'dragover',\n onDragEnd: 'dragend',\n onRightDown: 'rightdown',\n onRightUp: 'rightup',\n onRightUpOutside: 'rightupoutside',\n onTouchStart: 'touchstart',\n onTouchEnd: 'touchend',\n onTouchEndOutside: 'touchendoutside',\n onTouchMove: 'touchmove',\n onTouchCancel: 'touchcancel',\n onPress: 'press',\n onPressUp: 'pressup',\n onPressEnd: 'pressend',\n onSwipe: 'swipe',\n onDrop: 'drop',\n onWeel: 'wheel',\n onClick: 'click',\n onDblClick: 'dblclick'\n};\n\nexport const LEGEND_CUSTOMIZED_EVENTS = {\n onLegendItemHover: 'legendItemHover',\n onLegendItemUnHover: 'legendItemUnHover',\n onLegendItemClick: 'legendItemClick',\n onLegendFilter: 'legendFilter',\n onLegendSelectedDataChange: 'legendSelectedDataChange'\n};\nexport const BRUSH_CUSTOMIZED_EVENTS = {\n onBrushStart: 'brushStart',\n onBrushChange: 'brushChange',\n onBrushEnd: 'brushEnd'\n};\n\nexport const DATAZOOM_CUSTOMIZED_EVENTS = {\n onDataZoomChange: 'dataZoomChange'\n};\n\nexport const PLAYER_CUSTOMIZED_EVENTS = {\n onPlayerPlay: 'playerPlay',\n onPlayerPause: 'playerPause',\n onPlayerEnd: 'playerEnd',\n onPlayerChange: 'playerChange',\n onPlayerForward: 'playerForward',\n onPlayerBackward: 'playerBackward'\n};\n\nexport const SCROLLBAR_CUSTOMIZED_EVENTS = {\n onScrollBarChange: 'scrollBarChange'\n};\n\nexport const CHART_EVENTS = {\n ...LEGEND_CUSTOMIZED_EVENTS,\n ...BRUSH_CUSTOMIZED_EVENTS,\n ...PLAYER_CUSTOMIZED_EVENTS,\n ...DATAZOOM_CUSTOMIZED_EVENTS,\n ...SCROLLBAR_CUSTOMIZED_EVENTS,\n ...REACT_TO_VCHART_EVENTS\n};\n\nexport const CHART_EVENTS_KEYS = Object.keys(CHART_EVENTS);\n\nexport const COMMON_EVENTK_KEYS = Object.keys(REACT_TO_VCHART_EVENTS);\n\nexport const VCHART_TO_REACT_EVENTS = Object.keys(REACT_TO_VCHART_EVENTS).reduce((res, key) => {\n res[REACT_TO_VCHART_EVENTS[key]] = key;\n\n return res;\n}, {});\n\nexport const findEventProps = <T extends EventsProps>(\n props: T,\n supportedEvents: Record<string, string> = REACT_TO_VCHART_EVENTS\n): EventsProps => {\n const result: EventsProps = {};\n\n Object.keys(props).forEach(key => {\n if (supportedEvents[key]) {\n result[key] = props[key];\n }\n });\n\n return result;\n};\n\nexport const bindEventsToChart = <T>(\n chart: IVChart,\n newProps?: T | null,\n prevProps?: T | null,\n supportedEvents: Record<string, string> = REACT_TO_VCHART_EVENTS\n) => {\n if ((!newProps && !prevProps) || !chart) {\n return false;\n }\n\n const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;\n const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;\n\n if (prevEventProps) {\n Object.keys(prevEventProps).forEach(eventKey => {\n if (!newEventProps || !newEventProps[eventKey] || newEventProps[eventKey] !== prevEventProps[eventKey]) {\n const res = chart.off(supportedEvents[eventKey], prevProps[eventKey]);\n }\n });\n }\n\n if (newEventProps) {\n Object.keys(newEventProps).forEach(eventKey => {\n if (!prevEventProps || !prevEventProps[eventKey] || prevEventProps[eventKey] !== newEventProps[eventKey]) {\n chart.on(supportedEvents[eventKey], newEventProps[eventKey]);\n }\n });\n }\n\n return true;\n};\n"]}
1
+ {"version":3,"sources":["eventsUtils.ts"],"names":[],"mappings":"AAmGA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,aAAa,EAAE,aAAa;IAC5B,WAAW,EAAE,WAAW;IACxB,kBAAkB,EAAE,kBAAkB;IACtC,YAAY,EAAE,YAAY;IAC1B,aAAa,EAAE,aAAa;IAC5B,aAAa,EAAE,aAAa;IAC5B,cAAc,EAAE,cAAc;IAC9B,cAAc,EAAE,cAAc;IAC9B,YAAY,EAAE,YAAY;IAC1B,WAAW,EAAE,WAAW;IACxB,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C,QAAQ,CAAC,CAAC,CAAC;aACvE;QACH,CAAC,CAAC,CAAC;KACJ;IAED,IAAI,aAAa,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC5C,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,QAAQ,CAAC,EAAE;gBACxG,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC9D;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","file":"eventsUtils.js","sourcesContent":["import type { IVChart, EventCallback, EventParamsDefinition } from '@visactor/vchart';\n\nexport interface LegendEventProps {\n onLegendItemHover?: (e: any) => void;\n onLegendItemUnHover?: (e: any) => void;\n onLegendItemClick?: (e: any) => void;\n onLegendFilter?: (e: any) => void;\n onLegendSelectedDataChange?: (e: any) => void;\n}\n\nexport interface BrushEventProps {\n onBrushStart?: (e: any) => void;\n onBrushChange?: (e: any) => void;\n onBrushEnd?: (e: any) => void;\n}\n\nexport interface DataZoomEventProps {\n onDataZoomChange?: (e: any) => void;\n}\n\nexport interface PlayerEventProps {\n onPlayerPlay?: (e: any) => void;\n onPlayerPause?: (e: any) => void;\n onPlayerEnd?: (e: any) => void;\n onPlayerChange?: (e: any) => void;\n onPlayerForward?: (e: any) => void;\n onPlayerBackward?: (e: any) => void;\n}\n\nexport interface ScrollBarEventProps {\n onScrollBarChange?: (e: any) => void;\n}\n\nexport interface DimensionEventProps {\n onDimensionHover?: (e: any) => void;\n onDimensionClick?: (e: any) => void;\n}\n\nexport interface HierarchyEventProps {\n onDrill?: (e: any) => void;\n}\n\nexport interface ChartLifeCycleEventProps {\n onInitialized?: (e: any) => void;\n onRendered?: (e: any) => void;\n onRenderFinished?: (e: any) => void;\n onAnimationFinished?: (e: any) => void;\n onLayoutStart?: (e: any) => void;\n onLayoutEnd?: (e: any) => void;\n}\n\nexport interface EventsProps {\n onPointerDown?: EventCallback<EventParamsDefinition['pointerdown']>;\n onPointerUp?: EventCallback<EventParamsDefinition['pointerup']>;\n onPointerUpOutside?: EventCallback<EventParamsDefinition['pointerupoutside']>;\n onPointerTap?: EventCallback<EventParamsDefinition['pointertap']>;\n onPointerOver?: EventCallback<EventParamsDefinition['pointerover']>;\n onPointerMove?: EventCallback<EventParamsDefinition['pointermove']>;\n onPointerEnter?: EventCallback<EventParamsDefinition['pointerenter']>;\n onPointerLeave?: EventCallback<EventParamsDefinition['pointerleave']>;\n onPointerOut?: EventCallback<EventParamsDefinition['pointerout']>;\n onMouseDown?: EventCallback<EventParamsDefinition['mousedown']>;\n onMouseUp?: EventCallback<EventParamsDefinition['mouseup']>;\n onMouseUpOutside?: EventCallback<EventParamsDefinition['mouseupoutside']>;\n onMouseMove?: EventCallback<EventParamsDefinition['mousemove']>;\n onMouseOver?: EventCallback<EventParamsDefinition['mouseover']>;\n onMouseOut?: EventCallback<EventParamsDefinition['mouseout']>;\n onMouseEnter?: EventCallback<EventParamsDefinition['mouseenter']>;\n onMouseLeave?: EventCallback<EventParamsDefinition['mouseleave']>;\n onPinch?: EventCallback<EventParamsDefinition['pinch']>;\n onPinchStart?: EventCallback<EventParamsDefinition['pinchstart']>;\n onPinchEnd?: EventCallback<EventParamsDefinition['pinchend']>;\n onPan?: EventCallback<EventParamsDefinition['pan']>;\n onPanStart?: EventCallback<EventParamsDefinition['panstart']>;\n onPanEnd?: EventCallback<EventParamsDefinition['panend']>;\n onDrag?: EventCallback<EventParamsDefinition['drag']>;\n onDragStart?: EventCallback<EventParamsDefinition['dragstart']>;\n onDragEnter?: EventCallback<EventParamsDefinition['dragenter']>;\n onDragLeave?: EventCallback<EventParamsDefinition['dragleave']>;\n onDragOver?: EventCallback<EventParamsDefinition['dragover']>;\n onDragEnd?: EventCallback<EventParamsDefinition['dragend']>;\n onRightDown?: EventCallback<EventParamsDefinition['rightdown']>;\n onRightUp?: EventCallback<EventParamsDefinition['rightup']>;\n onRightUpOutside?: EventCallback<EventParamsDefinition['rightupoutside']>;\n onTouchStart?: EventCallback<EventParamsDefinition['touchstart']>;\n onTouchEnd?: EventCallback<EventParamsDefinition['touchend']>;\n onTouchEndOutside?: EventCallback<EventParamsDefinition['touchendoutside']>;\n onTouchMove?: EventCallback<EventParamsDefinition['touchmove']>;\n onTouchCancel?: EventCallback<EventParamsDefinition['touchcancel']>;\n onPress?: EventCallback<EventParamsDefinition['press']>;\n onPressUp?: EventCallback<EventParamsDefinition['pressup']>;\n onPressEnd?: EventCallback<EventParamsDefinition['pressend']>;\n onSwipe?: EventCallback<EventParamsDefinition['swipe']>;\n onDrop?: EventCallback<EventParamsDefinition['drop']>;\n onWeel?: EventCallback<EventParamsDefinition['weel']>;\n onClick?: EventCallback<EventParamsDefinition['click']>;\n onDblClick?: EventCallback<EventParamsDefinition['dblclick']>;\n}\n\nexport const REACT_TO_VCHART_EVENTS = {\n onPointerDown: 'pointerdown',\n onPointerUp: 'pointerup',\n onPointerUpOutside: 'pointerupoutside',\n onPointerTap: 'pointertap',\n onPointerOver: 'pointerover',\n onPointerMove: 'pointermove',\n onPointerEnter: 'pointerenter',\n onPointerLeave: 'pointerleave',\n onPointerOut: 'pointerout',\n onMouseDown: 'mousedown',\n onMouseUp: 'mouseup',\n onMouseUpOutside: 'mouseupoutside',\n onMouseMove: 'mousemove',\n onMouseOver: 'mouseover',\n onMouseOut: 'mouseout',\n onMouseEnter: 'mouseenter',\n onMouseLeave: 'mouseleave',\n onPinch: 'pinch',\n onPinchStart: 'pinchstart',\n onPinchEnd: 'pinchend',\n onPan: 'pan',\n onPanStart: 'panstart',\n onPanEnd: 'panend',\n onDrag: 'drag',\n onDragStart: 'dragstart',\n onDragEnter: 'dragenter',\n onDragLeave: 'dragleave',\n onDragOver: 'dragover',\n onDragEnd: 'dragend',\n onRightDown: 'rightdown',\n onRightUp: 'rightup',\n onRightUpOutside: 'rightupoutside',\n onTouchStart: 'touchstart',\n onTouchEnd: 'touchend',\n onTouchEndOutside: 'touchendoutside',\n onTouchMove: 'touchmove',\n onTouchCancel: 'touchcancel',\n onPress: 'press',\n onPressUp: 'pressup',\n onPressEnd: 'pressend',\n onSwipe: 'swipe',\n onDrop: 'drop',\n onWeel: 'wheel',\n onClick: 'click',\n onDblClick: 'dblclick'\n};\n\nexport const LEGEND_CUSTOMIZED_EVENTS = {\n onLegendItemHover: 'legendItemHover',\n onLegendItemUnHover: 'legendItemUnHover',\n onLegendItemClick: 'legendItemClick',\n onLegendFilter: 'legendFilter',\n onLegendSelectedDataChange: 'legendSelectedDataChange'\n};\nexport const BRUSH_CUSTOMIZED_EVENTS = {\n onBrushStart: 'brushStart',\n onBrushChange: 'brushChange',\n onBrushEnd: 'brushEnd'\n};\n\nexport const DATAZOOM_CUSTOMIZED_EVENTS = {\n onDataZoomChange: 'dataZoomChange'\n};\n\nexport const PLAYER_CUSTOMIZED_EVENTS = {\n onPlayerPlay: 'playerPlay',\n onPlayerPause: 'playerPause',\n onPlayerEnd: 'playerEnd',\n onPlayerChange: 'playerChange',\n onPlayerForward: 'playerForward',\n onPlayerBackward: 'playerBackward'\n};\n\nexport const SCROLLBAR_CUSTOMIZED_EVENTS = {\n onScrollBarChange: 'scrollBarChange'\n};\n\nexport const DIMENSION_EVENTS = {\n onDimensionHover: 'dimensionHover',\n onDimensionClick: 'dimensionClick'\n};\n\nexport const HIERARCHY_EVENTS = {\n onDrill: 'drill'\n};\n\nexport const CHART_LIFECYCLE_EVENTS = {\n onInitialized: 'initialized',\n onRendered: 'rendered',\n onRenderFinished: 'renderFinished',\n onAnimationFinished: 'animationFinished',\n onLayoutStart: 'layoutStart',\n onLayoutEnd: 'layoutEnd'\n};\n\nexport const CHART_EVENTS = {\n ...LEGEND_CUSTOMIZED_EVENTS,\n ...BRUSH_CUSTOMIZED_EVENTS,\n ...PLAYER_CUSTOMIZED_EVENTS,\n ...DATAZOOM_CUSTOMIZED_EVENTS,\n ...SCROLLBAR_CUSTOMIZED_EVENTS,\n ...DIMENSION_EVENTS,\n ...CHART_LIFECYCLE_EVENTS,\n ...HIERARCHY_EVENTS,\n ...REACT_TO_VCHART_EVENTS\n};\n\nexport const CHART_EVENTS_KEYS = Object.keys(CHART_EVENTS);\n\nexport const COMMON_EVENTK_KEYS = Object.keys(REACT_TO_VCHART_EVENTS);\n\nexport const VCHART_TO_REACT_EVENTS = Object.keys(REACT_TO_VCHART_EVENTS).reduce((res, key) => {\n res[REACT_TO_VCHART_EVENTS[key]] = key;\n\n return res;\n}, {});\n\nexport const findEventProps = <T extends EventsProps>(\n props: T,\n supportedEvents: Record<string, string> = REACT_TO_VCHART_EVENTS\n): EventsProps => {\n const result: EventsProps = {};\n\n Object.keys(props).forEach(key => {\n if (supportedEvents[key]) {\n result[key] = props[key];\n }\n });\n\n return result;\n};\n\nexport const bindEventsToChart = <T>(\n chart: IVChart,\n newProps?: T | null,\n prevProps?: T | null,\n supportedEvents: Record<string, string> = REACT_TO_VCHART_EVENTS\n) => {\n if ((!newProps && !prevProps) || !chart) {\n return false;\n }\n\n const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;\n const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;\n\n if (prevEventProps) {\n Object.keys(prevEventProps).forEach(eventKey => {\n if (!newEventProps || !newEventProps[eventKey] || newEventProps[eventKey] !== prevEventProps[eventKey]) {\n const res = chart.off(supportedEvents[eventKey], prevProps[eventKey]);\n }\n });\n }\n\n if (newEventProps) {\n Object.keys(newEventProps).forEach(eventKey => {\n if (!prevEventProps || !prevEventProps[eventKey] || prevEventProps[eventKey] !== newEventProps[eventKey]) {\n chart.on(supportedEvents[eventKey], newEventProps[eventKey]);\n }\n });\n }\n\n return true;\n};\n"]}
@@ -1,4 +1,3 @@
1
1
  import { createSeries } from "./BaseSeries";
2
2
 
3
- export const Link = createSeries("Link", [ "link" ], "link");
4
- //# sourceMappingURL=Link.js.map
3
+ export const Link = createSeries("Link", [ "link" ], "link");
package/esm/series/Pie.js CHANGED
@@ -1,3 +1,4 @@
1
1
  import { createSeries } from "./BaseSeries";
2
2
 
3
- export const Pie = createSeries("Pie", [ "pie" ], "pie");
3
+ export const Pie = createSeries("Pie", [ "pie" ], "pie");
4
+ //# sourceMappingURL=Pie.js.map
@@ -1,4 +1,4 @@
1
1
  import { createSeries } from "./BaseSeries";
2
2
 
3
3
  export const WordCloud = createSeries("WordCloud", [ "wordCloud" ], "wordCloud");
4
- //# sourceMappingURL=WordCloud.js.map
4
+ //# sourceMappingURL=WordCloud.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/react-vchart",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "The react version of VChart 4.x",
5
5
  "keywords": [
6
6
  "react",
@@ -22,11 +22,11 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@visactor/vchart": "1.6.0",
26
- "@visactor/vutils": "~0.16.6",
27
- "@visactor/vrender-core": "~0.16.11",
28
- "@visactor/vrender-kits": "~0.16.11",
29
- "@visactor/vgrammar-core": "~0.8.1",
25
+ "@visactor/vchart": "1.6.1",
26
+ "@visactor/vutils": "~0.16.7",
27
+ "@visactor/vrender-core": "~0.16.12",
28
+ "@visactor/vrender-kits": "~0.16.12",
29
+ "@visactor/vgrammar-core": "~0.8.2",
30
30
  "react-is": "^18.2.0"
31
31
  },
32
32
  "devDependencies": {
@@ -54,8 +54,8 @@
54
54
  "@vitejs/plugin-react": "3.1.0",
55
55
  "vite": "3.2.6",
56
56
  "@internal/bundler": "0.0.1",
57
- "@internal/ts-config": "0.0.1",
58
- "@internal/eslint-config": "0.0.1"
57
+ "@internal/eslint-config": "0.0.1",
58
+ "@internal/ts-config": "0.0.1"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "react": ">=16.0.0",