UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

126 lines (125 loc) 6.25 kB
"use strict"; 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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); 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 __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.HoneycombChart = void 0; var React = __importStar(require("react")); var mobx_react_1 = require("mobx-react"); var mobx_1 = require("mobx"); var antd_1 = require("antd"); var BasicComponent_1 = __importDefault(require("../../../components/Base/BasicComponent")); var bind_1 = __importDefault(require("../../../utils/bind")); var errorBoundary_1 = __importDefault(require("../../../hocs/errorBoundary")); var ChartContainer_1 = __importDefault(require("../components/ChartContainer")); var StoreWrapper_1 = __importDefault(require("../components/StoreWrapper")); var HoneycombChartCom_1 = require("./Component/HoneycombChartCom"); var store_1 = __importDefault(require("./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(mobx_1.reaction(function () { return _this.props.store.chartWidth; }, function (chartWidth) { if (Math.abs(chartWidth - _this.width) > 10) { _this.setWidth(chartWidth); } }, { fireImmediately: true }), mobx_1.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_1.default, { onClient: debounceHandleClient }, React.createElement(antd_1.Spin, { spinning: isAnalysising }, React.createElement(HoneycombChartCom_1.HoneycombChartComponent, { key: chartWidth + "-" + chartHeight, option: option, handleClick: this.handleClick, width: this.width, height: this.height })))); }; __decorate([ mobx_1.observable, __metadata("design:type", Object) ], HoneycombChart.prototype, "width", void 0); __decorate([ mobx_1.observable, __metadata("design:type", Object) ], HoneycombChart.prototype, "height", void 0); __decorate([ bind_1.default, mobx_1.action, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0) ], HoneycombChart.prototype, "setWidth", null); __decorate([ bind_1.default, mobx_1.action, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0) ], HoneycombChart.prototype, "setHeight", null); HoneycombChart = __decorate([ mobx_react_1.observer ], HoneycombChart); return HoneycombChart; }(BasicComponent_1.default)); exports.HoneycombChart = HoneycombChart; exports.default = errorBoundary_1.default(StoreWrapper_1.default(HoneycombChart, store_1.default));