UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

140 lines (139 loc) 5.57 kB
"use strict"; 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); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var mobx_1 = require("mobx"); var bind_1 = __importDefault(require("../../../../utils/bind")); var sparkline_1 = require("../../../../constants/sparkline"); var SparkLineConfig = /** @class */ (function () { function SparkLineConfig(option) { this.type = sparkline_1.SparkLineChartType.Line; this.lineColor = sparkline_1.DefaultLineColor; this.colorSplitter = sparkline_1.DefaultColorSplitter; this.type = option.type || sparkline_1.SparkLineChartType.Line; this.lineColor = option.lineColor || sparkline_1.DefaultLineColor; this.colorSplitter = option.colorSplitter || sparkline_1.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[sparkline_1.SparkLineChartType.Line] = this.lineConfig, _a[sparkline_1.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([ mobx_1.observable, __metadata("design:type", String) ], SparkLineConfig.prototype, "type", void 0); __decorate([ mobx_1.observable, __metadata("design:type", String) ], SparkLineConfig.prototype, "lineColor", void 0); __decorate([ mobx_1.observable.ref, __metadata("design:type", Object) ], SparkLineConfig.prototype, "colorSplitter", void 0); __decorate([ mobx_1.computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], SparkLineConfig.prototype, "option", null); __decorate([ mobx_1.computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], SparkLineConfig.prototype, "sparkLineConfig", null); __decorate([ mobx_1.computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], SparkLineConfig.prototype, "lineConfig", null); __decorate([ mobx_1.computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], SparkLineConfig.prototype, "statusConfig", null); __decorate([ bind_1.default, mobx_1.action, __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", void 0) ], SparkLineConfig.prototype, "setType", null); __decorate([ bind_1.default, mobx_1.action, __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", void 0) ], SparkLineConfig.prototype, "setLineColor", null); __decorate([ bind_1.default, mobx_1.action, __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], SparkLineConfig.prototype, "setColorSplitter", null); return SparkLineConfig; }()); exports.default = SparkLineConfig;