@visactor/react-vchart
Version:
The react version of VChart 4.x
27 lines (21 loc) • 911 B
JavaScript
;
var __importDefault = this && this.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : {
default: mod
};
};
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.withChartInstance = void 0;
const react_1 = __importDefault(require("react")), ChartContext = react_1.default.createContext(null);
function withChartInstance(Component) {
const Com = react_1.default.forwardRef(((props, ref) => react_1.default.createElement(ChartContext.Consumer, null, (ctx => react_1.default.createElement(Component, Object.assign({}, props, {
chart: ctx.chart
}, ref ? {
ref: ref
} : {}))))));
return Com.displayName = Component.displayName || Component.name, Com;
}
ChartContext.displayName = "ChartContext", exports.withChartInstance = withChartInstance,
exports.default = ChartContext;
//# sourceMappingURL=chart.js.map