@qn-pandora/pandora-visualization
Version:
Pandora 通用可视化库
130 lines (129 loc) • 4.89 kB
JavaScript
;
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 Legend = /** @class */ (function () {
function Legend(option) {
this.sortList = option.sortList;
this.position = option.position || "top" /* Top */;
this.columnsWidthMap = option.columnsWidthMap;
this.width = option.width;
this.sort = option.sort;
}
Object.defineProperty(Legend.prototype, "option", {
get: function () {
return this.baseOption;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Legend.prototype, "baseOption", {
get: function () {
return {
position: this.position,
columnsWidthMap: this.columnsWidthMap,
sortList: this.sortList,
width: this.width,
sort: this.sort
};
},
enumerable: false,
configurable: true
});
Legend.prototype.setPosition = function (position) {
this.position = position;
};
Legend.prototype.setColumnWidthMap = function (columnsWidthMap) {
this.columnsWidthMap = columnsWidthMap;
};
Legend.prototype.set = function (option) {
this.position = option.position || "top" /* Top */;
this.columnsWidthMap = option.columnsWidthMap;
this.width = option.width;
this.sort = option.sort;
};
Legend.prototype.setSort = function (sort) {
this.sort = sort;
};
Legend.prototype.setWidth = function (width) {
this.width = width;
};
__decorate([
mobx_1.observable,
__metadata("design:type", String)
], Legend.prototype, "position", void 0);
__decorate([
mobx_1.observable.ref,
__metadata("design:type", Object)
], Legend.prototype, "columnsWidthMap", void 0);
__decorate([
mobx_1.observable.ref,
__metadata("design:type", Array)
], Legend.prototype, "sortList", void 0);
__decorate([
mobx_1.observable,
__metadata("design:type", Number)
], Legend.prototype, "width", void 0);
__decorate([
mobx_1.observable,
__metadata("design:type", Object)
], Legend.prototype, "sort", void 0);
__decorate([
mobx_1.computed,
__metadata("design:type", Object),
__metadata("design:paramtypes", [])
], Legend.prototype, "option", null);
__decorate([
mobx_1.computed,
__metadata("design:type", Object),
__metadata("design:paramtypes", [])
], Legend.prototype, "baseOption", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], Legend.prototype, "setPosition", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], Legend.prototype, "setColumnWidthMap", null);
__decorate([
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], Legend.prototype, "set", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], Legend.prototype, "setSort", null);
__decorate([
bind_1.default,
mobx_1.action,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", void 0)
], Legend.prototype, "setWidth", null);
return Legend;
}());
exports.default = Legend;