@visactor/openinula-vchart 1.10.2-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.
- package/README.md +54 -0
- package/cjs/VChart.js +17 -0
- package/cjs/VChart.js.map +1 -0
- package/cjs/VChartSimple.js +10 -0
- package/cjs/VChartSimple.js.map +1 -0
- package/cjs/charts/AreaChart.js +19 -0
- package/cjs/charts/AreaChart.js.map +1 -0
- package/cjs/charts/BarChart.js +19 -0
- package/cjs/charts/BarChart.js.map +1 -0
- package/cjs/charts/BaseChart.d.ts +26 -0
- package/cjs/charts/BaseChart.js +125 -0
- package/cjs/charts/BaseChart.js.map +1 -0
- package/cjs/charts/BoxPlotChart.js +19 -0
- package/cjs/charts/BoxPlotChart.js.map +1 -0
- package/cjs/charts/CircularProgressChart.js +19 -0
- package/cjs/charts/CircularProgressChart.js.map +1 -0
- package/cjs/charts/CommonChart.js +19 -0
- package/cjs/charts/CommonChart.js.map +1 -0
- package/cjs/charts/FunnelChart.js +19 -0
- package/cjs/charts/FunnelChart.js.map +1 -0
- package/cjs/charts/HistogramChart.js +19 -0
- package/cjs/charts/HistogramChart.js.map +1 -0
- package/cjs/charts/LineChart.js +19 -0
- package/cjs/charts/LineChart.js.map +1 -0
- package/cjs/charts/LinearProgressChart.js +19 -0
- package/cjs/charts/LinearProgressChart.js.map +1 -0
- package/cjs/charts/MapChart.js +19 -0
- package/cjs/charts/MapChart.js.map +1 -0
- package/cjs/charts/PieChart.js +19 -0
- package/cjs/charts/PieChart.js.map +1 -0
- package/cjs/charts/RadarChart.js +19 -0
- package/cjs/charts/RadarChart.js.map +1 -0
- package/cjs/charts/RangeColumnChart.js +19 -0
- package/cjs/charts/RangeColumnChart.js.map +1 -0
- package/cjs/charts/RoseChart.js +18 -0
- package/cjs/charts/RoseChart.js.map +1 -0
- package/cjs/charts/ScatterChart.js +19 -0
- package/cjs/charts/ScatterChart.js.map +1 -0
- package/cjs/charts/SequenceChart.js +19 -0
- package/cjs/charts/SequenceChart.js.map +1 -0
- package/cjs/charts/WordCloudChart.js +19 -0
- package/cjs/charts/WordCloudChart.js.map +1 -0
- package/cjs/charts/index.d.ts +18 -0
- package/cjs/charts/index.js +28 -0
- package/cjs/charts/index.js.map +1 -0
- package/cjs/components/Axis.js +10 -0
- package/cjs/components/Axis.js.map +1 -0
- package/cjs/components/BaseComponent.js +55 -0
- package/cjs/components/BaseComponent.js.map +1 -0
- package/cjs/components/Brush.js +10 -0
- package/cjs/components/Brush.js.map +1 -0
- package/cjs/components/Crosshair.js +10 -0
- package/cjs/components/Crosshair.js.map +1 -0
- package/cjs/components/DataZoom.js +10 -0
- package/cjs/components/DataZoom.js.map +1 -0
- package/cjs/components/Indicator.js +10 -0
- package/cjs/components/Indicator.js.map +1 -0
- package/cjs/components/Legend.js +10 -0
- package/cjs/components/Legend.js.map +1 -0
- package/cjs/components/Mark.js +10 -0
- package/cjs/components/Mark.js.map +1 -0
- package/cjs/components/MarkArea.js +10 -0
- package/cjs/components/MarkArea.js.map +1 -0
- package/cjs/components/MarkLine.js +10 -0
- package/cjs/components/MarkLine.js.map +1 -0
- package/cjs/components/MarkPoint.js +10 -0
- package/cjs/components/MarkPoint.js.map +1 -0
- package/cjs/components/Player.js +10 -0
- package/cjs/components/Player.js.map +1 -0
- package/cjs/components/Region.js +9 -0
- package/cjs/components/Region.js.map +1 -0
- package/cjs/components/ScrollBar.js +10 -0
- package/cjs/components/ScrollBar.js.map +1 -0
- package/cjs/components/Title.js +10 -0
- package/cjs/components/Title.js.map +1 -0
- package/cjs/components/index.d.ts +15 -0
- package/cjs/components/index.js +28 -0
- package/cjs/components/index.js.map +1 -0
- package/cjs/components/tooltip/Tooltip.js +10 -0
- package/cjs/components/tooltip/Tooltip.js.map +1 -0
- package/cjs/components/tooltip/constant.d.ts +1 -0
- package/cjs/components/tooltip/constant.js +10 -0
- package/cjs/components/tooltip/constant.js.map +1 -0
- package/cjs/components/tooltip/index.d.ts +3 -0
- package/cjs/components/tooltip/index.js +22 -0
- package/cjs/components/tooltip/index.js.map +1 -0
- package/cjs/components/tooltip/interface.d.ts +14 -0
- package/cjs/components/tooltip/interface.js +6 -0
- package/cjs/components/tooltip/interface.js.map +1 -0
- package/cjs/components/tooltip/util.d.ts +4 -0
- package/cjs/components/tooltip/util.js +47 -0
- package/cjs/components/tooltip/util.js.map +1 -0
- package/cjs/constants.d.ts +1 -0
- package/cjs/constants.js +6 -0
- package/cjs/constants.js.map +1 -0
- package/cjs/containers/withContainer.d.ts +11 -0
- package/cjs/containers/withContainer.js +64 -0
- package/cjs/containers/withContainer.js.map +1 -0
- package/cjs/context/chart.d.ts +13 -0
- package/cjs/context/chart.js +25 -0
- package/cjs/context/chart.js.map +1 -0
- package/cjs/context/stage.d.ts +9 -0
- package/cjs/context/stage.js +24 -0
- package/cjs/context/stage.js.map +1 -0
- package/cjs/context/view.d.ts +9 -0
- package/cjs/context/view.js +24 -0
- package/cjs/context/view.js.map +1 -0
- package/cjs/eventsUtils.d.ts +256 -0
- package/cjs/eventsUtils.js +114 -0
- package/cjs/eventsUtils.js.map +1 -0
- package/cjs/index.d.ts +7 -0
- package/cjs/index.js +23 -0
- package/cjs/index.js.map +1 -0
- package/cjs/series/Area.js +10 -0
- package/cjs/series/Area.js.map +1 -0
- package/cjs/series/Bar.js +10 -0
- package/cjs/series/Bar.js.map +1 -0
- package/cjs/series/BaseSeries.js +51 -0
- package/cjs/series/BaseSeries.js.map +1 -0
- package/cjs/series/BoxPlot.js +10 -0
- package/cjs/series/BoxPlot.js.map +1 -0
- package/cjs/series/CircularProgress.js +10 -0
- package/cjs/series/CircularProgress.js.map +1 -0
- package/cjs/series/Dot.js +10 -0
- package/cjs/series/Dot.js.map +1 -0
- package/cjs/series/Funnel.js +10 -0
- package/cjs/series/Funnel.js.map +1 -0
- package/cjs/series/Line.js +10 -0
- package/cjs/series/Line.js.map +1 -0
- package/cjs/series/LinearProgress.js +10 -0
- package/cjs/series/LinearProgress.js.map +1 -0
- package/cjs/series/Link.js +9 -0
- package/cjs/series/Link.js.map +1 -0
- package/cjs/series/Map.js +10 -0
- package/cjs/series/Map.js.map +1 -0
- package/cjs/series/Pie.js +10 -0
- package/cjs/series/Pie.js.map +1 -0
- package/cjs/series/Radar.js +10 -0
- package/cjs/series/Radar.js.map +1 -0
- package/cjs/series/RangeColumn.js +10 -0
- package/cjs/series/RangeColumn.js.map +1 -0
- package/cjs/series/Rose.js +10 -0
- package/cjs/series/Rose.js.map +1 -0
- package/cjs/series/Scatter.js +10 -0
- package/cjs/series/Scatter.js.map +1 -0
- package/cjs/series/Series.js +10 -0
- package/cjs/series/Series.js.map +1 -0
- package/cjs/series/WordCloud.js +10 -0
- package/cjs/series/WordCloud.js.map +1 -0
- package/cjs/series/index.d.ts +17 -0
- package/cjs/series/index.js +29 -0
- package/cjs/series/index.js.map +1 -0
- package/cjs/util.js +57 -0
- package/cjs/util.js.map +1 -0
- package/esm/VChart.js +9 -0
- package/esm/VChart.js.map +1 -0
- package/esm/VChartSimple.js +4 -0
- package/esm/VChartSimple.js.map +1 -0
- package/esm/charts/AreaChart.js +9 -0
- package/esm/charts/AreaChart.js.map +1 -0
- package/esm/charts/BarChart.js +9 -0
- package/esm/charts/BarChart.js.map +1 -0
- package/esm/charts/BaseChart.d.ts +26 -0
- package/esm/charts/BaseChart.js +104 -0
- package/esm/charts/BaseChart.js.map +1 -0
- package/esm/charts/BoxPlotChart.js +9 -0
- package/esm/charts/BoxPlotChart.js.map +1 -0
- package/esm/charts/CircularProgressChart.js +9 -0
- package/esm/charts/CircularProgressChart.js.map +1 -0
- package/esm/charts/CommonChart.js +9 -0
- package/esm/charts/CommonChart.js.map +1 -0
- package/esm/charts/FunnelChart.js +9 -0
- package/esm/charts/FunnelChart.js.map +1 -0
- package/esm/charts/HistogramChart.js +9 -0
- package/esm/charts/HistogramChart.js.map +1 -0
- package/esm/charts/LineChart.js +9 -0
- package/esm/charts/LineChart.js.map +1 -0
- package/esm/charts/LinearProgressChart.js +9 -0
- package/esm/charts/LinearProgressChart.js.map +1 -0
- package/esm/charts/MapChart.js +9 -0
- package/esm/charts/MapChart.js.map +1 -0
- package/esm/charts/PieChart.js +9 -0
- package/esm/charts/PieChart.js.map +1 -0
- package/esm/charts/RadarChart.js +9 -0
- package/esm/charts/RadarChart.js.map +1 -0
- package/esm/charts/RangeColumnChart.js +9 -0
- package/esm/charts/RangeColumnChart.js.map +1 -0
- package/esm/charts/RoseChart.js +8 -0
- package/esm/charts/RoseChart.js.map +1 -0
- package/esm/charts/ScatterChart.js +9 -0
- package/esm/charts/ScatterChart.js.map +1 -0
- package/esm/charts/SequenceChart.js +9 -0
- package/esm/charts/SequenceChart.js.map +1 -0
- package/esm/charts/WordCloudChart.js +9 -0
- package/esm/charts/WordCloudChart.js.map +1 -0
- package/esm/charts/index.d.ts +18 -0
- package/esm/charts/index.js +32 -0
- package/esm/charts/index.js.map +1 -0
- package/esm/components/Axis.js +4 -0
- package/esm/components/Axis.js.map +1 -0
- package/esm/components/BaseComponent.js +26 -0
- package/esm/components/BaseComponent.js.map +1 -0
- package/esm/components/Brush.js +6 -0
- package/esm/components/Brush.js.map +1 -0
- package/esm/components/Crosshair.js +4 -0
- package/esm/components/Crosshair.js.map +1 -0
- package/esm/components/DataZoom.js +6 -0
- package/esm/components/DataZoom.js.map +1 -0
- package/esm/components/Indicator.js +4 -0
- package/esm/components/Indicator.js.map +1 -0
- package/esm/components/Legend.js +6 -0
- package/esm/components/Legend.js.map +1 -0
- package/esm/components/Mark.js +4 -0
- package/esm/components/Mark.js.map +1 -0
- package/esm/components/MarkArea.js +4 -0
- package/esm/components/MarkArea.js.map +1 -0
- package/esm/components/MarkLine.js +4 -0
- package/esm/components/MarkLine.js.map +1 -0
- package/esm/components/MarkPoint.js +4 -0
- package/esm/components/MarkPoint.js.map +1 -0
- package/esm/components/Player.js +6 -0
- package/esm/components/Player.js.map +1 -0
- package/esm/components/Region.js +3 -0
- package/esm/components/Region.js.map +1 -0
- package/esm/components/ScrollBar.js +6 -0
- package/esm/components/ScrollBar.js.map +1 -0
- package/esm/components/Title.js +4 -0
- package/esm/components/Title.js.map +1 -0
- package/esm/components/index.d.ts +15 -0
- package/esm/components/index.js +30 -0
- package/esm/components/index.js.map +1 -0
- package/esm/components/tooltip/Tooltip.js +4 -0
- package/esm/components/tooltip/Tooltip.js.map +1 -0
- package/esm/components/tooltip/constant.d.ts +1 -0
- package/esm/components/tooltip/constant.js +4 -0
- package/esm/components/tooltip/constant.js.map +1 -0
- package/esm/components/tooltip/index.d.ts +3 -0
- package/esm/components/tooltip/index.js +6 -0
- package/esm/components/tooltip/index.js.map +1 -0
- package/esm/components/tooltip/interface.d.ts +14 -0
- package/esm/components/tooltip/interface.js +2 -0
- package/esm/components/tooltip/interface.js.map +1 -0
- package/esm/components/tooltip/util.d.ts +4 -0
- package/esm/components/tooltip/util.js +40 -0
- package/esm/components/tooltip/util.js.map +1 -0
- package/esm/constants.d.ts +1 -0
- package/esm/constants.js +2 -0
- package/esm/constants.js.map +1 -0
- package/esm/containers/withContainer.d.ts +11 -0
- package/esm/containers/withContainer.js +33 -0
- package/esm/containers/withContainer.js.map +1 -0
- package/esm/context/chart.d.ts +13 -0
- package/esm/context/chart.js +16 -0
- package/esm/context/chart.js.map +1 -0
- package/esm/context/stage.d.ts +9 -0
- package/esm/context/stage.js +16 -0
- package/esm/context/stage.js.map +1 -0
- package/esm/context/view.d.ts +9 -0
- package/esm/context/view.js +16 -0
- package/esm/context/view.js.map +1 -0
- package/esm/eventsUtils.d.ts +256 -0
- package/esm/eventsUtils.js +126 -0
- package/esm/eventsUtils.js.map +1 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.js +12 -0
- package/esm/index.js.map +1 -0
- package/esm/series/Area.js +4 -0
- package/esm/series/Area.js.map +1 -0
- package/esm/series/Bar.js +4 -0
- package/esm/series/Bar.js.map +1 -0
- package/esm/series/BaseSeries.js +45 -0
- package/esm/series/BaseSeries.js.map +1 -0
- package/esm/series/BoxPlot.js +4 -0
- package/esm/series/BoxPlot.js.map +1 -0
- package/esm/series/CircularProgress.js +4 -0
- package/esm/series/CircularProgress.js.map +1 -0
- package/esm/series/Dot.js +4 -0
- package/esm/series/Dot.js.map +1 -0
- package/esm/series/Funnel.js +4 -0
- package/esm/series/Funnel.js.map +1 -0
- package/esm/series/Line.js +4 -0
- package/esm/series/Line.js.map +1 -0
- package/esm/series/LinearProgress.js +4 -0
- package/esm/series/LinearProgress.js.map +1 -0
- package/esm/series/Link.js +3 -0
- package/esm/series/Link.js.map +1 -0
- package/esm/series/Map.js +4 -0
- package/esm/series/Map.js.map +1 -0
- package/esm/series/Pie.js +4 -0
- package/esm/series/Pie.js.map +1 -0
- package/esm/series/Radar.js +4 -0
- package/esm/series/Radar.js.map +1 -0
- package/esm/series/RangeColumn.js +4 -0
- package/esm/series/RangeColumn.js.map +1 -0
- package/esm/series/Rose.js +4 -0
- package/esm/series/Rose.js.map +1 -0
- package/esm/series/Scatter.js +4 -0
- package/esm/series/Scatter.js.map +1 -0
- package/esm/series/Series.js +4 -0
- package/esm/series/Series.js.map +1 -0
- package/esm/series/WordCloud.js +4 -0
- package/esm/series/WordCloud.js.map +1 -0
- package/esm/series/index.d.ts +17 -0
- package/esm/series/index.js +34 -0
- package/esm/series/index.js.map +1 -0
- package/esm/util.js +36 -0
- package/esm/util.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __importDefault = this && this.__importDefault || function(mod) {
|
|
4
|
+
return mod && mod.__esModule ? mod : {
|
|
5
|
+
default: mod
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: !0
|
|
11
|
+
}), exports.initCustomTooltip = void 0;
|
|
12
|
+
|
|
13
|
+
const openinula_1 = __importDefault(require("openinula")), vutils_1 = require("@visactor/vutils"), constant_1 = require("./constant"), openinula_2 = require("openinula"), initCustomTooltip = (setTooltipNode, props, spec) => {
|
|
14
|
+
let render;
|
|
15
|
+
if ((null == spec ? void 0 : spec.tooltipRender) ? (render = spec.tooltipRender,
|
|
16
|
+
delete spec.tooltipRender) : (null == spec ? void 0 : spec.children) ? render = (tooltipElement, actualTooltip, params) => openinula_1.default.Children.map(spec.children, (child => (0,
|
|
17
|
+
vutils_1.isObject)(child) ? openinula_1.default.cloneElement(child, {
|
|
18
|
+
tooltipElement: tooltipElement,
|
|
19
|
+
actualTooltip: actualTooltip,
|
|
20
|
+
params: params
|
|
21
|
+
}) : child)) : props.tooltipRender && (render = props.tooltipRender), render) {
|
|
22
|
+
let reserve;
|
|
23
|
+
return (null == spec ? void 0 : spec.reserveDefaultTooltip) ? (reserve = spec.reserveDefaultTooltip,
|
|
24
|
+
delete spec.reserveDefaultTooltip) : reserve = props.reserveDefaultTooltip, Object.assign(Object.assign({}, spec), {
|
|
25
|
+
updateElement: (el, actualTooltip, params) => {
|
|
26
|
+
const {changePositionOnly: changePositionOnly} = params;
|
|
27
|
+
if (!changePositionOnly) {
|
|
28
|
+
if (!reserve) {
|
|
29
|
+
el.style.width = "auto", el.style.height = "auto", el.style.minHeight = "auto",
|
|
30
|
+
el.style.padding = "0px";
|
|
31
|
+
for (let i = 0; i < el.children.length; i++) {
|
|
32
|
+
const childNode = el.children[i];
|
|
33
|
+
childNode.className !== constant_1.REACT_TOOLTIP_ClASS_NAME && "none" !== childNode.style.display && (childNode.style.display = "none");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
setTooltipNode((0, openinula_2.createPortal)(openinula_1.default.createElement("div", {
|
|
37
|
+
className: constant_1.REACT_TOOLTIP_ClASS_NAME
|
|
38
|
+
}, render(el, actualTooltip, params)), el));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return spec;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
exports.initCustomTooltip = initCustomTooltip;
|
|
47
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/tooltip/util.tsx"],"names":[],"mappings":";;;;;;AAAA,0DAA8B;AAG9B,6CAA4C;AAE5C,yCAAsD;AACtD,yCAAyC;AAGlC,MAAM,iBAAiB,GAAG,CAC/B,cAAqE,EACrE,KAAqB,EACrB,IAAmB,EACnB,EAAE;IACF,IAAI,MAAM,GAAkB,SAAS,CAAC;IACtC,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,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,EAAE;QACzB,MAAM,GAAG,CAAC,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,CACjD,mBAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CACxC,IAAA,iBAAQ,EAAC,KAAK,CAAC;YACb,CAAC,CAAC,mBAAK,CAAC,YAAY,CAAC,KAAkE,EAAE;gBACrF,cAAc;gBACd,aAAa;gBACb,MAAM;aACP,CAAC;YACJ,CAAC,CAAC,KAAK,CACV,CAAC;KACL;SAAM,IAAI,KAAK,CAAC,aAAa,EAAE;QAC9B,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC;KAC9B;IAED,IAAI,MAAM,EAAE;QACV,IAAI,OAAO,GAAY,SAAS,CAAC;QACjC,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,qBAAqB,EAAE;YAC/B,OAAO,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACrC,OAAO,IAAI,CAAC,qBAAqB,CAAC;SACnC;aAAM;YACL,OAAO,GAAG,KAAK,CAAC,qBAAqB,CAAC;SACvC;QACD,OAAO,gCACF,IAAI,KACP,aAAa,EAAE,CAAC,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE;gBAC3C,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC;gBACtC,IAAI,kBAAkB,EAAE;oBACtB,OAAO;iBACR;gBACD,IAAI,CAAC,OAAO,EAAE;oBACZ,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC;oBACxB,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;oBACzB,EAAE,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;oBAC5B,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;oBACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBAC3C,MAAM,SAAS,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAgB,CAAC;wBAChD,IAAI,SAAS,CAAC,SAAS,KAAK,mCAAwB,IAAI,SAAS,CAAC,KAAK,CAAC,OAAO,KAAK,MAAM,EAAE;4BAC1F,SAAS,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;yBAClC;qBACF;iBACF;gBACD,cAAc,CACZ,IAAA,wBAAY,EAAC,2CAAK,SAAS,EAAE,mCAAwB,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;AA3DW,QAAA,iBAAiB,qBA2D5B","file":"util.js","sourcesContent":["import React from 'openinula';\nimport type { BaseChartProps } from '../../charts/BaseChart';\nimport { TooltipProps, TooltipRender } from './interface';\nimport { isObject } from '@visactor/vutils';\nimport { ITooltipSpec } from '@visactor/vchart';\nimport { REACT_TOOLTIP_ClASS_NAME } from './constant';\nimport { createPortal } from 'openinula';\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 = undefined;\n if (spec?.tooltipRender) {\n render = spec.tooltipRender;\n delete spec.tooltipRender;\n } else if (spec?.children) {\n render = (tooltipElement, actualTooltip, params) =>\n React.Children.map(spec.children, child =>\n isObject(child)\n ? React.cloneElement(child as React.ReactElement<any, React.JSXElementConstructor<any>>, {\n tooltipElement,\n actualTooltip,\n params\n })\n : child\n );\n } else if (props.tooltipRender) {\n render = props.tooltipRender;\n }\n\n if (render) {\n let reserve: boolean = undefined;\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 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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const REACT_PRIVATE_PROPS: string[];
|
package/cjs/constants.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC","file":"constants.js","sourcesContent":["export const REACT_PRIVATE_PROPS = ['children', 'hooks', 'ref'];\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ContainerProps {
|
|
2
|
+
style?: React.CSSProperties;
|
|
3
|
+
className?: string;
|
|
4
|
+
width?: number | string;
|
|
5
|
+
height?: number | string;
|
|
6
|
+
}
|
|
7
|
+
export default function withContainer<Props extends ContainerProps, CompProps>(Comp: any, name?: string, getProps?: (props: any) => CompProps): import("openinula").ExoticComponent<import("openinula").PropsOmitRef<CompProps & Props>> & {
|
|
8
|
+
key?: import("openinula").Key;
|
|
9
|
+
} & {
|
|
10
|
+
ref?: import("openinula").Ref<any>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
4
|
+
void 0 === k2 && (k2 = k);
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
desc && !("get" in desc ? !m.__esModule : desc.writable || desc.configurable) || (desc = {
|
|
7
|
+
enumerable: !0,
|
|
8
|
+
get: function() {
|
|
9
|
+
return m[k];
|
|
10
|
+
}
|
|
11
|
+
}), Object.defineProperty(o, k2, desc);
|
|
12
|
+
} : function(o, m, k, k2) {
|
|
13
|
+
void 0 === k2 && (k2 = k), o[k2] = m[k];
|
|
14
|
+
}), __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", {
|
|
16
|
+
enumerable: !0,
|
|
17
|
+
value: v
|
|
18
|
+
});
|
|
19
|
+
} : function(o, v) {
|
|
20
|
+
o.default = v;
|
|
21
|
+
}), __importStar = this && this.__importStar || function(mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (null != mod) for (var k in mod) "default" !== k && Object.prototype.hasOwnProperty.call(mod, k) && __createBinding(result, mod, k);
|
|
25
|
+
return __setModuleDefault(result, mod), result;
|
|
26
|
+
}, __rest = this && this.__rest || function(s, e) {
|
|
27
|
+
var t = {};
|
|
28
|
+
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
29
|
+
if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
|
|
30
|
+
var i = 0;
|
|
31
|
+
for (p = Object.getOwnPropertySymbols(s); i < p.length; i++) e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
|
|
32
|
+
}
|
|
33
|
+
return t;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
Object.defineProperty(exports, "__esModule", {
|
|
37
|
+
value: !0
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const openinula_1 = __importStar(require("openinula"));
|
|
41
|
+
|
|
42
|
+
function withContainer(Comp, name = "ChartContainer", getProps) {
|
|
43
|
+
const Cls = openinula_1.default.forwardRef(((props, ref) => {
|
|
44
|
+
const container = (0, openinula_1.useRef)(), [inited, setInited] = (0, openinula_1.useState)(!1), {className: className, style: style, width: width} = props, options = __rest(props, [ "className", "style", "width" ]);
|
|
45
|
+
return (0, openinula_1.useLayoutEffect)((() => {
|
|
46
|
+
setInited(!0);
|
|
47
|
+
}), []), openinula_1.default.createElement("div", {
|
|
48
|
+
ref: container,
|
|
49
|
+
className: className,
|
|
50
|
+
style: Object.assign({
|
|
51
|
+
position: "relative",
|
|
52
|
+
height: props.height || "100%",
|
|
53
|
+
width: props.width || "100%"
|
|
54
|
+
}, style)
|
|
55
|
+
}, inited ? openinula_1.default.createElement(Comp, Object.assign({
|
|
56
|
+
ref: ref,
|
|
57
|
+
container: container.current
|
|
58
|
+
}, getProps ? getProps(options) : options)) : openinula_1.default.createElement(openinula_1.default.Fragment, null));
|
|
59
|
+
}));
|
|
60
|
+
return Cls.displayName = name || Comp.name, Cls;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
exports.default = withContainer;
|
|
64
|
+
//# sourceMappingURL=withContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/containers/withContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAqE;AASrE,SAAwB,aAAa,CACnC,IAAS,EACT,IAAI,GAAG,gBAAgB,EACvB,QAAoC;IAEpC,MAAM,GAAG,GAAG,mBAAK,CAAC,UAAU,CAAyB,CAAC,KAAwB,EAAE,GAAG,EAAE,EAAE;QACrF,MAAM,SAAS,GAAG,IAAA,kBAAM,GAAE,CAAC;QAC3B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,oBAAQ,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,2BAAe,EAAC,GAAG,EAAE;YACnB,SAAS,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,CACL,2CACE,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,kCAAC,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,qEAAK,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 'openinula';\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"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'openinula';
|
|
2
|
+
import type { IVChart } from '@visactor/vchart';
|
|
3
|
+
export interface ChartContextType {
|
|
4
|
+
chart?: IVChart;
|
|
5
|
+
isChildrenUpdated?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const ChartContext: import("openinula").Context<ChartContextType>;
|
|
8
|
+
export declare function withChartInstance<T>(Component: typeof React.Component): import("openinula").ExoticComponent<import("openinula").PropsOmitRef<T>> & {
|
|
9
|
+
key?: import("openinula").Key;
|
|
10
|
+
} & {
|
|
11
|
+
ref?: import("openinula").Ref<any>;
|
|
12
|
+
};
|
|
13
|
+
export default ChartContext;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __importDefault = this && this.__importDefault || function(mod) {
|
|
4
|
+
return mod && mod.__esModule ? mod : {
|
|
5
|
+
default: mod
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: !0
|
|
11
|
+
}), exports.withChartInstance = void 0;
|
|
12
|
+
|
|
13
|
+
const openinula_1 = __importDefault(require("openinula")), ChartContext = openinula_1.default.createContext(null);
|
|
14
|
+
|
|
15
|
+
function withChartInstance(Component) {
|
|
16
|
+
const Com = openinula_1.default.forwardRef(((props, ref) => openinula_1.default.createElement(ChartContext.Consumer, null, (ctx => openinula_1.default.createElement(Component, Object.assign({
|
|
17
|
+
ref: ref,
|
|
18
|
+
chart: ctx.chart
|
|
19
|
+
}, props))))));
|
|
20
|
+
return Com.displayName = Component.name, Com;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
ChartContext.displayName = "ChartContext", exports.withChartInstance = withChartInstance,
|
|
24
|
+
exports.default = ChartContext;
|
|
25
|
+
//# sourceMappingURL=chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/context/chart.tsx"],"names":[],"mappings":";;;;;;AAAA,0DAA8B;AAQ9B,MAAM,YAAY,GAAG,mBAAK,CAAC,aAAa,CAAmB,IAAI,CAAC,CAAC;AACjE,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,SAAgB,iBAAiB,CAAI,SAAiC;IACpE,MAAM,GAAG,GAAG,mBAAK,CAAC,UAAU,CAAS,CAAC,KAAQ,EAAE,GAAG,EAAE,EAAE;QACrD,OAAO,CACL,kCAAC,YAAY,CAAC,QAAQ,QACnB,CAAC,GAAqB,EAAE,EAAE,CAAC,kCAAC,SAAS,kBAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,IAAM,KAAK,EAAI,CAC1D,CACzB,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC;AAVD,8CAUC;AAED,kBAAe,YAAY,CAAC","file":"chart.js","sourcesContent":["import React from 'openinula';\nimport type { IVChart } from '@visactor/vchart';\n\nexport interface ChartContextType {\n chart?: IVChart;\n isChildrenUpdated?: boolean;\n}\n\nconst ChartContext = React.createContext<ChartContextType>(null);\nChartContext.displayName = 'ChartContext';\n\nexport function withChartInstance<T>(Component: typeof React.Component) {\n const Com = React.forwardRef<any, T>((props: T, ref) => {\n return (\n <ChartContext.Consumer>\n {(ctx: ChartContextType) => <Component ref={ref} chart={ctx.chart} {...props} />}\n </ChartContext.Consumer>\n );\n });\n Com.displayName = Component.name;\n return Com;\n}\n\nexport default ChartContext;\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'openinula';
|
|
2
|
+
import type { IStage } from '@visactor/vrender-core';
|
|
3
|
+
declare const StageContext: import("openinula").Context<IStage>;
|
|
4
|
+
export declare function withStage<T>(Component: typeof React.Component): import("openinula").ExoticComponent<import("openinula").PropsOmitRef<T>> & {
|
|
5
|
+
key?: import("openinula").Key;
|
|
6
|
+
} & {
|
|
7
|
+
ref?: import("openinula").Ref<any>;
|
|
8
|
+
};
|
|
9
|
+
export default StageContext;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __importDefault = this && this.__importDefault || function(mod) {
|
|
4
|
+
return mod && mod.__esModule ? mod : {
|
|
5
|
+
default: mod
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: !0
|
|
11
|
+
}), exports.withStage = void 0;
|
|
12
|
+
|
|
13
|
+
const openinula_1 = __importDefault(require("openinula")), StageContext = openinula_1.default.createContext(null);
|
|
14
|
+
|
|
15
|
+
function withStage(Component) {
|
|
16
|
+
const Com = openinula_1.default.forwardRef(((props, ref) => openinula_1.default.createElement(StageContext.Consumer, null, (ctx => openinula_1.default.createElement(Component, Object.assign({
|
|
17
|
+
ref: ref,
|
|
18
|
+
stage: ctx
|
|
19
|
+
}, props))))));
|
|
20
|
+
return Com.displayName = Component.name, Com;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
StageContext.displayName = "StageContext", exports.withStage = withStage, exports.default = StageContext;
|
|
24
|
+
//# sourceMappingURL=stage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/context/stage.tsx"],"names":[],"mappings":";;;;;;AAAA,0DAA8B;AAG9B,MAAM,YAAY,GAAG,mBAAK,CAAC,aAAa,CAAS,IAAI,CAAC,CAAC;AACvD,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,SAAgB,SAAS,CAAI,SAAiC;IAC5D,MAAM,GAAG,GAAG,mBAAK,CAAC,UAAU,CAAS,CAAC,KAAQ,EAAE,GAAG,EAAE,EAAE;QACrD,OAAO,kCAAC,YAAY,CAAC,QAAQ,QAAE,GAAG,CAAC,EAAE,CAAC,kCAAC,SAAS,kBAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,IAAM,KAAK,EAAI,CAAyB,CAAC;IAChH,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC;AAND,8BAMC;AAED,kBAAe,YAAY,CAAC","file":"stage.js","sourcesContent":["import React from 'openinula';\nimport type { IStage } from '@visactor/vrender-core';\n\nconst StageContext = React.createContext<IStage>(null);\nStageContext.displayName = 'StageContext';\n\nexport function withStage<T>(Component: typeof React.Component) {\n const Com = React.forwardRef<any, T>((props: T, ref) => {\n return <StageContext.Consumer>{ctx => <Component ref={ref} stage={ctx} {...props} />}</StageContext.Consumer>;\n });\n Com.displayName = Component.name;\n return Com;\n}\n\nexport default StageContext;\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'openinula';
|
|
2
|
+
import type { IView } from '@visactor/vgrammar-core';
|
|
3
|
+
declare const ViewContext: import("openinula").Context<IView>;
|
|
4
|
+
export declare function withView<T>(Component: typeof React.Component): import("openinula").ExoticComponent<import("openinula").PropsOmitRef<T>> & {
|
|
5
|
+
key?: import("openinula").Key;
|
|
6
|
+
} & {
|
|
7
|
+
ref?: import("openinula").Ref<any>;
|
|
8
|
+
};
|
|
9
|
+
export default ViewContext;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __importDefault = this && this.__importDefault || function(mod) {
|
|
4
|
+
return mod && mod.__esModule ? mod : {
|
|
5
|
+
default: mod
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: !0
|
|
11
|
+
}), exports.withView = void 0;
|
|
12
|
+
|
|
13
|
+
const openinula_1 = __importDefault(require("openinula")), ViewContext = openinula_1.default.createContext(null);
|
|
14
|
+
|
|
15
|
+
function withView(Component) {
|
|
16
|
+
const Com = openinula_1.default.forwardRef(((props, ref) => openinula_1.default.createElement(ViewContext.Consumer, null, (ctx => openinula_1.default.createElement(Component, Object.assign({
|
|
17
|
+
ref: ref,
|
|
18
|
+
view: ctx
|
|
19
|
+
}, props))))));
|
|
20
|
+
return Com.displayName = Component.name, Com;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
ViewContext.displayName = "ViewContext", exports.withView = withView, exports.default = ViewContext;
|
|
24
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/context/view.tsx"],"names":[],"mappings":";;;;;;AAAA,0DAA8B;AAG9B,MAAM,WAAW,GAAG,mBAAK,CAAC,aAAa,CAAQ,IAAI,CAAC,CAAC;AACrD,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC;AAExC,SAAgB,QAAQ,CAAI,SAAiC;IAC3D,MAAM,GAAG,GAAG,mBAAK,CAAC,UAAU,CAAS,CAAC,KAAQ,EAAE,GAAG,EAAE,EAAE;QACrD,OAAO,kCAAC,WAAW,CAAC,QAAQ,QAAE,GAAG,CAAC,EAAE,CAAC,kCAAC,SAAS,kBAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAM,KAAK,EAAI,CAAwB,CAAC;IAC7G,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC;AAND,4BAMC;AAED,kBAAe,WAAW,CAAC","file":"view.js","sourcesContent":["import React from 'openinula';\nimport type { IView } from '@visactor/vgrammar-core';\n\nconst ViewContext = React.createContext<IView>(null);\nViewContext.displayName = 'ViewContext';\n\nexport function withView<T>(Component: typeof React.Component) {\n const Com = React.forwardRef<any, T>((props: T, ref) => {\n return <ViewContext.Consumer>{ctx => <Component ref={ref} view={ctx} {...props} />}</ViewContext.Consumer>;\n });\n Com.displayName = Component.name;\n return Com;\n}\n\nexport default ViewContext;\n"]}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import type { IVChart, EventCallback, EventParamsDefinition } from '@visactor/vchart';
|
|
2
|
+
export interface LegendEventProps {
|
|
3
|
+
onLegendItemHover?: (e: any) => void;
|
|
4
|
+
onLegendItemUnHover?: (e: any) => void;
|
|
5
|
+
onLegendItemClick?: (e: any) => void;
|
|
6
|
+
onLegendFilter?: (e: any) => void;
|
|
7
|
+
onLegendSelectedDataChange?: (e: any) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface BrushEventProps {
|
|
10
|
+
onBrushStart?: (e: any) => void;
|
|
11
|
+
onBrushChange?: (e: any) => void;
|
|
12
|
+
onBrushEnd?: (e: any) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface DataZoomEventProps {
|
|
15
|
+
onDataZoomChange?: (e: any) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface PlayerEventProps {
|
|
18
|
+
onPlayerPlay?: (e: any) => void;
|
|
19
|
+
onPlayerPause?: (e: any) => void;
|
|
20
|
+
onPlayerEnd?: (e: any) => void;
|
|
21
|
+
onPlayerChange?: (e: any) => void;
|
|
22
|
+
onPlayerForward?: (e: any) => void;
|
|
23
|
+
onPlayerBackward?: (e: any) => void;
|
|
24
|
+
}
|
|
25
|
+
export interface ScrollBarEventProps {
|
|
26
|
+
onScrollBarChange?: (e: any) => void;
|
|
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
|
+
}
|
|
43
|
+
export interface EventsProps {
|
|
44
|
+
onPointerDown?: EventCallback<EventParamsDefinition['pointerdown']>;
|
|
45
|
+
onPointerUp?: EventCallback<EventParamsDefinition['pointerup']>;
|
|
46
|
+
onPointerUpOutside?: EventCallback<EventParamsDefinition['pointerupoutside']>;
|
|
47
|
+
onPointerTap?: EventCallback<EventParamsDefinition['pointertap']>;
|
|
48
|
+
onPointerOver?: EventCallback<EventParamsDefinition['pointerover']>;
|
|
49
|
+
onPointerMove?: EventCallback<EventParamsDefinition['pointermove']>;
|
|
50
|
+
onPointerEnter?: EventCallback<EventParamsDefinition['pointerenter']>;
|
|
51
|
+
onPointerLeave?: EventCallback<EventParamsDefinition['pointerleave']>;
|
|
52
|
+
onPointerOut?: EventCallback<EventParamsDefinition['pointerout']>;
|
|
53
|
+
onMouseDown?: EventCallback<EventParamsDefinition['mousedown']>;
|
|
54
|
+
onMouseUp?: EventCallback<EventParamsDefinition['mouseup']>;
|
|
55
|
+
onMouseUpOutside?: EventCallback<EventParamsDefinition['mouseupoutside']>;
|
|
56
|
+
onMouseMove?: EventCallback<EventParamsDefinition['mousemove']>;
|
|
57
|
+
onMouseOver?: EventCallback<EventParamsDefinition['mouseover']>;
|
|
58
|
+
onMouseOut?: EventCallback<EventParamsDefinition['mouseout']>;
|
|
59
|
+
onMouseEnter?: EventCallback<EventParamsDefinition['mouseenter']>;
|
|
60
|
+
onMouseLeave?: EventCallback<EventParamsDefinition['mouseleave']>;
|
|
61
|
+
onPinch?: EventCallback<EventParamsDefinition['pinch']>;
|
|
62
|
+
onPinchStart?: EventCallback<EventParamsDefinition['pinchstart']>;
|
|
63
|
+
onPinchEnd?: EventCallback<EventParamsDefinition['pinchend']>;
|
|
64
|
+
onPan?: EventCallback<EventParamsDefinition['pan']>;
|
|
65
|
+
onPanStart?: EventCallback<EventParamsDefinition['panstart']>;
|
|
66
|
+
onPanEnd?: EventCallback<EventParamsDefinition['panend']>;
|
|
67
|
+
onDrag?: EventCallback<EventParamsDefinition['drag']>;
|
|
68
|
+
onDragStart?: EventCallback<EventParamsDefinition['dragstart']>;
|
|
69
|
+
onDragEnter?: EventCallback<EventParamsDefinition['dragenter']>;
|
|
70
|
+
onDragLeave?: EventCallback<EventParamsDefinition['dragleave']>;
|
|
71
|
+
onDragOver?: EventCallback<EventParamsDefinition['dragover']>;
|
|
72
|
+
onDragEnd?: EventCallback<EventParamsDefinition['dragend']>;
|
|
73
|
+
onRightDown?: EventCallback<EventParamsDefinition['rightdown']>;
|
|
74
|
+
onRightUp?: EventCallback<EventParamsDefinition['rightup']>;
|
|
75
|
+
onRightUpOutside?: EventCallback<EventParamsDefinition['rightupoutside']>;
|
|
76
|
+
onTouchStart?: EventCallback<EventParamsDefinition['touchstart']>;
|
|
77
|
+
onTouchEnd?: EventCallback<EventParamsDefinition['touchend']>;
|
|
78
|
+
onTouchEndOutside?: EventCallback<EventParamsDefinition['touchendoutside']>;
|
|
79
|
+
onTouchMove?: EventCallback<EventParamsDefinition['touchmove']>;
|
|
80
|
+
onTouchCancel?: EventCallback<EventParamsDefinition['touchcancel']>;
|
|
81
|
+
onPress?: EventCallback<EventParamsDefinition['press']>;
|
|
82
|
+
onPressUp?: EventCallback<EventParamsDefinition['pressup']>;
|
|
83
|
+
onPressEnd?: EventCallback<EventParamsDefinition['pressend']>;
|
|
84
|
+
onSwipe?: EventCallback<EventParamsDefinition['swipe']>;
|
|
85
|
+
onDrop?: EventCallback<EventParamsDefinition['drop']>;
|
|
86
|
+
onWeel?: EventCallback<EventParamsDefinition['weel']>;
|
|
87
|
+
onClick?: EventCallback<EventParamsDefinition['click']>;
|
|
88
|
+
onDblClick?: EventCallback<EventParamsDefinition['dblclick']>;
|
|
89
|
+
}
|
|
90
|
+
export declare const REACT_TO_VCHART_EVENTS: {
|
|
91
|
+
onPointerDown: string;
|
|
92
|
+
onPointerUp: string;
|
|
93
|
+
onPointerUpOutside: string;
|
|
94
|
+
onPointerTap: string;
|
|
95
|
+
onPointerOver: string;
|
|
96
|
+
onPointerMove: string;
|
|
97
|
+
onPointerEnter: string;
|
|
98
|
+
onPointerLeave: string;
|
|
99
|
+
onPointerOut: string;
|
|
100
|
+
onMouseDown: string;
|
|
101
|
+
onMouseUp: string;
|
|
102
|
+
onMouseUpOutside: string;
|
|
103
|
+
onMouseMove: string;
|
|
104
|
+
onMouseOver: string;
|
|
105
|
+
onMouseOut: string;
|
|
106
|
+
onMouseEnter: string;
|
|
107
|
+
onMouseLeave: string;
|
|
108
|
+
onPinch: string;
|
|
109
|
+
onPinchStart: string;
|
|
110
|
+
onPinchEnd: string;
|
|
111
|
+
onPan: string;
|
|
112
|
+
onPanStart: string;
|
|
113
|
+
onPanEnd: string;
|
|
114
|
+
onDrag: string;
|
|
115
|
+
onDragStart: string;
|
|
116
|
+
onDragEnter: string;
|
|
117
|
+
onDragLeave: string;
|
|
118
|
+
onDragOver: string;
|
|
119
|
+
onDragEnd: string;
|
|
120
|
+
onRightDown: string;
|
|
121
|
+
onRightUp: string;
|
|
122
|
+
onRightUpOutside: string;
|
|
123
|
+
onTouchStart: string;
|
|
124
|
+
onTouchEnd: string;
|
|
125
|
+
onTouchEndOutside: string;
|
|
126
|
+
onTouchMove: string;
|
|
127
|
+
onTouchCancel: string;
|
|
128
|
+
onPress: string;
|
|
129
|
+
onPressUp: string;
|
|
130
|
+
onPressEnd: string;
|
|
131
|
+
onSwipe: string;
|
|
132
|
+
onDrop: string;
|
|
133
|
+
onWeel: string;
|
|
134
|
+
onClick: string;
|
|
135
|
+
onDblClick: string;
|
|
136
|
+
};
|
|
137
|
+
export declare const LEGEND_CUSTOMIZED_EVENTS: {
|
|
138
|
+
onLegendItemHover: string;
|
|
139
|
+
onLegendItemUnHover: string;
|
|
140
|
+
onLegendItemClick: string;
|
|
141
|
+
onLegendFilter: string;
|
|
142
|
+
onLegendSelectedDataChange: string;
|
|
143
|
+
};
|
|
144
|
+
export declare const BRUSH_CUSTOMIZED_EVENTS: {
|
|
145
|
+
onBrushStart: string;
|
|
146
|
+
onBrushChange: string;
|
|
147
|
+
onBrushEnd: string;
|
|
148
|
+
onBrushClear: string;
|
|
149
|
+
};
|
|
150
|
+
export declare const DATAZOOM_CUSTOMIZED_EVENTS: {
|
|
151
|
+
onDataZoomChange: string;
|
|
152
|
+
};
|
|
153
|
+
export declare const PLAYER_CUSTOMIZED_EVENTS: {
|
|
154
|
+
onPlayerPlay: string;
|
|
155
|
+
onPlayerPause: string;
|
|
156
|
+
onPlayerEnd: string;
|
|
157
|
+
onPlayerChange: string;
|
|
158
|
+
onPlayerForward: string;
|
|
159
|
+
onPlayerBackward: string;
|
|
160
|
+
};
|
|
161
|
+
export declare const SCROLLBAR_CUSTOMIZED_EVENTS: {
|
|
162
|
+
onScrollBarChange: string;
|
|
163
|
+
};
|
|
164
|
+
export declare const DIMENSION_EVENTS: {
|
|
165
|
+
onDimensionHover: string;
|
|
166
|
+
onDimensionClick: string;
|
|
167
|
+
};
|
|
168
|
+
export declare const HIERARCHY_EVENTS: {
|
|
169
|
+
onDrill: string;
|
|
170
|
+
};
|
|
171
|
+
export declare const CHART_LIFECYCLE_EVENTS: {
|
|
172
|
+
onInitialized: string;
|
|
173
|
+
onRendered: string;
|
|
174
|
+
onRenderFinished: string;
|
|
175
|
+
onAnimationFinished: string;
|
|
176
|
+
onLayoutStart: string;
|
|
177
|
+
onLayoutEnd: string;
|
|
178
|
+
};
|
|
179
|
+
export declare const CHART_EVENTS: {
|
|
180
|
+
onPointerDown: string;
|
|
181
|
+
onPointerUp: string;
|
|
182
|
+
onPointerUpOutside: string;
|
|
183
|
+
onPointerTap: string;
|
|
184
|
+
onPointerOver: string;
|
|
185
|
+
onPointerMove: string;
|
|
186
|
+
onPointerEnter: string;
|
|
187
|
+
onPointerLeave: string;
|
|
188
|
+
onPointerOut: string;
|
|
189
|
+
onMouseDown: string;
|
|
190
|
+
onMouseUp: string;
|
|
191
|
+
onMouseUpOutside: string;
|
|
192
|
+
onMouseMove: string;
|
|
193
|
+
onMouseOver: string;
|
|
194
|
+
onMouseOut: string;
|
|
195
|
+
onMouseEnter: string;
|
|
196
|
+
onMouseLeave: string;
|
|
197
|
+
onPinch: string;
|
|
198
|
+
onPinchStart: string;
|
|
199
|
+
onPinchEnd: string;
|
|
200
|
+
onPan: string;
|
|
201
|
+
onPanStart: string;
|
|
202
|
+
onPanEnd: string;
|
|
203
|
+
onDrag: string;
|
|
204
|
+
onDragStart: string;
|
|
205
|
+
onDragEnter: string;
|
|
206
|
+
onDragLeave: string;
|
|
207
|
+
onDragOver: string;
|
|
208
|
+
onDragEnd: string;
|
|
209
|
+
onRightDown: string;
|
|
210
|
+
onRightUp: string;
|
|
211
|
+
onRightUpOutside: string;
|
|
212
|
+
onTouchStart: string;
|
|
213
|
+
onTouchEnd: string;
|
|
214
|
+
onTouchEndOutside: string;
|
|
215
|
+
onTouchMove: string;
|
|
216
|
+
onTouchCancel: string;
|
|
217
|
+
onPress: string;
|
|
218
|
+
onPressUp: string;
|
|
219
|
+
onPressEnd: string;
|
|
220
|
+
onSwipe: string;
|
|
221
|
+
onDrop: string;
|
|
222
|
+
onWeel: string;
|
|
223
|
+
onClick: string;
|
|
224
|
+
onDblClick: string;
|
|
225
|
+
onDrill: string;
|
|
226
|
+
onInitialized: string;
|
|
227
|
+
onRendered: string;
|
|
228
|
+
onRenderFinished: string;
|
|
229
|
+
onAnimationFinished: string;
|
|
230
|
+
onLayoutStart: string;
|
|
231
|
+
onLayoutEnd: string;
|
|
232
|
+
onDimensionHover: string;
|
|
233
|
+
onDimensionClick: string;
|
|
234
|
+
onScrollBarChange: string;
|
|
235
|
+
onDataZoomChange: string;
|
|
236
|
+
onPlayerPlay: string;
|
|
237
|
+
onPlayerPause: string;
|
|
238
|
+
onPlayerEnd: string;
|
|
239
|
+
onPlayerChange: string;
|
|
240
|
+
onPlayerForward: string;
|
|
241
|
+
onPlayerBackward: string;
|
|
242
|
+
onBrushStart: string;
|
|
243
|
+
onBrushChange: string;
|
|
244
|
+
onBrushEnd: string;
|
|
245
|
+
onBrushClear: string;
|
|
246
|
+
onLegendItemHover: string;
|
|
247
|
+
onLegendItemUnHover: string;
|
|
248
|
+
onLegendItemClick: string;
|
|
249
|
+
onLegendFilter: string;
|
|
250
|
+
onLegendSelectedDataChange: string;
|
|
251
|
+
};
|
|
252
|
+
export declare const CHART_EVENTS_KEYS: string[];
|
|
253
|
+
export declare const COMMON_EVENTK_KEYS: string[];
|
|
254
|
+
export declare const VCHART_TO_REACT_EVENTS: {};
|
|
255
|
+
export declare const findEventProps: <T extends EventsProps>(props: T, supportedEvents?: Record<string, string>) => EventsProps;
|
|
256
|
+
export declare const bindEventsToChart: <T>(chart: IVChart, newProps?: T, prevProps?: T, supportedEvents?: Record<string, string>) => boolean;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
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.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
|
+
exports.REACT_TO_VCHART_EVENTS = {
|
|
7
|
+
onPointerDown: "pointerdown",
|
|
8
|
+
onPointerUp: "pointerup",
|
|
9
|
+
onPointerUpOutside: "pointerupoutside",
|
|
10
|
+
onPointerTap: "pointertap",
|
|
11
|
+
onPointerOver: "pointerover",
|
|
12
|
+
onPointerMove: "pointermove",
|
|
13
|
+
onPointerEnter: "pointerenter",
|
|
14
|
+
onPointerLeave: "pointerleave",
|
|
15
|
+
onPointerOut: "pointerout",
|
|
16
|
+
onMouseDown: "mousedown",
|
|
17
|
+
onMouseUp: "mouseup",
|
|
18
|
+
onMouseUpOutside: "mouseupoutside",
|
|
19
|
+
onMouseMove: "mousemove",
|
|
20
|
+
onMouseOver: "mouseover",
|
|
21
|
+
onMouseOut: "mouseout",
|
|
22
|
+
onMouseEnter: "mouseenter",
|
|
23
|
+
onMouseLeave: "mouseleave",
|
|
24
|
+
onPinch: "pinch",
|
|
25
|
+
onPinchStart: "pinchstart",
|
|
26
|
+
onPinchEnd: "pinchend",
|
|
27
|
+
onPan: "pan",
|
|
28
|
+
onPanStart: "panstart",
|
|
29
|
+
onPanEnd: "panend",
|
|
30
|
+
onDrag: "drag",
|
|
31
|
+
onDragStart: "dragstart",
|
|
32
|
+
onDragEnter: "dragenter",
|
|
33
|
+
onDragLeave: "dragleave",
|
|
34
|
+
onDragOver: "dragover",
|
|
35
|
+
onDragEnd: "dragend",
|
|
36
|
+
onRightDown: "rightdown",
|
|
37
|
+
onRightUp: "rightup",
|
|
38
|
+
onRightUpOutside: "rightupoutside",
|
|
39
|
+
onTouchStart: "touchstart",
|
|
40
|
+
onTouchEnd: "touchend",
|
|
41
|
+
onTouchEndOutside: "touchendoutside",
|
|
42
|
+
onTouchMove: "touchmove",
|
|
43
|
+
onTouchCancel: "touchcancel",
|
|
44
|
+
onPress: "press",
|
|
45
|
+
onPressUp: "pressup",
|
|
46
|
+
onPressEnd: "pressend",
|
|
47
|
+
onSwipe: "swipe",
|
|
48
|
+
onDrop: "drop",
|
|
49
|
+
onWeel: "wheel",
|
|
50
|
+
onClick: "click",
|
|
51
|
+
onDblClick: "dblclick"
|
|
52
|
+
}, exports.LEGEND_CUSTOMIZED_EVENTS = {
|
|
53
|
+
onLegendItemHover: "legendItemHover",
|
|
54
|
+
onLegendItemUnHover: "legendItemUnHover",
|
|
55
|
+
onLegendItemClick: "legendItemClick",
|
|
56
|
+
onLegendFilter: "legendFilter",
|
|
57
|
+
onLegendSelectedDataChange: "legendSelectedDataChange"
|
|
58
|
+
}, exports.BRUSH_CUSTOMIZED_EVENTS = {
|
|
59
|
+
onBrushStart: "brushStart",
|
|
60
|
+
onBrushChange: "brushChange",
|
|
61
|
+
onBrushEnd: "brushEnd",
|
|
62
|
+
onBrushClear: "brushClear"
|
|
63
|
+
}, exports.DATAZOOM_CUSTOMIZED_EVENTS = {
|
|
64
|
+
onDataZoomChange: "dataZoomChange"
|
|
65
|
+
}, exports.PLAYER_CUSTOMIZED_EVENTS = {
|
|
66
|
+
onPlayerPlay: "playerPlay",
|
|
67
|
+
onPlayerPause: "playerPause",
|
|
68
|
+
onPlayerEnd: "playerEnd",
|
|
69
|
+
onPlayerChange: "playerChange",
|
|
70
|
+
onPlayerForward: "playerForward",
|
|
71
|
+
onPlayerBackward: "playerBackward"
|
|
72
|
+
}, exports.SCROLLBAR_CUSTOMIZED_EVENTS = {
|
|
73
|
+
onScrollBarChange: "scrollBarChange"
|
|
74
|
+
}, exports.DIMENSION_EVENTS = {
|
|
75
|
+
onDimensionHover: "dimensionHover",
|
|
76
|
+
onDimensionClick: "dimensionClick"
|
|
77
|
+
}, exports.HIERARCHY_EVENTS = {
|
|
78
|
+
onDrill: "drill"
|
|
79
|
+
}, exports.CHART_LIFECYCLE_EVENTS = {
|
|
80
|
+
onInitialized: "initialized",
|
|
81
|
+
onRendered: "rendered",
|
|
82
|
+
onRenderFinished: "renderFinished",
|
|
83
|
+
onAnimationFinished: "animationFinished",
|
|
84
|
+
onLayoutStart: "layoutStart",
|
|
85
|
+
onLayoutEnd: "layoutEnd"
|
|
86
|
+
}, 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),
|
|
87
|
+
exports.CHART_EVENTS_KEYS = Object.keys(exports.CHART_EVENTS), exports.COMMON_EVENTK_KEYS = Object.keys(exports.REACT_TO_VCHART_EVENTS),
|
|
88
|
+
exports.VCHART_TO_REACT_EVENTS = Object.keys(exports.REACT_TO_VCHART_EVENTS).reduce(((res, key) => (res[exports.REACT_TO_VCHART_EVENTS[key]] = key,
|
|
89
|
+
res)), {});
|
|
90
|
+
|
|
91
|
+
const findEventProps = (props, supportedEvents = exports.REACT_TO_VCHART_EVENTS) => {
|
|
92
|
+
const result = {};
|
|
93
|
+
return Object.keys(props).forEach((key => {
|
|
94
|
+
supportedEvents[key] && props[key] && (result[key] = props[key]);
|
|
95
|
+
})), result;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.findEventProps = findEventProps;
|
|
99
|
+
|
|
100
|
+
const bindEventsToChart = (chart, newProps, prevProps, supportedEvents = exports.REACT_TO_VCHART_EVENTS) => {
|
|
101
|
+
if (!newProps && !prevProps || !chart) return !1;
|
|
102
|
+
const prevEventProps = prevProps ? (0, exports.findEventProps)(prevProps, supportedEvents) : null, newEventProps = newProps ? (0,
|
|
103
|
+
exports.findEventProps)(newProps, supportedEvents) : null;
|
|
104
|
+
return prevEventProps && Object.keys(prevEventProps).forEach((eventKey => {
|
|
105
|
+
if (!newEventProps || !newEventProps[eventKey] || newEventProps[eventKey] !== prevEventProps[eventKey]) {
|
|
106
|
+
chart.off(supportedEvents[eventKey], prevProps[eventKey]);
|
|
107
|
+
}
|
|
108
|
+
})), newEventProps && Object.keys(newEventProps).forEach((eventKey => {
|
|
109
|
+
prevEventProps && prevEventProps[eventKey] && prevEventProps[eventKey] === newEventProps[eventKey] || chart.on(supportedEvents[eventKey], newEventProps[eventKey]);
|
|
110
|
+
})), !0;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
exports.bindEventsToChart = bindEventsToChart;
|
|
114
|
+
//# sourceMappingURL=eventsUtils.js.map
|