UNPKG

@visactor/vtable

Version:

canvas table width high performance

227 lines (221 loc) 9.17 kB
"use strict"; let defaultStyle; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.Style = void 0; const EventTarget_1 = require("../../event/EventTarget"), EVENT_TYPE = { CHANGE_STYLE: "change_style" }; class Style extends EventTarget_1.EventTarget { static get EVENT_TYPE() { return EVENT_TYPE; } static get DEFAULT() { return defaultStyle || (defaultStyle = new Style); } constructor(style = {}, headerStyle = {}) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7; super(), this._defaultPadding = [ 10, 16, 10, 16 ], this._color = null !== (_a = style.color) && void 0 !== _a ? _a : null == headerStyle ? void 0 : headerStyle.color, this._strokeColor = null !== (_b = null == style ? void 0 : style.strokeColor) && void 0 !== _b ? _b : null == headerStyle ? void 0 : headerStyle.strokeColor, this._fontSize = null !== (_c = style.fontSize) && void 0 !== _c ? _c : null == headerStyle ? void 0 : headerStyle.fontSize, this._fontFamily = null !== (_d = style.fontFamily) && void 0 !== _d ? _d : null == headerStyle ? void 0 : headerStyle.fontFamily, this._fontWeight = null !== (_e = style.fontWeight) && void 0 !== _e ? _e : null == headerStyle ? void 0 : headerStyle.fontWeight, this._fontVariant = null !== (_f = style.fontVariant) && void 0 !== _f ? _f : null == headerStyle ? void 0 : headerStyle.fontVariant, this._fontStyle = null !== (_g = style.fontStyle) && void 0 !== _g ? _g : null == headerStyle ? void 0 : headerStyle.fontStyle, this._textOverflow = (null !== (_h = style.textOverflow) && void 0 !== _h ? _h : null == headerStyle ? void 0 : headerStyle.textOverflow) || "ellipsis", this._textStick = null !== (_k = null !== (_j = style.textStick) && void 0 !== _j ? _j : null == headerStyle ? void 0 : headerStyle.textStick) && void 0 !== _k && _k, this._textStickBaseOnAlign = null !== (_m = null !== (_l = style.textStickBaseOnAlign) && void 0 !== _l ? _l : null == headerStyle ? void 0 : headerStyle.textStickBaseOnAlign) && void 0 !== _m && _m, this._marked = null !== (_p = null !== (_o = style.marked) && void 0 !== _o ? _o : null == headerStyle ? void 0 : headerStyle.marked) && void 0 !== _p && _p, this._textAlign = (null !== (_q = style.textAlign) && void 0 !== _q ? _q : null == headerStyle ? void 0 : headerStyle.textAlign) || "left", this._textBaseline = (null !== (_r = style.textBaseline) && void 0 !== _r ? _r : null == headerStyle ? void 0 : headerStyle.textBaseline) || "middle", this._bgColor = null !== (_s = style.bgColor) && void 0 !== _s ? _s : null == headerStyle ? void 0 : headerStyle.bgColor, this._padding = null !== (_u = null !== (_t = style.padding) && void 0 !== _t ? _t : null == headerStyle ? void 0 : headerStyle.padding) && void 0 !== _u ? _u : this._defaultPadding, this._borderColor = null !== (_v = style.borderColor) && void 0 !== _v ? _v : null == headerStyle ? void 0 : headerStyle.borderColor, this._lineHeight = null !== (_w = style.lineHeight) && void 0 !== _w ? _w : null == headerStyle ? void 0 : headerStyle.lineHeight, this._underline = null !== (_x = style.underline) && void 0 !== _x ? _x : null == headerStyle ? void 0 : headerStyle.underline, this._underlineColor = null !== (_y = style.underlineColor) && void 0 !== _y ? _y : null == headerStyle ? void 0 : headerStyle.underlineColor, this._underlineDash = null !== (_z = style.underlineDash) && void 0 !== _z ? _z : null == headerStyle ? void 0 : headerStyle.underlineDash, this._underlineOffset = null !== (_0 = style.underlineOffset) && void 0 !== _0 ? _0 : null == headerStyle ? void 0 : headerStyle.underlineOffset, this._lineThrough = null !== (_1 = style.lineThrough) && void 0 !== _1 ? _1 : null == headerStyle ? void 0 : headerStyle.lineThrough, this._lineThroughColor = null !== (_2 = style.lineThroughColor) && void 0 !== _2 ? _2 : null == headerStyle ? void 0 : headerStyle.lineThroughColor, this._lineThroughDash = null !== (_3 = style.lineThroughDash) && void 0 !== _3 ? _3 : null == headerStyle ? void 0 : headerStyle.lineThroughDash, this._linkColor = null !== (_4 = style.linkColor) && void 0 !== _4 ? _4 : null == headerStyle ? void 0 : headerStyle.linkColor, this._cursor = null !== (_5 = style.cursor) && void 0 !== _5 ? _5 : null == headerStyle ? void 0 : headerStyle.cursor, this._borderLineWidth = null !== (_6 = style.borderLineWidth) && void 0 !== _6 ? _6 : null == headerStyle ? void 0 : headerStyle.borderLineWidth, this._borderLineDash = null !== (_7 = style.borderLineDash) && void 0 !== _7 ? _7 : null == headerStyle ? void 0 : headerStyle.borderLineDash; } get bgColor() { return this._bgColor; } set bgColor(bgColor) { this._bgColor = bgColor; } get color() { return this._color; } set color(color) { this._color = color; } get strokeColor() { return this._strokeColor; } set strokeColor(strokeColor) { this._strokeColor = strokeColor; } get fontSize() { return this._fontSize; } set fontSize(fontSize) { this._fontSize = fontSize; } get fontFamily() { return this._fontFamily; } set fontFamily(fontFamily) { this._fontFamily = fontFamily; } get fontWeight() { return this._fontWeight; } set fontWeight(fontWeight) { this._fontWeight = fontWeight; } get fontVariant() { return this._fontVariant; } set fontVariant(fontVariant) { this._fontVariant = fontVariant; } get fontStyle() { return this._fontStyle; } set fontStyle(fontStyle) { this._fontStyle = fontStyle; } get textOverflow() { return this._textOverflow; } set textOverflow(textOverflow) { this._textOverflow = textOverflow; } get padding() { var _a; return null !== (_a = this._padding) && void 0 !== _a ? _a : this._defaultPadding; } set padding(padding) { this._padding = padding; } get borderColor() { return this._borderColor; } set borderColor(borderColor) { this._borderColor = borderColor; } get textStick() { return this._textStick; } set textStick(textStick) { this._textStick = textStick; } get textStickBaseOnAlign() { return this._textStickBaseOnAlign; } set textStickBaseOnAlign(textStickBaseOnAlign) { this._textStickBaseOnAlign = textStickBaseOnAlign; } get marked() { return this._marked; } set marked(marked) { this._marked = marked; } get textAlign() { return this._textAlign; } set textAlign(textAlign) { this._textAlign = textAlign; } get textBaseline() { return this._textBaseline; } set textBaseline(textBaseline) { this._textBaseline = textBaseline; } get lineHeight() { return this._lineHeight; } set lineHeight(lineHeight) { this._lineHeight = lineHeight; } get underline() { return this._underline; } set underline(underline) { this._underline = underline; } get underlineColor() { return this._underlineColor; } set underlineColor(underlineColor) { this._underlineColor = underlineColor; } get underlineDash() { return this._underlineDash; } set underlineDash(underlineDash) { this._underlineDash = underlineDash; } get underlineOffset() { return this._underlineOffset; } set underlineOffset(underlineOffset) { this._underlineOffset = underlineOffset; } get lineThrough() { return this._lineThrough; } set lineThrough(lineThrough) { this._lineThrough = lineThrough; } get lineThroughColor() { return this._lineThroughColor; } set lineThroughColor(lineThroughColor) { this._lineThroughColor = lineThroughColor; } get lineThroughDash() { return this._lineThroughDash; } set lineThroughDash(lineThroughDash) { this._lineThroughDash = lineThroughDash; } get linkColor() { return this._linkColor; } set linkColor(linkColor) { this._linkColor = linkColor; } get cursor() { return this._cursor; } set cursor(cursor) { this._cursor = cursor; } get borderLineWidth() { return this._borderLineWidth; } set borderLineWidth(borderLineWidth) { this._borderLineWidth = borderLineWidth; } get borderLineDash() { return this._borderLineDash; } set borderLineDash(borderLineDash) { this._borderLineDash = borderLineDash; } clone() { return new Style(this); } } exports.Style = Style; //# sourceMappingURL=Style.js.map