@visactor/vtable
Version:
canvas table width high performance
140 lines (133 loc) • 4.73 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.ProgressBarStyle = void 0;
const Style_1 = require("./Style");
let defaultStyle;
const DEFAULT_BAR_COLOR = args => {
const num = args.value;
return Number(num) > 80 ? "#20a8d8" : Number(num) > 50 ? "#4dbd74" : Number(num) > 20 ? "#ffc107" : "#f86c6b";
};
class ProgressBarStyle extends Style_1.Style {
static get DEFAULT() {
return defaultStyle || (defaultStyle = new ProgressBarStyle);
}
constructor(style = {}, bodyStyle = {}) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
super(style, bodyStyle), this._showBar = null === (_a = style.showBar) || void 0 === _a || _a,
this._barColor = null !== (_b = style.barColor) && void 0 !== _b ? _b : DEFAULT_BAR_COLOR,
this._barPositiveColor = null !== (_c = style.barPositiveColor) && void 0 !== _c ? _c : "#4dbd74",
this._barNegativeColor = null !== (_d = style.barNegativeColor) && void 0 !== _d ? _d : "#f86c6b",
this._barAxisColor = null !== (_e = style.barAxisColor) && void 0 !== _e ? _e : "black",
this._barBgColor = style.barBgColor, this._barHeight = null !== (_f = style.barHeight) && void 0 !== _f ? _f : 3,
this._barHeight = null !== (_g = style.barHeight) && void 0 !== _g ? _g : 3, this._barBottom = null !== (_h = style.barBottom) && void 0 !== _h ? _h : 0,
this._barPadding = null !== (_j = style.barPadding) && void 0 !== _j ? _j : [ 0, 0, 0, 0 ],
this._showBarMark = null !== (_k = style.showBarMark) && void 0 !== _k && _k, this._barMarkPositiveColor = null !== (_l = style.barMarkPositiveColor) && void 0 !== _l ? _l : "#4dbd74",
this._barMarkNegativeColor = null !== (_m = style.barMarkNegativeColor) && void 0 !== _m ? _m : "#f86c6b",
this._barMarkWidth = null !== (_o = style.barMarkWidth) && void 0 !== _o ? _o : 2,
this._barMarkPosition = null !== (_p = style.barMarkPosition) && void 0 !== _p ? _p : "right",
this._barRightToLeft = null !== (_q = style.barRightToLeft) && void 0 !== _q && _q,
this._barMarkInBar = null === (_r = style.barMarkInBar) || void 0 === _r || _r;
}
get showBar() {
return this._showBar;
}
set showBar(value) {
this._showBar = value;
}
get barColor() {
return this._barColor;
}
set barColor(barColor) {
this._barColor = barColor;
}
get barBgColor() {
return this._barBgColor;
}
set barBgColor(barBgColor) {
this._barBgColor = barBgColor;
}
get barHeight() {
return this._barHeight;
}
set barHeight(barHeight) {
this._barHeight = barHeight;
}
get barBottom() {
return this._barBottom;
}
set barBottom(barBottom) {
this._barBottom = barBottom;
}
get barPositiveColor() {
return this._barPositiveColor;
}
set barPositiveColor(barPositiveColor) {
this._barPositiveColor = barPositiveColor;
}
get barNegativeColor() {
return this._barNegativeColor;
}
set barNegativeColor(barNegativeColor) {
this._barNegativeColor = barNegativeColor;
}
get barAxisColor() {
return this._barAxisColor;
}
set barAxisColor(barAxisColor) {
this._barAxisColor = barAxisColor;
}
get barPadding() {
return this._barPadding;
}
set barPadding(barPadding) {
this._barPadding = barPadding;
}
get showBarMark() {
return this._showBarMark;
}
set showBarMark(value) {
this._showBarMark = value;
}
get barMarkPositiveColor() {
return this._barMarkPositiveColor;
}
set barMarkPositiveColor(value) {
this._barMarkPositiveColor = value;
}
get barMarkNegativeColor() {
return this._barMarkNegativeColor;
}
set barMarkNegativeColor(value) {
this._barMarkNegativeColor = value;
}
get barMarkWidth() {
return this._barMarkWidth;
}
set barMarkWidth(value) {
this._barMarkWidth = value;
}
get barMarkPosition() {
return this._barMarkPosition;
}
set barMarkPosition(value) {
this._barMarkPosition = value;
}
get barRightToLeft() {
return this._barRightToLeft;
}
set barRightToLeft(value) {
this._barRightToLeft = value;
}
get barMarkInBar() {
return this._barMarkInBar;
}
set barMarkInBar(value) {
this._barMarkInBar = value;
}
clone() {
return new ProgressBarStyle(this, null);
}
}
exports.ProgressBarStyle = ProgressBarStyle;
//# sourceMappingURL=ProgressBarStyle.js.map