UNPKG

@visactor/vtable

Version:

canvas table width high performance

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