UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

135 lines (134 loc) 5.2 kB
var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; 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 { observable, computed, action } from 'mobx'; import bind from '../../../../utils/bind'; import { SparkLineChartType, DefaultLineColor, DefaultColorSplitter } from '../../../../constants/sparkline'; var SparkLineConfig = /** @class */ (function () { function SparkLineConfig(option) { this.type = SparkLineChartType.Line; this.lineColor = DefaultLineColor; this.colorSplitter = DefaultColorSplitter; this.type = option.type || SparkLineChartType.Line; this.lineColor = option.lineColor || DefaultLineColor; this.colorSplitter = option.colorSplitter || DefaultColorSplitter; } Object.defineProperty(SparkLineConfig.prototype, "option", { get: function () { var sparkLineConfig = this.sparkLineConfig[this.type] || {}; return __assign({ type: this.type }, sparkLineConfig); }, enumerable: false, configurable: true }); Object.defineProperty(SparkLineConfig.prototype, "sparkLineConfig", { get: function () { var _a; return _a = {}, _a[SparkLineChartType.Line] = this.lineConfig, _a[SparkLineChartType.Status] = this.statusConfig, _a; }, enumerable: false, configurable: true }); Object.defineProperty(SparkLineConfig.prototype, "lineConfig", { get: function () { return { lineColor: this.lineColor }; }, enumerable: false, configurable: true }); Object.defineProperty(SparkLineConfig.prototype, "statusConfig", { get: function () { return { colorSplitter: this.colorSplitter }; }, enumerable: false, configurable: true }); SparkLineConfig.prototype.setType = function (type) { this.type = type; }; SparkLineConfig.prototype.setLineColor = function (color) { this.lineColor = color; }; SparkLineConfig.prototype.setColorSplitter = function (colorSplitter) { this.colorSplitter = colorSplitter; }; __decorate([ observable, __metadata("design:type", String) ], SparkLineConfig.prototype, "type", void 0); __decorate([ observable, __metadata("design:type", String) ], SparkLineConfig.prototype, "lineColor", void 0); __decorate([ observable.ref, __metadata("design:type", Object) ], SparkLineConfig.prototype, "colorSplitter", void 0); __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], SparkLineConfig.prototype, "option", null); __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], SparkLineConfig.prototype, "sparkLineConfig", null); __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], SparkLineConfig.prototype, "lineConfig", null); __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], SparkLineConfig.prototype, "statusConfig", null); __decorate([ bind, action, __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", void 0) ], SparkLineConfig.prototype, "setType", null); __decorate([ bind, action, __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", void 0) ], SparkLineConfig.prototype, "setLineColor", null); __decorate([ bind, action, __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], SparkLineConfig.prototype, "setColorSplitter", null); return SparkLineConfig; }()); export default SparkLineConfig;