UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

101 lines (100 loc) 4.87 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import * as React from 'react'; import { observer } from 'mobx-react'; import { observable, action, reaction } from 'mobx'; import { Spin } from 'antd'; import BasicComponent from '../../../components/Base/BasicComponent'; import bind from '../../../utils/bind'; import errorBoundary from '../../../hocs/errorBoundary'; import ChartContainer from '../components/ChartContainer'; import storeWrapper from '../components/StoreWrapper'; import { HoneycombChartComponent } from './Component/HoneycombChartCom'; import HoneycombStore from './store'; var HoneycombChart = /** @class */ (function (_super) { __extends(HoneycombChart, _super); function HoneycombChart() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.width = _this.props.store.chartWidth; _this.height = _this.props.store.chartHeight; _this.handleClick = function (data) { _this.props.store.handleDrillDown({ currentData: data.value, originRow: data.originRow }); }; return _this; } HoneycombChart.prototype.setWidth = function (width) { this.width = width; }; HoneycombChart.prototype.setHeight = function (height) { this.height = height; }; HoneycombChart.prototype.componentDidMount = function () { var _this = this; this.addDisposer(reaction(function () { return _this.props.store.chartWidth; }, function (chartWidth) { if (Math.abs(chartWidth - _this.width) > 10) { _this.setWidth(chartWidth); } }, { fireImmediately: true }), reaction(function () { return _this.props.store.chartHeight; }, function (chartHeight) { if (Math.abs(chartHeight - _this.height) > 10) { _this.setHeight(chartHeight); } }, { fireImmediately: true })); }; HoneycombChart.prototype.render = function () { var _a = this.props.store, option = _a.option, chartWidth = _a.chartWidth, chartHeight = _a.chartHeight, debounceHandleClient = _a.debounceHandleClient, isAnalysising = _a.chartContainerService.chartConditionService.isAnalysising; return (React.createElement(ChartContainer, { onClient: debounceHandleClient }, React.createElement(Spin, { spinning: isAnalysising }, React.createElement(HoneycombChartComponent, { key: chartWidth + "-" + chartHeight, option: option, handleClick: this.handleClick, width: this.width, height: this.height })))); }; __decorate([ observable, __metadata("design:type", Object) ], HoneycombChart.prototype, "width", void 0); __decorate([ observable, __metadata("design:type", Object) ], HoneycombChart.prototype, "height", void 0); __decorate([ bind, action, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0) ], HoneycombChart.prototype, "setWidth", null); __decorate([ bind, action, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0) ], HoneycombChart.prototype, "setHeight", null); HoneycombChart = __decorate([ observer ], HoneycombChart); return HoneycombChart; }(BasicComponent)); export { HoneycombChart }; export default errorBoundary(storeWrapper(HoneycombChart, HoneycombStore));