@qn-pandora/pandora-visualization
Version:
Pandora 通用可视化库
224 lines (223 loc) • 9.08 kB
JavaScript
;
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 });
var mobx_1 = require("mobx");
var pandora_component_1 = require("@qn-pandora/pandora-component");
var bind_1 = __importDefault(require("../../../../../utils/bind"));
var metric_panel_style_1 = require("../../../../../constants/metric-panel-style");
var constants_1 = require("../../../../../constants");
var base_1 = __importStar(require("../base"));
var NODE_COUNT = 50;
var TimeLineStyleService = /** @class */ (function (_super) {
__extends(TimeLineStyleService, _super);
function TimeLineStyleService(chart) {
var _this = _super.call(this, chart) || this;
_this.chartType = constants_1.ChartType.TopoLogy;
_this.levels = metric_panel_style_1.defaultLevels;
_this.nodeRules = [];
_this.edgeRules = [];
_this.nodeCount = NODE_COUNT;
_this.layout = pandora_component_1.ELayoutTYpe.Fruchterman;
_this.showLabel = true;
_this.from = {};
_this.to = {};
_this.edgeRules = chart.edgeRules || [];
_this.nodeCount = chart.nodeCount || NODE_COUNT;
_this.layout = chart.layout || pandora_component_1.ELayoutTYpe.Fruchterman;
_this.levels = chart.levels || [];
_this.nodeRules = chart.nodeRules || [];
_this.showLabel = chart.showLabel || false;
_this.from = chart.from || {};
_this.to = chart.to || {};
return _this;
}
TimeLineStyleService.getChartInitStyle = function (option) {
return option;
};
Object.defineProperty(TimeLineStyleService.prototype, "contextOption", {
get: function () {
return {
buckets: [],
metrics: []
};
},
enumerable: false,
configurable: true
});
TimeLineStyleService.prototype.getOptions = function () {
return {
chartType: this.chartType,
levels: this.levels,
nodeRules: this.nodeRules,
edgeRules: this.edgeRules,
nodeCount: this.nodeCount,
nodeLayout: this.layout,
showLabel: this.showLabel,
layout: this.layout,
from: this.from,
to: this.to
};
};
TimeLineStyleService.prototype.setLevels = function (levels) {
this.levels = levels;
};
TimeLineStyleService.prototype.setNodeRules = function (nodeRules) {
this.nodeRules = nodeRules;
};
TimeLineStyleService.prototype.setEdgeRules = function (edgeRules) {
this.edgeRules = edgeRules;
};
TimeLineStyleService.prototype.setLayout = function (layout) {
this.layout = layout;
};
TimeLineStyleService.prototype.setShowLabel = function (showLabel) {
this.showLabel = showLabel;
};
TimeLineStyleService.prototype.setNodeCount = function (nodeCount) {
this.nodeCount = nodeCount;
};
TimeLineStyleService.prototype.setTo = function (to) {
this.to = to;
};
TimeLineStyleService.prototype.setFrom = function (from) {
this.from = from;
};
__decorate([
base_1.styleOption(),
__metadata("design:type", Array)
], TimeLineStyleService.prototype, "levels", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", Array)
], TimeLineStyleService.prototype, "nodeRules", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", Array)
], TimeLineStyleService.prototype, "edgeRules", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", Number)
], TimeLineStyleService.prototype, "nodeCount", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", String)
], TimeLineStyleService.prototype, "layout", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", Boolean)
], TimeLineStyleService.prototype, "showLabel", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", Object)
], TimeLineStyleService.prototype, "from", void 0);
__decorate([
base_1.styleOption(),
__metadata("design:type", Object)
], TimeLineStyleService.prototype, "to", void 0);
__decorate([
mobx_1.computed,
__metadata("design:type", Object),
__metadata("design:paramtypes", [])
], TimeLineStyleService.prototype, "contextOption", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Array]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setLevels", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Array]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setNodeRules", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Array]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setEdgeRules", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setLayout", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Boolean]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setShowLabel", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setNodeCount", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setTo", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], TimeLineStyleService.prototype, "setFrom", null);
return TimeLineStyleService;
}(base_1.default));
exports.default = TimeLineStyleService;