@visactor/react-vchart 1.13.11-alpha.1 → 1.13.11-alpha.2

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.
@@ -56,12 +56,13 @@ const react_1 = __importStar(require("react")), withContainer_1 = __importDefaul
56
56
  }));
57
57
  const hasSpec = !!props.spec, [view, setView] = (0, react_1.useState)(null), isUnmount = (0,
58
58
  react_1.useRef)(!1), prevSpec = (0, react_1.useRef)((0, vutils_1.pickWithout)(props, notSpecKeys)), specFromChildren = (0,
59
- react_1.useRef)(null), eventsBinded = react_1.default.useRef(null), skipFunctionDiff = !!props.skipFunctionDiff, parseSpec = props => {
59
+ react_1.useRef)(null), eventsBinded = react_1.default.useRef(null), skipFunctionDiff = !!props.skipFunctionDiff, [tooltipNode, setTooltipNode] = (0,
60
+ react_1.useState)(null), parseSpec = props => {
60
61
  let spec;
61
62
  hasSpec && props.spec ? (spec = props.spec, (0, vutils_1.isValid)(props.data) && (spec = Object.assign(Object.assign({}, props.spec), {
62
63
  data: props.data
63
64
  }))) : spec = Object.assign(Object.assign({}, prevSpec.current), specFromChildren.current);
64
- const tooltipSpec = (0, util_2.initCustomTooltip)(props, spec.tooltip);
65
+ const tooltipSpec = (0, util_2.initCustomTooltip)(setTooltipNode, props, spec.tooltip);
65
66
  return tooltipSpec && (spec.tooltip = tooltipSpec), spec;
66
67
  }, handleChartRender = rebindEvent => {
67
68
  if (!isUnmount.current) {
@@ -118,7 +119,7 @@ const react_1 = __importStar(require("react")), withContainer_1 = __importDefaul
118
119
  updateId: updateId,
119
120
  componentId: childId
120
121
  }));
121
- }))));
122
+ })), tooltipNode));
122
123
  })), createChart = (componentName, defaultProps, registers) => {
123
124
  registers && registers.length && defaultProps.vchartConstrouctor && defaultProps.vchartConstrouctor.useRegisters(registers);
124
125
  const Com = (0, withContainer_1.default)(BaseChart, componentName, (props => defaultProps ? Object.assign(props, defaultProps) : props));
@@ -1 +1 @@
1
- {"version":3,"sources":["../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YAAY,CAAC,KAAkE,EAAE;gBACtF,QAAQ,EAAE,QAAQ;gBAClB,WAAW,EAAE,OAAO;aACrB,CAAC,CACa,CAClB,CAAC;QACJ,CAAC,CAAC,CACmB,CACG,CAC7B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEI,MAAM,WAAW,GAAG,CACzB,aAAqB,EACrB,YAAyB,EACzB,SAA0B,EAC1B,EAAE;IACF,IAAI,SAAS,IAAI,SAAS,CAAC,MAAM,IAAI,YAAY,CAAC,kBAAkB,EAAE;QACpE,YAAY,CAAC,kBAAkB,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;KACzD;IAED,MAAM,GAAG,GAAG,IAAA,uBAAa,EAAoB,SAAgB,EAAE,aAAa,EAAE,CAAC,KAAQ,EAAE,EAAE;QACzF,IAAI,YAAY,EAAE;YAChB,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;SAC3C;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAjBW,QAAA,WAAW,eAiBtB","file":"BaseChart.js","sourcesContent":["import type {\n IVChart,\n IData,\n IInitOption,\n ISpec,\n IVChartConstructor,\n IHierarchyData,\n IVChartRenderOption\n} from '@visactor/vchart';\nimport type { ReactNode } from 'react';\nimport React, { useState, useEffect, useRef, useImperativeHandle } from 'react';\nimport type { ContainerProps } from '../containers/withContainer';\nimport withContainer from '../containers/withContainer';\nimport type { ChartContextType } from '../context/chart';\nimport RootChartContext from '../context/chart';\nimport type { IView } from '@visactor/vgrammar-core';\nimport { isEqual, isNil, isValid, pickWithout } from '@visactor/vutils';\nimport ViewContext from '../context/view';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport type {\n EventsProps,\n LegendEventProps,\n ScrollBarEventProps,\n BrushEventProps,\n DataZoomEventProps,\n PlayerEventProps,\n DimensionEventProps,\n HierarchyEventProps,\n ChartLifeCycleEventProps\n} from '../eventsUtils';\nimport { bindEventsToChart, CHART_EVENTS_KEYS, CHART_EVENTS } from '../eventsUtils';\nimport type { IReactTooltipProps } from '../components/tooltip/interface';\nimport { initCustomTooltip } from '../components/tooltip/util';\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 IReactTooltipProps {\n vchartConstrouctor?: IVChartConstructor;\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /**\n * used only by <VChart />\n */\n spec?: ISpec;\n /** 数据 */\n data?: IData | IHierarchyData;\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n /** 图表配置 */\n options?: ChartOptions;\n /** skip function diff when component update */\n skipFunctionDiff?: boolean;\n /**\n * add `morphConfig` for chart\n * @since 1.12.7\n */\n morphConfig?: IVChartRenderOption['morphConfig'];\n /** 图表渲染完成事件 */\n onReady?: (instance: IVChart, isInitial: boolean) => void;\n /** throw error when chart run into an error */\n onError?: (err: Error) => void;\n /**\n * use sync render\n *\n * @since 1.8.3\n * @deprecated 1.9.0\n **/\n useSyncRender?: boolean;\n}\n\ntype Props = React.PropsWithChildren<BaseChartProps>;\n\nconst notSpecKeys = [\n ...REACT_PRIVATE_PROPS,\n ...CHART_EVENTS_KEYS,\n 'vchartConstrouctor',\n 'useSyncRender',\n 'skipFunctionDiff',\n 'onError',\n 'onReady',\n 'spec',\n 'container',\n 'options',\n 'morphConfig'\n];\nconst defaultMorphConfig = {\n morph: false,\n enableExitAnimation: false\n};\n\nconst getComponentId = (child: React.ReactNode, index: number) => {\n const componentName = child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n return `${componentName}-${index}`;\n};\n\nconst parseSpecFromChildren = (props: Props) => {\n const specFromChildren: Omit<ISpec, 'type' | 'data' | 'width' | 'height'> = {};\n\n toArray(props.children).map((child, index) => {\n const parseSpec = child && (child as any).type && (child as any).type.parseSpec;\n\n if (parseSpec && (child as any).props) {\n const childProps = isNil((child as any).props.componentId)\n ? {\n ...(child as any).props,\n componentId: getComponentId(child, index)\n }\n : (child as any).props;\n\n const specResult = parseSpec(childProps);\n\n if (specResult.isSingle) {\n (specFromChildren as any)[specResult.specName] = specResult.spec;\n } else {\n if (!(specFromChildren as any)[specResult.specName]) {\n (specFromChildren as any)[specResult.specName] = [];\n }\n\n (specFromChildren as any)[specResult.specName].push(specResult.spec);\n }\n }\n });\n\n return specFromChildren;\n};\n\nconst BaseChart: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const chartContext = useRef<ChartContextType>({});\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 specFromChildren = useRef<Omit<ISpec, 'type' | 'data' | 'width' | 'height'>>(null);\n const eventsBinded = React.useRef<BaseChartProps>(null);\n const skipFunctionDiff = !!props.skipFunctionDiff;\n\n const parseSpec = (props: Props) => {\n let spec: ISpec;\n\n if (hasSpec && props.spec) {\n spec = props.spec;\n\n if (isValid(props.data)) {\n spec = {\n ...props.spec,\n data: props.data\n } as ISpec;\n }\n } else {\n spec = {\n ...prevSpec.current,\n ...specFromChildren.current\n } as ISpec;\n }\n\n const tooltipSpec = initCustomTooltip(props, spec.tooltip);\n if (tooltipSpec) {\n spec.tooltip = tooltipSpec;\n }\n return spec;\n };\n\n const createChart = (props: Props) => {\n const cs = new props.vchartConstrouctor(parseSpec(props), {\n ...props.options,\n onError: props.onError,\n autoFit: true,\n dom: props.container\n });\n chartContext.current = { ...chartContext.current, chart: cs };\n isUnmount.current = false;\n };\n\n const handleChartRender = (rebindEvent?: boolean) => {\n // rebind events after render\n if (!isUnmount.current) {\n if (!chartContext.current || !chartContext.current.chart) {\n return;\n }\n\n if (rebindEvent) {\n bindEventsToChart(chartContext.current.chart, props, eventsBinded.current, CHART_EVENTS);\n }\n\n const newView = chartContext.current.chart.getCompiler().getVGrammarView();\n\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(chartContext.current.chart, updateId === 0);\n }\n setView(newView);\n }\n };\n\n const renderChart = () => {\n if (chartContext.current.chart) {\n // event should bind before render when the chart has not been rendered\n bindEventsToChart(chartContext.current.chart, props, eventsBinded.current, CHART_EVENTS);\n\n chartContext.current.chart.renderSync({\n reuse: false\n });\n handleChartRender();\n }\n };\n\n useEffect(() => {\n const newSpecFromChildren = hasSpec ? null : parseSpecFromChildren(props);\n\n if (!chartContext.current?.chart) {\n if (!hasSpec) {\n specFromChildren.current = newSpecFromChildren;\n }\n\n createChart(props);\n renderChart();\n eventsBinded.current = props;\n return;\n }\n\n if (hasSpec) {\n if (!isEqual(eventsBinded.current.spec, props.spec, { skipFunction: skipFunctionDiff })) {\n chartContext.current.chart.updateSpecSync(parseSpec(props), undefined, props.morphConfig ?? defaultMorphConfig);\n handleChartRender(true);\n eventsBinded.current = props;\n } else if (eventsBinded.current.data !== props.data) {\n chartContext.current.chart.updateFullDataSync(props.data as any);\n handleChartRender(true);\n eventsBinded.current = props;\n }\n return;\n }\n\n const newSpec = pickWithout(props, notSpecKeys);\n\n if (\n !isEqual(newSpec, prevSpec.current, { skipFunction: skipFunctionDiff }) ||\n !isEqual(newSpecFromChildren, specFromChildren.current, { skipFunction: skipFunctionDiff })\n ) {\n prevSpec.current = newSpec;\n specFromChildren.current = newSpecFromChildren;\n\n chartContext.current.chart.updateSpecSync(parseSpec(props), undefined, props.morphConfig ?? defaultMorphConfig);\n handleChartRender(true);\n eventsBinded.current = props;\n }\n }, [props]);\n\n useEffect(() => {\n return () => {\n if (chartContext) {\n if (chartContext.current && chartContext.current.chart) {\n chartContext.current.chart.release();\n chartContext.current.chart = null;\n }\n }\n eventsBinded.current = null;\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 if (typeof child === 'string') {\n return null;\n }\n\n const childId = getComponentId(child, index);\n\n return (\n <React.Fragment key={childId}>\n {React.cloneElement(child as React.ReactElement<any, React.JSXElementConstructor<any>>, {\n updateId: updateId,\n componentId: childId\n })}\n </React.Fragment>\n );\n })}\n </ViewContext.Provider>\n </RootChartContext.Provider>\n );\n});\n\nexport const createChart = <T extends Props>(\n componentName: string,\n defaultProps?: Partial<T>,\n registers?: (() => void)[]\n) => {\n if (registers && registers.length && defaultProps.vchartConstrouctor) {\n defaultProps.vchartConstrouctor.useRegisters(registers);\n }\n\n const Com = withContainer<ContainerProps, T>(BaseChart as any, componentName, (props: T) => {\n if (defaultProps) {\n return Object.assign(props, defaultProps);\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
1
+ {"version":3,"sources":["../src/charts/BaseChart.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,+CAAgF;AAEhF,gFAAwD;AAExD,6DAAgD;AAEhD,6CAAwE;AACxE,2DAA0C;AAC1C,kCAAkC;AAClC,4CAAmD;AAYnD,gDAAoF;AAEpF,qDAA+D;AAqD/D,MAAM,WAAW,GAAG;IAClB,GAAG,+BAAmB;IACtB,GAAG,+BAAiB;IACpB,oBAAoB;IACpB,eAAe;IACf,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,MAAM;IACN,WAAW;IACX,SAAS;IACT,aAAa;CACd,CAAC;AACF,MAAM,kBAAkB,GAAG;IACzB,KAAK,EAAE,KAAK;IACZ,mBAAmB,EAAE,KAAK;CAC3B,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAsB,EAAE,KAAa,EAAE,EAAE;IAC/D,MAAM,aAAa,GAAG,KAAK,IAAK,KAAa,CAAC,IAAI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AAE,EAAE;QACzF,IAAI,YAAY,EAAE;YAChB,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;SAC3C;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAjBW,QAAA,WAAW,eAiBtB","file":"BaseChart.js","sourcesContent":["import type {\n IVChart,\n IData,\n IInitOption,\n ISpec,\n IVChartConstructor,\n IHierarchyData,\n IVChartRenderOption\n} from '@visactor/vchart';\nimport type { ReactNode } from 'react';\nimport React, { useState, useEffect, useRef, useImperativeHandle } from 'react';\nimport type { ContainerProps } from '../containers/withContainer';\nimport withContainer from '../containers/withContainer';\nimport type { ChartContextType } from '../context/chart';\nimport RootChartContext from '../context/chart';\nimport type { IView } from '@visactor/vgrammar-core';\nimport { isEqual, isNil, isValid, pickWithout } from '@visactor/vutils';\nimport ViewContext from '../context/view';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport type {\n EventsProps,\n LegendEventProps,\n ScrollBarEventProps,\n BrushEventProps,\n DataZoomEventProps,\n PlayerEventProps,\n DimensionEventProps,\n HierarchyEventProps,\n ChartLifeCycleEventProps\n} from '../eventsUtils';\nimport { bindEventsToChart, CHART_EVENTS_KEYS, CHART_EVENTS } from '../eventsUtils';\nimport type { IReactTooltipProps } from '../components/tooltip/interface';\nimport { initCustomTooltip } from '../components/tooltip/util';\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 IReactTooltipProps {\n vchartConstrouctor?: IVChartConstructor;\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /**\n * used only by <VChart />\n */\n spec?: ISpec;\n /** 数据 */\n data?: IData | IHierarchyData;\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n /** 图表配置 */\n options?: ChartOptions;\n /** skip function diff when component update */\n skipFunctionDiff?: boolean;\n /**\n * add `morphConfig` for chart\n * @since 1.12.7\n */\n morphConfig?: IVChartRenderOption['morphConfig'];\n /** 图表渲染完成事件 */\n onReady?: (instance: IVChart, isInitial: boolean) => void;\n /** throw error when chart run into an error */\n onError?: (err: Error) => void;\n /**\n * use sync render\n *\n * @since 1.8.3\n * @deprecated 1.9.0\n **/\n useSyncRender?: boolean;\n}\n\ntype Props = React.PropsWithChildren<BaseChartProps>;\n\nconst notSpecKeys = [\n ...REACT_PRIVATE_PROPS,\n ...CHART_EVENTS_KEYS,\n 'vchartConstrouctor',\n 'useSyncRender',\n 'skipFunctionDiff',\n 'onError',\n 'onReady',\n 'spec',\n 'container',\n 'options',\n 'morphConfig'\n];\nconst defaultMorphConfig = {\n morph: false,\n enableExitAnimation: false\n};\n\nconst getComponentId = (child: React.ReactNode, index: number) => {\n const componentName = child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n return `${componentName}-${index}`;\n};\n\nconst parseSpecFromChildren = (props: Props) => {\n const specFromChildren: Omit<ISpec, 'type' | 'data' | 'width' | 'height'> = {};\n\n toArray(props.children).map((child, index) => {\n const parseSpec = child && (child as any).type && (child as any).type.parseSpec;\n\n if (parseSpec && (child as any).props) {\n const childProps = isNil((child as any).props.componentId)\n ? {\n ...(child as any).props,\n componentId: getComponentId(child, index)\n }\n : (child as any).props;\n\n const specResult = parseSpec(childProps);\n\n if (specResult.isSingle) {\n (specFromChildren as any)[specResult.specName] = specResult.spec;\n } else {\n if (!(specFromChildren as any)[specResult.specName]) {\n (specFromChildren as any)[specResult.specName] = [];\n }\n\n (specFromChildren as any)[specResult.specName].push(specResult.spec);\n }\n }\n });\n\n return specFromChildren;\n};\n\nconst BaseChart: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const chartContext = useRef<ChartContextType>({});\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 specFromChildren = useRef<Omit<ISpec, 'type' | 'data' | 'width' | 'height'>>(null);\n const eventsBinded = React.useRef<BaseChartProps>(null);\n const skipFunctionDiff = !!props.skipFunctionDiff;\n const [tooltipNode, setTooltipNode] = useState<ReactNode>(null);\n\n const parseSpec = (props: Props) => {\n let spec: ISpec;\n\n if (hasSpec && props.spec) {\n spec = props.spec;\n\n if (isValid(props.data)) {\n spec = {\n ...props.spec,\n data: props.data\n } as ISpec;\n }\n } else {\n spec = {\n ...prevSpec.current,\n ...specFromChildren.current\n } as ISpec;\n }\n\n const tooltipSpec = initCustomTooltip(setTooltipNode, props, spec.tooltip);\n if (tooltipSpec) {\n spec.tooltip = tooltipSpec;\n }\n return spec;\n };\n\n const createChart = (props: Props) => {\n const cs = new props.vchartConstrouctor(parseSpec(props), {\n ...props.options,\n onError: props.onError,\n autoFit: true,\n dom: props.container\n });\n chartContext.current = { ...chartContext.current, chart: cs };\n isUnmount.current = false;\n };\n\n const handleChartRender = (rebindEvent?: boolean) => {\n // rebind events after render\n if (!isUnmount.current) {\n if (!chartContext.current || !chartContext.current.chart) {\n return;\n }\n\n if (rebindEvent) {\n bindEventsToChart(chartContext.current.chart, props, eventsBinded.current, CHART_EVENTS);\n }\n\n const newView = chartContext.current.chart.getCompiler().getVGrammarView();\n\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(chartContext.current.chart, updateId === 0);\n }\n setView(newView);\n }\n };\n\n const renderChart = () => {\n if (chartContext.current.chart) {\n // event should bind before render when the chart has not been rendered\n bindEventsToChart(chartContext.current.chart, props, eventsBinded.current, CHART_EVENTS);\n\n chartContext.current.chart.renderSync({\n reuse: false\n });\n handleChartRender();\n }\n };\n\n useEffect(() => {\n const newSpecFromChildren = hasSpec ? null : parseSpecFromChildren(props);\n\n if (!chartContext.current?.chart) {\n if (!hasSpec) {\n specFromChildren.current = newSpecFromChildren;\n }\n\n createChart(props);\n renderChart();\n eventsBinded.current = props;\n return;\n }\n\n if (hasSpec) {\n if (!isEqual(eventsBinded.current.spec, props.spec, { skipFunction: skipFunctionDiff })) {\n chartContext.current.chart.updateSpecSync(parseSpec(props), undefined, props.morphConfig ?? defaultMorphConfig);\n handleChartRender(true);\n eventsBinded.current = props;\n } else if (eventsBinded.current.data !== props.data) {\n chartContext.current.chart.updateFullDataSync(props.data as any);\n handleChartRender(true);\n eventsBinded.current = props;\n }\n return;\n }\n\n const newSpec = pickWithout(props, notSpecKeys);\n\n if (\n !isEqual(newSpec, prevSpec.current, { skipFunction: skipFunctionDiff }) ||\n !isEqual(newSpecFromChildren, specFromChildren.current, { skipFunction: skipFunctionDiff })\n ) {\n prevSpec.current = newSpec;\n specFromChildren.current = newSpecFromChildren;\n\n chartContext.current.chart.updateSpecSync(parseSpec(props), undefined, props.morphConfig ?? defaultMorphConfig);\n handleChartRender(true);\n eventsBinded.current = props;\n }\n }, [props]);\n\n useEffect(() => {\n return () => {\n if (chartContext) {\n if (chartContext.current && chartContext.current.chart) {\n chartContext.current.chart.release();\n chartContext.current.chart = null;\n }\n }\n eventsBinded.current = null;\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 if (typeof child === 'string') {\n return null;\n }\n\n const childId = getComponentId(child, index);\n\n return (\n <React.Fragment key={childId}>\n {React.cloneElement(child as React.ReactElement<any, React.JSXElementConstructor<any>>, {\n updateId: updateId,\n componentId: childId\n })}\n </React.Fragment>\n );\n })}\n {tooltipNode}\n </ViewContext.Provider>\n </RootChartContext.Provider>\n );\n});\n\nexport const createChart = <T extends Props>(\n componentName: string,\n defaultProps?: Partial<T>,\n registers?: (() => void)[]\n) => {\n if (registers && registers.length && defaultProps.vchartConstrouctor) {\n defaultProps.vchartConstrouctor.useRegisters(registers);\n }\n\n const Com = withContainer<ContainerProps, T>(BaseChart as any, componentName, (props: T) => {\n if (defaultProps) {\n return Object.assign(props, defaultProps);\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
@@ -1,4 +1,5 @@
1
+ import React from 'react';
1
2
  import type { BaseChartProps } from '../../charts/BaseChart';
2
3
  import type { TooltipProps } from './interface';
3
4
  import type { ITooltipSpec } from '@visactor/vchart';
4
- export declare const initCustomTooltip: (props: BaseChartProps, spec?: TooltipProps) => ITooltipSpec;
5
+ export declare const initCustomTooltip: (setTooltipNode: React.Dispatch<React.SetStateAction<React.ReactNode>>, props: BaseChartProps, spec?: TooltipProps) => ITooltipSpec;
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", {
10
10
  value: !0
11
11
  }), exports.initCustomTooltip = void 0;
12
12
 
13
- const react_1 = __importDefault(require("react")), constant_1 = require("./constant"), client_1 = require("react-dom/client"), react_dom_1 = require("react-dom"), initCustomTooltip = (props, spec) => {
13
+ const react_1 = __importDefault(require("react")), constant_1 = require("./constant"), react_dom_1 = require("react-dom"), initCustomTooltip = (setTooltipNode, props, spec) => {
14
14
  let render;
15
15
  if ((null == spec ? void 0 : spec.tooltipRender) ? (render = spec.tooltipRender,
16
16
  delete spec.tooltipRender) : props.tooltipRender && (render = props.tooltipRender),
@@ -20,23 +20,19 @@ const react_1 = __importDefault(require("react")), constant_1 = require("./const
20
20
  delete spec.reserveDefaultTooltip) : reserve = props.reserveDefaultTooltip, Object.assign(Object.assign({}, spec), {
21
21
  updateElement: (el, actualTooltip, params) => {
22
22
  const {changePositionOnly: changePositionOnly} = params;
23
- if (changePositionOnly) return;
24
- if (!reserve) {
25
- el.style.width = "auto", el.style.height = "auto", el.style.minHeight = "auto",
26
- el.style.padding = "0px";
27
- for (let i = 0; i < el.children.length; i++) {
28
- const childNode = el.children[i];
29
- childNode.className !== constant_1.REACT_TOOLTIP_ClASS_NAME && "none" !== childNode.style.display && (childNode.style.display = "none");
23
+ if (!changePositionOnly) {
24
+ if (!reserve) {
25
+ el.style.width = "auto", el.style.height = "auto", el.style.minHeight = "auto",
26
+ el.style.padding = "0px";
27
+ for (let i = 0; i < el.children.length; i++) {
28
+ const childNode = el.children[i];
29
+ childNode.className !== constant_1.REACT_TOOLTIP_ClASS_NAME && "none" !== childNode.style.display && (childNode.style.display = "none");
30
+ }
30
31
  }
32
+ setTooltipNode((0, react_dom_1.createPortal)(react_1.default.createElement("div", {
33
+ className: constant_1.REACT_TOOLTIP_ClASS_NAME
34
+ }, render(el, actualTooltip, params)), el));
31
35
  }
32
- let container = el.querySelector(`.${constant_1.REACT_TOOLTIP_ClASS_NAME}`);
33
- container || (container = document.createElement("div"), container.className = constant_1.REACT_TOOLTIP_ClASS_NAME,
34
- el.appendChild(container));
35
- const element = render(el, actualTooltip, params), finalElement = react_1.default.isValidElement(element) ? element : react_1.default.createElement(react_1.default.Fragment, null, element);
36
- if (client_1.createRoot) if (container.reactRoot) container.reactRoot.render(finalElement); else {
37
- const root = (0, client_1.createRoot)(container);
38
- container.reactRoot = root, root.render(finalElement);
39
- } else (0, react_dom_1.render)(finalElement, container);
40
36
  }
41
37
  });
42
38
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/tooltip/util.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B,yCAAsD;AACtD,6CAA8C;AAC9C,yCAAkD;AAG3C,MAAM,iBAAiB,GAAG,CAAC,KAAqB,EAAE,IAAmB,EAAE,EAAE;IAC9E,IAAI,MAAqB,CAAC;IAC1B,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,aAAa,EAAE;QACvB,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC;QAC5B,OAAO,IAAI,CAAC,aAAa,CAAC;KAC3B;SAAM,IAAI,KAAK,CAAC,aAAa,EAAE;QAC9B,MAAM,GAAG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,aAAa,CAAC,KAAK,CAAC,CAAC;oBAC1C,SAAS,CAAC,SAAS,GAAG,mCAAwB,CAAC;oBAC/C,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;iBAC3B;gBACD,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;gBAClD,MAAM,YAAY,GAAG,eAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,8BAAC,eAAK,CAAC,QAAQ,QAAE,OAAO,CAAkB,CAAC;gBAE1G,IAAI,mBAAU,EAAE;oBACd,IAAK,SAAiB,CAAC,SAAS,EAAE;wBAC/B,SAAiB,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;qBACnD;yBAAM;wBACL,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,SAAS,CAAC,CAAC;wBAClC,SAAiB,CAAC,SAAS,GAAG,IAAI,CAAC;wBACpC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;qBAC3B;iBACF;qBAAM;oBAEL,IAAA,kBAAW,EAAC,YAAY,EAAE,SAAS,CAAC,CAAC;iBACtC;YACH,CAAC,GACc,CAAC;KACnB;IAED,OAAO,IAAoB,CAAC;AAC9B,CAAC,CAAC;AAhEW,QAAA,iBAAiB,qBAgE5B","file":"util.js","sourcesContent":["import React from 'react';\nimport type { BaseChartProps } from '../../charts/BaseChart';\nimport type { TooltipProps, TooltipRender } from './interface';\nimport type { ITooltipSpec } from '@visactor/vchart';\nimport { REACT_TOOLTIP_ClASS_NAME } from './constant';\nimport { createRoot } from 'react-dom/client';\nimport { render as reactRender } from 'react-dom';\n\n/** tooltip 自定义插槽 */\nexport const initCustomTooltip = (props: BaseChartProps, spec?: TooltipProps) => {\n let render: TooltipRender;\n if (spec?.tooltipRender) {\n render = spec.tooltipRender;\n delete spec.tooltipRender;\n } else if (props.tooltipRender) {\n render = props.tooltipRender;\n }\n\n if (render) {\n let reserve: boolean;\n if (spec?.reserveDefaultTooltip) {\n reserve = spec.reserveDefaultTooltip;\n delete spec.reserveDefaultTooltip;\n } else {\n reserve = props.reserveDefaultTooltip;\n }\n return {\n ...spec,\n updateElement: (el, actualTooltip, params) => {\n const { changePositionOnly } = params;\n if (changePositionOnly) {\n return;\n }\n if (!reserve) {\n el.style.width = 'auto';\n el.style.height = 'auto';\n el.style.minHeight = 'auto';\n el.style.padding = '0px';\n for (let i = 0; i < el.children.length; i++) {\n const childNode = el.children[i] as HTMLElement;\n if (childNode.className !== REACT_TOOLTIP_ClASS_NAME && childNode.style.display !== 'none') {\n childNode.style.display = 'none';\n }\n }\n }\n\n let container = el.querySelector(`.${REACT_TOOLTIP_ClASS_NAME}`);\n if (!container) {\n // eslint-disable-next-line no-undef\n container = document.createElement('div');\n container.className = REACT_TOOLTIP_ClASS_NAME;\n el.appendChild(container);\n }\n const element = render(el, actualTooltip, params);\n const finalElement = React.isValidElement(element) ? element : <React.Fragment>{element}</React.Fragment>;\n\n if (createRoot) {\n if ((container as any).reactRoot) {\n (container as any).reactRoot.render(finalElement);\n } else {\n const root = createRoot(container);\n (container as any).reactRoot = root;\n root.render(finalElement);\n }\n } else {\n // react 17 以及以下\n reactRender(finalElement, container);\n }\n }\n } as ITooltipSpec;\n }\n\n return spec as ITooltipSpec;\n};\n"]}
1
+ {"version":3,"sources":["../src/components/tooltip/util.tsx"],"names":[],"mappings":";;;;;;AACA,kDAA0B;AAI1B,yCAAsD;AACtD,yCAAyC;AAGlC,MAAM,iBAAiB,GAAG,CAC/B,cAAqE,EACrE,KAAqB,EACrB,IAAmB,EACnB,EAAE;IACF,IAAI,MAAqB,CAAC;IAC1B,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,aAAa,EAAE;QACvB,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC;QAC5B,OAAO,IAAI,CAAC,aAAa,CAAC;KAC3B;SAAM,IAAI,KAAK,CAAC,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CAAC,CAAO,EAAE,EAAE,CAAC,CACtG,CAAC;YACJ,CAAC,GACc,CAAC;KACnB;IAED,OAAO,IAAoB,CAAC;AAC9B,CAAC,CAAC;AAjDW,QAAA,iBAAiB,qBAiD5B","file":"util.js","sourcesContent":["// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport React from 'react';\nimport type { BaseChartProps } from '../../charts/BaseChart';\nimport type { TooltipProps, TooltipRender } from './interface';\nimport type { ITooltipSpec } from '@visactor/vchart';\nimport { REACT_TOOLTIP_ClASS_NAME } from './constant';\nimport { createPortal } from 'react-dom';\n\n/** tooltip 自定义插槽 */\nexport const initCustomTooltip = (\n setTooltipNode: React.Dispatch<React.SetStateAction<React.ReactNode>>,\n props: BaseChartProps,\n spec?: TooltipProps\n) => {\n let render: TooltipRender;\n if (spec?.tooltipRender) {\n render = spec.tooltipRender;\n delete spec.tooltipRender;\n } else if (props.tooltipRender) {\n render = props.tooltipRender;\n }\n\n if (render) {\n let reserve: boolean;\n if (spec?.reserveDefaultTooltip) {\n reserve = spec.reserveDefaultTooltip;\n delete spec.reserveDefaultTooltip;\n } else {\n reserve = props.reserveDefaultTooltip;\n }\n return {\n ...spec,\n updateElement: (el, actualTooltip, params) => {\n const { changePositionOnly } = params;\n if (changePositionOnly) {\n return;\n }\n if (!reserve) {\n el.style.width = 'auto';\n el.style.height = 'auto';\n el.style.minHeight = 'auto';\n el.style.padding = '0px';\n for (let i = 0; i < el.children.length; i++) {\n const childNode = el.children[i] as HTMLElement;\n if (childNode.className !== REACT_TOOLTIP_ClASS_NAME && childNode.style.display !== 'none') {\n childNode.style.display = 'none';\n }\n }\n }\n\n setTooltipNode(\n createPortal(<div className={REACT_TOOLTIP_ClASS_NAME}>{render(el, actualTooltip, params)}</div>, el)\n );\n }\n } as ITooltipSpec;\n }\n\n return spec as ITooltipSpec;\n};\n"]}
@@ -4,5 +4,6 @@ export interface ContainerProps {
4
4
  className?: string;
5
5
  width?: number | string;
6
6
  height?: number | string;
7
+ id?: string;
7
8
  }
8
9
  export default function withContainer<Props extends ContainerProps, CompProps>(Comp: any, name?: string, getProps?: (props: any) => CompProps): React.ForwardRefExoticComponent<React.PropsWithoutRef<CompProps & Props> & React.RefAttributes<any>>;
@@ -41,16 +41,17 @@ const react_1 = __importStar(require("react"));
41
41
 
42
42
  function withContainer(Comp, name = "ChartContainer", getProps) {
43
43
  const Cls = react_1.default.forwardRef(((props, ref) => {
44
- const container = (0, react_1.useRef)(), [inited, setInited] = (0, react_1.useState)(!1), {className: className, style: style, width: width} = props, options = __rest(props, [ "className", "style", "width" ]);
44
+ const container = (0, react_1.useRef)(), [inited, setInited] = (0, react_1.useState)(!1), {className: className, style: style, width: width, height: height, id: id} = props, options = __rest(props, [ "className", "style", "width", "height", "id" ]);
45
45
  return (0, react_1.useLayoutEffect)((() => {
46
46
  setInited(!0);
47
47
  }), []), react_1.default.createElement("div", {
48
48
  ref: container,
49
+ id: id,
49
50
  className: className,
50
51
  style: Object.assign({
51
52
  position: "relative",
52
- height: props.height || "100%",
53
- width: props.width || "100%"
53
+ height: height || "100%",
54
+ width: width || "100%"
54
55
  }, style)
55
56
  }, inited ? react_1.default.createElement(Comp, Object.assign({
56
57
  ref: ref,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/containers/withContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiE;AASjE,SAAwB,aAAa,CACnC,IAAS,EACT,IAAI,GAAG,gBAAgB,EACvB,QAAoC;IAEpC,MAAM,GAAG,GAAG,eAAK,CAAC,UAAU,CAAyB,CAAC,KAAwB,EAAE,GAAG,EAAE,EAAE;QACrF,MAAM,SAAS,GAAG,IAAA,cAAM,GAAE,CAAC;QAC3B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,KAAiB,KAAK,EAAjB,OAAO,UAAK,KAAK,EAA/C,+BAAuC,CAAQ,CAAC;QAEtD,IAAA,uBAAe,EAAC,GAAG,EAAE;YACnB,SAAS,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,CACL,uCACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,kBACH,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,MAAM,EAC9B,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,MAAM,IACzB,KAAK,KAGT,MAAM,CAAC,CAAC,CAAC,CACR,8BAAC,IAAI,kBAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,OAAO,IAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,OAAqB,CAAC,EAAI,CAC9G,CAAC,CAAC,CAAC,CACF,6DAAK,CACN,CACG,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;IACpC,OAAO,GAAG,CAAC;AACb,CAAC;AAnCD,gCAmCC","file":"withContainer.js","sourcesContent":["import React, { useRef, useState, useLayoutEffect } from 'react';\n\nexport interface ContainerProps {\n style?: React.CSSProperties;\n className?: string;\n width?: number | string;\n height?: number | string;\n}\n\nexport default function withContainer<Props extends ContainerProps, CompProps>(\n Comp: any,\n name = 'ChartContainer',\n getProps?: (props: any) => CompProps\n) {\n const Cls = React.forwardRef<any, CompProps & Props>((props: CompProps & Props, ref) => {\n const container = useRef();\n const [inited, setInited] = useState(false);\n const { className, style, width, ...options } = props;\n\n useLayoutEffect(() => {\n setInited(true);\n }, []);\n\n return (\n <div\n ref={container}\n className={className}\n style={{\n position: 'relative',\n height: props.height || '100%',\n width: props.width || '100%',\n ...style\n }}\n >\n {inited ? (\n <Comp ref={ref} container={container.current} {...(getProps ? getProps(options) : (options as CompProps))} />\n ) : (\n <></>\n )}\n </div>\n );\n });\n Cls.displayName = name || Comp.name;\n return Cls;\n}\n"]}
1
+ {"version":3,"sources":["../src/containers/withContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiE;AAUjE,SAAwB,aAAa,CACnC,IAAS,EACT,IAAI,GAAG,gBAAgB,EACvB,QAAoC;IAEpC,MAAM,GAAG,GAAG,eAAK,CAAC,UAAU,CAAyB,CAAC,KAAwB,EAAE,GAAG,EAAE,EAAE;QACrF,MAAM,SAAS,GAAG,IAAA,cAAM,GAAE,CAAC;QAC3B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAiB,KAAK,EAAjB,OAAO,UAAK,KAAK,EAA3D,+CAAmD,CAAQ,CAAC;QAElE,IAAA,uBAAe,EAAC,GAAG,EAAE;YACnB,SAAS,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,CACL,uCACE,GAAG,EAAE,SAAS,EACd,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,SAAS,EACpB,KAAK,kBACH,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,MAAM,IAAI,MAAM,EACxB,KAAK,EAAE,KAAK,IAAI,MAAM,IACnB,KAAK,KAGT,MAAM,CAAC,CAAC,CAAC,CACR,8BAAC,IAAI,kBAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,OAAO,IAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,OAAqB,CAAC,EAAI,CAC9G,CAAC,CAAC,CAAC,CACF,6DAAK,CACN,CACG,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;IACpC,OAAO,GAAG,CAAC;AACb,CAAC;AApCD,gCAoCC","file":"withContainer.js","sourcesContent":["import React, { useRef, useState, useLayoutEffect } from 'react';\n\nexport interface ContainerProps {\n style?: React.CSSProperties;\n className?: string;\n width?: number | string;\n height?: number | string;\n id?: string;\n}\n\nexport default function withContainer<Props extends ContainerProps, CompProps>(\n Comp: any,\n name = 'ChartContainer',\n getProps?: (props: any) => CompProps\n) {\n const Cls = React.forwardRef<any, CompProps & Props>((props: CompProps & Props, ref) => {\n const container = useRef();\n const [inited, setInited] = useState(false);\n const { className, style, width, height, id, ...options } = props;\n\n useLayoutEffect(() => {\n setInited(true);\n }, []);\n\n return (\n <div\n ref={container}\n id={id}\n className={className}\n style={{\n position: 'relative',\n height: height || '100%',\n width: width || '100%',\n ...style\n }}\n >\n {inited ? (\n <Comp ref={ref} container={container.current} {...(getProps ? getProps(options) : (options as CompProps))} />\n ) : (\n <></>\n )}\n </div>\n );\n });\n Cls.displayName = name || Comp.name;\n return Cls;\n}\n"]}
package/cjs/index.d.ts CHANGED
@@ -5,5 +5,5 @@ export * from './VChart';
5
5
  export * from './VChartSimple';
6
6
  export * from './register';
7
7
  export { VChart as VChartCore } from '@visactor/vchart';
8
- export declare const version = "1.13.11-alpha.1";
8
+ export declare const version = "1.13.11-alpha.2";
9
9
  export type { IAreaChartSpec, IBarChartSpec, IBar3dChartSpec, IBoxPlotChartSpec, ICirclePackingChartSpec, ICommonChartSpec, IFunnelChartSpec, IFunnel3dChartSpec, IGaugeChartSpec, IHeatmapChartSpec, IHistogramChartSpec, IHistogram3dChartSpec, ILineChartSpec, IMapChartSpec, IPieChartSpec, IPie3dChartSpec, ICircularProgressChartSpec, ILinearProgressChartSpec, IRadarChartSpec, IRangeColumnChartSpec, IRangeColumn3dChartSpec, IRangeAreaChartSpec, IRoseChartSpec, IScatterChartSpec, ISankeyChartSpec, ISequenceChartSpec, ISunburstChartSpec, ITreemapChartSpec, IWaterfallChartSpec, ICorrelationChartSpec, ILiquidChartSpec, IWordCloud3dChartSpec, IWordCloudChartSpec, IPolarChartSpec, ICartesianChartSpec, ITheme, IInitOption, ISpec, IVChart } from '@visactor/vchart';
package/cjs/index.js CHANGED
@@ -29,5 +29,5 @@ Object.defineProperty(exports, "VChartCore", {
29
29
  get: function() {
30
30
  return vchart_1.VChart;
31
31
  }
32
- }), exports.version = "1.13.11-alpha.1";
32
+ }), exports.version = "1.13.11-alpha.2";
33
33
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB;AACzB,+CAA6B;AAC7B,2CAAyB;AACzB,iDAA+B;AAC/B,6CAA2B;AAC3B,2CAAwD;AAA/C,oGAAA,MAAM,OAAc;AAGhB,QAAA,OAAO,GAAG,iBAAiB,CAAC","file":"index.js","sourcesContent":["export * from './charts';\nexport * from './series';\nexport * from './components';\nexport * from './VChart';\nexport * from './VChartSimple';\nexport * from './register';\nexport { VChart as VChartCore } from '@visactor/vchart';\n\n// export the version, since @1.8.3\nexport const version = \"1.13.11-alpha.1\";\n\nexport type {\n IAreaChartSpec,\n IBarChartSpec,\n IBar3dChartSpec,\n IBoxPlotChartSpec,\n ICirclePackingChartSpec,\n ICommonChartSpec,\n IFunnelChartSpec,\n IFunnel3dChartSpec,\n IGaugeChartSpec,\n IHeatmapChartSpec,\n IHistogramChartSpec,\n IHistogram3dChartSpec,\n ILineChartSpec,\n IMapChartSpec,\n IPieChartSpec,\n IPie3dChartSpec,\n ICircularProgressChartSpec,\n ILinearProgressChartSpec,\n IRadarChartSpec,\n IRangeColumnChartSpec,\n IRangeColumn3dChartSpec,\n IRangeAreaChartSpec,\n IRoseChartSpec,\n IScatterChartSpec,\n ISankeyChartSpec,\n ISequenceChartSpec,\n ISunburstChartSpec,\n ITreemapChartSpec,\n IWaterfallChartSpec,\n ICorrelationChartSpec,\n ILiquidChartSpec,\n IWordCloud3dChartSpec,\n IWordCloudChartSpec,\n IPolarChartSpec,\n ICartesianChartSpec,\n ITheme,\n IInitOption,\n ISpec,\n IVChart\n} from '@visactor/vchart';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB;AACzB,+CAA6B;AAC7B,2CAAyB;AACzB,iDAA+B;AAC/B,6CAA2B;AAC3B,2CAAwD;AAA/C,oGAAA,MAAM,OAAc;AAGhB,QAAA,OAAO,GAAG,iBAAiB,CAAC","file":"index.js","sourcesContent":["export * from './charts';\nexport * from './series';\nexport * from './components';\nexport * from './VChart';\nexport * from './VChartSimple';\nexport * from './register';\nexport { VChart as VChartCore } from '@visactor/vchart';\n\n// export the version, since @1.8.3\nexport const version = \"1.13.11-alpha.2\";\n\nexport type {\n IAreaChartSpec,\n IBarChartSpec,\n IBar3dChartSpec,\n IBoxPlotChartSpec,\n ICirclePackingChartSpec,\n ICommonChartSpec,\n IFunnelChartSpec,\n IFunnel3dChartSpec,\n IGaugeChartSpec,\n IHeatmapChartSpec,\n IHistogramChartSpec,\n IHistogram3dChartSpec,\n ILineChartSpec,\n IMapChartSpec,\n IPieChartSpec,\n IPie3dChartSpec,\n ICircularProgressChartSpec,\n ILinearProgressChartSpec,\n IRadarChartSpec,\n IRangeColumnChartSpec,\n IRangeColumn3dChartSpec,\n IRangeAreaChartSpec,\n IRoseChartSpec,\n IScatterChartSpec,\n ISankeyChartSpec,\n ISequenceChartSpec,\n ISunburstChartSpec,\n ITreemapChartSpec,\n IWaterfallChartSpec,\n ICorrelationChartSpec,\n ILiquidChartSpec,\n IWordCloud3dChartSpec,\n IWordCloudChartSpec,\n IPolarChartSpec,\n ICartesianChartSpec,\n ITheme,\n IInitOption,\n ISpec,\n IVChart\n} from '@visactor/vchart';\n"]}
@@ -37,12 +37,12 @@ const notSpecKeys = [ ...REACT_PRIVATE_PROPS, ...CHART_EVENTS_KEYS, "vchartConst
37
37
  var _a;
38
38
  return null === (_a = chartContext.current) || void 0 === _a ? void 0 : _a.chart;
39
39
  }));
40
- const hasSpec = !!props.spec, [view, setView] = useState(null), isUnmount = useRef(!1), prevSpec = useRef(pickWithout(props, notSpecKeys)), specFromChildren = useRef(null), eventsBinded = React.useRef(null), skipFunctionDiff = !!props.skipFunctionDiff, parseSpec = props => {
40
+ const hasSpec = !!props.spec, [view, setView] = useState(null), isUnmount = useRef(!1), prevSpec = useRef(pickWithout(props, notSpecKeys)), specFromChildren = useRef(null), eventsBinded = React.useRef(null), skipFunctionDiff = !!props.skipFunctionDiff, [tooltipNode, setTooltipNode] = useState(null), parseSpec = props => {
41
41
  let spec;
42
42
  hasSpec && props.spec ? (spec = props.spec, isValid(props.data) && (spec = Object.assign(Object.assign({}, props.spec), {
43
43
  data: props.data
44
44
  }))) : spec = Object.assign(Object.assign({}, prevSpec.current), specFromChildren.current);
45
- const tooltipSpec = initCustomTooltip(props, spec.tooltip);
45
+ const tooltipSpec = initCustomTooltip(setTooltipNode, props, spec.tooltip);
46
46
  return tooltipSpec && (spec.tooltip = tooltipSpec), spec;
47
47
  }, handleChartRender = rebindEvent => {
48
48
  if (!isUnmount.current) {
@@ -99,7 +99,7 @@ const notSpecKeys = [ ...REACT_PRIVATE_PROPS, ...CHART_EVENTS_KEYS, "vchartConst
99
99
  updateId: updateId,
100
100
  componentId: childId
101
101
  }));
102
- }))));
102
+ })), tooltipNode));
103
103
  }));
104
104
 
105
105
  export const createChart = (componentName, defaultProps, registers) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/charts/BaseChart.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAEhF,OAAO,aAAa,MAA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AO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,OAAO,IACzB,KAAK,CAAC,YAAY,CAAC,KAAkE,EAAE;gBACtF,QAAQ,EAAE,QAAQ;gBAClB,WAAW,EAAE,OAAO;aACrB,CAAC,CACa,CAClB,CAAC;QACJ,CAAC,CAAC,CACmB,CACG,CAC7B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,aAAqB,EACrB,YAAyB,EACzB,SAA0B,EAC1B,EAAE;IACF,IAAI,SAAS,IAAI,SAAS,CAAC,MAAM,IAAI,YAAY,CAAC,kBAAkB,EAAE;QACpE,YAAY,CAAC,kBAAkB,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;KACzD;IAED,MAAM,GAAG,GAAG,aAAa,CAAoB,SAAgB,EAAE,aAAa,EAAE,CAAC,KAAQ,EAAE,EAAE;QACzF,IAAI,YAAY,EAAE;YAChB,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;SAC3C;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 type {\n IVChart,\n IData,\n IInitOption,\n ISpec,\n IVChartConstructor,\n IHierarchyData,\n IVChartRenderOption\n} from '@visactor/vchart';\nimport type { ReactNode } from 'react';\nimport React, { useState, useEffect, useRef, useImperativeHandle } from 'react';\nimport type { ContainerProps } from '../containers/withContainer';\nimport withContainer from '../containers/withContainer';\nimport type { ChartContextType } from '../context/chart';\nimport RootChartContext from '../context/chart';\nimport type { IView } from '@visactor/vgrammar-core';\nimport { isEqual, isNil, isValid, pickWithout } from '@visactor/vutils';\nimport ViewContext from '../context/view';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport type {\n EventsProps,\n LegendEventProps,\n ScrollBarEventProps,\n BrushEventProps,\n DataZoomEventProps,\n PlayerEventProps,\n DimensionEventProps,\n HierarchyEventProps,\n ChartLifeCycleEventProps\n} from '../eventsUtils';\nimport { bindEventsToChart, CHART_EVENTS_KEYS, CHART_EVENTS } from '../eventsUtils';\nimport type { IReactTooltipProps } from '../components/tooltip/interface';\nimport { initCustomTooltip } from '../components/tooltip/util';\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 IReactTooltipProps {\n vchartConstrouctor?: IVChartConstructor;\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /**\n * used only by <VChart />\n */\n spec?: ISpec;\n /** 数据 */\n data?: IData | IHierarchyData;\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n /** 图表配置 */\n options?: ChartOptions;\n /** skip function diff when component update */\n skipFunctionDiff?: boolean;\n /**\n * add `morphConfig` for chart\n * @since 1.12.7\n */\n morphConfig?: IVChartRenderOption['morphConfig'];\n /** 图表渲染完成事件 */\n onReady?: (instance: IVChart, isInitial: boolean) => void;\n /** throw error when chart run into an error */\n onError?: (err: Error) => void;\n /**\n * use sync render\n *\n * @since 1.8.3\n * @deprecated 1.9.0\n **/\n useSyncRender?: boolean;\n}\n\ntype Props = React.PropsWithChildren<BaseChartProps>;\n\nconst notSpecKeys = [\n ...REACT_PRIVATE_PROPS,\n ...CHART_EVENTS_KEYS,\n 'vchartConstrouctor',\n 'useSyncRender',\n 'skipFunctionDiff',\n 'onError',\n 'onReady',\n 'spec',\n 'container',\n 'options',\n 'morphConfig'\n];\nconst defaultMorphConfig = {\n morph: false,\n enableExitAnimation: false\n};\n\nconst getComponentId = (child: React.ReactNode, index: number) => {\n const componentName = child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n return `${componentName}-${index}`;\n};\n\nconst parseSpecFromChildren = (props: Props) => {\n const specFromChildren: Omit<ISpec, 'type' | 'data' | 'width' | 'height'> = {};\n\n toArray(props.children).map((child, index) => {\n const parseSpec = child && (child as any).type && (child as any).type.parseSpec;\n\n if (parseSpec && (child as any).props) {\n const childProps = isNil((child as any).props.componentId)\n ? {\n ...(child as any).props,\n componentId: getComponentId(child, index)\n }\n : (child as any).props;\n\n const specResult = parseSpec(childProps);\n\n if (specResult.isSingle) {\n (specFromChildren as any)[specResult.specName] = specResult.spec;\n } else {\n if (!(specFromChildren as any)[specResult.specName]) {\n (specFromChildren as any)[specResult.specName] = [];\n }\n\n (specFromChildren as any)[specResult.specName].push(specResult.spec);\n }\n }\n });\n\n return specFromChildren;\n};\n\nconst BaseChart: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const chartContext = useRef<ChartContextType>({});\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 specFromChildren = useRef<Omit<ISpec, 'type' | 'data' | 'width' | 'height'>>(null);\n const eventsBinded = React.useRef<BaseChartProps>(null);\n const skipFunctionDiff = !!props.skipFunctionDiff;\n\n const parseSpec = (props: Props) => {\n let spec: ISpec;\n\n if (hasSpec && props.spec) {\n spec = props.spec;\n\n if (isValid(props.data)) {\n spec = {\n ...props.spec,\n data: props.data\n } as ISpec;\n }\n } else {\n spec = {\n ...prevSpec.current,\n ...specFromChildren.current\n } as ISpec;\n }\n\n const tooltipSpec = initCustomTooltip(props, spec.tooltip);\n if (tooltipSpec) {\n spec.tooltip = tooltipSpec;\n }\n return spec;\n };\n\n const createChart = (props: Props) => {\n const cs = new props.vchartConstrouctor(parseSpec(props), {\n ...props.options,\n onError: props.onError,\n autoFit: true,\n dom: props.container\n });\n chartContext.current = { ...chartContext.current, chart: cs };\n isUnmount.current = false;\n };\n\n const handleChartRender = (rebindEvent?: boolean) => {\n // rebind events after render\n if (!isUnmount.current) {\n if (!chartContext.current || !chartContext.current.chart) {\n return;\n }\n\n if (rebindEvent) {\n bindEventsToChart(chartContext.current.chart, props, eventsBinded.current, CHART_EVENTS);\n }\n\n const newView = chartContext.current.chart.getCompiler().getVGrammarView();\n\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(chartContext.current.chart, updateId === 0);\n }\n setView(newView);\n }\n };\n\n const renderChart = () => {\n if (chartContext.current.chart) {\n // event should bind before render when the chart has not been rendered\n bindEventsToChart(chartContext.current.chart, props, eventsBinded.current, CHART_EVENTS);\n\n chartContext.current.chart.renderSync({\n reuse: false\n });\n handleChartRender();\n }\n };\n\n useEffect(() => {\n const newSpecFromChildren = hasSpec ? null : parseSpecFromChildren(props);\n\n if (!chartContext.current?.chart) {\n if (!hasSpec) {\n specFromChildren.current = newSpecFromChildren;\n }\n\n createChart(props);\n renderChart();\n eventsBinded.current = props;\n return;\n }\n\n if (hasSpec) {\n if (!isEqual(eventsBinded.current.spec, props.spec, { skipFunction: skipFunctionDiff })) {\n chartContext.current.chart.updateSpecSync(parseSpec(props), undefined, props.morphConfig ?? defaultMorphConfig);\n handleChartRender(true);\n eventsBinded.current = props;\n } else if (eventsBinded.current.data !== props.data) {\n chartContext.current.chart.updateFullDataSync(props.data as any);\n handleChartRender(true);\n eventsBinded.current = props;\n }\n return;\n }\n\n const newSpec = pickWithout(props, notSpecKeys);\n\n if (\n !isEqual(newSpec, prevSpec.current, { skipFunction: skipFunctionDiff }) ||\n !isEqual(newSpecFromChildren, specFromChildren.current, { skipFunction: skipFunctionDiff })\n ) {\n prevSpec.current = newSpec;\n specFromChildren.current = newSpecFromChildren;\n\n chartContext.current.chart.updateSpecSync(parseSpec(props), undefined, props.morphConfig ?? defaultMorphConfig);\n handleChartRender(true);\n eventsBinded.current = props;\n }\n }, [props]);\n\n useEffect(() => {\n return () => {\n if (chartContext) {\n if (chartContext.current && chartContext.current.chart) {\n chartContext.current.chart.release();\n chartContext.current.chart = null;\n }\n }\n eventsBinded.current = null;\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 if (typeof child === 'string') {\n return null;\n }\n\n const childId = getComponentId(child, index);\n\n return (\n <React.Fragment key={childId}>\n {React.cloneElement(child as React.ReactElement<any, React.JSXElementConstructor<any>>, {\n updateId: updateId,\n componentId: childId\n })}\n </React.Fragment>\n );\n })}\n </ViewContext.Provider>\n </RootChartContext.Provider>\n );\n});\n\nexport const createChart = <T extends Props>(\n componentName: string,\n defaultProps?: Partial<T>,\n registers?: (() => void)[]\n) => {\n if (registers && registers.length && defaultProps.vchartConstrouctor) {\n defaultProps.vchartConstrouctor.useRegisters(registers);\n }\n\n const Com = withContainer<ContainerProps, T>(BaseChart as any, componentName, (props: T) => {\n if (defaultProps) {\n return Object.assign(props, defaultProps);\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
1
+ {"version":3,"sources":["../src/charts/BaseChart.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAEhF,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAExD,OAAO,gBAAgB,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAYnD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEpF,OAAO,EAA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,WAAW,GAAG,CACzB,aAAqB,EACrB,YAAyB,EACzB,SAA0B,EAC1B,EAAE;IACF,IAAI,SAAS,IAAI,SAAS,CAAC,MAAM,IAAI,YAAY,CAAC,kBAAkB,EAAE;QACpE,YAAY,CAAC,kBAAkB,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;KACzD;IAED,MAAM,GAAG,GAAG,aAAa,CAAoB,SAAgB,EAAE,aAAa,EAAE,CAAC,KAAQ,EAAE,EAAE;QACzF,IAAI,YAAY,EAAE;YAChB,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;SAC3C;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 type {\n IVChart,\n IData,\n IInitOption,\n ISpec,\n IVChartConstructor,\n IHierarchyData,\n IVChartRenderOption\n} from '@visactor/vchart';\nimport type { ReactNode } from 'react';\nimport React, { useState, useEffect, useRef, useImperativeHandle } from 'react';\nimport type { ContainerProps } from '../containers/withContainer';\nimport withContainer from '../containers/withContainer';\nimport type { ChartContextType } from '../context/chart';\nimport RootChartContext from '../context/chart';\nimport type { IView } from '@visactor/vgrammar-core';\nimport { isEqual, isNil, isValid, pickWithout } from '@visactor/vutils';\nimport ViewContext from '../context/view';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport type {\n EventsProps,\n LegendEventProps,\n ScrollBarEventProps,\n BrushEventProps,\n DataZoomEventProps,\n PlayerEventProps,\n DimensionEventProps,\n HierarchyEventProps,\n ChartLifeCycleEventProps\n} from '../eventsUtils';\nimport { bindEventsToChart, CHART_EVENTS_KEYS, CHART_EVENTS } from '../eventsUtils';\nimport type { IReactTooltipProps } from '../components/tooltip/interface';\nimport { initCustomTooltip } from '../components/tooltip/util';\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 IReactTooltipProps {\n vchartConstrouctor?: IVChartConstructor;\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /**\n * used only by <VChart />\n */\n spec?: ISpec;\n /** 数据 */\n data?: IData | IHierarchyData;\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n /** 图表配置 */\n options?: ChartOptions;\n /** skip function diff when component update */\n skipFunctionDiff?: boolean;\n /**\n * add `morphConfig` for chart\n * @since 1.12.7\n */\n morphConfig?: IVChartRenderOption['morphConfig'];\n /** 图表渲染完成事件 */\n onReady?: (instance: IVChart, isInitial: boolean) => void;\n /** throw error when chart run into an error */\n onError?: (err: Error) => void;\n /**\n * use sync render\n *\n * @since 1.8.3\n * @deprecated 1.9.0\n **/\n useSyncRender?: boolean;\n}\n\ntype Props = React.PropsWithChildren<BaseChartProps>;\n\nconst notSpecKeys = [\n ...REACT_PRIVATE_PROPS,\n ...CHART_EVENTS_KEYS,\n 'vchartConstrouctor',\n 'useSyncRender',\n 'skipFunctionDiff',\n 'onError',\n 'onReady',\n 'spec',\n 'container',\n 'options',\n 'morphConfig'\n];\nconst defaultMorphConfig = {\n morph: false,\n enableExitAnimation: false\n};\n\nconst getComponentId = (child: React.ReactNode, index: number) => {\n const componentName = child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n return `${componentName}-${index}`;\n};\n\nconst parseSpecFromChildren = (props: Props) => {\n const specFromChildren: Omit<ISpec, 'type' | 'data' | 'width' | 'height'> = {};\n\n toArray(props.children).map((child, index) => {\n const parseSpec = child && (child as any).type && (child as any).type.parseSpec;\n\n if (parseSpec && (child as any).props) {\n const childProps = isNil((child as any).props.componentId)\n ? {\n ...(child as any).props,\n componentId: getComponentId(child, index)\n }\n : (child as any).props;\n\n const specResult = parseSpec(childProps);\n\n if (specResult.isSingle) {\n (specFromChildren as any)[specResult.specName] = specResult.spec;\n } else {\n if (!(specFromChildren as any)[specResult.specName]) {\n (specFromChildren as any)[specResult.specName] = [];\n }\n\n (specFromChildren as any)[specResult.specName].push(specResult.spec);\n }\n }\n });\n\n return specFromChildren;\n};\n\nconst BaseChart: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const chartContext = useRef<ChartContextType>({});\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 specFromChildren = useRef<Omit<ISpec, 'type' | 'data' | 'width' | 'height'>>(null);\n const eventsBinded = React.useRef<BaseChartProps>(null);\n const skipFunctionDiff = !!props.skipFunctionDiff;\n const [tooltipNode, setTooltipNode] = useState<ReactNode>(null);\n\n const parseSpec = (props: Props) => {\n let spec: ISpec;\n\n if (hasSpec && props.spec) {\n spec = props.spec;\n\n if (isValid(props.data)) {\n spec = {\n ...props.spec,\n data: props.data\n } as ISpec;\n }\n } else {\n spec = {\n ...prevSpec.current,\n ...specFromChildren.current\n } as ISpec;\n }\n\n const tooltipSpec = initCustomTooltip(setTooltipNode, props, spec.tooltip);\n if (tooltipSpec) {\n spec.tooltip = tooltipSpec;\n }\n return spec;\n };\n\n const createChart = (props: Props) => {\n const cs = new props.vchartConstrouctor(parseSpec(props), {\n ...props.options,\n onError: props.onError,\n autoFit: true,\n dom: props.container\n });\n chartContext.current = { ...chartContext.current, chart: cs };\n isUnmount.current = false;\n };\n\n const handleChartRender = (rebindEvent?: boolean) => {\n // rebind events after render\n if (!isUnmount.current) {\n if (!chartContext.current || !chartContext.current.chart) {\n return;\n }\n\n if (rebindEvent) {\n bindEventsToChart(chartContext.current.chart, props, eventsBinded.current, CHART_EVENTS);\n }\n\n const newView = chartContext.current.chart.getCompiler().getVGrammarView();\n\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(chartContext.current.chart, updateId === 0);\n }\n setView(newView);\n }\n };\n\n const renderChart = () => {\n if (chartContext.current.chart) {\n // event should bind before render when the chart has not been rendered\n bindEventsToChart(chartContext.current.chart, props, eventsBinded.current, CHART_EVENTS);\n\n chartContext.current.chart.renderSync({\n reuse: false\n });\n handleChartRender();\n }\n };\n\n useEffect(() => {\n const newSpecFromChildren = hasSpec ? null : parseSpecFromChildren(props);\n\n if (!chartContext.current?.chart) {\n if (!hasSpec) {\n specFromChildren.current = newSpecFromChildren;\n }\n\n createChart(props);\n renderChart();\n eventsBinded.current = props;\n return;\n }\n\n if (hasSpec) {\n if (!isEqual(eventsBinded.current.spec, props.spec, { skipFunction: skipFunctionDiff })) {\n chartContext.current.chart.updateSpecSync(parseSpec(props), undefined, props.morphConfig ?? defaultMorphConfig);\n handleChartRender(true);\n eventsBinded.current = props;\n } else if (eventsBinded.current.data !== props.data) {\n chartContext.current.chart.updateFullDataSync(props.data as any);\n handleChartRender(true);\n eventsBinded.current = props;\n }\n return;\n }\n\n const newSpec = pickWithout(props, notSpecKeys);\n\n if (\n !isEqual(newSpec, prevSpec.current, { skipFunction: skipFunctionDiff }) ||\n !isEqual(newSpecFromChildren, specFromChildren.current, { skipFunction: skipFunctionDiff })\n ) {\n prevSpec.current = newSpec;\n specFromChildren.current = newSpecFromChildren;\n\n chartContext.current.chart.updateSpecSync(parseSpec(props), undefined, props.morphConfig ?? defaultMorphConfig);\n handleChartRender(true);\n eventsBinded.current = props;\n }\n }, [props]);\n\n useEffect(() => {\n return () => {\n if (chartContext) {\n if (chartContext.current && chartContext.current.chart) {\n chartContext.current.chart.release();\n chartContext.current.chart = null;\n }\n }\n eventsBinded.current = null;\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 if (typeof child === 'string') {\n return null;\n }\n\n const childId = getComponentId(child, index);\n\n return (\n <React.Fragment key={childId}>\n {React.cloneElement(child as React.ReactElement<any, React.JSXElementConstructor<any>>, {\n updateId: updateId,\n componentId: childId\n })}\n </React.Fragment>\n );\n })}\n {tooltipNode}\n </ViewContext.Provider>\n </RootChartContext.Provider>\n );\n});\n\nexport const createChart = <T extends Props>(\n componentName: string,\n defaultProps?: Partial<T>,\n registers?: (() => void)[]\n) => {\n if (registers && registers.length && defaultProps.vchartConstrouctor) {\n defaultProps.vchartConstrouctor.useRegisters(registers);\n }\n\n const Com = withContainer<ContainerProps, T>(BaseChart as any, componentName, (props: T) => {\n if (defaultProps) {\n return Object.assign(props, defaultProps);\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
@@ -1,4 +1,5 @@
1
+ import React from 'react';
1
2
  import type { BaseChartProps } from '../../charts/BaseChart';
2
3
  import type { TooltipProps } from './interface';
3
4
  import type { ITooltipSpec } from '@visactor/vchart';
4
- export declare const initCustomTooltip: (props: BaseChartProps, spec?: TooltipProps) => ITooltipSpec;
5
+ export declare const initCustomTooltip: (setTooltipNode: React.Dispatch<React.SetStateAction<React.ReactNode>>, props: BaseChartProps, spec?: TooltipProps) => ITooltipSpec;
@@ -2,11 +2,9 @@ import React from "react";
2
2
 
3
3
  import { REACT_TOOLTIP_ClASS_NAME } from "./constant";
4
4
 
5
- import { createRoot } from "react-dom/client";
5
+ import { createPortal } from "react-dom";
6
6
 
7
- import { render as reactRender } from "react-dom";
8
-
9
- export const initCustomTooltip = (props, spec) => {
7
+ export const initCustomTooltip = (setTooltipNode, props, spec) => {
10
8
  let render;
11
9
  if ((null == spec ? void 0 : spec.tooltipRender) ? (render = spec.tooltipRender,
12
10
  delete spec.tooltipRender) : props.tooltipRender && (render = props.tooltipRender),
@@ -16,23 +14,19 @@ export const initCustomTooltip = (props, spec) => {
16
14
  delete spec.reserveDefaultTooltip) : reserve = props.reserveDefaultTooltip, Object.assign(Object.assign({}, spec), {
17
15
  updateElement: (el, actualTooltip, params) => {
18
16
  const {changePositionOnly: changePositionOnly} = params;
19
- if (changePositionOnly) return;
20
- if (!reserve) {
21
- el.style.width = "auto", el.style.height = "auto", el.style.minHeight = "auto",
22
- el.style.padding = "0px";
23
- for (let i = 0; i < el.children.length; i++) {
24
- const childNode = el.children[i];
25
- childNode.className !== REACT_TOOLTIP_ClASS_NAME && "none" !== childNode.style.display && (childNode.style.display = "none");
17
+ if (!changePositionOnly) {
18
+ if (!reserve) {
19
+ el.style.width = "auto", el.style.height = "auto", el.style.minHeight = "auto",
20
+ el.style.padding = "0px";
21
+ for (let i = 0; i < el.children.length; i++) {
22
+ const childNode = el.children[i];
23
+ childNode.className !== REACT_TOOLTIP_ClASS_NAME && "none" !== childNode.style.display && (childNode.style.display = "none");
24
+ }
26
25
  }
26
+ setTooltipNode(createPortal(React.createElement("div", {
27
+ className: REACT_TOOLTIP_ClASS_NAME
28
+ }, render(el, actualTooltip, params)), el));
27
29
  }
28
- let container = el.querySelector(`.${REACT_TOOLTIP_ClASS_NAME}`);
29
- container || (container = document.createElement("div"), container.className = REACT_TOOLTIP_ClASS_NAME,
30
- el.appendChild(container));
31
- const element = render(el, actualTooltip, params), finalElement = React.isValidElement(element) ? element : React.createElement(React.Fragment, null, element);
32
- if (createRoot) if (container.reactRoot) container.reactRoot.render(finalElement); else {
33
- const root = createRoot(container);
34
- container.reactRoot = root, root.render(finalElement);
35
- } else reactRender(finalElement, container);
36
30
  }
37
31
  });
38
32
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/tooltip/util.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAGlD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAqB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AC,KAAK,CAAC,OAAO,KAAK,MAAM,EAAE;4BAC1F,SAAS,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;yBAClC;qBACF;iBACF;gBAED,IAAI,SAAS,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,wBAAwB,EAAE,CAAC,CAAC;gBACjE,IAAI,CAAC,SAAS,EAAE;oBAEd,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;oBAC1C,SAAS,CAAC,SAAS,GAAG,wBAAwB,CAAC;oBAC/C,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;iBAC3B;gBACD,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;gBAClD,MAAM,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAC,KAAK,CAAC,QAAQ,QAAE,OAAO,CAAkB,CAAC;gBAE1G,IAAI,UAAU,EAAE;oBACd,IAAK,SAAiB,CAAC,SAAS,EAAE;wBAC/B,SAAiB,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;qBACnD;yBAAM;wBACL,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;wBAClC,SAAiB,CAAC,SAAS,GAAG,IAAI,CAAC;wBACpC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;qBAC3B;iBACF;qBAAM;oBAEL,WAAW,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;iBACtC;YACH,CAAC,GACc,CAAC;KACnB;IAED,OAAO,IAAoB,CAAC;AAC9B,CAAC,CAAC","file":"util.js","sourcesContent":["import React from 'react';\nimport type { BaseChartProps } from '../../charts/BaseChart';\nimport type { TooltipProps, TooltipRender } from './interface';\nimport type { ITooltipSpec } from '@visactor/vchart';\nimport { REACT_TOOLTIP_ClASS_NAME } from './constant';\nimport { createRoot } from 'react-dom/client';\nimport { render as reactRender } from 'react-dom';\n\n/** tooltip 自定义插槽 */\nexport const initCustomTooltip = (props: BaseChartProps, spec?: TooltipProps) => {\n let render: TooltipRender;\n if (spec?.tooltipRender) {\n render = spec.tooltipRender;\n delete spec.tooltipRender;\n } else if (props.tooltipRender) {\n render = props.tooltipRender;\n }\n\n if (render) {\n let reserve: boolean;\n if (spec?.reserveDefaultTooltip) {\n reserve = spec.reserveDefaultTooltip;\n delete spec.reserveDefaultTooltip;\n } else {\n reserve = props.reserveDefaultTooltip;\n }\n return {\n ...spec,\n updateElement: (el, actualTooltip, params) => {\n const { changePositionOnly } = params;\n if (changePositionOnly) {\n return;\n }\n if (!reserve) {\n el.style.width = 'auto';\n el.style.height = 'auto';\n el.style.minHeight = 'auto';\n el.style.padding = '0px';\n for (let i = 0; i < el.children.length; i++) {\n const childNode = el.children[i] as HTMLElement;\n if (childNode.className !== REACT_TOOLTIP_ClASS_NAME && childNode.style.display !== 'none') {\n childNode.style.display = 'none';\n }\n }\n }\n\n let container = el.querySelector(`.${REACT_TOOLTIP_ClASS_NAME}`);\n if (!container) {\n // eslint-disable-next-line no-undef\n container = document.createElement('div');\n container.className = REACT_TOOLTIP_ClASS_NAME;\n el.appendChild(container);\n }\n const element = render(el, actualTooltip, params);\n const finalElement = React.isValidElement(element) ? element : <React.Fragment>{element}</React.Fragment>;\n\n if (createRoot) {\n if ((container as any).reactRoot) {\n (container as any).reactRoot.render(finalElement);\n } else {\n const root = createRoot(container);\n (container as any).reactRoot = root;\n root.render(finalElement);\n }\n } else {\n // react 17 以及以下\n reactRender(finalElement, container);\n }\n }\n } as ITooltipSpec;\n }\n\n return spec as ITooltipSpec;\n};\n"]}
1
+ {"version":3,"sources":["../src/components/tooltip/util.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,M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,CAAC,CAAgB,CAAC;wBAChD,IAAI,SAAS,CAAC,SAAS,KAAK,wBAAwB,IAAI,SAAS,CAAC,KAAK,CAAC,OAAO,KAAK,MAAM,EAAE;4BAC1F,SAAS,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;yBAClC;qBACF;iBACF;gBAED,cAAc,CACZ,YAAY,CAAC,6BAAK,SAAS,EAAE,wBAAwB,IAAG,MAAM,CAAC,EAAE,EAAE,aAAa,EAAE,MAAM,CAAC,CAAO,EAAE,EAAE,CAAC,CACtG,CAAC;YACJ,CAAC,GACc,CAAC;KACnB;IAED,OAAO,IAAoB,CAAC;AAC9B,CAAC,CAAC","file":"util.js","sourcesContent":["// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport React from 'react';\nimport type { BaseChartProps } from '../../charts/BaseChart';\nimport type { TooltipProps, TooltipRender } from './interface';\nimport type { ITooltipSpec } from '@visactor/vchart';\nimport { REACT_TOOLTIP_ClASS_NAME } from './constant';\nimport { createPortal } from 'react-dom';\n\n/** tooltip 自定义插槽 */\nexport const initCustomTooltip = (\n setTooltipNode: React.Dispatch<React.SetStateAction<React.ReactNode>>,\n props: BaseChartProps,\n spec?: TooltipProps\n) => {\n let render: TooltipRender;\n if (spec?.tooltipRender) {\n render = spec.tooltipRender;\n delete spec.tooltipRender;\n } else if (props.tooltipRender) {\n render = props.tooltipRender;\n }\n\n if (render) {\n let reserve: boolean;\n if (spec?.reserveDefaultTooltip) {\n reserve = spec.reserveDefaultTooltip;\n delete spec.reserveDefaultTooltip;\n } else {\n reserve = props.reserveDefaultTooltip;\n }\n return {\n ...spec,\n updateElement: (el, actualTooltip, params) => {\n const { changePositionOnly } = params;\n if (changePositionOnly) {\n return;\n }\n if (!reserve) {\n el.style.width = 'auto';\n el.style.height = 'auto';\n el.style.minHeight = 'auto';\n el.style.padding = '0px';\n for (let i = 0; i < el.children.length; i++) {\n const childNode = el.children[i] as HTMLElement;\n if (childNode.className !== REACT_TOOLTIP_ClASS_NAME && childNode.style.display !== 'none') {\n childNode.style.display = 'none';\n }\n }\n }\n\n setTooltipNode(\n createPortal(<div className={REACT_TOOLTIP_ClASS_NAME}>{render(el, actualTooltip, params)}</div>, el)\n );\n }\n } as ITooltipSpec;\n }\n\n return spec as ITooltipSpec;\n};\n"]}
@@ -4,5 +4,6 @@ export interface ContainerProps {
4
4
  className?: string;
5
5
  width?: number | string;
6
6
  height?: number | string;
7
+ id?: string;
7
8
  }
8
9
  export default function withContainer<Props extends ContainerProps, CompProps>(Comp: any, name?: string, getProps?: (props: any) => CompProps): React.ForwardRefExoticComponent<React.PropsWithoutRef<CompProps & Props> & React.RefAttributes<any>>;
@@ -12,16 +12,17 @@ import React, { useRef, useState, useLayoutEffect } from "react";
12
12
 
13
13
  export default function withContainer(Comp, name = "ChartContainer", getProps) {
14
14
  const Cls = React.forwardRef(((props, ref) => {
15
- const container = useRef(), [inited, setInited] = useState(!1), {className: className, style: style, width: width} = props, options = __rest(props, [ "className", "style", "width" ]);
15
+ const container = useRef(), [inited, setInited] = useState(!1), {className: className, style: style, width: width, height: height, id: id} = props, options = __rest(props, [ "className", "style", "width", "height", "id" ]);
16
16
  return useLayoutEffect((() => {
17
17
  setInited(!0);
18
18
  }), []), React.createElement("div", {
19
19
  ref: container,
20
+ id: id,
20
21
  className: className,
21
22
  style: Object.assign({
22
23
  position: "relative",
23
- height: props.height || "100%",
24
- width: props.width || "100%"
24
+ height: height || "100%",
25
+ width: width || "100%"
25
26
  }, style)
26
27
  }, inited ? React.createElement(Comp, Object.assign({
27
28
  ref: ref,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/containers/withContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AASjE,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,IAAS,EACT,IAAI,GAAG,gBAAgB,EACvB,QAAoC;IAEpC,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAyB,CAAC,KAAwB,EAAE,GAAG,EAAE,EAAE;QACrF,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC;QAC3B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,KAAiB,KAAK,EAAjB,OAAO,UAAK,KAAK,EAA/C,+BAAuC,CAAQ,CAAC;QAEtD,eAAe,CAAC,GAAG,EAAE;YACnB,SAAS,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,CACL,6BACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,kBACH,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,MAAM,EAC9B,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,MAAM,IACzB,KAAK,KAGT,MAAM,CAAC,CAAC,CAAC,CACR,oBAAC,IAAI,kBAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,OAAO,IAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,OAAqB,CAAC,EAAI,CAC9G,CAAC,CAAC,CAAC,CACF,yCAAK,CACN,CACG,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;IACpC,OAAO,GAAG,CAAC;AACb,CAAC","file":"withContainer.js","sourcesContent":["import React, { useRef, useState, useLayoutEffect } from 'react';\n\nexport interface ContainerProps {\n style?: React.CSSProperties;\n className?: string;\n width?: number | string;\n height?: number | string;\n}\n\nexport default function withContainer<Props extends ContainerProps, CompProps>(\n Comp: any,\n name = 'ChartContainer',\n getProps?: (props: any) => CompProps\n) {\n const Cls = React.forwardRef<any, CompProps & Props>((props: CompProps & Props, ref) => {\n const container = useRef();\n const [inited, setInited] = useState(false);\n const { className, style, width, ...options } = props;\n\n useLayoutEffect(() => {\n setInited(true);\n }, []);\n\n return (\n <div\n ref={container}\n className={className}\n style={{\n position: 'relative',\n height: props.height || '100%',\n width: props.width || '100%',\n ...style\n }}\n >\n {inited ? (\n <Comp ref={ref} container={container.current} {...(getProps ? getProps(options) : (options as CompProps))} />\n ) : (\n <></>\n )}\n </div>\n );\n });\n Cls.displayName = name || Comp.name;\n return Cls;\n}\n"]}
1
+ {"version":3,"sources":["../src/containers/withContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAUjE,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,IAAS,EACT,IAAI,GAAG,gBAAgB,EACvB,QAAoC;IAEpC,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAyB,CAAC,KAAwB,EAAE,GAAG,EAAE,EAAE;QACrF,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC;QAC3B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAiB,KAAK,EAAjB,OAAO,UAAK,KAAK,EAA3D,+CAAmD,CAAQ,CAAC;QAElE,eAAe,CAAC,GAAG,EAAE;YACnB,SAAS,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,CACL,6BACE,GAAG,EAAE,SAAS,EACd,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,SAAS,EACpB,KAAK,kBACH,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,MAAM,IAAI,MAAM,EACxB,KAAK,EAAE,KAAK,IAAI,MAAM,IACnB,KAAK,KAGT,MAAM,CAAC,CAAC,CAAC,CACR,oBAAC,IAAI,kBAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,OAAO,IAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,OAAqB,CAAC,EAAI,CAC9G,CAAC,CAAC,CAAC,CACF,yCAAK,CACN,CACG,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;IACpC,OAAO,GAAG,CAAC;AACb,CAAC","file":"withContainer.js","sourcesContent":["import React, { useRef, useState, useLayoutEffect } from 'react';\n\nexport interface ContainerProps {\n style?: React.CSSProperties;\n className?: string;\n width?: number | string;\n height?: number | string;\n id?: string;\n}\n\nexport default function withContainer<Props extends ContainerProps, CompProps>(\n Comp: any,\n name = 'ChartContainer',\n getProps?: (props: any) => CompProps\n) {\n const Cls = React.forwardRef<any, CompProps & Props>((props: CompProps & Props, ref) => {\n const container = useRef();\n const [inited, setInited] = useState(false);\n const { className, style, width, height, id, ...options } = props;\n\n useLayoutEffect(() => {\n setInited(true);\n }, []);\n\n return (\n <div\n ref={container}\n id={id}\n className={className}\n style={{\n position: 'relative',\n height: height || '100%',\n width: width || '100%',\n ...style\n }}\n >\n {inited ? (\n <Comp ref={ref} container={container.current} {...(getProps ? getProps(options) : (options as CompProps))} />\n ) : (\n <></>\n )}\n </div>\n );\n });\n Cls.displayName = name || Comp.name;\n return Cls;\n}\n"]}
package/esm/index.d.ts CHANGED
@@ -5,5 +5,5 @@ export * from './VChart';
5
5
  export * from './VChartSimple';
6
6
  export * from './register';
7
7
  export { VChart as VChartCore } from '@visactor/vchart';
8
- export declare const version = "1.13.11-alpha.1";
8
+ export declare const version = "1.13.11-alpha.2";
9
9
  export type { IAreaChartSpec, IBarChartSpec, IBar3dChartSpec, IBoxPlotChartSpec, ICirclePackingChartSpec, ICommonChartSpec, IFunnelChartSpec, IFunnel3dChartSpec, IGaugeChartSpec, IHeatmapChartSpec, IHistogramChartSpec, IHistogram3dChartSpec, ILineChartSpec, IMapChartSpec, IPieChartSpec, IPie3dChartSpec, ICircularProgressChartSpec, ILinearProgressChartSpec, IRadarChartSpec, IRangeColumnChartSpec, IRangeColumn3dChartSpec, IRangeAreaChartSpec, IRoseChartSpec, IScatterChartSpec, ISankeyChartSpec, ISequenceChartSpec, ISunburstChartSpec, ITreemapChartSpec, IWaterfallChartSpec, ICorrelationChartSpec, ILiquidChartSpec, IWordCloud3dChartSpec, IWordCloudChartSpec, IPolarChartSpec, ICartesianChartSpec, ITheme, IInitOption, ISpec, IVChart } from '@visactor/vchart';
package/esm/index.js CHANGED
@@ -12,5 +12,5 @@ export * from "./register";
12
12
 
13
13
  export { VChart as VChartCore } from "@visactor/vchart";
14
14
 
15
- export const version = "1.13.11-alpha.1";
15
+ export const version = "1.13.11-alpha.2";
16
16
  //# sourceMappingURL=index.js.map
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGxD,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAC","file":"index.js","sourcesContent":["export * from './charts';\nexport * from './series';\nexport * from './components';\nexport * from './VChart';\nexport * from './VChartSimple';\nexport * from './register';\nexport { VChart as VChartCore } from '@visactor/vchart';\n\n// export the version, since @1.8.3\nexport const version = \"1.13.11-alpha.1\";\n\nexport type {\n IAreaChartSpec,\n IBarChartSpec,\n IBar3dChartSpec,\n IBoxPlotChartSpec,\n ICirclePackingChartSpec,\n ICommonChartSpec,\n IFunnelChartSpec,\n IFunnel3dChartSpec,\n IGaugeChartSpec,\n IHeatmapChartSpec,\n IHistogramChartSpec,\n IHistogram3dChartSpec,\n ILineChartSpec,\n IMapChartSpec,\n IPieChartSpec,\n IPie3dChartSpec,\n ICircularProgressChartSpec,\n ILinearProgressChartSpec,\n IRadarChartSpec,\n IRangeColumnChartSpec,\n IRangeColumn3dChartSpec,\n IRangeAreaChartSpec,\n IRoseChartSpec,\n IScatterChartSpec,\n ISankeyChartSpec,\n ISequenceChartSpec,\n ISunburstChartSpec,\n ITreemapChartSpec,\n IWaterfallChartSpec,\n ICorrelationChartSpec,\n ILiquidChartSpec,\n IWordCloud3dChartSpec,\n IWordCloudChartSpec,\n IPolarChartSpec,\n ICartesianChartSpec,\n ITheme,\n IInitOption,\n ISpec,\n IVChart\n} from '@visactor/vchart';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGxD,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAC","file":"index.js","sourcesContent":["export * from './charts';\nexport * from './series';\nexport * from './components';\nexport * from './VChart';\nexport * from './VChartSimple';\nexport * from './register';\nexport { VChart as VChartCore } from '@visactor/vchart';\n\n// export the version, since @1.8.3\nexport const version = \"1.13.11-alpha.2\";\n\nexport type {\n IAreaChartSpec,\n IBarChartSpec,\n IBar3dChartSpec,\n IBoxPlotChartSpec,\n ICirclePackingChartSpec,\n ICommonChartSpec,\n IFunnelChartSpec,\n IFunnel3dChartSpec,\n IGaugeChartSpec,\n IHeatmapChartSpec,\n IHistogramChartSpec,\n IHistogram3dChartSpec,\n ILineChartSpec,\n IMapChartSpec,\n IPieChartSpec,\n IPie3dChartSpec,\n ICircularProgressChartSpec,\n ILinearProgressChartSpec,\n IRadarChartSpec,\n IRangeColumnChartSpec,\n IRangeColumn3dChartSpec,\n IRangeAreaChartSpec,\n IRoseChartSpec,\n IScatterChartSpec,\n ISankeyChartSpec,\n ISequenceChartSpec,\n ISunburstChartSpec,\n ITreemapChartSpec,\n IWaterfallChartSpec,\n ICorrelationChartSpec,\n ILiquidChartSpec,\n IWordCloud3dChartSpec,\n IWordCloudChartSpec,\n IPolarChartSpec,\n ICartesianChartSpec,\n ITheme,\n IInitOption,\n ISpec,\n IVChart\n} from '@visactor/vchart';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/react-vchart",
3
- "version": "1.13.11-alpha.1",
3
+ "version": "1.13.11-alpha.2",
4
4
  "sideEffects": false,
5
5
  "description": "The react version of VChart 4.x",
6
6
  "keywords": [
@@ -23,7 +23,7 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "@visactor/vchart": "1.13.11-alpha.1",
26
+ "@visactor/vchart": "1.13.11-alpha.2",
27
27
  "@visactor/vutils": "~0.19.5",
28
28
  "@visactor/vrender-core": "0.22.10",
29
29
  "@visactor/vrender-kits": "0.22.10",
@@ -55,8 +55,8 @@
55
55
  "@vitejs/plugin-react": "3.1.0",
56
56
  "vite": "3.2.6",
57
57
  "@internal/bundler": "0.0.1",
58
- "@internal/ts-config": "0.0.1",
59
- "@internal/eslint-config": "0.0.1"
58
+ "@internal/eslint-config": "0.0.1",
59
+ "@internal/ts-config": "0.0.1"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "react": ">=16.0.0",